Search in sources :

Example 81 with ExpressionExperiment

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

the class ExpressionExperimentReportGenerationController method run.

public String run(Long id) {
    ExpressionExperiment ee = expressionExperimentService.load(id);
    if (ee == null) {
        throw new IllegalArgumentException("Could not access experiment with id=" + id);
    }
    ExpressionExperimentReportTaskCommand cmd = new ExpressionExperimentReportTaskCommand(ee);
    return taskRunningService.submitLocalTask(cmd);
}
Also used : ExpressionExperimentReportTaskCommand(ubic.gemma.core.tasks.maintenance.ExpressionExperimentReportTaskCommand) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment)

Example 82 with ExpressionExperiment

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

the class BioAssayServiceTest method setup.

@Before
public void setup() {
    ExpressionExperiment ee = super.getTestPersistentCompleteExpressionExperiment(false);
    ba = ee.getBioAssays().iterator().next();
}
Also used : ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) Before(org.junit.Before)

Example 83 with ExpressionExperiment

use of ubic.gemma.model.expression.experiment.ExpressionExperiment 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 84 with ExpressionExperiment

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

the class CoexpressionSearchController method doSearchQuickComplete.

/**
 * Do a search that fills in the edges among the genes already found. Maps to doSearchQuickComplete in javascript.
 *
 * @param searchOptions search options
 * @param queryGeneIds  the genes which were used originally to start the search
 * @return coexp meta VO
 */
public CoexpressionMetaValueObject doSearchQuickComplete(CoexpressionSearchCommand searchOptions, Collection<Long> queryGeneIds) {
    if (searchOptions == null) {
        throw new IllegalArgumentException("Search options cannot be null");
    }
    assert queryGeneIds != null && !queryGeneIds.isEmpty();
    CoexpressionMetaValueObject result = new CoexpressionMetaValueObject();
    if (queryGeneIds.size() == 1) {
        // there is nothing to do; really we shouldn't be here.
        assert !searchOptions.getGeneIds().isEmpty();
        return this.doSearch(searchOptions);
    }
    assert searchOptions.getQueryGenesOnly();
    // Add the user's datasets to the selected datasets
    Collection<ExpressionExperiment> myEE = null;
    if (searchOptions.isUseMyDatasets()) {
        myEE = expressionExperimentService.loadAll();
    }
    Collection<Long> eeIds = this.chooseExperimentsToQuery(searchOptions, result);
    if (StringUtils.isNotBlank(result.getErrorState()))
        return result;
    if (myEE != null && !myEE.isEmpty()) {
        eeIds.addAll(EntityUtils.getIds(myEE));
    } else {
        CoexpressionSearchController.log.debug("No user data to add");
    }
    if (eeIds.isEmpty()) {
    // search all available experiments.
    } else {
        searchOptions.setEeIds(eeIds);
    }
    StopWatch timer = new StopWatch();
    timer.start();
    CoexpressionSearchController.log.info("Coexpression search for " + searchOptions.getGeneIds().size() + " genes, stringency=" + searchOptions.getStringency() + (searchOptions.getEeIds() != null ? (" ees=" + searchOptions.getEeIds().size()) : " All ees"));
    result = geneCoexpressionService.coexpressionSearchQuick(searchOptions.getEeIds(), searchOptions.getGeneIds(), searchOptions.getStringency(), -1, /* no limit in this situation anyway */
    true);
    result.setSearchSettings(searchOptions);
    if (result.getResults() == null || result.getResults().isEmpty()) {
        result.setErrorState(CoexpressionSearchController.NOTHING_FOUND_MESSAGE);
        CoexpressionSearchController.log.info("No search results for query: " + searchOptions);
    }
    if (timer.getTime() > 2000) {
        CoexpressionSearchController.log.info("Search complete: " + result.getResults().size() + " hits");
    }
    return result;
}
Also used : CoexpressionMetaValueObject(ubic.gemma.core.analysis.expression.coexpression.CoexpressionMetaValueObject) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) StopWatch(org.apache.commons.lang3.time.StopWatch)

Example 85 with ExpressionExperiment

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

the class CoexpressionSearchController method doSearch.

/**
 * Important entry point - called by the CoexpressionSearchTask
 *
 * @param searchOptions search options
 * @return coexp. meta VO
 */
public CoexpressionMetaValueObject doSearch(CoexpressionSearchCommand searchOptions) {
    Collection<ExpressionExperiment> myEE = null;
    CoexpressionMetaValueObject result = new CoexpressionMetaValueObject();
    if (searchOptions.getGeneIds() == null || searchOptions.getGeneIds().isEmpty()) {
        if (searchOptions.getGeneSetId() != null) {
            searchOptions.setGeneIds(geneSetService.getGeneIdsInGroup(new GeneSetValueObject(searchOptions.getGeneSetId())));
        }
        if (searchOptions.getGeneIds().isEmpty()) {
            result.setErrorState("No genes were selected");
            return result;
        }
    }
    if (searchOptions.getGeneIds().size() > CoexpressionSearchController.MAX_GENES_FOR_QUERY_GENES_ONLY_QUERY) {
        result.setErrorState("Too many genes selected, please limit searches to " + CoexpressionSearchController.MAX_GENES_FOR_QUERY_GENES_ONLY_QUERY + " genes");
        return result;
    }
    if (searchOptions.getGeneIds().size() == 0) {
        result.setErrorState("Invalid gene id(s) - no genes found");
        return result;
    }
    // Add the user's datasets to the selected datasets
    if (searchOptions.isUseMyDatasets()) {
        myEE = expressionExperimentService.loadAll();
    }
    Collection<Long> eeIds = this.chooseExperimentsToQuery(searchOptions, result);
    if (StringUtils.isNotBlank(result.getErrorState()))
        return result;
    if (myEE != null && !myEE.isEmpty()) {
        eeIds.addAll(EntityUtils.getIds(myEE));
    } else {
        CoexpressionSearchController.log.info("No user data to add");
    }
    if (eeIds.isEmpty()) {
    // search all available experiments.
    } else {
        searchOptions.setEeIds(eeIds);
    }
    CoexpressionSearchController.log.info("Starting coexpression search: " + searchOptions);
    result = geneCoexpressionService.coexpressionSearch(searchOptions.getEeIds(), searchOptions.getGeneIds(), searchOptions.getStringency(), CoexpressionSearchController.MAX_RESULTS_PER_GENE, searchOptions.getQueryGenesOnly());
    // make sure to create an empty list instead of null for front-end
    if (result.getResults() == null) {
        List<CoexpressionValueObjectExt> res = new ArrayList<>();
        result.setResults(res);
    }
    if (result.getResults().isEmpty()) {
        result.setErrorState(CoexpressionSearchController.NOTHING_FOUND_MESSAGE);
        CoexpressionSearchController.log.info("No search results for query: " + searchOptions);
    }
    return result;
}
Also used : CoexpressionMetaValueObject(ubic.gemma.core.analysis.expression.coexpression.CoexpressionMetaValueObject) CoexpressionValueObjectExt(ubic.gemma.core.analysis.expression.coexpression.CoexpressionValueObjectExt) ArrayList(java.util.ArrayList) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) GeneSetValueObject(ubic.gemma.model.genome.gene.GeneSetValueObject)

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