Search in sources :

Example 1 with ExpressionDataBooleanMatrix

use of ubic.gemma.core.datastructure.matrix.ExpressionDataBooleanMatrix in project Gemma by PavlidisLab.

the class TwoChannelMissingValuesTest method testMissingValueGSE11017.

/**
 * Was giving all missing values.
 */
@Test
public void testMissingValueGSE11017() throws Exception {
    ExpressionExperiment old = eeService.findByShortName("GSE11017");
    if (old != null)
        eeService.remove(old);
    InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GSE11017.soft.gz"));
    GeoFamilyParser parser = new GeoFamilyParser();
    parser.parse(is);
    GeoSeries series = ((GeoParseResult) parser.getResults().iterator().next()).getSeriesMap().get("GSE11017");
    DatasetCombiner datasetCombiner = new DatasetCombiner();
    GeoSampleCorrespondence correspondence = datasetCombiner.findGSECorrespondence(series);
    series.setSampleCorrespondence(correspondence);
    Object result = this.gc.convert(series);
    assertNotNull(result);
    ExpressionExperiment expExp = (ExpressionExperiment) ((Collection<?>) result).iterator().next();
    expExp = persisterHelper.persist(expExp, persisterHelper.prepare(expExp));
    Collection<RawExpressionDataVector> calls = tcmv.computeMissingValues(expExp, 2.0, new ArrayList<Double>());
    // print( calls );
    assertEquals(20, calls.size());
    boolean hasNewQT = false;
    Collection<QuantitationType> qts = eeService.getQuantitationTypes(expExp);
    for (QuantitationType qt : qts) {
        if (qt.getType().equals(StandardQuantitationType.PRESENTABSENT)) {
            hasNewQT = true;
            break;
        }
    }
    assertTrue(hasNewQT);
    ExpressionDataMatrixBuilder builder = new ExpressionDataMatrixBuilder(calls);
    ExpressionDataBooleanMatrix missingValues = builder.getMissingValueData();
    assertTrue(missingValues.getQuantitationTypes().iterator().next().getDescription().contains("signal threshold"));
    Boolean[][] mm = missingValues.getRawMatrix();
    boolean hasPresent = false;
    for (Boolean[] aMm : mm) {
        for (Boolean anAMm : aMm) {
            if (anAMm) {
                hasPresent = true;
                break;
            }
        }
    }
    assertTrue(hasPresent);
}
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) ExpressionDataBooleanMatrix(ubic.gemma.core.datastructure.matrix.ExpressionDataBooleanMatrix) RawExpressionDataVector(ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector) Collection(java.util.Collection) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType) StandardQuantitationType(ubic.gemma.model.common.quantitationtype.StandardQuantitationType) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Aggregations

InputStream (java.io.InputStream)1 Collection (java.util.Collection)1 GZIPInputStream (java.util.zip.GZIPInputStream)1 Test (org.junit.Test)1 ExpressionDataBooleanMatrix (ubic.gemma.core.datastructure.matrix.ExpressionDataBooleanMatrix)1 GeoSeries (ubic.gemma.core.loader.expression.geo.model.GeoSeries)1 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)1 QuantitationType (ubic.gemma.model.common.quantitationtype.QuantitationType)1 StandardQuantitationType (ubic.gemma.model.common.quantitationtype.StandardQuantitationType)1 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)1 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)1