Search in sources :

Example 41 with ExpressionExperiment

use of ubic.gemma.model.expression.experiment.ExpressionExperiment in project Gemma by PavlidisLab.

the class DifferentialExpressionAnalysisCli method doWork.

@Override
protected Exception doWork(String[] args) {
    Exception err = this.processCommandLine(args);
    if (err != null) {
        return err;
    }
    SecurityService securityService = this.getBean(SecurityService.class);
    for (BioAssaySet ee : expressionExperiments) {
        if (!(ee instanceof ExpressionExperiment)) {
            continue;
        }
        if (expressionExperiments.size() > 1) {
            AbstractCLI.log.info(">>>>>> Begin processing: " + ee);
        }
        /*
             * This is really only important when running as admin and in a batch mode.
             */
        AbstractCLI.log.debug(securityService.getOwner(ee));
        if (!securityService.isOwnedByCurrentUser(ee) && this.expressionExperiments.size() > 1) {
            AbstractCLI.log.warn("Experiment is not owned by current user, skipping: " + ee);
            continue;
        }
        this.processExperiment((ExpressionExperiment) ee);
    }
    this.summarizeProcessing();
    return null;
}
Also used : SecurityService(gemma.gsec.SecurityService) BioAssaySet(ubic.gemma.model.expression.experiment.BioAssaySet) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment)

Example 42 with ExpressionExperiment

use of ubic.gemma.model.expression.experiment.ExpressionExperiment in project Gemma by PavlidisLab.

the class SVDServiceHelperImpl method getTopLoadedVectors.

@Override
public Map<ProbeLoading, DoubleVectorValueObject> getTopLoadedVectors(ExpressionExperiment ee, int component, int count) {
    PrincipalComponentAnalysis pca = principalComponentAnalysisService.loadForExperiment(ee);
    Map<ProbeLoading, DoubleVectorValueObject> result = new HashMap<>();
    if (pca == null) {
        return result;
    }
    List<ProbeLoading> topLoadedProbes = principalComponentAnalysisService.getTopLoadedProbes(ee, component, count);
    if (topLoadedProbes == null) {
        SVDServiceHelperImpl.log.warn("No probes?");
        return result;
    }
    Map<Long, ProbeLoading> probes = new LinkedHashMap<>();
    Set<CompositeSequence> p = new HashSet<>();
    for (ProbeLoading probeLoading : topLoadedProbes) {
        CompositeSequence probe = probeLoading.getProbe();
        probes.put(probe.getId(), probeLoading);
        p.add(probe);
    }
    if (probes.isEmpty())
        return result;
    assert probes.size() <= count;
    Collection<ExpressionExperiment> ees = new HashSet<>();
    ees.add(ee);
    Collection<DoubleVectorValueObject> dvVos = processedExpressionDataVectorService.getProcessedDataArraysByProbe(ees, p);
    if (dvVos.isEmpty()) {
        SVDServiceHelperImpl.log.warn("No vectors came back from the call; check the Gene2CS table?");
        return result;
    }
    // note that this might have come from a cache.
    /*
         * This is actually expected, because we go through the genes.
         */
    BioAssayDimension bioAssayDimension = pca.getBioAssayDimension();
    assert bioAssayDimension != null;
    assert !bioAssayDimension.getBioAssays().isEmpty();
    for (DoubleVectorValueObject vct : dvVos) {
        ProbeLoading probeLoading = probes.get(vct.getDesignElement().getId());
        if (probeLoading == null) {
            /*
                 * This is okay, we will skip this probe. It was another probe for a gene that _was_ highly loaded.
                 */
            continue;
        }
        assert bioAssayDimension.getBioAssays().size() == vct.getData().length;
        vct.setRank(probeLoading.getLoadingRank().doubleValue());
        vct.setExpressionExperiment(new ExpressionExperimentValueObject(ee));
        result.put(probeLoading, vct);
    }
    if (result.isEmpty()) {
        SVDServiceHelperImpl.log.warn("No results, something went wrong; there were " + dvVos.size() + " vectors to start but they all got filtered out.");
    }
    return result;
}
Also used : ProbeLoading(ubic.gemma.model.analysis.expression.pca.ProbeLoading) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) BioAssayDimension(ubic.gemma.model.expression.bioAssayData.BioAssayDimension) PrincipalComponentAnalysis(ubic.gemma.model.analysis.expression.pca.PrincipalComponentAnalysis) ExpressionExperimentValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentValueObject) DoubleVectorValueObject(ubic.gemma.model.expression.bioAssayData.DoubleVectorValueObject)

Example 43 with ExpressionExperiment

use of ubic.gemma.model.expression.experiment.ExpressionExperiment in project Gemma by PavlidisLab.

the class WhatsNewServiceImpl method addAllEEs.

private void addAllEEs(Date date, Collection<ExpressionExperiment> ees, Collection<AuditableObject> newObjects) {
    for (ExpressionExperiment ee : ees) {
        AuditableObject ao = new AuditableObject();
        ao.date = date;
        ao.type = "ExpressionExperiment";
        ao.id = ee.getId();
        newObjects.add(ao);
    }
}
Also used : ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment)

Example 44 with ExpressionExperiment

use of ubic.gemma.model.expression.experiment.ExpressionExperiment in project Gemma by PavlidisLab.

the class GeoDatasetServiceTest method testFetchAndLoadMultiChipPerSeriesShort.

@Test
public void testFetchAndLoadMultiChipPerSeriesShort() throws Exception {
    geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath("shortTest")));
    /*
         * HG-U133A. GDS473 is for the other chip (B). Series is GSE674. see
         * http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gds&term=GSE674[Accession]&cmd=search
         */
    ExpressionExperiment newee;
    try {
        Collection<?> results = geoService.fetchAndLoad("GSE674", false, true, false);
        newee = (ExpressionExperiment) results.iterator().next();
    } catch (AlreadyExistsInSystemException e) {
        log.info("Skipping test, data already exists in db");
        return;
    }
    assertNotNull(newee);
    newee = eeService.thaw(newee);
    /*
         * Test for bug 468 (merging of subsets across GDS's)
         */
    ExperimentalFactor factor = newee.getExperimentalDesign().getExperimentalFactors().iterator().next();
    // otherwise get 4.
    assertEquals(2, factor.getFactorValues().size());
    Collection<RawExpressionDataVector> vectors = newee.getRawExpressionDataVectors();
    rawExpressionDataVectorService.thaw(vectors);
    ExpressionDataMatrixBuilder builder = new ExpressionDataMatrixBuilder(vectors);
    ExpressionDataMatrix<Double> matrix = builder.getPreferredData();
    assertNotNull(matrix);
    assertEquals(31, matrix.rows());
    assertEquals(15, matrix.columns());
    // GSM10363 = D1-U133B
    this.testMatrixValue(newee, matrix, "200000_s_at", "GSM10363", 5722.0);
    // GSM10380 = C7-U133A
    this.testMatrixValue(newee, matrix, "1007_s_at", "GSM10380", 1272.0);
}
Also used : ExpressionDataMatrixBuilder(ubic.gemma.core.analysis.preprocess.ExpressionDataMatrixBuilder) RawExpressionDataVector(ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector) ExperimentalFactor(ubic.gemma.model.expression.experiment.ExperimentalFactor) AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) GeoDomainObjectGeneratorLocal(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

Example 45 with ExpressionExperiment

use of ubic.gemma.model.expression.experiment.ExpressionExperiment in project Gemma by PavlidisLab.

the class GeoSuperSeriesLoadTest method removeOldData.

private void removeOldData(ExpressionExperiment ee2) {
    Collection<ArrayDesign> arrayDesignsUsed = ees.getArrayDesignsUsed(ee2);
    ees.remove(ee2);
    for (ArrayDesign ad : arrayDesignsUsed) {
        for (ExpressionExperiment ee3 : adService.getExpressionExperiments(ad)) {
            this.removeOldData(ee3);
        }
        for (ArrayDesign aa : ad.getMergees()) {
            adService.remove(aa);
        }
        adService.remove(ad);
    }
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment)

Aggregations

ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)214 Test (org.junit.Test)71 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)42 InputStream (java.io.InputStream)36 GeoSeries (ubic.gemma.core.loader.expression.geo.model.GeoSeries)29 AlreadyExistsInSystemException (ubic.gemma.core.loader.util.AlreadyExistsInSystemException)29 GZIPInputStream (java.util.zip.GZIPInputStream)28 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)26 HashSet (java.util.HashSet)25 BioAssaySet (ubic.gemma.model.expression.experiment.BioAssaySet)25 GeoDomainObjectGeneratorLocal (ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal)23 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)22 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)20 Collection (java.util.Collection)18 StopWatch (org.apache.commons.lang3.time.StopWatch)18 ExperimentalFactor (ubic.gemma.model.expression.experiment.ExperimentalFactor)18 Taxon (ubic.gemma.model.genome.Taxon)14 Before (org.junit.Before)12 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)12 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)11