Changeset 6958


Ignore:
Timestamp:
Sep 30, 2015, 2:55:14 PM (6 years ago)
Author:
Nicklas Nordborg
Message:

References #1941: Store experimental factor values as part experiments

Updated test program to set experimental factor values on root raw bioassays instead of raw bioassays.

Noted that the "Item overview validation" now complains about missing experimental factors, probably because it has not been updated and still check the raw bioassays and not the root raw bioassays.

Location:
trunk
Files:
4 edited

Legend:

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

    r6124 r6958  
    21272127  </li>
    21282128 
    2129   <li><a name="inheritannotations"></a>
    2130     Inherit the annotations from the scans, extracts, samples and biosource for each raw bioassay.
    2131     Use the <i>auto-inherit</i> function that exists on the experiment properties
    2132     tab. Make sure that all experimental factors are selected by the check boxes,
    2133     then click on the <i>Auto-inherit</i> link in the column header. <br>
    2134     <b>Note!</b> The <i>Dye swap</i>
    2135     annotation will not get values until the next step, and the <i>Affymetrix raw A.3</i>
    2136     data set is missing biomaterial parents with annotations.<br>
    2137     <b>Note 2!</b> In <i>Experiment A</i> there are duplicate values for the <i>RIN</i>
    2138     annotations. Fix this by manually removing the annotations that are inherited from
    2139     the <i>Extract A.ref.qc</i> extract.
    2140     <p>
    2141 
    2142   </li>
    2143  
    21442129  <li>
    21452130    Import raw data to the Genepix and Cufflinks raw bioassays.
     
    22422227   
    22432228  </li>
     2229 
     2230  <li><a name="inheritannotations"></a>
     2231    Inherit the annotations from the scans, extracts, samples and biosource for each root raw bioassay.
     2232    Use the <i>auto-inherit</i> function that exists on the experiment properties
     2233    tab. Make sure that all experimental factors are selected by the check boxes,
     2234    then click on the <i>Auto-inherit</i> link in the column header. Use the <b>Inherit</b>
     2235    option for some annotations and <b>Clone</b> option for some. Uncheck the <b>No duplicates</b>
     2236    option for the <i>RIN</i> annotation (see note 2 below).
     2237    <br>
     2238    <b>Note!</b> The <i>Affymetrix raw A.3</i>
     2239    data set is missing biomaterial parents with annotations.<br>
     2240    <b>Note 2!</b> In <i>Experiment A</i> there are duplicate values for the <i>RIN</i>
     2241    annotations. Verify and fix this by manually removing the annotations that are inherited
     2242    from the <i>Extract A.ref.qc</i> extract (value=9.2).
     2243    <p>
     2244
     2245  </li>
     2246 
    22442247 
    22452248  <li>
  • trunk/src/clients/web/net/sf/basedb/clients/web/Base.java

    r6955 r6958  
    14311431      //  oldItem.getAnnotationSet() : null;
    14321432      AnnotationSet newAs = newItem.getAnnotationSet();
    1433       /*if (oldItem == newItem)
     1433      if (oldItem == newItem)
    14341434      {
    14351435        // The items were not loaded in separate sessions, the protocol has to be
     
    14381438        if (p != null) dc.reattachItem(p, false);
    14391439      }
    1440       */
    14411440     
    14421441      for (int entryNo = 0; entryNo < jsonModified.size(); entryNo++)
  • trunk/src/core/net/sf/basedb/core/Experiment.java

    r6915 r6958  
    733733
    734734  /**
     735    Get the root raw bioassay that represents the given raw bioassay
     736    in this experiment.
     737    @return A root raw bioassay object or null if the given
     738      raw bioassay is not part of the experiment
     739    @since 3.6
     740  */
     741  public RootRawBioAssay getRootRawBioAssay(RawBioAssay raw)
     742  {
     743    RootRawBioAssayData root = getData().getRootRawBioAssays().get(raw.getData());
     744    return getDbControl().getItem(RootRawBioAssay.class, root);
     745  }
     746 
     747  /**
    735748    Create a new root transformation for this experiment.
    736749    @param job The job that executed the transformation
  • trunk/src/test/net/sf/basedb/test/roles/UserTest.java

    r6921 r6958  
    2323
    2424import net.sf.basedb.core.Annotatable;
    25 import net.sf.basedb.core.Annotation;
    2625import net.sf.basedb.core.AnnotationSet;
    2726import net.sf.basedb.core.AnnotationType;
     
    5756import net.sf.basedb.core.RawDataType;
    5857import net.sf.basedb.core.RawDataTypes;
     58import net.sf.basedb.core.RootRawBioAssay;
    5959import net.sf.basedb.core.Sample;
    6060import net.sf.basedb.core.Software;
     
    359359      seqRaw2 = Util.findRawBioAssay(dc, "SeqRaw A.24h");
    360360     
    361       inheritAnnotations(dc, rba1, s1, e1Qc, bioSource, sc1);
    362       inheritAnnotations(dc, rba2, s2, e2Qc, bioSource, sc2);
    363       inheritAnnotations(dc, rba1DyeSwap, s1, e1Qc, bioSource, sc1DyeSwap);
    364       inheritAnnotations(dc, rba2DyeSwap, s2, e2Qc, bioSource, sc2DyeSwap);
    365      
    366       // Affymetrix
    367       inheritAnnotations(dc, affyRaw1, s1, e1Qc, bioSource, affyScan1);
    368       inheritAnnotations(dc, affyRaw2, s2, e2Qc, bioSource, affyScan2);
    369       inheritAnnotations(dc, affyRaw3, sRef, eRefQc, affyScan3);
    370      
    371       // Sequence
    372       inheritAnnotations(dc, seqRaw1, s1, e1Qc, bioSource);
    373       inheritAnnotations(dc, seqRaw2, s2, e2Qc, bioSource);
    374      
    375361      PluginConfiguration rawDataImporter = Util.findPluginConfiguration(dc, "Raw data for project A");
    376362      PluginConfiguration rawDataImporterDyeSwap = Util.findPluginConfiguration(dc, "Raw data for project A (dye-swap)");
     
    386372      importRawData(seqRawImporter, seqData1, seqRaw1);
    387373      importRawData(seqRawImporter, seqData2, seqRaw2);
    388  
     374       
    389375      // Experiment
    390376      dc = TestUtil.getDbControl();
    391       Experiment exp1 = createExperiment(dc, "Experiment A",
    392         RawDataTypes.getSafeRawDataType("genepix"), rba1, rba2, rba1DyeSwap, rba2DyeSwap);
    393       Experiment affyExperiment = createExperiment(dc, "Affymetrix A",
    394         affymetrixPlatform.getRawDataType(), affyRaw1, affyRaw2, affyRaw3);
    395       Experiment seqExperiment = createExperiment(dc, "Sequence A",
    396         RawDataTypes.getSafeRawDataType("cufflinks"), seqRaw1, seqRaw2);
     377      AnnotationType drugResistance = Util.findAnnotationType(dc, "Drug resistance", Item.BIOSOURCE);
     378      AnnotationType dyeSwap = Util.findAnnotationType(dc, "Dye swap", Item.RAWBIOASSAY);
     379      AnnotationType pmtGain = Util.findAnnotationType(dc, "PMT gain", Item.DERIVEDBIOASSAY);
     380      AnnotationType rin = Util.findAnnotationType(dc, "RIN", Item.EXTRACT);
     381      AnnotationType timeAnnotation = Util.findAnnotationType(dc, "Time", Item.SAMPLE);
     382     
     383      Experiment exp1 = createExperiment(dc, "Experiment A", RawDataTypes.getSafeRawDataType("genepix"),
     384        rawBioAssays(rba1, rba2, rba1DyeSwap, rba2DyeSwap),
     385        experimentalFactors(drugResistance, dyeSwap, pmtGain, rin, timeAnnotation)
     386        );
     387      Experiment affyExperiment = createExperiment(dc, "Affymetrix A", affymetrixPlatform.getRawDataType(),
     388        rawBioAssays(affyRaw1, affyRaw2, affyRaw3),
     389        experimentalFactors(drugResistance, pmtGain, rin, timeAnnotation)
     390        );
     391      Experiment seqExperiment = createExperiment(dc, "Sequence A", RawDataTypes.getSafeRawDataType("cufflinks"),
     392        rawBioAssays(seqRaw1, seqRaw2),
     393        experimentalFactors(drugResistance, rin, timeAnnotation)
     394        );
     395      dc.commit();
     396     
     397      // Experimental factors
     398      // Experiment A
     399      dc = TestUtil.getDbControl();
     400      inheritExperimentalFactors(dc, exp1, rba1, s1, e1Qc, bioSource, sc1);
     401      inheritExperimentalFactors(dc, exp1, rba2, s2, e2Qc, bioSource, sc2);
     402      inheritExperimentalFactors(dc, exp1, rba1DyeSwap, s1, e1Qc, bioSource, sc1DyeSwap);
     403      inheritExperimentalFactors(dc, exp1, rba2DyeSwap, s2, e2Qc, bioSource, sc2DyeSwap);
     404     
     405      // Affymetrix
     406      inheritExperimentalFactors(dc, affyExperiment, affyRaw1, s1, e1Qc, bioSource, affyScan1);
     407      inheritExperimentalFactors(dc, affyExperiment, affyRaw2, s2, e2Qc, bioSource, affyScan2);
     408      inheritExperimentalFactors(dc, affyExperiment, affyRaw3, sRef, eRefQc, affyScan3);
     409     
     410      // Sequence
     411      inheritExperimentalFactors(dc, seqExperiment, seqRaw1, s1, e1Qc, bioSource);
     412      inheritExperimentalFactors(dc, seqExperiment, seqRaw2, s2, e2Qc, bioSource);
    397413      dc.commit();
    398414     
     
    415431  }
    416432
     433  public static RawBioAssay[] rawBioAssays(RawBioAssay... rba)
     434  {
     435    return rba;
     436  }
     437 
     438  public static AnnotationType[] experimentalFactors(AnnotationType... annotationTypes)
     439  {
     440    return annotationTypes;
     441  }
     442 
    417443  /**
    418444    Create a biosource.
     
    679705 
    680706  /**
    681     Inherit all annotations from the parent.
    682   */
    683   public static void inheritAnnotations(DbControl dc, Annotatable item, Annotatable... parents)
    684   {
    685     AnnotationSet as = item.getAnnotationSet();
     707    Inherit all annotations to the root raw bioassay from the
     708    raw bioassay and other parents.
     709  */
     710  public static void inheritExperimentalFactors(DbControl dc, Experiment experiment, RawBioAssay raw, Annotatable... parents)
     711  {
     712    experiment = Experiment.getById(dc, experiment.getId());
     713    raw = RawBioAssay.getById(dc, raw.getId());
     714    RootRawBioAssay root = experiment.getRootRawBioAssay(raw);
     715    AnnotationSet as = root.getAnnotationSet();
     716    if (raw.isAnnotated()) as.inheritAll(raw.getAnnotationSet(), false);
    686717    for (Annotatable parent : parents)
    687718    {
     
    726757    Create an experiment.
    727758  */
    728   public static Experiment createExperiment(DbControl dc, String name, RawDataType rawDataType, RawBioAssay... rawBioAssays)
     759  public static Experiment createExperiment(DbControl dc, String name, RawDataType rawDataType, RawBioAssay[] rawBioAssays, AnnotationType[] experimentalFactors)
    729760  {
    730761    TestUtil.write("--Creating experiment: " + name + "\n");
     
    732763    experiment.setName(name);
    733764   
    734     for (RawBioAssay rba : rawBioAssays)
    735     {
    736       rba = RawBioAssay.getById(dc, rba.getId()); // To get the latest information
    737       experiment.addRawBioAssay(rba);
    738      
    739       AnnotationSet as = rba.getAnnotationSet();
    740       for (Annotation a : as.getAnnotations(null).list(dc))
     765    if (rawBioAssays != null)
     766    {
     767      for (RawBioAssay rba : rawBioAssays)
    741768      {
    742         experiment.addExperimentalFactor(a.getAnnotationType());
     769        experiment.addRawBioAssay(rba);
     770      }
     771    }
     772   
     773    if (experimentalFactors != null)
     774    {
     775      for (AnnotationType at : experimentalFactors)
     776      {
     777        experiment.addExperimentalFactor(at);
    743778      }
    744779    }
Note: See TracChangeset for help on using the changeset viewer.