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);
}
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();
}
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;
}
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;
}
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;
}
Aggregations