Changeset 3887
- Timestamp:
- Oct 29, 2007, 9:45:30 AM (15 years ago)
- Location:
- trunk/src/plugins/core/net/sf/basedb/plugins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/core/net/sf/basedb/plugins/LowessNormalization.java
r3879 r3887 333 333 Expression ch1 = Dynamic.column(VirtualColumn.channel(1)); 334 334 Expression ch2 = Dynamic.column(VirtualColumn.channel(2)); 335 // A = log10(sqrt(ch1 * ch2))336 Expression pseudoA = Expressions.multiply(ch1, ch2);337 Expression A = Expressions.log10(Expressions.sqrt(pseudoA));338 335 339 336 // Create restriction: ch1 > 0 and ch2 > 0 … … 364 361 query.restrict(bioAssayRestriction); 365 362 query.order(Orders.asc(block)); 366 query.order(Orders.asc(pseudoA));367 363 368 364 // Normalize one bioassay at a time … … 424 420 if (toIndex > fromIndex) 425 421 { 426 List<Double> smoothCurve = lowess(data.subList(fromIndex, toIndex), fitFraction, iterations, delta); 422 List <SpotData> toNormalize = data.subList(fromIndex, toIndex); 423 Collections.sort(toNormalize); 424 List<Double> smoothCurve = lowess(toNormalize, fitFraction, iterations, delta); 427 425 for (int j = 0; j < smoothCurve.size(); ++j) 428 426 { 429 SpotData spot = data.get(fromIndex +j);427 SpotData spot = toNormalize.get(j); 430 428 double factor = Math.exp(smoothCurve.get(j) * 0.5); 431 429 batcher.insert(bioassayColumn, spot.position, (float)(spot.ch1/factor), (float)(spot.ch2*factor)); … … 637 635 638 636 private static class SpotData 637 implements Comparable<SpotData> 639 638 { 640 639 final int position; … … 655 654 this.A = Math.log10(Math.sqrt(ch1 * ch2)); 656 655 } 656 657 /** 658 Sort by A in ascending order. 659 */ 660 public int compareTo(SpotData o) 661 { 662 return this.A < o.A ? -1 : 1; 663 } 664 657 665 } 658 666 -
trunk/src/plugins/core/net/sf/basedb/plugins/MedianRatioNormalization.java
r3879 r3887 30 30 import java.util.Arrays; 31 31 import java.util.Collection; 32 import java.util.Collections; 32 33 import java.util.EnumSet; 33 34 import java.util.HashSet; … … 329 330 Expression ch1 = Dynamic.column(VirtualColumn.channel(1)); 330 331 Expression ch2 = Dynamic.column(VirtualColumn.channel(2)); 331 // ratio = ch1 / ch2332 Expression ratio = Expressions.divide(ch1, ch2);333 332 334 333 // Create restriction: ch1 > minIntensity and ch2 > minIntensity … … 360 359 query.restrict(bioAssayRestriction); 361 360 query.order(Orders.asc(block)); 362 query.order(Orders.asc(ratio));363 361 364 362 // Normalize one bioassay at a time … … 425 423 if (highIndex > lowIndex) 426 424 { 425 List <SpotData> toNormalize = data.subList(fromIndex, toIndex); 426 Collections.sort(toNormalize); 427 427 // Find median ratio in the current block range 428 double median = median( data.subList(lowIndex, highIndex));428 double median = median(toNormalize); 429 429 430 430 // Correct all spot intensities … … 509 509 510 510 private static class SpotData 511 implements Comparable<SpotData> 511 512 { 512 513 final int position; … … 524 525 this.ratio = ch1 / ch2; 525 526 } 527 /** 528 Sort by ratio in ascending order. 529 */ 530 public int compareTo(SpotData o) 531 { 532 return this.ratio < o.ratio ? -1 : 1; 533 } 526 534 } 527 535 }
Note: See TracChangeset
for help on using the changeset viewer.