Changeset 5144


Ignore:
Timestamp:
Oct 20, 2009, 8:21:22 AM (12 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #1406: Add a protocol parameter in the 'roles' test case

Added 'PMT gain' as a protocol parameter to the scanning protocol.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/test/roles/index.html

    r5091 r5144  
    481481 
    482482  <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]:
    561484    <table class="listing" cellspacing="0" cellpadding="2" border="0">
    562485    <tr>
     
    569492    </tr>
    570493    <tr>
    571       <td>Drug resistance</td>
     494      <td>Drug resistance [A]</td>
    572495      <td>String</td>
    573496      <td>-</td>
     
    577500    </tr>
    578501    <tr>
    579       <td>Time</td>
     502      <td>Time [A]</td>
    580503      <td>Integer</td>
    581504      <td>Hour</td>
     
    585508    </tr>
    586509    <tr>
    587       <td>Dye swap</td>
     510      <td>Dye swap [A]</td>
    588511      <td>Boolean</td>
    589512      <td>-</td>
     
    592515      <td>Raw bioassay</td>
    593516    </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 
    597608  <li>
    598609    Create file formats (<i>i.e.</i>, plug-in configurations). The formats marked as
     
    13321343      </tr>
    13331344      </table>
    1334       The files listed for biosource and samples also contains annotations
     1345      The files listed for biosource, samples and scans also contains annotations
    13351346      for the items and these files should also be used with the annotation importer.
    13361347      The procedure is the same as for batch importers except that only <code>\Name\</code>
     
    15731584      <th>Scanner</th>
    15741585      <th>Protocol</th>
     1586      <th>PMT gain</th>
    15751587    </tr>
    15761588    <tr>
     
    15791591      <td>Scanner A</td>
    15801592      <td>Scanning A</td>
     1593      <td>400 V</td>
    15811594    </tr>
    15821595    <tr>
     
    15851598      <td>Scanner A</td>
    15861599      <td>Scanning A</td>
     1600      <td>500 V</td>
    15871601    </tr>
    15881602    <tr class="shaded">
     
    15911605      <td>Scanner A</td>
    15921606      <td>Scanning A</td>
     1607      <td>600 V</td>
    15931608    </tr>
    15941609    <tr class="shaded">
     
    15971612      <td>Scanner A</td>
    15981613      <td>Scanning A</td>
     1614      <td>700 V</td>
    15991615    </tr>
    16001616    <tr>
     
    16031619      <td>Scanner A</td>
    16041620      <td>Scanning A</td>
     1621      <td>800 V</td>
    16051622    </tr>
    16061623    <tr>
     
    16091626      <td>Scanner A</td>
    16101627      <td>Scanning A</td>
     1628      <td>900 V</td>
    16111629    </tr>
    16121630    <tr>
     
    16151633      <td>Scanner A</td>
    16161634      <td>Scanning A</td>
     1635      <td>1000 V</td>
    16171636    </tr>
    16181637    </table>
     
    17441763      <td>Raw bioassay A.00h,<br>Raw bioassay A.24h,<br>Raw bioassay A.00h (dye-swap),<br>
    17451764        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>
    17471766    </tr>
    17481767    <tr>
     
    17501769      <td>Affymetrix</td>
    17511770      <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>
    17531772    </tr>
    17541773    </table>
     
    17571776 
    17581777  <li><a name="inheritannotations"></a>
    1759     Inherit the annotations from the samples and biosource for each raw bioassay.
     1778    Inherit the annotations from the scans, samples and biosource for each raw bioassay.
    17601779    Use the <i>auto-inherit</i> function that exists on the experiment properties
    17611780    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  
    7272  <ol>
    7373  <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[])}
    7575  <li>Create hardware: {@link #createHardware(DbControl, String, String)}
    7676  <li>Create software: {@link #createSoftware(DbControl, String, String)}
     
    111111      TestUtil.getSessionControl().setActiveProject(p);
    112112     
    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
    128115      AnnotationType drugResistance = createAnnotationType(dc, "Drug resistance",
    129116          Type.STRING, null,
     
    143130          new Item[] { Item.RAWBIOASSAY }
    144131        );
     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);
    145152     
    146153      PlateType plateType = createPlateType(dc, "Plate type A", 16, 24);
     
    283290    Create a protocol.
    284291  */
    285   public static Protocol createProtocol(DbControl dc, String name, String type)
     292  public static Protocol createProtocol(DbControl dc, String name, String type, AnnotationType... parameters)
    286293  {
    287294    TestUtil.write("--Creating protocol: " + name + "\n");
     
    289296    Protocol p = Protocol.getNew(dc, pt);
    290297    p.setName(name);
     298    if (parameters != null)
     299    {
     300      for (AnnotationType pp : parameters)
     301      {
     302        p.addParameter(pp);
     303      }
     304    }
    291305    dc.saveItem(p);
    292306    return p;
     
    347361  }
    348362
     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 
    349377  /**
    350378    Create a plate type.
  • trunk/src/test/net/sf/basedb/test/roles/UserTest.java

    r5000 r5144  
    145145      Quantity time = Quantity.getById(dc, SystemItems.getId(Quantity.TIME));
    146146      Unit hoursUnit = time.getUnit("hour");
     147      Quantity potential = Quantity.getById(dc, SystemItems.getId(Quantity.POTENTIAL));
     148      Unit volt = potential.getUnit("V");
     149
    147150      Platform genericPlatform = Platform.getByExternalId(dc, Platform.GENERIC);
    148151      Platform affymetrixPlatform = Platform.getByExternalId(dc, Platform.AFFYMETRIX);
     
    165168      Sample sRef = null;
    166169     
     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
    167178      RawBioAssay rba1 = null;
    168179      RawBioAssay rba2 = null;
     
    220231        Hybridization affyHyb3 = createHybridization(dc, "Affymetrix hyb A.3", "Affymetrix slide A.3", leRef);
    221232       
    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);
    226237 
    227238        // 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);
    231242   
    232243        // Raw bioassays
     
    266277        importHybridizations(hybridizationBatchImporter, batchImportFile_Hybridization);     
    267278        importScans(scanBatchImporter, batchImportFile_Scan);
     279        importAnnotations(annotationImporter, batchImportFile_Scan, Item.SCAN, getScanColumnHeaders(), "\\t");
    268280        importRawBioAssays(rawBioAssayBatchImporter, batchImportFile_RawBioAssay);
    269281        bioSource = Util.findBioSource(dc, "Biosource A");
     
    272284        sRef = Util.findSample(dc, "Sample A.ref");
    273285       
     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");
    274293        dc.close();
    275294      }
     
    282301      affyRaw2 = Util.findRawBioAssay(dc, "Affymetrix raw A.2");
    283302      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);
    288307     
    289308      // 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);
    293312     
    294313      PluginConfiguration rawDataImporter = Util.findPluginConfiguration(dc, "Raw data for project A");
     
    436455    Create a scan.
    437456  */
    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)
    439458  {
    440459    TestUtil.write("--Creating scan: " + name + "\n");
     
    444463    scan.setScanner(Util.findHardware(dc, "Scanner A"));
    445464    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
    446472    return scan;
    447473  }
     
    590616      job.setParameterValue("dataSplitterRegexp", new StringParameterType(), "\\t");
    591617      job.setParameterValue("dataHeaderRegexp", new StringParameterType(),
    592           "Name\\tHybridization\\tDescription\\tProtocol\\tScanner");
     618          "Name\\tHybridization\\tDescription\\tProtocol\\tScanner\\tPMT gain");
    593619     
    594620      job.setParameterValue("nameColumnMapping", new StringParameterType(), "\\Name\\");
     
    853879    return new String[] {"Name", "Original quantity", "Description", "External id", "Created", "Pooled", "Biosource", "Protocol", "Bioplate", "Biowell row", "Biowell column", "Time"};
    854880  }
     881 
     882  private static String[] getScanColumnHeaders()
     883  {
     884    return new String[] {"Name", "Hybridization", "Description", "Protocol", "Scanner", "PMT gain"};
     885  }
     886
    855887}
  • trunk/src/test/net/sf/basedb/test/roles/Util.java

    r4917 r5144  
    5252import net.sf.basedb.core.Role;
    5353import net.sf.basedb.core.Sample;
     54import net.sf.basedb.core.Scan;
    5455import net.sf.basedb.core.Software;
    5556import net.sf.basedb.core.Unit;
     
    303304    return query.list(dc).get(0);
    304305  }
     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
    305317}
Note: See TracChangeset for help on using the changeset viewer.