Esempio n. 1
0
 // test multiple derived data with no scan , multiple normalizations.
 @Test
 public void testNoScanWithNorm() {
   MageTabDocumentSet ds = getDocumentSet(TestMageTabSets.MULTI_NO_SCAN_2_INPUT_SET);
   CaArrayFileSet fileSet = TestMageTabSets.getFileSet(ds);
   CaArrayTranslationResult result = this.translator.translate(ds, fileSet);
   Experiment experiment = result.getInvestigations().iterator().next();
   Hybridization hyb = experiment.getHybridizations().iterator().next();
   checkPaCollection(hyb.getProtocolApplications(), "Scan");
   RawArrayData rad = hyb.getRawDataCollection().iterator().next();
   checkPaCollection(
       rad.getProtocolApplications(),
       "normalization-protocol-1",
       "normalization-protocol-2",
       "derived-data-protocol-1",
       "derived-data-protocol-2");
   for (DerivedArrayData d : hyb.getDerivedDataCollection()) {
     if (d.getName().equals("test.data")) {
       checkPaCollection(d.getProtocolApplications());
     } else if (d.getName().equals("test2.data")) {
       checkPaCollection(d.getProtocolApplications());
     } else {
       fail(d.getName());
     }
   }
 }
Esempio n. 2
0
 // test normalization protocols end up in raw data.
 @Test
 public void testNormal_3() {
   MageTabDocumentSet ds = getDocumentSet(TestMageTabSets.NORMAL_3_INPUT_SET);
   CaArrayFileSet fileSet = TestMageTabSets.getFileSet(ds);
   CaArrayTranslationResult result = this.translator.translate(ds, fileSet);
   Experiment experiment = result.getInvestigations().iterator().next();
   Hybridization hyb = experiment.getHybridizations().iterator().next();
   RawArrayData rad = hyb.getRawDataCollection().iterator().next();
   checkPaCollection(rad.getProtocolApplications(), "TRANPRTCL10656", "derived-data-protocol");
   DerivedArrayData dad = hyb.getDerivedDataCollection().iterator().next();
   checkPaCollection(dad.getProtocolApplications());
 }
Esempio n. 3
0
 @Test
 public void testNoNormNoDerivedData() {
   MageTabDocumentSet ds = getDocumentSet(TestMageTabSets.NO_DERIVED_2_INPUT_SET);
   CaArrayFileSet fileSet = TestMageTabSets.getFileSet(ds);
   CaArrayTranslationResult result = this.translator.translate(ds, fileSet);
   Experiment experiment = result.getInvestigations().iterator().next();
   Hybridization hyb = experiment.getHybridizations().iterator().next();
   checkPaCollection(hyb.getProtocolApplications(), "Scan");
   RawArrayData rad = hyb.getRawDataCollection().iterator().next();
   checkPaCollection(rad.getProtocolApplications(), "TRANPRTCL10656");
   assertTrue(hyb.getDerivedDataCollection().isEmpty());
 }
Esempio n. 4
0
 /*
  * Tests to make sure that Characteristic categories with various forms of
  * "external id", regardless of spaces and case, get translated into the
  * "externalId" attribute of the biomaterial.
  */
 @Test
 public void testExternalIds() {
   MageTabDocumentSet ds = getDocumentSet(TestMageTabSets.EXTERNAL_ID_1_INPUT_SET);
   CaArrayFileSet fileSet = TestMageTabSets.getFileSet(ds);
   CaArrayTranslationResult result = this.translator.translate(ds, fileSet);
   Experiment experiment = result.getInvestigations().iterator().next();
   Source src = experiment.getSources().iterator().next();
   String sourceExternalId = src.getExternalId();
   assertTrue(SOURCE_1_EXTERNAL_ID.equals(sourceExternalId));
   Sample sampl = experiment.getSamples().iterator().next();
   String sampleExternalId = sampl.getExternalId();
   assertTrue(SAMPLE_1_EXTERNAL_ID.equals(sampleExternalId));
 }
Esempio n. 5
0
 private void mergeFactors(Experiment originalExperiment, Experiment translatedExperiment) {
   for (final Factor translatedFactor : translatedExperiment.getFactors()) {
     boolean isNewFactor = true;
     final Set<Factor> originalFactors = originalExperiment.getFactors();
     for (final Factor originalFactor : originalFactors) {
       if (originalFactor.getName().equals(translatedFactor.getName())) {
         isNewFactor = false;
         for (final AbstractFactorValue newValue : translatedFactor.getFactorValues()) {
           newValue.setFactor(originalFactor);
         }
         break;
       }
     }
     if (isNewFactor) {
       originalFactors.add(translatedFactor);
     }
   }
 }
Esempio n. 6
0
 private void mergeExperimentContacts(
     Experiment originalExperiment, Experiment translatedExperiment) {
   for (final ExperimentContact translatedEc : translatedExperiment.getExperimentContacts()) {
     final List<ExperimentContact> originalExperimentContacts =
         originalExperiment.getExperimentContacts();
     boolean isNewEc = true;
     for (final ExperimentContact originalEc : originalExperimentContacts) {
       if (originalEc.equalsBaseContact(translatedEc)) {
         isNewEc = false;
         break;
       }
     }
     if (isNewEc) {
       translatedEc.setExperiment(originalExperiment);
       originalExperimentContacts.add(translatedEc);
     }
   }
 }
Esempio n. 7
0
 @Test
 public void testNormal_1() {
   MageTabDocumentSet ds = getDocumentSet(TestMageTabSets.NORMAL_1_INPUT_SET);
   CaArrayFileSet fileSet = TestMageTabSets.getFileSet(ds);
   CaArrayTranslationResult result = this.translator.translate(ds, fileSet);
   Experiment experiment = result.getInvestigations().iterator().next();
   Hybridization hyb = experiment.getHybridizations().iterator().next();
   checkPaCollection(hyb.getProtocolApplications(), "Scan");
   for (RawArrayData rad : hyb.getRawDataCollection()) {
     if (rad.getName().equals("test1.CEL")) {
       checkPaCollection(rad.getProtocolApplications());
     } else if (rad.getName().equals("test2.CEL")) {
       checkPaCollection(rad.getProtocolApplications(), "TRANPRTCL10656");
     } else {
       fail(rad.getName());
     }
   }
   DerivedArrayData dad = hyb.getDerivedDataCollection().iterator().next();
   checkPaCollection(dad.getProtocolApplications());
 }
Esempio n. 8
0
  private void mergeTranslatedData(Experiment originalExperiment, Experiment translatedExperiment) {
    originalExperiment.getArrayDesigns().addAll(translatedExperiment.getArrayDesigns());
    originalExperiment.setDate(translatedExperiment.getDate());
    originalExperiment.setDescription(translatedExperiment.getDescription());
    mergeFactors(originalExperiment, translatedExperiment);
    originalExperiment
        .getExperimentDesignTypes()
        .addAll(translatedExperiment.getExperimentDesignTypes());
    originalExperiment.getNormalizationTypes().addAll(translatedExperiment.getNormalizationTypes());
    originalExperiment.getPublications().addAll(translatedExperiment.getPublications());
    originalExperiment
        .getQualityControlTypes()
        .addAll(translatedExperiment.getQualityControlTypes());
    originalExperiment.getReplicateTypes().addAll(translatedExperiment.getReplicateTypes());
    mergeExperimentContacts(originalExperiment, translatedExperiment);

    originalExperiment.getHybridizations().addAll(translatedExperiment.getHybridizations());
    this.projectDao.save(originalExperiment.getHybridizations());

    for (final LabeledExtract le : translatedExperiment.getLabeledExtracts()) {
      le.setExperiment(originalExperiment);
      originalExperiment.getLabeledExtracts().add(le);
    }
    this.projectDao.save(originalExperiment.getLabeledExtracts());
    for (final Extract e : translatedExperiment.getExtracts()) {
      e.setExperiment(originalExperiment);
      originalExperiment.getExtracts().add(e);
    }
    this.projectDao.save(originalExperiment.getExtracts());
    for (final Sample s : translatedExperiment.getSamples()) {
      s.setExperiment(originalExperiment);
      originalExperiment.getSamples().add(s);
    }
    this.projectDao.save(originalExperiment.getSamples());
    for (final Source s : translatedExperiment.getSources()) {
      s.setExperiment(originalExperiment);
      originalExperiment.getSources().add(s);
    }
    this.projectDao.save(originalExperiment.getSources());
  }