Skip to content

Commit fbbcdef

Browse files
committed
Merge branch 'release2.0_k2.11' into release2.0_k2.10
2 parents 217ca80 + 48488f9 commit fbbcdef

File tree

13 files changed

+597
-44
lines changed

13 files changed

+597
-44
lines changed

CHANGES.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
======================================================================================================
2+
2015-02-18
3+
VERSION v2.0.2
4+
5+
ISSUES
6+
7+
* fixes part a) of issue #63: B score description, cleanup
8+
* fixes #66: Operetta Reader node fails on Execution (due to missing values)
9+
* fixes #67: Plate Heatmap Viewer - well view fails with image data
10+
11+
NEW FEATURES / IMPROVEMENTS
12+
13+
* implementation of Mean-Aggregation and Mad-Aggregation
14+
* barcode pattern preference as table
15+
116
======================================================================================================
217
2014-11-13
318
VERSION v2.0.1

de.mpicbg.knime.hcs.base/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: HCS-Tools for KNIME
44
Bundle-SymbolicName: de.mpicbg.knime.hcs.base;singleton:=true
5-
Bundle-Version: 2.0.1.qualifier
5+
Bundle-Version: 2.0.2.qualifier
66
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
77
Bundle-ClassPath: hcstools.jar,
88
lib/GradientSlider.jar

de.mpicbg.knime.hcs.base/plugin.xml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,14 +287,20 @@
287287
<splashExtension icon="resources/hcstools_splash.png" id="HCS-Tools" tooltip="Some tools to ease HCS analysis">
288288
</splashExtension>
289289
</extension>
290-
291-
<!--
292290
<extension
293291
point="org.knime.base.AggregationOperator">
294-
<AggregationOperator
295-
AggregationOperator="de.mpicbg.tds.knime.utils.MADOperator">
296-
</AggregationOperator>
292+
<AggregationOperator
293+
AggregationOperator="de.mpicbg.knime.hcs.base.aggregation.HCSMeanOperator"
294+
deprecated="false"
295+
id="de.mpicbg.knime.hcs.base.aggregation.PreciseMean"
296+
name="Precise Mean">
297+
</AggregationOperator>
298+
<AggregationOperator
299+
AggregationOperator="de.mpicbg.knime.hcs.base.aggregation.HCSMadOperator"
300+
deprecated="false"
301+
id="de.mpicbg.knime.hcs.base.aggregation.Mad"
302+
name="Median absolute deviation">
303+
</AggregationOperator>
297304
</extension>
298-
-->
299305

300306
</plugin>
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
package de.mpicbg.knime.hcs.base.aggregation;
2+
3+
import java.util.Collections;
4+
import java.util.List;
5+
6+
import org.eclipse.jface.preference.IPreferenceStore;
7+
import org.knime.base.data.aggregation.AggregationOperator;
8+
import org.knime.base.data.aggregation.GlobalSettings;
9+
import org.knime.base.data.aggregation.OperatorColumnSettings;
10+
import org.knime.base.data.aggregation.OperatorData;
11+
import org.knime.base.data.aggregation.numerical.MedianOperator;
12+
import org.knime.core.data.DataCell;
13+
import org.knime.core.data.DoubleValue;
14+
import org.knime.core.data.def.DoubleCell;
15+
16+
import de.mpicbg.knime.hcs.base.HCSToolsBundleActivator;
17+
import de.mpicbg.knime.hcs.base.prefs.HCSToolsPreferenceInitializer;
18+
import de.mpicbg.knime.hcs.base.utils.ExtDescriptiveStats;
19+
import de.mpicbg.knime.hcs.base.utils.MadStatistic;
20+
import de.mpicbg.knime.hcs.base.utils.MadStatistic.IllegalMadFactorException;
21+
22+
public class HCSMadOperator extends MedianOperator {
23+
24+
/* (non-Javadoc)
25+
* @see org.knime.base.data.aggregation.numerical.MedianOperator#createInstance(org.knime.base.data.aggregation.GlobalSettings, org.knime.base.data.aggregation.OperatorColumnSettings)
26+
*/
27+
@Override
28+
public AggregationOperator createInstance(GlobalSettings globalSettings,
29+
OperatorColumnSettings opColSettings) {
30+
return new HCSMadOperator(getOperatorData(), globalSettings, opColSettings);
31+
}
32+
33+
public HCSMadOperator() {
34+
super(new OperatorData("HCS-Mad", false, false, DoubleValue.class, false),
35+
GlobalSettings.DEFAULT, OperatorColumnSettings.DEFAULT_EXCL_MISSING);
36+
}
37+
38+
public HCSMadOperator(GlobalSettings globalSettings,
39+
OperatorColumnSettings opColSettings) {
40+
super(globalSettings, opColSettings);
41+
}
42+
43+
public HCSMadOperator(OperatorData operatorData, GlobalSettings globalSettings,
44+
OperatorColumnSettings opColSettings) {
45+
super(operatorData, globalSettings, opColSettings);
46+
}
47+
48+
/* (non-Javadoc)
49+
* @see org.knime.base.data.aggregation.numerical.MedianOperator#getResultInternal()
50+
*/
51+
@Override
52+
protected DataCell getResultInternal() {
53+
54+
// get preference data
55+
IPreferenceStore prefStore = HCSToolsBundleActivator.getDefault().getPreferenceStore();
56+
double madScalingFactor = prefStore.getDouble(HCSToolsPreferenceInitializer.MAD_SCALING_FACTOR);
57+
58+
// return missing, if median is already missing value
59+
if(super.getResultInternal().isMissing()) return super.getResultInternal();
60+
61+
final List<DataCell> cells = super.getCells();
62+
63+
ExtDescriptiveStats stats = new ExtDescriptiveStats();
64+
stats.setMadImpl(new MadStatistic(madScalingFactor));
65+
66+
for(DataCell dc : cells) {
67+
double val = ((DoubleCell)dc).getDoubleValue();
68+
stats.addValue(val);
69+
}
70+
71+
try {
72+
return new DoubleCell(stats.getMad());
73+
} catch (IllegalMadFactorException e) {
74+
return new DoubleCell(Double.NaN);
75+
}
76+
}
77+
78+
/* (non-Javadoc)
79+
* @see org.knime.base.data.aggregation.numerical.MedianOperator#getDescription()
80+
*/
81+
@Override
82+
public String getDescription() {
83+
return "Calculates the median absolute deviation value (MAD) per group. (HCS-Tools)";
84+
}
85+
86+
87+
88+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package de.mpicbg.knime.hcs.base.aggregation;
2+
3+
import org.knime.base.data.aggregation.AggregationOperator;
4+
import org.knime.base.data.aggregation.GlobalSettings;
5+
import org.knime.base.data.aggregation.OperatorColumnSettings;
6+
import org.knime.base.data.aggregation.OperatorData;
7+
import org.knime.base.data.aggregation.numerical.MeanOperator;
8+
import org.knime.core.data.DataCell;
9+
import org.knime.core.data.DataType;
10+
import org.knime.core.data.DoubleValue;
11+
import org.knime.core.data.def.DoubleCell;
12+
13+
public class HCSMeanOperator extends AggregationOperator {
14+
15+
private final DataType m_type = DoubleCell.TYPE;
16+
private int m_count = 0;
17+
private double m_mean = 0;
18+
19+
20+
public HCSMeanOperator(OperatorData operatorData) {
21+
super(operatorData);
22+
}
23+
24+
public HCSMeanOperator() {
25+
//super(new OperatorData("HCS-Mean", false, false, DoubleValue.class, false));
26+
super(new OperatorData("HCS-Mean", false, false, DoubleValue.class, false),
27+
GlobalSettings.DEFAULT, OperatorColumnSettings.DEFAULT_EXCL_MISSING);
28+
}
29+
30+
public HCSMeanOperator(OperatorData operatorData,
31+
GlobalSettings globalSettings, OperatorColumnSettings opColSettings) {
32+
super(operatorData, globalSettings, opColSettings);
33+
}
34+
35+
@Override
36+
public String getDescription() {
37+
return "Calculates the mean value per group. (HCS-Tools)";
38+
}
39+
40+
@Override
41+
public AggregationOperator createInstance(GlobalSettings globalSettings,
42+
OperatorColumnSettings opColSettings) {
43+
return new HCSMeanOperator(getOperatorData(), globalSettings, opColSettings);
44+
}
45+
46+
@Override
47+
protected boolean computeInternal(DataCell cell) {
48+
final double d = ((DoubleValue)cell).getDoubleValue();
49+
m_count++;
50+
m_mean = m_mean + (d - m_mean)/(m_count);
51+
52+
return false;
53+
}
54+
55+
@Override
56+
protected DataType getDataType(DataType origType) {
57+
return m_type;
58+
}
59+
60+
@Override
61+
protected DataCell getResultInternal() {
62+
if (m_count == 0) {
63+
return DataType.getMissingCell();
64+
}
65+
return new DoubleCell(m_mean);
66+
}
67+
68+
@Override
69+
protected void resetInternal() {
70+
m_mean = 0;
71+
m_count = 0;
72+
}
73+
74+
}

de.mpicbg.knime.hcs.base/src/de/mpicbg/knime/hcs/base/heatmap/WellViewer.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ private void configure(Well well) {
278278
imageTable.getContentTable().setColumnWidth(nameWidth + numberWidth + 10);
279279
} else {
280280
// imageTable.setDataTable(((DataContainer)well.getImageData()).getTable());
281-
imageTable.setDataTable(loadImageData().getTable());
281+
imageTable.setDataTable(loadImageData());
282282
}
283283

284284
// Render the row id column invisible (no purpose here)
@@ -301,7 +301,7 @@ private void configure(Well well) {
301301
*
302302
* @return {@link DataContainer} representing a one-row-table with the images.
303303
*/
304-
private DataContainer loadImageData() {
304+
private DataTable loadImageData() {
305305
long startTime = System.currentTimeMillis();
306306

307307
BufferedDataTable bufferedTable = parent.getHeatMapModel().getInternalTables()[0];
@@ -331,16 +331,19 @@ private DataContainer loadImageData() {
331331
break;
332332
}
333333
}
334+
335+
DataColumnSpec[] cSpecArr = new DataColumnSpec[imgColumns.size()];
336+
cSpecArr = imgColumns.toArray(cSpecArr);
334337

335-
DataContainer table = new DataContainer(new DataTableSpec((DataColumnSpec[])imgColumns.toArray()));
338+
DataContainer table = new DataContainer(new DataTableSpec(cSpecArr));
336339
table.addRowToTable(new DefaultRow(new RowKey(""), imageCells));
337340
table.close();
338341

339342
long stopTime = System.currentTimeMillis();
340343
long elapsedTime = stopTime - startTime;
341344
System.err.println("Elapsed time: " + elapsedTime);
342345

343-
return table;
346+
return table.getTable();
344347
}
345348

346349

de.mpicbg.knime.hcs.base/src/de/mpicbg/knime/hcs/base/nodes/norm/BScoreNormalizerFactory.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<fullDescription>
1111
<intro>
1212
<p>
13-
Each group will be normalized by applying the B score. The B score algorithm uses an iterative 'median
13+
Each plate will be normalized by applying the B score. The B score algorithm uses an iterative 'median
1414
polish' procedure.
1515
</p>
1616
<p>
@@ -23,16 +23,12 @@
2323
(MA): Addison-Wesley, 1977.
2424
</p>
2525
<p>
26-
It is possible to normalize without grouping (e.g. normalization of the whole screen based on all
27-
negative
28-
controls available).
2926
Note: The node expects the presence of integer columns named 'plateRow' and 'plateColumn' containing the
3027
well position.
3128
</p>
3229
</intro>
3330

34-
<option name="Group wells by">Select the column to define the groups (e.g. "barcode" for plate-wise
35-
normalization).
31+
<option name="Group wells by">Select the column to define the plates (e.g. "barcode").
3632
</option>
3733
<option name="Normalize">Select the columns with data to be normalized.
3834
</option>

de.mpicbg.knime.hcs.base/src/de/mpicbg/knime/hcs/base/nodes/reader/OperettaFileReader.java

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.knime.core.data.DataCell;
1111
import org.knime.core.data.DataRow;
1212
import org.knime.core.data.DataTableSpec;
13+
import org.knime.core.data.MissingCell;
1314
import org.knime.core.data.RowKey;
1415
import org.knime.core.data.def.DefaultRow;
1516
import org.knime.core.data.def.DoubleCell;
@@ -123,19 +124,10 @@ protected BufferedDataTable[] execute(BufferedDataTable[] inData, ExecutionConte
123124
String colValue = colData[i];
124125

125126
String value = colValue.trim();
126-
double doubleValue;
127127

128-
try {
129-
// handle inf
130-
if(value.equals("INF"))
131-
doubleValue = Double.MAX_VALUE;
132-
else
133-
doubleValue = Double.parseDouble(value);
134-
} catch (NumberFormatException nfe) {
135-
throw new Exception(nfe.getMessage() + "\n" + "Operetta result files may only contain numerical data. Please re-export the result file: " + inputFile.getAbsolutePath());
136-
}
128+
DataCell valueCell = parseValue(value);
137129

138-
knimeRow[i + 1] = colAttributes.get(i + 1).createCell(doubleValue);
130+
knimeRow[i + 1] = valueCell;
139131
}
140132

141133
DataRow tableRow = new DefaultRow(new RowKey("" + rowCounter++), knimeRow);
@@ -152,7 +144,26 @@ protected BufferedDataTable[] execute(BufferedDataTable[] inData, ExecutionConte
152144
}
153145

154146

155-
private List<Attribute> getOperettaColModel(File inputFile) {
147+
private DataCell parseValue(String value) throws Exception {
148+
if(value.length() == 0)
149+
return new MissingCell(null);
150+
151+
double doubleValue;
152+
try {
153+
// handle inf
154+
if(value.equals("INF"))
155+
doubleValue = Double.POSITIVE_INFINITY;
156+
else
157+
doubleValue = Double.parseDouble(value);
158+
} catch (NumberFormatException nfe) {
159+
throw new Exception(nfe.getMessage() + "\n" + "Operetta result files may only contain numerical data. Please re-export the result file: ");
160+
}
161+
162+
return new DoubleCell(doubleValue);
163+
}
164+
165+
166+
private List<Attribute> getOperettaColModel(File inputFile) {
156167
try {
157168
BufferedReader reader = new BufferedReader(new FileReader(inputFile));
158169
String line;

0 commit comments

Comments
 (0)