Changeset 4359
- Timestamp:
- Jul 1, 2008, 11:40:28 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.7-stable/src/plugins/core/net/sf/basedb/plugins/MedianRatioNormalization.java
r4308 r4359 237 237 if (command.equals(Request.COMMAND_EXECUTE)) 238 238 { 239 if (progress != null) progress.display(0, "Preparing to normalize...");240 241 239 DbControl dc = null; 242 240 try … … 250 248 float highExclude = (Float) job.getValue(highExcludeParameter.getName()); 251 249 Job thisJob = getCurrentJob(dc); 252 253 // Create Transformation 254 Transformation t = source.newTransformation(getCurrentJob(dc)); 255 t.setName(about.getName()); 256 dc.saveItem(t); 257 258 // Create the normalized bioassay set 259 BioAssaySet child = t.newProduct(null, "new", true); 260 dc.saveItem(child); 261 262 // Batcher for inserting normalized data 263 SpotBatcher batcher = child.getSpotBatcher(); 264 265 int nofChannels=source.getRawDataType().getChannels(); 266 switch (nofChannels) 250 251 BioAssaySet child = null; 252 int rawChannels = source.getRawDataType().getChannels(); 253 switch (rawChannels) 267 254 { 268 case 1: 269 String method = (String) job.getValue(methodParameter.getName()); 270 normalize1ch(dc, source, batcher, minIntensity, lowExclude, 271 highExclude, method.equals("Scale"), progress); 255 case 1: 256 String method = (String) job.getValue(methodParameter.getName()); 257 child = normalize1ch(dc, source, thisJob, minIntensity, lowExclude, 258 highExclude, method.equals("Scale"), progress); 259 break; 260 case 2: 261 int blockGroupSize = 262 (Integer) job.getValue(blockGroupParameter.getName()); 263 child = normalize(dc, source, thisJob, minIntensity, lowExclude, 264 highExclude, blockGroupSize, progress); 272 265 break; 273 case 2: 274 int blockGroupSize = 275 (Integer) job.getValue(blockGroupParameter.getName()); 276 normalize2ch(dc, source, batcher, minIntensity, lowExclude, 277 highExclude, blockGroupSize, progress); 278 break; 279 default: 280 throw new InvalidDataException(nofChannels + 281 "-channel arrays not supported"); 282 } 283 284 batcher.close(); 266 default: 267 throw new InvalidDataException(rawChannels + 268 "-channel arrays not supported"); 269 } 270 285 271 child.setName(childName); 286 272 child.setDescription(childDescription); 287 273 dc.commit(); 288 289 274 int normalizedSpots = child.getNumSpots(); 290 275 response.setDone(normalizedSpots + " spots normalized, " + (source.getNumSpots() - normalizedSpots) + " spots removed"); … … 416 401 @since 2.7 417 402 */ 418 private void419 normalize1ch(DbControl dc, BioAssaySet source, SpotBatcher batcher,403 private BioAssaySet 404 normalize1ch(DbControl dc, BioAssaySet source, Job job, 420 405 float minIntensity, float lowExclude, float highExclude, 421 406 boolean scale, ProgressReporter progress) 422 407 { 408 // Create Transformation 409 Transformation t = source.newTransformation(job); 410 t.setName(about.getName()); 411 dc.saveItem(t); 412 413 // Create the normalized bioassay set 414 BioAssaySet child = t.newProduct(null, "new", true); 415 dc.saveItem(child); 416 417 // Batcher for inserting normalized data 418 SpotBatcher batcher = child.getSpotBatcher(); 419 423 420 // Expressions used to get data 424 421 Expression ch1 = Dynamic.column(VirtualColumn.channel(1)); … … 504 501 throw new BaseException(e); 505 502 } 503 return child; 506 504 } 507 505 508 506 /** 509 Normalise the source bioassay set using MEDIAN-RATIO normalization. 507 Normalise the source bioassay set using MEDIAN-RATIO normalization. NOTE! 508 This normalization method only works with 2-channel data. 509 510 510 @param dc The DbControl to use for database access 511 511 @param source The source bioassay set that is going to be normalized 512 @param job The job that is doing the normalization, or null 512 513 @param minIntensity All spots which have a lower intensity value in either channel 513 514 will be filtered out … … 519 520 @param progress Progress reporter for the caller to keep track of the plugin's progress. Null is allowed. 520 521 @return The normalized bioassayset 521 @since 2.5 522 */ 523 private void 524 normalize2ch(DbControl dc, BioAssaySet source, SpotBatcher batcher, 525 float minIntensity, float lowExclude, float highExclude, 526 int blockGroupSize, ProgressReporter progress) 527 { 522 @since 2.5; This method was removed in 2.7.0 by accident, added in 2.7.2 again 523 */ 524 public BioAssaySet normalize(DbControl dc, BioAssaySet source, Job job, 525 float minIntensity, float lowExclude, float highExclude, 526 int blockGroupSize, ProgressReporter progress) 527 { 528 if (progress != null) progress.display(0, "Preparing to normalize..."); 529 530 // Create Transformation 531 Transformation t = source.newTransformation(job); 532 t.setName(about.getName()); 533 dc.saveItem(t); 534 535 // Create the normalized bioassay set 536 BioAssaySet child = t.newProduct(null, "new", true); 537 dc.saveItem(child); 538 539 // Batcher for inserting normalized data 540 SpotBatcher batcher = child.getSpotBatcher(); 541 528 542 // Expressions used to get data 529 543 Expression block = Dynamic.rawData("block"); … … 560 574 query.restrict(bioAssayRestriction); 561 575 query.order(Orders.asc(block)); 562 576 563 577 // Normalize one bioassay at a time 564 578 List<BioAssay> assays = source.getBioAssays().list(dc); … … 568 582 { 569 583 checkInterrupted(); 570 584 571 585 // Prepare list for holding data 572 586 int assaySpots = assay.getNumSpots(); … … 650 664 fromBlock = toBlock + 1; 651 665 } 652 batcher.flush();653 }666 } 667 batcher.flush(); 654 668 batcher.close(); 655 669 } … … 658 672 throw new BaseException(e); 659 673 } 674 return child; 660 675 } 661 676
Note: See TracChangeset
for help on using the changeset viewer.