Search in sources :

Example 16 with AlreadyExistsInSystemException

use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.

the class TwoWayAnovaWithInteractionsTest2 method setup.

@Before
public void setup() throws Exception {
    geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(FileTools.resourceToPath("/data/analysis/expression/gse18795short")));
    try {
        Collection<?> results = geoService.fetchAndLoad("GSE18795", false, true, false);
        ee = (ExpressionExperiment) results.iterator().next();
    } catch (AlreadyExistsInSystemException e) {
        ee = (ExpressionExperiment) ((Collection<?>) e.getData()).iterator().next();
    }
    ee = expressionExperimentService.thawLite(ee);
    Collection<ExperimentalFactor> toremove = new HashSet<>(ee.getExperimentalDesign().getExperimentalFactors());
    for (ExperimentalFactor ef : toremove) {
        experimentalFactorService.delete(ef);
        ee.getExperimentalDesign().getExperimentalFactors().remove(ef);
    }
    expressionExperimentService.update(ee);
    processedExpressionDataVectorService.computeProcessedExpressionData(ee);
    ee = expressionExperimentService.thaw(ee);
    designImporter.importDesign(ee, this.getClass().getResourceAsStream("/data/analysis/expression/gse18795short/6290_GSE18795_expdesign.data.txt"));
}
Also used : ExperimentalFactor(ubic.gemma.model.expression.experiment.ExperimentalFactor) Collection(java.util.Collection) AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) GeoDomainObjectGeneratorLocal(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal) HashSet(java.util.HashSet) Before(org.junit.Before)

Example 17 with AlreadyExistsInSystemException

use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.

the class ExonArrayDataAddIntegrationTest method testAddAffyExonRat.

@Test
public void testAddAffyExonRat() {
    if (!hasApt) {
        log.warn("Test skipped due to lack of Affy Power Tools executable");
        return;
    }
    // GSE33597
    ExpressionExperiment ee;
    try {
        geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGenerator());
        Collection<?> results = geoService.fetchAndLoad("GSE33597", false, false, false);
        ee = (ExpressionExperiment) results.iterator().next();
    } catch (AlreadyExistsInSystemException e) {
        ee = (ExpressionExperiment) ((List<?>) e.getData()).get(0);
    }
    dataUpdater.addAffyExonArrayData(ee);
    experimentService.load(ee.getId());
}
Also used : GeoDomainObjectGenerator(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator) AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

Example 18 with AlreadyExistsInSystemException

use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.

the class ExonArrayDataAddIntegrationTest method testAddAffyExonHuman.

@Test
public void testAddAffyExonHuman() {
    if (!hasApt) {
        log.warn("Test skipped due to lack of Affy Power Tools executable");
        return;
    }
    // GSE22498
    ExpressionExperiment ee;
    try {
        geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGenerator());
        Collection<?> results = geoService.fetchAndLoad("GSE22498", false, false, false);
        ee = (ExpressionExperiment) results.iterator().next();
    } catch (AlreadyExistsInSystemException e) {
        ee = (ExpressionExperiment) ((List<?>) e.getData()).get(0);
    }
    dataUpdater.addAffyExonArrayData(ee);
    experimentService.load(ee.getId());
}
Also used : GeoDomainObjectGenerator(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator) AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

Example 19 with AlreadyExistsInSystemException

use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.

the class ProcessedExpressionDataVectorServiceTest method getDataset.

private Collection<ExpressionExperiment> getDataset() throws Exception {
    // Dataset uses spotted arrays, 11 samples.
    ExpressionExperiment ee;
    try {
        geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath("gse432Short")));
        // noinspection unchecked
        Collection<ExpressionExperiment> results = (Collection<ExpressionExperiment>) geoService.fetchAndLoad("GSE432", false, true, false);
        ee = results.iterator().next();
        TwoChannelMissingValues tcmv = this.getBean(TwoChannelMissingValues.class);
        tcmv.computeMissingValues(ee, 1.5, null);
    // No masked preferred computation.
    } catch (AlreadyExistsInSystemException e) {
        if (e.getData() instanceof List) {
            ee = (ExpressionExperiment) ((List<?>) e.getData()).iterator().next();
        } else {
            ee = (ExpressionExperiment) e.getData();
        }
    } catch (Exception e) {
        if (e.getCause() instanceof IOException && e.getCause().getMessage().contains("502")) {
            return null;
        }
        throw e;
    }
    ee.setShortName(RandomStringUtils.randomAlphabetic(12));
    expressionExperimentService.update(ee);
    ee = expressionExperimentService.thawLite(ee);
    processedDataVectorService.createProcessedDataVectors(ee);
    Collection<ExpressionExperiment> e = new HashSet<>();
    e.add(ee);
    return e;
}
Also used : TwoChannelMissingValues(ubic.gemma.core.analysis.preprocess.TwoChannelMissingValues) Collection(java.util.Collection) List(java.util.List) AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) IOException(java.io.IOException) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) IOException(java.io.IOException) GeoDomainObjectGeneratorLocal(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal) HashSet(java.util.HashSet)

Example 20 with AlreadyExistsInSystemException

use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.

the class SubsettedAnalysis3Test method setup.

@Before
public void setup() throws Exception {
    geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(FileTools.resourceToPath("/data/analysis/expression/gse26927short")));
    try {
        Collection<?> results = geoService.fetchAndLoad("GSE26927", false, true, false);
        ee = (ExpressionExperiment) results.iterator().next();
    } catch (AlreadyExistsInSystemException e) {
        ee = (ExpressionExperiment) ((Collection<?>) e.getData()).iterator().next();
    }
    ee = expressionExperimentService.thawLite(ee);
    Collection<ExperimentalFactor> toremove = new HashSet<>(ee.getExperimentalDesign().getExperimentalFactors());
    for (ExperimentalFactor ef : toremove) {
        experimentalFactorService.delete(ef);
        ee.getExperimentalDesign().getExperimentalFactors().remove(ef);
    }
    expressionExperimentService.update(ee);
    processedExpressionDataVectorService.computeProcessedExpressionData(ee);
    ee = expressionExperimentService.thaw(ee);
    designImporter.importDesign(ee, this.getClass().getResourceAsStream("/data/analysis/expression/gse26927short/2684_GSE26927_expdesign.data.txt"));
}
Also used : ExperimentalFactor(ubic.gemma.model.expression.experiment.ExperimentalFactor) Collection(java.util.Collection) AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) GeoDomainObjectGeneratorLocal(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal) HashSet(java.util.HashSet) Before(org.junit.Before)

Aggregations

AlreadyExistsInSystemException (ubic.gemma.core.loader.util.AlreadyExistsInSystemException)41 GeoDomainObjectGeneratorLocal (ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal)33 Test (org.junit.Test)29 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)29 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)27 ExperimentalFactor (ubic.gemma.model.expression.experiment.ExperimentalFactor)10 Collection (java.util.Collection)9 HashSet (java.util.HashSet)8 Before (org.junit.Before)8 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)8 InputStream (java.io.InputStream)7 List (java.util.List)7 GeoDomainObjectGenerator (ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator)6 ProcessedExpressionDataVector (ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector)6 ExpressionDataDoubleMatrix (ubic.gemma.core.datastructure.matrix.ExpressionDataDoubleMatrix)5 QuantitationType (ubic.gemma.model.common.quantitationtype.QuantitationType)5 DoubleVectorValueObject (ubic.gemma.model.expression.bioAssayData.DoubleVectorValueObject)5 DoubleMatrixReader (ubic.basecode.io.reader.DoubleMatrixReader)4 File (java.io.File)3 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)3