Changeset 5144
- Timestamp:
- Oct 20, 2009, 8:21:22 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/test/roles/index.html
r5091 r5144 481 481 482 482 <li> 483 Create protocols: 484 <table class="listing" cellspacing="0" cellpadding="2" border="0"> 485 <tr> 486 <th>Name</th> 487 <th>Type</th> 488 </tr> 489 <tr> 490 <td>Sampling A</td> 491 <td>Sampling</td> 492 </tr> 493 <tr> 494 <td>Extraction A</td> 495 <td>Extraction</td> 496 </tr> 497 <tr> 498 <td>Labeling A</td> 499 <td>Labeling</td> 500 </tr> 501 <tr> 502 <td>Hybridization A</td> 503 <td>Hybridization</td> 504 </tr> 505 <tr> 506 <td>Scanning A</td> 507 <td>Scanning</td> 508 </tr> 509 <tr> 510 <td>Feature extraction A</td> 511 <td>Feature extraction</td> 512 </tr> 513 <tr> 514 <td>Printing A</td> 515 <td>Printing</td> 516 </tr> 517 </table> 518 <p> 519 </li> 520 521 <li> 522 Create hardware: 523 <table class="listing" cellspacing="0" cellpadding="2" border="0"> 524 <tr> 525 <th>Name</th> 526 <th>Type</th> 527 </tr> 528 <tr> 529 <td>Hybridization station A</td> 530 <td>Hybridization station</td> 531 </tr> 532 <tr> 533 <td>Scanner A</td> 534 <td>Scanner</td> 535 </tr> 536 <tr> 537 <td>Print robot A</td> 538 <td>Print robot</td> 539 </tr> 540 </table> 541 <p> 542 </li> 543 544 <li> 545 Create software: 546 <table class="listing" cellspacing="0" cellpadding="2" border="0"> 547 <tr> 548 <th>Name</th> 549 <th>Type</th> 550 </tr> 551 <tr> 552 <td>Software A</td> 553 <td>Feature extraction</td> 554 </tr> 555 </table> 556 <p> 557 </li> 558 559 <li> 560 Create annotation types: 483 Create annotation types [A] and protocol parameters [P]: 561 484 <table class="listing" cellspacing="0" cellpadding="2" border="0"> 562 485 <tr> … … 569 492 </tr> 570 493 <tr> 571 <td>Drug resistance </td>494 <td>Drug resistance [A]</td> 572 495 <td>String</td> 573 496 <td>-</td> … … 577 500 </tr> 578 501 <tr> 579 <td>Time </td>502 <td>Time [A]</td> 580 503 <td>Integer</td> 581 504 <td>Hour</td> … … 585 508 </tr> 586 509 <tr> 587 <td>Dye swap </td>510 <td>Dye swap [A]</td> 588 511 <td>Boolean</td> 589 512 <td>-</td> … … 592 515 <td>Raw bioassay</td> 593 516 </tr> 594 </table> 595 <p> 596 517 <tr> 518 <td>PMT gain [P]</td> 519 <td>Float</td> 520 <td>Volt (Electric potential)</td> 521 <td>-</td> 522 <td>-</td> 523 <td>Scan</td> 524 </tr> 525 </table> 526 <p> 527 </li> 528 529 <li> 530 Create protocols: 531 <table class="listing" cellspacing="0" cellpadding="2" border="0"> 532 <tr> 533 <th>Name</th> 534 <th>Type</th> 535 <th>Comment</th> 536 </tr> 537 <tr> 538 <td>Sampling A</td> 539 <td>Sampling</td> 540 </tr> 541 <tr> 542 <td>Extraction A</td> 543 <td>Extraction</td> 544 </tr> 545 <tr> 546 <td>Labeling A</td> 547 <td>Labeling</td> 548 </tr> 549 <tr> 550 <td>Hybridization A</td> 551 <td>Hybridization</td> 552 </tr> 553 <tr> 554 <td>Scanning A</td> 555 <td>Scanning</td> 556 <td>Select 'PMT gain' as a protocol parameter.</td> 557 </tr> 558 <tr> 559 <td>Feature extraction A</td> 560 <td>Feature extraction</td> 561 </tr> 562 <tr> 563 <td>Printing A</td> 564 <td>Printing</td> 565 </tr> 566 </table> 567 <p> 568 </li> 569 570 <li> 571 Create hardware: 572 <table class="listing" cellspacing="0" cellpadding="2" border="0"> 573 <tr> 574 <th>Name</th> 575 <th>Type</th> 576 </tr> 577 <tr> 578 <td>Hybridization station A</td> 579 <td>Hybridization station</td> 580 </tr> 581 <tr> 582 <td>Scanner A</td> 583 <td>Scanner</td> 584 </tr> 585 <tr> 586 <td>Print robot A</td> 587 <td>Print robot</td> 588 </tr> 589 </table> 590 <p> 591 </li> 592 593 <li> 594 Create software: 595 <table class="listing" cellspacing="0" cellpadding="2" border="0"> 596 <tr> 597 <th>Name</th> 598 <th>Type</th> 599 </tr> 600 <tr> 601 <td>Software A</td> 602 <td>Feature extraction</td> 603 </tr> 604 </table> 605 <p> 606 </li> 607 597 608 <li> 598 609 Create file formats (<i>i.e.</i>, plug-in configurations). The formats marked as … … 1332 1343 </tr> 1333 1344 </table> 1334 The files listed for biosource and samples also contains annotations1345 The files listed for biosource, samples and scans also contains annotations 1335 1346 for the items and these files should also be used with the annotation importer. 1336 1347 The procedure is the same as for batch importers except that only <code>\Name\</code> … … 1573 1584 <th>Scanner</th> 1574 1585 <th>Protocol</th> 1586 <th>PMT gain</th> 1575 1587 </tr> 1576 1588 <tr> … … 1579 1591 <td>Scanner A</td> 1580 1592 <td>Scanning A</td> 1593 <td>400 V</td> 1581 1594 </tr> 1582 1595 <tr> … … 1585 1598 <td>Scanner A</td> 1586 1599 <td>Scanning A</td> 1600 <td>500 V</td> 1587 1601 </tr> 1588 1602 <tr class="shaded"> … … 1591 1605 <td>Scanner A</td> 1592 1606 <td>Scanning A</td> 1607 <td>600 V</td> 1593 1608 </tr> 1594 1609 <tr class="shaded"> … … 1597 1612 <td>Scanner A</td> 1598 1613 <td>Scanning A</td> 1614 <td>700 V</td> 1599 1615 </tr> 1600 1616 <tr> … … 1603 1619 <td>Scanner A</td> 1604 1620 <td>Scanning A</td> 1621 <td>800 V</td> 1605 1622 </tr> 1606 1623 <tr> … … 1609 1626 <td>Scanner A</td> 1610 1627 <td>Scanning A</td> 1628 <td>900 V</td> 1611 1629 </tr> 1612 1630 <tr> … … 1615 1633 <td>Scanner A</td> 1616 1634 <td>Scanning A</td> 1635 <td>1000 V</td> 1617 1636 </tr> 1618 1637 </table> … … 1744 1763 <td>Raw bioassay A.00h,<br>Raw bioassay A.24h,<br>Raw bioassay A.00h (dye-swap),<br> 1745 1764 Raw bioassay A.24h (dye-swap)</td> 1746 <td>Drug resistance, Time, Dye swap </td>1765 <td>Drug resistance, Time, Dye swap, PMT gain</td> 1747 1766 </tr> 1748 1767 <tr> … … 1750 1769 <td>Affymetrix</td> 1751 1770 <td>Affymetrix raw A.1,<br>Affymetrix raw A.2,<br>Affymetrix raw A.3</td> 1752 <td>Drug resistance, Time </td>1771 <td>Drug resistance, Time, PMT gain</td> 1753 1772 </tr> 1754 1773 </table> … … 1757 1776 1758 1777 <li><a name="inheritannotations"></a> 1759 Inherit the annotations from the s amples and biosource for each raw bioassay.1778 Inherit the annotations from the scans, samples and biosource for each raw bioassay. 1760 1779 Use the <i>auto-inherit</i> function that exists on the experiment properties 1761 1780 tab. The <i>Status</i> column in <i>Experimental factors</i> table should indicate -
trunk/src/test/net/sf/basedb/test/roles/PowerUserTest.java
r4628 r5144 72 72 <ol> 73 73 <li>Create a project {@link #createProject(DbControl, String)} and activate it 74 <li>Create several protocols: {@link #createProtocol(DbControl, String, String )}74 <li>Create several protocols: {@link #createProtocol(DbControl, String, String, AnnotationType[])} 75 75 <li>Create hardware: {@link #createHardware(DbControl, String, String)} 76 76 <li>Create software: {@link #createSoftware(DbControl, String, String)} … … 111 111 TestUtil.getSessionControl().setActiveProject(p); 112 112 113 // Protocols, hardware and software 114 dc = TestUtil.getDbControl(); 115 Protocol sampling = createProtocol(dc, "Sampling A", ProtocolType.SAMPLING); 116 Protocol extraction = createProtocol(dc, "Extraction A", ProtocolType.EXTRACTION); 117 Protocol labeling = createProtocol(dc, "Labeling A", ProtocolType.LABELING); 118 Protocol hybridization = createProtocol(dc, "Hybridization A", ProtocolType.HYBRIDIZATION); 119 Protocol scanning = createProtocol(dc, "Scanning A", ProtocolType.SCANNING); 120 Protocol feature = createProtocol(dc, "Feature extraction A", ProtocolType.FEATURE_EXTRACTION); 121 Protocol printing = createProtocol(dc, "Printing A", ProtocolType.PRINTING); 122 123 Hardware hybStation = createHardware(dc, "Hybridization station A", HardwareType.HYBRIDIZATION_STATION); 124 Hardware robot = createHardware(dc, "Print robot A", HardwareType.PRINT_ROBOT); 125 Hardware scanner = createHardware(dc, "Scanner A", HardwareType.SCANNER); 126 Software software = createSoftware(dc, "Software A", SoftwareType.FEATURE_EXTRACTION); 127 113 dc = TestUtil.getDbControl(); 114 // Annotation types 128 115 AnnotationType drugResistance = createAnnotationType(dc, "Drug resistance", 129 116 Type.STRING, null, … … 143 130 new Item[] { Item.RAWBIOASSAY } 144 131 ); 132 133 Quantity potential = Quantity.getById(dc, SystemItems.getId(Quantity.POTENTIAL)); 134 Unit volt = potential.getUnit("V"); 135 AnnotationType pmtGain = createProtocolParameter(dc, "PMT gain", 136 Type.FLOAT, volt, null, new Item[] { Item.SCAN } 137 ); 138 139 // Protocols, hardware and software 140 Protocol sampling = createProtocol(dc, "Sampling A", ProtocolType.SAMPLING); 141 Protocol extraction = createProtocol(dc, "Extraction A", ProtocolType.EXTRACTION); 142 Protocol labeling = createProtocol(dc, "Labeling A", ProtocolType.LABELING); 143 Protocol hybridization = createProtocol(dc, "Hybridization A", ProtocolType.HYBRIDIZATION); 144 Protocol scanning = createProtocol(dc, "Scanning A", ProtocolType.SCANNING, pmtGain); 145 Protocol feature = createProtocol(dc, "Feature extraction A", ProtocolType.FEATURE_EXTRACTION); 146 Protocol printing = createProtocol(dc, "Printing A", ProtocolType.PRINTING); 147 148 Hardware hybStation = createHardware(dc, "Hybridization station A", HardwareType.HYBRIDIZATION_STATION); 149 Hardware robot = createHardware(dc, "Print robot A", HardwareType.PRINT_ROBOT); 150 Hardware scanner = createHardware(dc, "Scanner A", HardwareType.SCANNER); 151 Software software = createSoftware(dc, "Software A", SoftwareType.FEATURE_EXTRACTION); 145 152 146 153 PlateType plateType = createPlateType(dc, "Plate type A", 16, 24); … … 283 290 Create a protocol. 284 291 */ 285 public static Protocol createProtocol(DbControl dc, String name, String type )292 public static Protocol createProtocol(DbControl dc, String name, String type, AnnotationType... parameters) 286 293 { 287 294 TestUtil.write("--Creating protocol: " + name + "\n"); … … 289 296 Protocol p = Protocol.getNew(dc, pt); 290 297 p.setName(name); 298 if (parameters != null) 299 { 300 for (AnnotationType pp : parameters) 301 { 302 p.addParameter(pp); 303 } 304 } 291 305 dc.saveItem(p); 292 306 return p; … … 347 361 } 348 362 363 /** 364 Create a protocol parameter. 365 */ 366 public static AnnotationType createProtocolParameter(DbControl dc, String name, 367 Type type, Unit unit, Object[] values, Item[] items) 368 { 369 TestUtil.write("--Creating protocol parameter: " + name + "\n"); 370 371 AnnotationType at = createAnnotationType(dc, name, type, unit, values, items); 372 at.setProtocolParameter(true); 373 return at; 374 } 375 376 349 377 /** 350 378 Create a plate type. -
trunk/src/test/net/sf/basedb/test/roles/UserTest.java
r5000 r5144 145 145 Quantity time = Quantity.getById(dc, SystemItems.getId(Quantity.TIME)); 146 146 Unit hoursUnit = time.getUnit("hour"); 147 Quantity potential = Quantity.getById(dc, SystemItems.getId(Quantity.POTENTIAL)); 148 Unit volt = potential.getUnit("V"); 149 147 150 Platform genericPlatform = Platform.getByExternalId(dc, Platform.GENERIC); 148 151 Platform affymetrixPlatform = Platform.getByExternalId(dc, Platform.AFFYMETRIX); … … 165 168 Sample sRef = null; 166 169 170 Scan sc1 = null; 171 Scan sc2 = null; 172 Scan sc1DyeSwap = null; 173 Scan sc2DyeSwap = null; 174 Scan affyScan1 = null; 175 Scan affyScan2 = null; 176 Scan affyScan3 = null; 177 167 178 RawBioAssay rba1 = null; 168 179 RawBioAssay rba2 = null; … … 220 231 Hybridization affyHyb3 = createHybridization(dc, "Affymetrix hyb A.3", "Affymetrix slide A.3", leRef); 221 232 222 Scan sc1 = createScan(dc, "Scan A.00h", h1);223 Scan sc2 = createScan(dc, "Scan A.24h", h2);224 Scan sc1DyeSwap = createScan(dc, "Scan A.00h (dye-swap)", h1DyeSwap);225 Scan sc2DyeSwap = createScan(dc, "Scan A.24h (dye-swap)", h2DyeSwap);233 sc1 = createScan(dc, "Scan A.00h", h1, 400f, volt); 234 sc2 = createScan(dc, "Scan A.24h", h2, 500f, volt); 235 sc1DyeSwap = createScan(dc, "Scan A.00h (dye-swap)", h1DyeSwap, 600f, volt); 236 sc2DyeSwap = createScan(dc, "Scan A.24h (dye-swap)", h2DyeSwap, 700f, volt); 226 237 227 238 // Affymetrix 228 Scan affyScan1 = createScan(dc, "Affymetrix scan A.1", affyHyb1);229 Scan affyScan2 = createScan(dc, "Affymetrix scan A.2", affyHyb2);230 Scan affyScan3 = createScan(dc, "Affymetrix scan A.3", affyHyb3);239 affyScan1 = createScan(dc, "Affymetrix scan A.1", affyHyb1, 800f, volt); 240 affyScan2 = createScan(dc, "Affymetrix scan A.2", affyHyb2, 900f, volt); 241 affyScan3 = createScan(dc, "Affymetrix scan A.3", affyHyb3, 1000f, volt); 231 242 232 243 // Raw bioassays … … 266 277 importHybridizations(hybridizationBatchImporter, batchImportFile_Hybridization); 267 278 importScans(scanBatchImporter, batchImportFile_Scan); 279 importAnnotations(annotationImporter, batchImportFile_Scan, Item.SCAN, getScanColumnHeaders(), "\\t"); 268 280 importRawBioAssays(rawBioAssayBatchImporter, batchImportFile_RawBioAssay); 269 281 bioSource = Util.findBioSource(dc, "Biosource A"); … … 272 284 sRef = Util.findSample(dc, "Sample A.ref"); 273 285 286 sc1 = Util.findScan(dc, "Scan A.00h"); 287 sc2 = Util.findScan(dc, "Scan A.24h"); 288 sc1DyeSwap = Util.findScan(dc, "Scan A.00h (dye-swap)"); 289 sc2DyeSwap = Util.findScan(dc, "Scan A.24h (dye-swap)"); 290 affyScan1 = Util.findScan(dc, "Affymetrix scan A.1"); 291 affyScan2 = Util.findScan(dc, "Affymetrix scan A.2"); 292 affyScan3 = Util.findScan(dc, "Affymetrix scan A.3"); 274 293 dc.close(); 275 294 } … … 282 301 affyRaw2 = Util.findRawBioAssay(dc, "Affymetrix raw A.2"); 283 302 affyRaw3 = Util.findRawBioAssay(dc, "Affymetrix raw A.3"); 284 inheritAnnotations(dc, rba1, s1, bioSource );285 inheritAnnotations(dc, rba2, s2, bioSource );286 inheritAnnotations(dc, rba1DyeSwap, s1, bioSource );287 inheritAnnotations(dc, rba2DyeSwap, s2, bioSource );303 inheritAnnotations(dc, rba1, s1, bioSource, sc1); 304 inheritAnnotations(dc, rba2, s2, bioSource, sc2); 305 inheritAnnotations(dc, rba1DyeSwap, s1, bioSource, sc1DyeSwap); 306 inheritAnnotations(dc, rba2DyeSwap, s2, bioSource, sc2DyeSwap); 288 307 289 308 // Affymetrix 290 inheritAnnotations(dc, affyRaw1, s1, bioSource );291 inheritAnnotations(dc, affyRaw2, s2, bioSource );292 inheritAnnotations(dc, affyRaw3, sRef );309 inheritAnnotations(dc, affyRaw1, s1, bioSource, affyScan1); 310 inheritAnnotations(dc, affyRaw2, s2, bioSource, affyScan2); 311 inheritAnnotations(dc, affyRaw3, sRef, affyScan3); 293 312 294 313 PluginConfiguration rawDataImporter = Util.findPluginConfiguration(dc, "Raw data for project A"); … … 436 455 Create a scan. 437 456 */ 438 public static Scan createScan(DbControl dc, String name, Hybridization hyb )457 public static Scan createScan(DbControl dc, String name, Hybridization hyb, Float pmtGain, Unit unit) 439 458 { 440 459 TestUtil.write("--Creating scan: " + name + "\n"); … … 444 463 scan.setScanner(Util.findHardware(dc, "Scanner A")); 445 464 dc.saveItem(scan); 465 466 if (pmtGain != null) 467 { 468 AnnotationType at = Util.findAnnotationType(dc, "PMT gain", Item.SCAN); 469 Util.setAnnotation(scan, at, pmtGain, unit); 470 } 471 446 472 return scan; 447 473 } … … 590 616 job.setParameterValue("dataSplitterRegexp", new StringParameterType(), "\\t"); 591 617 job.setParameterValue("dataHeaderRegexp", new StringParameterType(), 592 "Name\\tHybridization\\tDescription\\tProtocol\\tScanner ");618 "Name\\tHybridization\\tDescription\\tProtocol\\tScanner\\tPMT gain"); 593 619 594 620 job.setParameterValue("nameColumnMapping", new StringParameterType(), "\\Name\\"); … … 853 879 return new String[] {"Name", "Original quantity", "Description", "External id", "Created", "Pooled", "Biosource", "Protocol", "Bioplate", "Biowell row", "Biowell column", "Time"}; 854 880 } 881 882 private static String[] getScanColumnHeaders() 883 { 884 return new String[] {"Name", "Hybridization", "Description", "Protocol", "Scanner", "PMT gain"}; 885 } 886 855 887 } -
trunk/src/test/net/sf/basedb/test/roles/Util.java
r4917 r5144 52 52 import net.sf.basedb.core.Role; 53 53 import net.sf.basedb.core.Sample; 54 import net.sf.basedb.core.Scan; 54 55 import net.sf.basedb.core.Software; 55 56 import net.sf.basedb.core.Unit; … … 303 304 return query.list(dc).get(0); 304 305 } 306 307 /** 308 Returns the first scan that was found with a certain name 309 */ 310 public static Scan findScan(DbControl dc, String name) 311 { 312 ItemQuery<Scan> query = Scan.getQuery(); 313 query.restrict(Restrictions.eq(Hql.property("name"), Expressions.string(name))); 314 return query.list(dc).get(0); 315 } 316 305 317 }
Note: See TracChangeset
for help on using the changeset viewer.