diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/CsvToCanonicalFeatureVector.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/CsvToCanonicalFeatureVector.java index 321b5f50b64f84266ed85d93efae4d8ce5987cab..58544933586d4c528435c6e25b843afcb6a06540 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/CsvToCanonicalFeatureVector.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/CsvToCanonicalFeatureVector.java @@ -134,8 +134,8 @@ public class CsvToCanonicalFeatureVector CanonicalFeatureVector featureVector = new CanonicalFeatureVector(); CodeAndLabel codeAndTitle = new CodeAndLabel(column.name); ImgFeatureDefDTO featureDef = new ImgFeatureDefDTO(); - featureDef.setLabel(codeAndTitle.getTitle()); - featureDef.setDescription(codeAndTitle.getTitle()); + featureDef.setLabel(codeAndTitle.getLabel()); + featureDef.setDescription(codeAndTitle.getLabel()); String code = codeAndTitle.getCode(); int count = counters.count(code); featureDef.setCode(count == 1 ? code : code + count); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/TabularDataGraphServlet.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/TabularDataGraphServlet.java index 5cc2e6a3d31e82fb304cf7bde1b4fe8dc11d42ab..18327b53c5c0975d7c454322981a82ce22277fb8 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/TabularDataGraphServlet.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/TabularDataGraphServlet.java @@ -101,7 +101,7 @@ public class TabularDataGraphServlet extends AbstractTabularDataGraphServlet for (CodeAndLabel featureCodeAndLabel : featureCodeAndLabels) { headerCodes[i] = featureCodeAndLabel.getCode(); - headerLabels[i++] = featureCodeAndLabel.getTitle(); + headerLabels[i++] = featureCodeAndLabel.getLabel(); } lines = new ArrayList<String[]>(); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/AbstractTabularDataGraph.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/AbstractTabularDataGraph.java index 399ee259a15d683122e6213568632b22a27ddef8..bbb2ed9b454177e29f1e53466c05c3a84944f368 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/AbstractTabularDataGraph.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/AbstractTabularDataGraph.java @@ -117,10 +117,15 @@ abstract class AbstractTabularDataGraph<T extends TabularDataGraphConfiguration> /** * Maps specified column code onto a column label. Returns column code if mapping doesn't work. */ - protected String getColumnLabel(String columnCode) + protected String getColumnLabel(CodeAndLabel columnCode) { + String label = columnCode.getLabel(); + if (label != null) + { + return label; + } int columnNumber = tryColumnNumberForHeader(columnCode); - return columnNumber < 0 ? columnCode : fileLines.getHeaderLabels()[columnNumber]; + return columnNumber < 0 ? columnCode.getCode() : fileLines.getHeaderLabels()[columnNumber]; } /** @@ -140,17 +145,16 @@ abstract class AbstractTabularDataGraph<T extends TabularDataGraphConfiguration> } /** - * Return the column number for the column header or -1 if none was found. Argument will - * be first normalized. + * Return the column number for the code of the column header or -1 if none was found. */ - protected int tryColumnNumberForHeader(String columnHeaderCode) + protected int tryColumnNumberForHeader(CodeAndLabel columnHeaderCode) { - String normalizedCode = CodeAndLabel.normalize(columnHeaderCode); + String code = columnHeaderCode.getCode(); String[] headers = fileLines.getHeaderCodes(); int i = 0; for (String header : headers) { - if (normalizedCode.equals(header)) + if (code.equals(header)) { return i; } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataGraphCollectionConfiguration.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataGraphCollectionConfiguration.java index bd66d97e497be4d6282157ed7875d7f1bd5af2ea..84d3f1ba72c3d5ea9cef05e8c433c7282c23225c 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataGraphCollectionConfiguration.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataGraphCollectionConfiguration.java @@ -32,6 +32,7 @@ import ch.systemsx.cisd.common.utilities.PropertyUtils; import ch.systemsx.cisd.common.utilities.PropertyParametersUtil.SectionProperties; import ch.systemsx.cisd.openbis.dss.generic.server.graph.TabularDataGraphConfiguration.GraphType; import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.ITabularData; +import ch.systemsx.cisd.openbis.dss.generic.shared.utils.CodeAndLabel; import ch.systemsx.cisd.utils.CsvFileReaderHelper.ICsvFileReaderConfiguration; /** @@ -39,6 +40,10 @@ import ch.systemsx.cisd.utils.CsvFileReaderHelper.ICsvFileReaderConfiguration; */ public class TabularDataGraphCollectionConfiguration implements ICsvFileReaderConfiguration { + private static final String CODE_POSTFIX = ".code"; + + private static final String LABEL_POSTFIX = ".label"; + private static final String SEPARATOR_PROPERTY_KEY = "separator"; private static final String IGNORE_COMMENTS_PROPERTY_KEY = "ignore-comments"; @@ -172,9 +177,9 @@ public class TabularDataGraphCollectionConfiguration implements ICsvFileReaderCo switch (type) { case HEATMAP: - String xAxis = PropertyUtils.getMandatoryProperty(props, X_AXIS_KEY); - String yAxis = PropertyUtils.getMandatoryProperty(props, Y_AXIS_KEY); - String zAxis = PropertyUtils.getMandatoryProperty(props, COLUMN_KEY); + CodeAndLabel xAxis = getCodeAndLabel(props, X_AXIS_KEY); + CodeAndLabel yAxis = getCodeAndLabel(props, Y_AXIS_KEY); + CodeAndLabel zAxis = getCodeAndLabel(props, COLUMN_KEY); if (xAxis.equals(yAxis)) { return new TabularDataHeatmapConfiguration(title, xAxis, zAxis, @@ -185,19 +190,42 @@ public class TabularDataGraphCollectionConfiguration implements ICsvFileReaderCo getThumbnailWidth(), getThumbnailHeight()); } case HISTOGRAM: - return new TabularDataHistogramConfiguration(title, PropertyUtils - .getMandatoryProperty(props, COLUMN_KEY), getThumbnailWidth(), - getThumbnailHeight(), PropertyUtils.getInt(props, NUMBER_OF_BINS_KEY, 10)); + return new TabularDataHistogramConfiguration(title, getCodeAndLabel(props, + COLUMN_KEY), getThumbnailWidth(), getThumbnailHeight(), PropertyUtils + .getInt(props, NUMBER_OF_BINS_KEY, 10)); case SCATTERPLOT: - return new TabularDataScatterplotConfiguration(title, PropertyUtils - .getMandatoryProperty(props, X_AXIS_KEY), PropertyUtils - .getMandatoryProperty(props, Y_AXIS_KEY), getThumbnailWidth(), - getThumbnailHeight()); + xAxis = getCodeAndLabel(props, X_AXIS_KEY); + yAxis = getCodeAndLabel(props, Y_AXIS_KEY); + return new TabularDataScatterplotConfiguration(title, xAxis, yAxis, + getThumbnailWidth(), getThumbnailHeight()); } // should never get here return null; } + + private CodeAndLabel getCodeAndLabel(Properties properties, String key) + { + String labelWithOptionalCode = properties.getProperty(key); + if (labelWithOptionalCode != null) + { + return new CodeAndLabel(labelWithOptionalCode); + } + String labelKey = key + LABEL_POSTFIX; + String label = properties.getProperty(labelKey); + String codeKey = key + CODE_POSTFIX; + String code = properties.getProperty(codeKey); + if (label == null && code == null) + { + throw new IllegalArgumentException("Missing one of the following properties: " + key + + ", " + codeKey + ", " + labelKey); + } + if (code == null) + { + return new CodeAndLabel(label); + } + return new CodeAndLabel(code, label); + } /** * Return the graph configuration associated with the graphTypeCode. diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataGraphConfiguration.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataGraphConfiguration.java index b60d7ccea511510b1599671ca60819a1a9265c48..7f82e6e31efe237448480d2093d8dd1daf6d4dd8 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataGraphConfiguration.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataGraphConfiguration.java @@ -16,6 +16,8 @@ package ch.systemsx.cisd.openbis.dss.generic.server.graph; +import ch.systemsx.cisd.openbis.dss.generic.shared.utils.CodeAndLabel; + /** * Represents the configuration data for a graph generated from tabular data. * @@ -33,10 +35,10 @@ public class TabularDataGraphConfiguration private final String title; // the column that is used as the x-axis - private final String xAxisColumn; + private final CodeAndLabel xAxisColumn; // the column that is used as the y-axis - private final String yAxisColumn; + private final CodeAndLabel yAxisColumn; private final int imageWidth; @@ -51,8 +53,8 @@ public class TabularDataGraphConfiguration * @param imageWidth The desired width of the resulting image * @param imageHeight The desired height of the resulting image */ - protected TabularDataGraphConfiguration(GraphType graphType, String title, String xAxisColumn, - String yAxisColumn, int imageWidth, int imageHeight) + protected TabularDataGraphConfiguration(GraphType graphType, String title, CodeAndLabel xAxisColumn, + CodeAndLabel yAxisColumn, int imageWidth, int imageHeight) { this.graphType = graphType; this.title = title; @@ -78,7 +80,7 @@ public class TabularDataGraphConfiguration /** * The name of the column from which the x values come. */ - protected String getXAxisColumn() + protected CodeAndLabel getXAxisColumn() { return xAxisColumn; } @@ -86,7 +88,7 @@ public class TabularDataGraphConfiguration /** * The name of the column from which the y values come. */ - protected String getYAxisColumn() + protected CodeAndLabel getYAxisColumn() { return yAxisColumn; } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataHeatmapConfiguration.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataHeatmapConfiguration.java index 78f1c0cce69236801ce9b4673883b9d109886974..383b4d6c734a1802fa9c4e825750495053788511 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataHeatmapConfiguration.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataHeatmapConfiguration.java @@ -16,6 +16,8 @@ package ch.systemsx.cisd.openbis.dss.generic.server.graph; +import ch.systemsx.cisd.openbis.dss.generic.shared.utils.CodeAndLabel; + /** * @author Chandrasekhar Ramakrishnan */ @@ -23,7 +25,7 @@ public class TabularDataHeatmapConfiguration extends TabularDataGraphConfigurati { // the column that is used as the y-axis - private final String zAxisColumn; + private final CodeAndLabel zAxisColumn; private final boolean isXYSplit; @@ -37,8 +39,8 @@ public class TabularDataHeatmapConfiguration extends TabularDataGraphConfigurati * @param imageWidth The desired width of the resulting image * @param imageHeight The desired height of the resulting image */ - protected TabularDataHeatmapConfiguration(String title, String xAxisColumn, String yAxisColumn, - String zAxisColumn, int imageWidth, int imageHeight) + protected TabularDataHeatmapConfiguration(String title, CodeAndLabel xAxisColumn, CodeAndLabel yAxisColumn, + CodeAndLabel zAxisColumn, int imageWidth, int imageHeight) { super(GraphType.HEATMAP, title, xAxisColumn, yAxisColumn, imageWidth, imageHeight); this.zAxisColumn = zAxisColumn; @@ -55,7 +57,7 @@ public class TabularDataHeatmapConfiguration extends TabularDataGraphConfigurati * @param imageWidth The desired width of the resulting image * @param imageHeight The desired height of the resulting image */ - protected TabularDataHeatmapConfiguration(String title, String indexColumn, String zAxisColumn, + protected TabularDataHeatmapConfiguration(String title, CodeAndLabel indexColumn, CodeAndLabel zAxisColumn, int imageWidth, int imageHeight) { super(GraphType.HEATMAP, title, indexColumn, indexColumn, imageWidth, imageHeight); @@ -63,7 +65,7 @@ public class TabularDataHeatmapConfiguration extends TabularDataGraphConfigurati isXYSplit = false; } - protected String getZAxisColumn() + protected CodeAndLabel getZAxisColumn() { return zAxisColumn; } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataHistogramConfiguration.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataHistogramConfiguration.java index 2fd73e71d85849c65df4790dfaaeff2ef0bce817..650d6b7d0b8c34d7803c67c18dbb75a258dcbeff 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataHistogramConfiguration.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataHistogramConfiguration.java @@ -16,6 +16,8 @@ package ch.systemsx.cisd.openbis.dss.generic.server.graph; +import ch.systemsx.cisd.openbis.dss.generic.shared.utils.CodeAndLabel; + /** * @author Chandrasekhar Ramakrishnan */ @@ -33,7 +35,7 @@ public class TabularDataHistogramConfiguration extends TabularDataGraphConfigura * @param imageHeight The desired height of the resulting image * @param numberOfBins The number of bins in the histogram */ - protected TabularDataHistogramConfiguration(String title, String histogramColumn, + protected TabularDataHistogramConfiguration(String title, CodeAndLabel histogramColumn, int imageWidth, int imageHeight, int numberOfBins) { super(GraphType.HISTOGRAM, title, histogramColumn, histogramColumn, imageWidth, imageHeight); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataScatterplotConfiguration.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataScatterplotConfiguration.java index 05d91f218d0182e3e0dc76faea52d5eff122bb0b..b2a371569feec13557c86b8d0ce450c47cdfe798 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataScatterplotConfiguration.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataScatterplotConfiguration.java @@ -16,6 +16,8 @@ package ch.systemsx.cisd.openbis.dss.generic.server.graph; +import ch.systemsx.cisd.openbis.dss.generic.shared.utils.CodeAndLabel; + /** * @author Chandrasekhar Ramakrishnan @@ -32,8 +34,8 @@ public class TabularDataScatterplotConfiguration extends TabularDataGraphConfigu * @param imageWidth * @param imageHeight */ - public TabularDataScatterplotConfiguration(String title, String xAxisColumn, - String yAxisColumn, int imageWidth, int imageHeight) + public TabularDataScatterplotConfiguration(String title, CodeAndLabel xAxisColumn, + CodeAndLabel yAxisColumn, int imageWidth, int imageHeight) { super(GraphType.SCATTERPLOT, title, xAxisColumn, yAxisColumn, imageWidth, imageHeight); } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/ImageAnalysisMergedRowsReportingPlugin.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/ImageAnalysisMergedRowsReportingPlugin.java index 0b80cfc9e95b546f0ec3aa0f9353ea5a9cc4fb8e..cb9dc5c0e3de0087d6b01a3fac5acba3d7ff2725 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/ImageAnalysisMergedRowsReportingPlugin.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/ImageAnalysisMergedRowsReportingPlugin.java @@ -94,7 +94,7 @@ public class ImageAnalysisMergedRowsReportingPlugin extends AbstractDatastorePlu builder.addHeader(COLUMN_TITLE); for (CodeAndLabel codeAndLabel : codeAndLabels) { - builder.addHeader(codeAndLabel.getTitle(), codeAndLabel.getCode()); + builder.addHeader(codeAndLabel.getLabel(), codeAndLabel.getCode()); } for (FeatureTableRow row : rows) { diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/FeatureTableBuilderTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/FeatureTableBuilderTest.java index 1388de771fb0dead8e5afb8e0ec1e78a9a2b7c8f..90f6c799b54186ee5d4bee37b90d4b7908ccae54 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/FeatureTableBuilderTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/FeatureTableBuilderTest.java @@ -143,7 +143,7 @@ public class FeatureTableBuilderTest extends AssertJUnit { String codeAndLabels = featureCodesAndLabels[i]; CodeAndLabel codeAndTitle = new CodeAndLabel(codeAndLabels); - String title = codeAndTitle.getTitle(); + String title = codeAndTitle.getLabel(); String code = codeAndTitle.getCode(); if (filteredCodeOrNull == null || filteredCodeOrNull.equals(code)) { diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataGraphCollectionConfigurationTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataGraphCollectionConfigurationTest.java index 09c7360fb3eb4b648c5afd40262ff35c7a6cd04e..957d0c83878e8f456938597cc3f97bc677d6887a 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataGraphCollectionConfigurationTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataGraphCollectionConfigurationTest.java @@ -58,6 +58,8 @@ public class TabularDataGraphCollectionConfigurationTest extends AssertJUnit assertEquals("scatter1", graphConfig.getTitle()); assertEquals(30, graphConfig.getImageHeight()); assertEquals(30, graphConfig.getImageWidth()); + assertEquals("<TOTALCELLS> TotalCells", graphConfig.getXAxisColumn().toString()); + assertEquals("<INFCELLS> Infected Cells", graphConfig.getYAxisColumn().toString()); assertEquals("hist", graphNames.get(1)); graphConfig = configuration.getGraphConfiguration(graphNames.get(1)); @@ -66,6 +68,7 @@ public class TabularDataGraphCollectionConfigurationTest extends AssertJUnit assertEquals("heat", graphNames.get(2)); graphConfig = configuration.getGraphConfiguration(graphNames.get(2)); assertEquals("Infected Cells", graphConfig.getTitle()); + assertEquals("<WELLNAME> WellName", graphConfig.getXAxisColumn().toString()); assertEquals("scatter2", graphNames.get(3)); } diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataHeatmapTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataHeatmapTest.java index eed6eef5482869d434b01aaa8842ada3427a58b6..b36ced2b96e89ba35e7c738f786f3766b6b217cb 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataHeatmapTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataHeatmapTest.java @@ -21,6 +21,8 @@ import java.io.IOException; import org.testng.annotations.Test; +import ch.systemsx.cisd.openbis.dss.generic.shared.utils.CodeAndLabel; + /** * @author Chandrasekhar Ramakrishnan */ @@ -32,7 +34,7 @@ public class TabularDataHeatmapTest extends AbstractTabularDataGraphTest File outputFile = getImageOutputFile(); TabularDataHeatmapConfiguration config = - new TabularDataHeatmapConfiguration("Test", "WellName", "InfectionIndex", 300, 200); + new TabularDataHeatmapConfiguration("Test", new CodeAndLabel("WellName"), new CodeAndLabel("InfectionIndex"), 300, 200); AbstractTabularDataGraph<TabularDataHeatmapConfiguration> graph = new TabularDataHeatmap(config, getDatasetFileLines(), getOutputStream(outputFile)); assertSame(graph.tryXColumnNumber(), graph.tryYColumnNumber()); @@ -48,7 +50,7 @@ public class TabularDataHeatmapTest extends AbstractTabularDataGraphTest File outputFile = getImageOutputFile(); TabularDataHeatmapConfiguration config = - new TabularDataHeatmapConfiguration("Test", "WellName", "BigNumber", 300, 200); + new TabularDataHeatmapConfiguration("Test", new CodeAndLabel("WellName"), new CodeAndLabel("BigNumber"), 300, 200); AbstractTabularDataGraph<TabularDataHeatmapConfiguration> graph = new TabularDataHeatmap(config, getBigNumberDatasetFileLines(), getOutputStream(outputFile)); @@ -65,7 +67,7 @@ public class TabularDataHeatmapTest extends AbstractTabularDataGraphTest File outputFile = getImageOutputFile(); TabularDataHeatmapConfiguration config = - new TabularDataHeatmapConfiguration("Test", "WellName", "Zero", 300, 200); + new TabularDataHeatmapConfiguration("Test", new CodeAndLabel("WellName"), new CodeAndLabel("Zero"), 300, 200); AbstractTabularDataGraph<TabularDataHeatmapConfiguration> graph = new TabularDataHeatmap(config, getBigNumberDatasetFileLines(), getOutputStream(outputFile)); @@ -83,7 +85,7 @@ public class TabularDataHeatmapTest extends AbstractTabularDataGraphTest File outputFile = getImageOutputFile(); TabularDataHeatmapConfiguration config = - new TabularDataHeatmapConfiguration("Test", "WellName", "Non-Existant", 300, 200); + new TabularDataHeatmapConfiguration("Test", new CodeAndLabel("WellName"), new CodeAndLabel("Non-Existant"), 300, 200); AbstractTabularDataGraph<TabularDataHeatmapConfiguration> graph = new TabularDataHeatmap(config, getDatasetFileLines(), getOutputStream(outputFile)); diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataHistogramTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataHistogramTest.java index 069d55811fe27478ad57570d59ab80ab4a53bcd4..87b89ad6127f98db04b1be2430b47a5ac51738c8 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataHistogramTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataHistogramTest.java @@ -21,6 +21,8 @@ import java.io.IOException; import org.testng.annotations.Test; +import ch.systemsx.cisd.openbis.dss.generic.shared.utils.CodeAndLabel; + /** * @author Chandrasekhar Ramakrishnan */ @@ -32,7 +34,7 @@ public class TabularDataHistogramTest extends AbstractTabularDataGraphTest File outputFile = getImageOutputFile(); TabularDataHistogramConfiguration config = - new TabularDataHistogramConfiguration("Test", "InfectedCells", 300, 200, 6); + new TabularDataHistogramConfiguration("Test", new CodeAndLabel("InfectedCells"), 300, 200, 6); AbstractTabularDataGraph<TabularDataHistogramConfiguration> graph = new TabularDataHistogram(config, getDatasetFileLines(), getOutputStream(outputFile)); assertSame(graph.tryXColumnNumber(), graph.tryYColumnNumber()); @@ -48,7 +50,7 @@ public class TabularDataHistogramTest extends AbstractTabularDataGraphTest File outputFile = getImageOutputFile(); TabularDataHistogramConfiguration config = - new TabularDataHistogramConfiguration("Test", "BigNumber", 300, 200, 6); + new TabularDataHistogramConfiguration("Test", new CodeAndLabel("BigNumber"), 300, 200, 6); AbstractTabularDataGraph<TabularDataHistogramConfiguration> graph = new TabularDataHistogram(config, getBigNumberDatasetFileLines(), getOutputStream(outputFile)); @@ -65,7 +67,7 @@ public class TabularDataHistogramTest extends AbstractTabularDataGraphTest File outputFile = getImageOutputFile(); TabularDataHistogramConfiguration config = - new TabularDataHistogramConfiguration("Test", "Non-Existant", 300, 200, 6); + new TabularDataHistogramConfiguration("Test", new CodeAndLabel("Non-Existant"), 300, 200, 6); AbstractTabularDataGraph<TabularDataHistogramConfiguration> graph = new TabularDataHistogram(config, getDatasetFileLines(), getOutputStream(outputFile)); diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataScatterplotTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataScatterplotTest.java index f19f20331154de0deb6ad8d4b5445f0e8bd9ade6..15e12d998ace8f703ff6ad2f07756ecd3fec23e3 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataScatterplotTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/TabularDataScatterplotTest.java @@ -21,6 +21,8 @@ import java.io.IOException; import org.testng.annotations.Test; +import ch.systemsx.cisd.openbis.dss.generic.shared.utils.CodeAndLabel; + /** * @author Chandrasekhar Ramakrishnan */ @@ -31,13 +33,18 @@ public class TabularDataScatterplotTest extends AbstractTabularDataGraphTest { File outputFile = getImageOutputFile(); + CodeAndLabel xAxisColumn = new CodeAndLabel("TotalCells", "Total Cells"); + CodeAndLabel yAxisColumn = new CodeAndLabel("<INFECTEDCELLS> Infected Cells"); TabularDataScatterplotConfiguration config = - new TabularDataScatterplotConfiguration("Test", "TotalCells", "InfectedCells", 300, + new TabularDataScatterplotConfiguration("Test", xAxisColumn, yAxisColumn, 300, 200); TabularDataScatterplot graph = new TabularDataScatterplot(config, getDatasetFileLines(), getOutputStream(outputFile)); - assertNotSame(graph.tryXColumnNumber(), graph.tryYColumnNumber()); + assertEquals(1, graph.tryXColumnNumber()); + assertEquals("Total Cells", graph.getXAxisLabel()); + assertEquals(2, graph.tryYColumnNumber()); + assertEquals("Infected Cells", graph.getYAxisLabel()); graph.generateImage(); assertTrue(outputFile.exists()); @@ -49,12 +56,17 @@ public class TabularDataScatterplotTest extends AbstractTabularDataGraphTest { File outputFile = getImageOutputFile(); + CodeAndLabel xAxisColumn = new CodeAndLabel("BIGNumber", null); + CodeAndLabel yAxisColumn = new CodeAndLabel("TotalCells", "Total Cells"); TabularDataScatterplotConfiguration config = - new TabularDataScatterplotConfiguration("Test", "BigNumber", "TotalCells", 300, 200); + new TabularDataScatterplotConfiguration("Test", xAxisColumn, yAxisColumn, 300, 200); TabularDataScatterplot graph = new TabularDataScatterplot(config, getBigNumberDatasetFileLines(), getOutputStream(outputFile)); - assertNotSame(graph.tryXColumnNumber(), graph.tryYColumnNumber()); + assertEquals(21, graph.tryXColumnNumber()); + assertEquals("BigNumber", graph.getXAxisLabel()); + assertEquals(1, graph.tryYColumnNumber()); + assertEquals("Total Cells", graph.getYAxisLabel()); graph.generateImage(); assertTrue(outputFile.exists()); @@ -67,7 +79,7 @@ public class TabularDataScatterplotTest extends AbstractTabularDataGraphTest File outputFile = getImageOutputFile(); TabularDataScatterplotConfiguration config = - new TabularDataScatterplotConfiguration("Test", "TotalCells", "Non-existant", 300, + new TabularDataScatterplotConfiguration("Test", new CodeAndLabel("TotalCells"), new CodeAndLabel("Non-existant"), 300, 200); TabularDataScatterplot graph = new TabularDataScatterplot(config, getDatasetFileLines(), diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/graph.properties b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/graph.properties index 6605628eba3190bb3f81a7dbc21d345265eb39ec..27f02187d65f463dca9dc281131eecfd93d7be07 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/graph.properties +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/graph/graph.properties @@ -26,7 +26,8 @@ graphs = scatter1, hist, heat, scatter2 # The properties for the first scatter plot scatter1.graph-type = scatterplot scatter1.x-axis = TotalCells -scatter1.y-axis = InfectedCells +scatter1.y-axis.code = INfcells +scatter1.y-axis.label = Infected Cells # The properties for the histogram hist.graph-type = histogram @@ -35,7 +36,7 @@ hist.title = Total Cells Histogram # The properties for the heatmap heat.graph-type = heatmap -heat.x-axis = WellName +heat.x-axis = <wellname> WellName heat.y-axis = WellName heat.column = InfectedCells heat.title = Infected Cells