Changeset 4308
 Timestamp:
 May 21, 2008, 10:49:43 PM (15 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/2.7stable/src/plugins/core/net/sf/basedb/plugins/MedianRatioNormalization.java
r4281 r4308 53 53 import net.sf.basedb.core.RequestInformation; 54 54 import net.sf.basedb.core.SpotBatcher; 55 import net.sf.basedb.core.StringParameterType; 55 56 import net.sf.basedb.core.Transformation; 56 57 import net.sf.basedb.core.Type; … … 94 95 ( 95 96 "Normalization: Median ratio", 96 ("This normalizer behaves differently depending on the array type.\n" + 97 "1channel arrays: Intensities are translated such that resulting median is zero.\n" + 97 ("This normalizer behaves differently depending on the array type.\n\n" + 98 99 "1channel arrays: Intensities are changed in two different ways depending " + 100 "on user selection.\n" + 101 "a) For absolute intensity data the intensities should be scaled with the " + 102 "median intensity, Inew=Iold/Imedian, such that resulting median is 1.\n" + 103 "b) For log intensity data the intensities should be subtracted with the median " + 104 "intensity, log(Inew)=log(Iold)log(Imedian), such that resulting median is 0.\n\n" + 105 98 106 "2channel arrays: Intensities are scaled such " + 99 107 "that their geometric mean (sqrt(i1 * i2)) is kept constant but " + 100 "the median of their ratios (i1/i2) is shifted to 1.\n" + 101 "All arrray types: The user can optionally exclude spots; all spots " + 108 "the median of their ratios (i1/i2) is shifted to 1.\n\n" + 109 110 "All array types: The user can optionally exclude spots; all spots " + 102 111 "with at least one intensity below a user selectable threshold are " + 103 112 "removed. User selectable (low/high intensity) fractions of the " + … … 138 147 new FloatParameterType(0F, 100F, 5F, true) 139 148 ); 140 149 150 /** 151 List of median normalization methods. 152 153 The method to use depends whether data is log values or 154 not. Absolute intensities should be scaled with the median 155 whereas log intensities should be subtracted with the median 156 intensity. 157 158 Inew = Iold/Imedian for absolute intensities. 159 160 log(Inew) = log(Iold)  log(Imedian) for log intensities. 161 162 Used with 1channel data only 163 */ 164 private static final 165 PluginParameter<String> methodParameter = new PluginParameter<String> 166 ( "method", 167 "Normalization method", 168 "Scale: Scaling of intensities, Inew=Iold/Imedian. Use with absolute intensities.\n" + 169 "Subtract: Subtraction of intensities, log(Inew)=log(Iold)log(Imedian), Use with " + 170 "log intensities.", 171 new StringParameterType(255, "Scale", true, 1, 0, 0, 172 Arrays.asList( 173 new String[] { "Scale" , 174 "Subtract" } 175 ) 176 ) 177 ); 178 179 /** 180 Used with 2channel data only 181 */ 141 182 private static final PluginParameter<Integer> blockGroupParameter = new PluginParameter<Integer> 142 183 ( … … 226 267 { 227 268 case 1: 269 String method = (String) job.getValue(methodParameter.getName()); 228 270 normalize1ch(dc, source, batcher, minIntensity, lowExclude, 229 highExclude, progress);271 highExclude, method.equals("Scale"), progress); 230 272 break; 231 273 case 2: … … 332 374 storeValue(job, request, highExcludeParameter); 333 375 storeValue(job, request, lowExcludeParameter); 376 // 1channel only 377 storeValue(job, request, methodParameter); 334 378 // 2channel only 335 379 storeValue(job, request, blockGroupParameter); … … 365 409 @param highExclude A percentage of the spots with highest ratio 366 410 that are excluded in the median calculation 411 @param scale If true, scale intensities with median intensity, 412 otherwise subtract median intensity 367 413 @param progress Progress reporter for the caller to keep track of 368 414 the plugin's progress. Null is allowed. … … 373 419 normalize1ch(DbControl dc, BioAssaySet source, SpotBatcher batcher, 374 420 float minIntensity, float lowExclude, float highExclude, 375 ProgressReporter progress)421 boolean scale, ProgressReporter progress) 376 422 { 377 423 // Expressions used to get data … … 444 490 for (int i = 0; i<nofChildSpots; ++i) 445 491 { 446 batcher.insert(bioassayColumn, position[i], intensity[i]median); 492 batcher.insert(bioassayColumn, position[i], 493 (scale ? intensity[i]/median : intensity[i]median) ); 447 494 } 448 495 normalizedSpots += nofChildSpots; … … 647 694 parameters.add(highExcludeParameter); 648 695 parameters.add(lowExcludeParameter); 649 String description="Set minimum intensity, low exclude and high exclude"; 650 if (nofChannels == 2) 696 String description="Set minimum intensity, low exclude, high exclude, and select method"; 697 if (nofChannels == 1) { 698 parameters.add(methodParameter); 699 } 700 else if (nofChannels == 2) 651 701 { 652 702 parameters.add(blockGroupParameter);
Note: See TracChangeset
for help on using the changeset viewer.