Changeset 4246
- Timestamp:
- Apr 24, 2008, 11:39:07 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/test/roles/index.html
r4025 r4246 1606 1606 <th>Raw bioassay</th> 1607 1607 <th>Raw data file</th> 1608 <th>Spots inserted </th>1608 <th>Spots inserted/with null reporter/skipped)</th> 1609 1609 <th>Annotations created</th> 1610 1610 </tr> … … 1612 1612 <td>Raw bioassay A.00h</td> 1613 1613 <td>genepix.mouse.v4.37k.00h.gpr</td> 1614 <td>36, 232</td>1614 <td>36,864/632/768</td> 1615 1615 <td><i>Dye swap</i>: false</td> 1616 1616 </tr> … … 1618 1618 <td>Raw bioassay A.24h</td> 1619 1619 <td>genepix.mouse.v4.37k.24h.gpr</td> 1620 <td>36, 232</td>1620 <td>36,864/632/768</td> 1621 1621 <td><i>Dye swap</i>: false</td> 1622 1622 </tr> … … 1624 1624 <td>Raw bioassay A.00h (dye-swap)</td> 1625 1625 <td>genepix.mouse.v4.37k.00h.dyeswap.gpr</td> 1626 <td>36, 232</td>1626 <td>36,864/632/768</td> 1627 1627 <td><i>Dye swap</i>: true</td> 1628 1628 </tr> … … 1630 1630 <td>Raw bioassay A.24h (dye-swap)</td> 1631 1631 <td>genepix.mouse.v4.37k.24h.dyeswap.gpr</td> 1632 <td>36, 232</td>1632 <td>36,864/632/768</td> 1633 1633 <td><i>Dye swap</i>: true</td> 1634 1634 </tr> … … 1751 1751 <td>Filtered bioassay set</td> 1752 1752 <td>All intensities > 0</td> 1753 <td>ch(1) > 0 && ch(2) > 0 </td>1753 <td>ch(1) > 0 && ch(2) > 0 && rep('id') != null</td> 1754 1754 </tr> 1755 1755 </table> 1756 1756 Wait for the plug-in to finish. It should report that 136,498 spots remain and 1757 that 8,430spots has been removed.1757 that 10,958 spots has been removed. 1758 1758 <p> 1759 1759 </li> -
trunk/src/core/net/sf/basedb/core/RawDataBatcher.java
r4243 r4246 176 176 private boolean useNullIfReporterNotFound = true; 177 177 178 /** 179 The number of reporters that was not found. 180 */ 181 private int numReportersNotFound = 0; 182 183 /** 184 If inserts that can't find a matching feature should be skipped 185 or generate an error. 186 */ 187 private boolean skipInsertIfMissingFeature = false; 188 189 /** 190 The number of skipped inserts due to missing feature 191 */ 192 private int numSkippedMissingFeature = 0; 193 194 /** 195 If we should always accept inserts when the feature has a NULL 196 reporter. 197 */ 198 private boolean acceptInsertIfNullReporterOnFeature = false; 199 200 /** 201 The number of accepted inserts were the feature had a NULL reporter 202 */ 203 private int numAcceptedWithNullReporterOnFeature = 0; 204 178 205 RawDataBatcher(DbControl dc, RawBioAssay rawBioAssay, FeatureIdentificationMethod fim) 179 206 throws BaseException … … 376 403 Specify if the insert method should use a null reporter if a reporter 377 404 with the given external ID isn't found. This setting only affects raw bioassays that 378 are not connected to an array design. The insert always fails if the reporter 379 doesn't match the array design. 405 are not connected to an array design. 380 406 @param useNull TRUE if the insert should use a null reporter (default), 381 407 FALSE otherwise 408 @see #skipInsertIfMissingFeature(boolean) 382 409 */ 383 410 public void useNullIfReporterNotFound(boolean useNull) … … 385 412 this.useNullIfReporterNotFound = useNull; 386 413 } 414 415 /** 416 Get the number of reporters that was not found. 417 @since 2.7 418 @see #useNullIfReporterNotFound(boolean) 419 */ 420 public int getNumReportersNotFound() 421 { 422 return numReportersNotFound; 423 } 424 425 /** 426 Specify if the insert method should skip the insert if a feature for 427 the spot can't be found. This setting only affects raw bioassays that 428 are connected to an array design. 429 430 @param skip TRUE if the insert should be skipped, FALSE to 431 throw an {@link ItemNotFoundException} (default) 432 @since 2.7 433 @see #useNullIfReporterNotFound(boolean) 434 */ 435 public void skipInsertIfMissingFeature(boolean skip) 436 { 437 this.skipInsertIfMissingFeature = skip; 438 } 439 440 /** 441 Get the number of skipped inserts because of a missing feature. 442 @since 2.7 443 @see #skipInsertIfMissingFeature(boolean) 444 */ 445 public int getNumSkippedMissingFeature() 446 { 447 return numSkippedMissingFeature; 448 } 449 450 /** 451 Specify if inserts always should be accepted if there is a matching 452 feature that has a NULL reporter. This settings only affects raw 453 bioassays that are connected to an array design. 454 <p> 455 NOTE! The inserted data will also reference the NULL reporter. 456 457 @param accept TRUE to always accept the insert, FALSE to throw an 458 {@link ItemNotFoundException} if the insert doesn't specify a NULL 459 reporter (default) 460 @since 2.7 461 */ 462 public void acceptInsertIfNullReporterOnFeature(boolean accept) 463 { 464 this.acceptInsertIfNullReporterOnFeature = accept; 465 } 466 467 /** 468 Get the number of accepted inserts because of features with 469 a NULL reporter. 470 @since 2.7 471 @see #acceptInsertIfNullReporterOnFeature(boolean) 472 */ 473 public int getNumAcceptedWithNullReporterOnFeature() 474 { 475 return numAcceptedWithNullReporterOnFeature; 476 } 387 477 388 478 /** … … 462 552 findReporter.setString("externalId", externalReporterId); 463 553 ReporterData reporter = HibernateUtil.loadData(ReporterData.class, findReporter); 464 if (reporter == null && !useNullIfReporterNotFound)554 if (reporter == null) 465 555 { 466 throw new ItemNotFoundException("Reporter[externalId=" + externalReporterId + "]"); 556 if (useNullIfReporterNotFound) 557 { 558 numReportersNotFound++; 559 } 560 else 561 { 562 throw new ItemNotFoundException("Reporter[externalId=" + externalReporterId + "]"); 563 } 467 564 } 468 565 data.setReporter(reporter); … … 477 574 "] has already been used by another spot."); 478 575 } 479 FeatureData f = preloaded.get(featureId); 480 if (f == null) 481 { 482 throw new ItemNotFoundException("Feature["+ fiMethod.toString() + "=" + featureId + "] doesn't exist on array design"); 483 } 484 ReporterData r = f.getReporter(); 485 if (validateReporterId) 576 FeatureData feature = preloaded.get(featureId); 577 if (feature == null) 578 { 579 numSkippedMissingFeature++; 580 if (skipInsertIfMissingFeature) return; 581 throw new ItemNotFoundException("Feature["+ fiMethod.toString() + 582 "=" + featureId + "] doesn't exist on array design"); 583 } 584 ReporterData reporterOnFeature = feature.getReporter(); 585 if (reporterOnFeature == null && acceptInsertIfNullReporterOnFeature) 586 { 587 numAcceptedWithNullReporterOnFeature++; 588 } 589 else if (validateReporterId) 486 590 { 487 591 // Get the reporter from the feature and verify that it has the same externalId 488 String r Id = r == null ? null : r.getExternalId();489 if (!StringUtil.isEqualOrNull(externalReporterId, r Id, caseInsensitive))592 String reporterIdOnFeature = reporterOnFeature == null ? null : reporterOnFeature.getExternalId(); 593 if (!StringUtil.isEqualOrNull(externalReporterId, reporterIdOnFeature, caseInsensitive)) 490 594 { 491 595 throw new ItemNotFoundException("Reporter mismatch: The feature has reporter '" + 492 r Id+ "' whereas you have given '" + externalReporterId + "'");596 reporterIdOnFeature + "' whereas you have given '" + externalReporterId + "'"); 493 597 } 494 598 } 495 data.setPosition(f .getPosition());496 setPropertyValue(data, "feature", f );497 data.setReporter(r );599 data.setPosition(feature.getPosition()); 600 setPropertyValue(data, "feature", feature); 601 data.setReporter(reporterOnFeature); 498 602 } 499 603 super.insert(data); -
trunk/src/plugins/core/net/sf/basedb/plugins/RawDataFlatFileImporter.java
r4124 r4246 237 237 "This can for example be caused by invalid block and/or spot coordinates or a different reporter. " + 238 238 "If not specified the default error handling is used.\n\n"+ 239 "smart = SKIP lines that have no feature on the array design, " + 240 "ACCEPT lines that has a feature with a NULL reporter, " + 241 "FAIL lines that has a feature with different reporter\n" + 239 242 "skip = Skip the current data line and continue\n"+ 240 243 "fail = Stop with an error message", 241 new StringParameterType(255, null, false, 1, 0, 0,242 Arrays.asList( new String[] { "s kip", "fail"} ))244 new StringParameterType(255, "smart", false, 1, 0, 0, 245 Arrays.asList( new String[] { "smart", "skip", "fail"} )) 243 246 ); 244 247 … … 272 275 273 276 private DbControl dc; 274 private int numInserted;275 277 private FlatFileParser ffp; 276 278 private NumberFormat numberFormat; … … 561 563 562 564 batcher = rawBioAssay.getRawDataBatcher(fiMethod); 563 numInserted = 0;564 565 this.ffp = ffp; 565 566 this.numberFormat = ffp.getDefaultNumberFormat(); … … 573 574 { 574 575 addErrorHandler(ItemNotFoundException.class, new SimpleErrorHandler("skip".equals(method))); 576 boolean isSmart = "smart".equals(method); 577 batcher.skipInsertIfMissingFeature(isSmart); 578 batcher.acceptInsertIfNullReporterOnFeature(isSmart); 575 579 } 576 580 } … … 680 684 raw.setExtended(ep.getName(), ep.parseString(m.getValue(data), numberFormat, nullIfException)); 681 685 } 682 683 686 batcher.insert(raw, externalId, featureId); 684 numInserted++;685 687 } 686 688 … … 700 702 protected String getSuccessMessage(int skippedLines) 701 703 { 702 String skipped = skippedLines > 0 ? "; " + skippedLines + " spot(s) skipped due to errors": ""; 703 return numInserted + " spot(s) inserted" + skipped; 704 StringBuilder msg = new StringBuilder(); 705 msg.append(batcher.getTotalInsertCount()).append(" spot(s) inserted"); 706 int numReportersNotFound = batcher.getNumReportersNotFound(); 707 int numSkippedMissingFeature = batcher.getNumSkippedMissingFeature(); 708 int numAcceptedWithNullReporterOnFeature = batcher.getNumAcceptedWithNullReporterOnFeature(); 709 if (numReportersNotFound > 0) 710 { 711 msg.append("; ").append(numReportersNotFound).append(" spot(s) could not find a reporter"); 712 } 713 if (numAcceptedWithNullReporterOnFeature > 0) 714 { 715 msg.append("; ").append(numAcceptedWithNullReporterOnFeature); 716 msg.append(" spot(s) accepted with null reporter on feature"); 717 } 718 if (numSkippedMissingFeature > 0) 719 { 720 msg.append("; ").append(numSkippedMissingFeature); 721 msg.append(" spot(s) skipped due to missing features"); 722 } 723 if (skippedLines > 0) 724 { 725 msg.append("; ").append(skippedLines).append(" spot(s) skipped due to errors"); 726 } 727 return msg.toString(); 704 728 } 705 729 // ------------------------------------------- -
trunk/src/test/TestArrayDesign.java
r4097 r4246 83 83 "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"ID\"\\t\"Name\".*", "\\t", 3, 4); 84 84 test_import_from_file(id2, "data/test.reportermap.import.txt", 85 "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"ID\"\\t\"Name\".*", 0, 2, 1, 3);85 "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"ID\"\\t\"Name\".*", null, 0, 2, 1, 3); 86 86 test_add_features(id, FeatureIdentificationMethod.COORDINATES, 10); 87 87 test_add_features(id6, FeatureIdentificationMethod.FEATURE_ID, 10); … … 547 547 } 548 548 549 static void test_import_from_file(int arrayDesignId, String filename, String headerRegexp, int blockCol, int rowCol, int colCol, int reporterCol) 549 static void test_import_from_file(int arrayDesignId, String filename, String headerRegexp, 550 String ignoreRegexp, int blockCol, int rowCol, int colCol, int reporterCol) 550 551 { 551 552 if (arrayDesignId == 0) return; … … 564 565 parser.setDataHeaderRegexp(Pattern.compile(headerRegexp)); 565 566 parser.setDataSplitterRegexp(Pattern.compile("\\t")); 567 if (ignoreRegexp != null) 568 { 569 parser.setIgnoreRegexp(Pattern.compile(ignoreRegexp)); 570 } 566 571 parser.setInputStream(FileUtil.getInputStream(new java.io.File(filename)), "ISO-8859-1"); 567 572 parser.parseHeaders(); -
trunk/src/test/TestDirty.java
r3820 r4246 75 75 int arrayDesignId = TestArrayDesign.test_create(Platform.GENERIC, false); 76 76 TestArrayDesign.test_import_from_file(arrayDesignId, "data/test.import.dirty.txt", 77 "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", 0, 2, 1, 4);77 "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", null, 0, 2, 1, 4); 78 78 79 79 int rawBioAssayId = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", 0, 0, 0, arrayDesignId, false); -
trunk/src/test/TestExperiment.java
r4232 r4246 85 85 int arrayDesignId = TestArrayDesign.test_create(Platform.GENERIC, false); 86 86 TestArrayDesign.test_import_from_file(arrayDesignId, "data/test.rawdata.import.txt", 87 "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", 0, 2, 1, 4);87 "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", null, 0, 2, 1, 4); 88 88 89 89 int rbaId1 = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", 0, 0, 0, arrayDesignId, false); -
trunk/src/test/TestRawBioAssay.java
r4232 r4246 58 58 "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", "\\t", 4, 3); 59 59 TestArrayDesign.test_import_from_file(arrayDesignId, "data/test.rawdata.import.txt", 60 "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", 0, 2, 1, 4);60 "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", null, 0, 2, 1, 4); 61 61 int softwareId = TestSoftware.test_create(SystemItems.getId(SoftwareType.FEATURE_EXTRACTION), false); 62 62 int protocolId = TestProtocol.test_create(SystemItems.getId(ProtocolType.FEATURE_EXTRACTION), false); -
trunk/src/test/TestRawDataFlatFileImporter.java
r4097 r4246 46 46 int fileId = TestFile.test_create("data/test.rawdata.import.txt", false, false); 47 47 int arrayDesignId = TestArrayDesign.test_create(Platform.GENERIC, false); 48 TestArrayDesign.test_import_from_file(arrayDesignId, "data/test.rawdata.import.txt", "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", 0, 2, 1, 4); 48 TestArrayDesign.test_import_from_file(arrayDesignId, "data/test.rawdata.import.txt", 49 "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", ".*(EMPTY_WELL|no clone).*", 0, 2, 1, 4); 49 50 int rawBioAssayId = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", 0, 0, 0, arrayDesignId, true); 50 51 … … 191 192 request.setParameterValue("decimalSeparator", "dot"); 192 193 request.setParameterValue("duplicateFeatureError", "skip"); 194 request.setParameterValue("featureMismatchError", "smart"); 193 195 194 196 PluginResponse response = request.invoke(); -
trunk/src/test/TestWebservices.java
r4033 r4246 104 104 int arrayDesignId1 = TestArrayDesign.test_create(Platform.GENERIC, false); 105 105 TestArrayDesign.test_import_from_file(arrayDesignId1, "data/test.rawdata.import.txt", 106 "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", 0, 2, 1, 4);106 "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", null, 0, 2, 1, 4); 107 107 int rawBioAssayId1 = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", 0, 0, 0, arrayDesignId1, false); 108 108 int rawBioAssayId2 = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", 0, 0, 0, arrayDesignId1, false); -
trunk/src/test/net/sf/basedb/test/roles/AnalysisTest.java
r4124 r4246 97 97 "Root bioassay set (" + user + ")", formula); 98 98 BioAssaySet filtered = filterBioAssaySet(experiment, root, 99 "Filtered bioassay set (" + user + ")", "ch(1) > 0 && ch(2) > 0 ");99 "Filtered bioassay set (" + user + ")", "ch(1) > 0 && ch(2) > 0 && rep('id') != null"); 100 100 101 101 BioAssaySet normalized = normalizeBioAssaySet(experiment, filtered, -
trunk/src/test/net/sf/basedb/test/roles/UserTest.java
r4124 r4246 372 372 job.setParameterValue("rawBioAssay", 373 373 new ItemParameterType<RawBioAssay>(RawBioAssay.class, null), rba); 374 job.setParameterValue("missingReporterError", new StringParameterType(), " skip");375 job.setParameterValue("featureMismatchError", new StringParameterType(), "s kip");374 job.setParameterValue("missingReporterError", new StringParameterType(), "null"); 375 job.setParameterValue("featureMismatchError", new StringParameterType(), "smart"); 376 376 dc.saveItem(job); 377 377 dc.commit();
Note: See TracChangeset
for help on using the changeset viewer.