Search in sources :

Example 26 with BioAssay

use of ubic.gemma.model.expression.bioAssay.BioAssay in project Gemma by PavlidisLab.

the class BatchInfoParser method getBatchInfo.

public Map<BioMaterial, Date> getBatchInfo(ExpressionExperiment ee, Collection<LocalFile> files) {
    Map<String, BioAssay> assayAccessions = this.getAccessionToBioAssayMap(ee);
    if (assayAccessions.isEmpty()) {
        throw new UnsupportedOperationException("Couldn't get any scan date information, could not determine provider or it is not supported for " + ee.getShortName());
    }
    Map<BioAssay, File> bioAssays2Files = this.matchBioAssaysToRawDataFiles(files, assayAccessions);
    /*
         * Check if we should go on
         */
    if (bioAssays2Files.size() < assayAccessions.size()) {
        if (bioAssays2Files.size() > 0) {
            /*
                 * Missing a few for some reason.
                 */
            for (BioAssay ba : bioAssays2Files.keySet()) {
                if (!assayAccessions.containsKey(ba.getAccession().getAccession())) {
                    BatchInfoParser.log.warn("Missing raw data file for " + ba + " on " + ee.getShortName());
                }
            }
        }
        throw new IllegalStateException("Did not get enough raw files :got " + bioAssays2Files.size() + ", expected " + assayAccessions.size() + " while processing " + ee.getShortName());
    }
    return this.getBatchInformationFromFiles(bioAssays2Files);
}
Also used : File(java.io.File) LocalFile(ubic.gemma.model.common.description.LocalFile) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay)

Example 27 with BioAssay

use of ubic.gemma.model.expression.bioAssay.BioAssay in project Gemma by PavlidisLab.

the class GeoDatasetServiceTest method testFetchAndLoadGSE13657.

/*
     * Left out quantitation types due to bug in how quantitation types were cached during persisting, if the QTs didn't
     * have descriptions.
     */
@Test
public void testFetchAndLoadGSE13657() throws Exception {
    try {
        geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath()));
        Collection<?> results = geoService.fetchAndLoad("GSE13657", false, true, false);
        ee = (ExpressionExperiment) results.iterator().next();
    } catch (AlreadyExistsInSystemException e) {
        log.info("Test skipped because GSE13657 was already loaded - clean the DB before running the test");
        return;
    }
    ee = this.eeService.thawLite(ee);
    aclTestUtils.checkEEAcls(ee);
    Collection<QuantitationType> qts = eeService.getQuantitationTypes(ee);
    assertEquals(13, qts.size());
    // make sure we got characteristics and treatments for both channels.
    for (BioAssay ba : ee.getBioAssays()) {
        BioMaterial bm = ba.getSampleUsed();
        assertNotNull(bm);
        log.info(bm + " " + bm.getDescription());
        assertEquals(9, bm.getCharacteristics().size());
    }
}
Also used : BioMaterial(ubic.gemma.model.expression.biomaterial.BioMaterial) AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay) GeoDomainObjectGeneratorLocal(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

Example 28 with BioAssay

use of ubic.gemma.model.expression.bioAssay.BioAssay in project Gemma by PavlidisLab.

the class GeoDatasetServiceTest method testMatrixValue.

private void testMatrixValue(ExpressionExperiment exp, ExpressionDataMatrix<Double> matrix, String probeToTest, String sampleToTest, double expectedValue) {
    CompositeSequence soughtDesignElement = null;
    BioAssay soughtBioAssay = null;
    Collection<RawExpressionDataVector> vectors = exp.getRawExpressionDataVectors();
    for (DesignElementDataVector vector : vectors) {
        CompositeSequence de = vector.getDesignElement();
        if (de.getName().equals(probeToTest)) {
            soughtDesignElement = de;
        }
        BioAssayDimension bad = vector.getBioAssayDimension();
        for (BioAssay ba : bad.getBioAssays()) {
            if (ba.getAccession().getAccession().equals(sampleToTest)) {
                soughtBioAssay = ba;
            }
        }
    }
    if (soughtDesignElement == null || soughtBioAssay == null)
        fail("didn't find values for " + sampleToTest);
    Double actualValue = matrix.get(soughtDesignElement, soughtBioAssay);
    assertNotNull("No value for " + soughtBioAssay, actualValue);
    assertEquals(expectedValue, actualValue, 0.00001);
}
Also used : BioAssayDimension(ubic.gemma.model.expression.bioAssayData.BioAssayDimension) RawExpressionDataVector(ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector) DesignElementDataVector(ubic.gemma.model.expression.bioAssayData.DesignElementDataVector) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay)

Example 29 with BioAssay

use of ubic.gemma.model.expression.bioAssay.BioAssay in project Gemma by PavlidisLab.

the class ExperimentalDesignImporterTest method testParseWhereExtraValue.

/*
     * test case where the design file has extra information not relevant to the current samples.
     */
@Test
public final void testParseWhereExtraValue() throws Exception {
    try (InputStream is = this.getClass().getResourceAsStream("/data/loader/expression/experimentalDesignTestExtra.txt")) {
        experimentalDesignImporter.importDesign(ee, is);
    }
    ee = this.eeService.thawLite(ee);
    Collection<BioMaterial> bms = new HashSet<>();
    for (BioAssay ba : ee.getBioAssays()) {
        BioMaterial bm = ba.getSampleUsed();
        bms.add(bm);
    }
    this.aclTestUtils.checkEEAcls(ee);
    this.checkResults(bms);
}
Also used : BioMaterial(ubic.gemma.model.expression.biomaterial.BioMaterial) InputStream(java.io.InputStream) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay) HashSet(java.util.HashSet) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest) Test(org.junit.Test)

Example 30 with BioAssay

use of ubic.gemma.model.expression.bioAssay.BioAssay in project Gemma by PavlidisLab.

the class TwoChannelMissingValuesTest method print.

/**
 * Debug code.
 */
@SuppressWarnings("unused")
private void print(Collection<RawExpressionDataVector> calls) {
    ByteArrayConverter bac = new ByteArrayConverter();
    BioAssayDimension dim = calls.iterator().next().getBioAssayDimension();
    System.err.print("\n");
    for (BioAssay bas : dim.getBioAssays()) {
        System.err.print("\t" + bas);
    }
    System.err.print("\n");
    for (DesignElementDataVector vector : calls) {
        System.err.print(vector.getDesignElement());
        byte[] dat = vector.getData();
        boolean[] row = bac.byteArrayToBooleans(dat);
        for (boolean b : row) {
            System.err.print("\t" + b);
        }
        System.err.print("\n");
    }
}
Also used : BioAssayDimension(ubic.gemma.model.expression.bioAssayData.BioAssayDimension) ByteArrayConverter(ubic.basecode.io.ByteArrayConverter) DesignElementDataVector(ubic.gemma.model.expression.bioAssayData.DesignElementDataVector) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay)

Aggregations

BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)144 BioMaterial (ubic.gemma.model.expression.biomaterial.BioMaterial)67 Test (org.junit.Test)29 BioAssayDimension (ubic.gemma.model.expression.bioAssayData.BioAssayDimension)29 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)24 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)20 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)18 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)16 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)15 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)14 ExperimentalFactor (ubic.gemma.model.expression.experiment.ExperimentalFactor)14 InputStream (java.io.InputStream)11 ByteArrayConverter (ubic.basecode.io.ByteArrayConverter)10 HashSet (java.util.HashSet)9 AlreadyExistsInSystemException (ubic.gemma.core.loader.util.AlreadyExistsInSystemException)8 DesignElementDataVector (ubic.gemma.model.expression.bioAssayData.DesignElementDataVector)8 FactorValue (ubic.gemma.model.expression.experiment.FactorValue)8 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 ModelAndView (org.springframework.web.servlet.ModelAndView)7 ExpressionDataDoubleMatrix (ubic.gemma.core.datastructure.matrix.ExpressionDataDoubleMatrix)7