Search in sources :

Example 11 with QuantitationType

use of ubic.gemma.model.common.quantitationtype.QuantitationType in project Gemma by PavlidisLab.

the class GeoConverterTest method testConvertGSE2982.

@SuppressWarnings("unchecked")
@Test
public void testConvertGSE2982() throws Exception {
    InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse2982Short/GSE2982_family.soft.gz"));
    GeoFamilyParser parser = new GeoFamilyParser();
    parser.parse(is);
    GeoSeries series = ((GeoParseResult) parser.getResults().iterator().next()).getSeriesMap().get("GSE2982");
    DatasetCombiner datasetCombiner = new DatasetCombiner();
    GeoSampleCorrespondence correspondence = datasetCombiner.findGSECorrespondence(series);
    series.setSampleCorrespondence(correspondence);
    Object result = this.gc.convert(series);
    assertNotNull(result);
    Collection<ExpressionExperiment> ees = (Collection<ExpressionExperiment>) result;
    assertEquals(1, ees.size());
    ExpressionExperiment ee = ees.iterator().next();
    boolean ok = false;
    for (RawExpressionDataVector dedv : ee.getRawExpressionDataVectors()) {
        QuantitationType qt = dedv.getQuantitationType();
        if (qt.getIsPreferred()) {
            ok = true;
            assertEquals("VALUE", qt.getName());
            assertEquals(StandardQuantitationType.AMOUNT, qt.getType());
            assertTrue(qt.getIsRatio());
        }
    }
    assertTrue(ok);
}
Also used : GeoSeries(ubic.gemma.core.loader.expression.geo.model.GeoSeries) GZIPInputStream(java.util.zip.GZIPInputStream) InputStream(java.io.InputStream) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) GZIPInputStream(java.util.zip.GZIPInputStream) RawExpressionDataVector(ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType) StandardQuantitationType(ubic.gemma.model.common.quantitationtype.StandardQuantitationType) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Example 12 with QuantitationType

use of ubic.gemma.model.common.quantitationtype.QuantitationType in project Gemma by PavlidisLab.

the class GeoConverterTest method testConvertGSE5091.

/*
     * Problem with QT being interpreted as String instead of Double.
     */
@SuppressWarnings("unchecked")
@Test
public void testConvertGSE5091() throws Exception {
    GeoFamilyParser parser = new GeoFamilyParser();
    try (InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GSE5091Short/GSE5091_family.soft.gz"))) {
        parser.parse(is);
    }
    GeoSeries series = ((GeoParseResult) parser.getResults().iterator().next()).getSeriesMap().get("GSE5091");
    DatasetCombiner datasetCombiner = new DatasetCombiner();
    GeoSampleCorrespondence correspondence = datasetCombiner.findGSECorrespondence(series);
    series.setSampleCorrespondence(correspondence);
    Object result = this.gc.convert(series);
    assertNotNull(result);
    Collection<ExpressionExperiment> ees = (Collection<ExpressionExperiment>) result;
    assertEquals(1, ees.size());
    ExpressionExperiment ee = ees.iterator().next();
    Collection<QuantitationType> quantitationTypes = ee.getQuantitationTypes();
    for (QuantitationType quantitationType : quantitationTypes) {
        // log.info(quantitationType);
        if (quantitationType.getName().equals("VALUE")) {
            /*
                 * Here's the problem. Of course it works fine...
                 */
            assertEquals(PrimitiveType.DOUBLE, quantitationType.getRepresentation());
            assertTrue(quantitationType.getIsPreferred());
            return;
        }
    }
    fail("Expected to find 'VALUE' with type Double");
}
Also used : GZIPInputStream(java.util.zip.GZIPInputStream) GeoSeries(ubic.gemma.core.loader.expression.geo.model.GeoSeries) GZIPInputStream(java.util.zip.GZIPInputStream) InputStream(java.io.InputStream) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType) StandardQuantitationType(ubic.gemma.model.common.quantitationtype.StandardQuantitationType) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Example 13 with QuantitationType

use of ubic.gemma.model.common.quantitationtype.QuantitationType in project Gemma by PavlidisLab.

the class GeoConverterTest method testConvertDataIntegers.

@Test
public void testConvertDataIntegers() {
    List<Object> testList = new ArrayList<>();
    testList.add("1");
    testList.add("2929202");
    testList.add("-394949");
    QuantitationType qt = QuantitationType.Factory.newInstance();
    qt.setRepresentation(PrimitiveType.INT);
    byte[] actualResult = gc.convertData(testList, qt);
    int[] revertedResult = bac.byteArrayToInts(actualResult);
    assertEquals(revertedResult[0], 1);
    assertEquals(revertedResult[1], 2929202);
    assertEquals(revertedResult[2], -394949);
}
Also used : QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType) StandardQuantitationType(ubic.gemma.model.common.quantitationtype.StandardQuantitationType) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Example 14 with QuantitationType

use of ubic.gemma.model.common.quantitationtype.QuantitationType in project Gemma by PavlidisLab.

the class MatrixConversionTest method testColumnMapping.

public final void testColumnMapping() {
    Collection<QuantitationType> quantTypes = new HashSet<>();
    QuantitationType quantType = PersistentDummyObjectHelper.getTestNonPersistentQuantitationType();
    quantType.setId(0L);
    quantTypes.add(quantType);
    Collection<DesignElementDataVector> vectors = this.getDesignElementDataVectors(quantTypes);
    ExpressionDataDoubleMatrix mat = new ExpressionDataDoubleMatrix(vectors);
    MatrixConversionTest.log.debug(vectors.size() + " vectors");
    TestCase.assertEquals(MatrixConversionTest.NUM_CS, mat.rows());
    TestCase.assertEquals(MatrixConversionTest.NUM_BIOMATERIALS, mat.columns());
    for (int j = 0; j < mat.rows(); j++) {
        // System.err.print( mat.getRowElement( j ) );
        for (int i = 0; i < mat.columns(); i++) {
            Double r = mat.get(j, i);
            TestCase.assertNotNull("No value for at index " + i, r);
            TestCase.assertTrue("Expected " + i + ", got " + r, i == r.intValue() || r.equals(Double.NaN));
        }
    }
}
Also used : DesignElementDataVector(ubic.gemma.model.expression.bioAssayData.DesignElementDataVector) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType)

Example 15 with QuantitationType

use of ubic.gemma.model.common.quantitationtype.QuantitationType in project Gemma by PavlidisLab.

the class TwoChannelMissingValueCLI method processExperiment.

private boolean processExperiment(ExpressionExperiment ee) {
    Collection<QuantitationType> types = eeService.getQuantitationTypes(ee);
    ee = this.eeService.thawLite(ee);
    if (!force && this.noNeedToRun(ee, MissingValueAnalysisEvent.class))
        return false;
    QuantitationType previousMissingValueQt = null;
    for (QuantitationType qType : types) {
        if (qType.getType() == StandardQuantitationType.PRESENTABSENT) {
            if (previousMissingValueQt != null) {
                AbstractCLI.log.warn("More than one present/absent quantitationtype!");
            }
            previousMissingValueQt = qType;
        }
    }
    if (previousMissingValueQt != null && !force) {
        AbstractCLI.log.warn(ee + " already has missing value vectors, skipping");
        return false;
    }
    if (force && previousMissingValueQt != null) {
        AbstractCLI.log.info("Removing old present/absent data");
        rawService.removeDataForQuantitationType(previousMissingValueQt);
        procService.removeDataForQuantitationType(previousMissingValueQt);
        quantitationTypeService.remove(previousMissingValueQt);
    }
    AbstractCLI.log.info("Got " + ee + ", thawing...");
    AbstractCLI.log.info("Computing missing value data..");
    Collection<RawExpressionDataVector> missingValueVectors = tcmv.computeMissingValues(ee, s2n, this.extraMissingValueIndicators);
    if (missingValueVectors.size() == 0) {
        AbstractCLI.log.warn("No missing value vectors computed");
        return false;
    }
    try {
        preprocessorService.process(ee, true);
    } catch (PreprocessingException e) {
        AbstractCLI.log.error("Error during postprocessing of " + ee + " , make sure additional steps are completed", e);
    }
    return true;
}
Also used : RawExpressionDataVector(ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector) MissingValueAnalysisEvent(ubic.gemma.model.common.auditAndSecurity.eventType.MissingValueAnalysisEvent) PreprocessingException(ubic.gemma.core.analysis.preprocess.PreprocessingException) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType) StandardQuantitationType(ubic.gemma.model.common.quantitationtype.StandardQuantitationType)

Aggregations

QuantitationType (ubic.gemma.model.common.quantitationtype.QuantitationType)74 StandardQuantitationType (ubic.gemma.model.common.quantitationtype.StandardQuantitationType)30 BioAssayDimension (ubic.gemma.model.expression.bioAssayData.BioAssayDimension)20 DesignElementDataVector (ubic.gemma.model.expression.bioAssayData.DesignElementDataVector)18 Test (org.junit.Test)16 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)14 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)13 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)11 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)10 ProcessedExpressionDataVector (ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector)10 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)8 BioMaterial (ubic.gemma.model.expression.biomaterial.BioMaterial)7 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)6 GeoDomainObjectGeneratorLocal (ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal)6 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)6 InputStream (java.io.InputStream)5 GZIPInputStream (java.util.zip.GZIPInputStream)5 GeoSeries (ubic.gemma.core.loader.expression.geo.model.GeoSeries)5 AlreadyExistsInSystemException (ubic.gemma.core.loader.util.AlreadyExistsInSystemException)5 ByteArrayConverter (ubic.basecode.io.ByteArrayConverter)4