use of ubic.gemma.model.genome.Gene in project Gemma by PavlidisLab.
the class GeneServiceImpl method loadValueObjectById.
@Override
@Transactional(readOnly = true)
public GeneValueObject loadValueObjectById(Long id) {
Gene g = this.geneDao.load(id);
if (g == null)
return null;
g = this.geneDao.thaw(g);
return GeneValueObject.convert2ValueObject(g);
}
use of ubic.gemma.model.genome.Gene in project Gemma by PavlidisLab.
the class GeneSetServiceImpl method findGeneSetsByGene.
@Override
@Transactional(readOnly = true)
public Collection<GeneSetValueObject> findGeneSetsByGene(Long geneId) {
Gene gene = geneService.load(geneId);
Collection<GeneSet> genesets = geneSetSearch.findByGene(gene);
Collection<GeneSetValueObject> gsvos = new ArrayList<>();
// noinspection CollectionAddAllCanBeReplacedWithConstructor // not possible safely
gsvos.addAll(geneSetValueObjectHelper.convertToValueObjects(genesets, false));
return gsvos;
}
use of ubic.gemma.model.genome.Gene in project Gemma by PavlidisLab.
the class GeneCoreServiceImpl method searchGenes.
/**
* Search for genes (by name or symbol)
*
* @param taxonId, can be null to not constrain by taxon
* @return Collection of Gene entity objects
*/
@Override
public Collection<GeneValueObject> searchGenes(String query, Long taxonId) {
Taxon taxon = null;
if (taxonId != null) {
taxon = this.taxonService.load(taxonId);
}
SearchSettings settings = SearchSettingsImpl.geneSearch(query, taxon);
List<SearchResult> geneSearchResults = this.searchService.search(settings).get(Gene.class);
Collection<Gene> genes = new HashSet<>();
if (geneSearchResults == null || geneSearchResults.isEmpty()) {
GeneCoreServiceImpl.log.info("No Genes for search: " + query + " taxon=" + taxonId);
return new HashSet<>();
}
GeneCoreServiceImpl.log.info("Gene search: " + query + " taxon=" + taxonId + ", " + geneSearchResults.size() + " found");
for (SearchResult sr : geneSearchResults) {
Gene g = (Gene) sr.getResultObject();
g = geneService.thaw(g);
genes.add(g);
GeneCoreServiceImpl.log.debug("Gene search result: " + g.getOfficialSymbol());
}
Collection<GeneValueObject> geneValueObjects = geneService.loadValueObjects(genes);
GeneCoreServiceImpl.log.debug("Gene search: " + geneValueObjects.size() + " value objects returned.");
return geneValueObjects;
}
use of ubic.gemma.model.genome.Gene in project Gemma by PavlidisLab.
the class DEDVController method getDEDVForDiffExVisualization.
/**
* AJAX exposed method - for ProbeLevelDiffExGrid, VisualizationDifferentialWindow,
* DifferentialExpressionAnalysesSummaryTree
*
* @param eeIds FIXME accommodate ExpressionExperimentSubSets. Currently we pass in the "source experiment" so we
* don't get the slice.
* @param geneIds (could be just one)
* @param threshold for 'significance'
* @param factorMap Collection of DiffExpressionSelectedFactorCommand showing which factors to use.
*/
public VisualizationValueObject[] getDEDVForDiffExVisualization(Collection<Long> eeIds, Collection<Long> geneIds, Double threshold, Collection<DiffExpressionSelectedFactorCommand> factorMap) {
if (eeIds.isEmpty() || geneIds.isEmpty())
return null;
StopWatch watch = new StopWatch();
watch.start();
Collection<? extends BioAssaySet> ees = expressionExperimentService.load(eeIds);
if (ees == null || ees.isEmpty())
return null;
Collection<Gene> genes = geneService.load(geneIds);
if (genes == null || genes.isEmpty())
return null;
Collection<DoubleVectorValueObject> dedvs = processedExpressionDataVectorService.getProcessedDataArrays(ees, geneIds);
watch.stop();
Long time = watch.getTime();
log.info("Retrieved " + dedvs.size() + " DEDVs for " + eeIds.size() + " EEs and " + geneIds.size() + " genes in " + time + " ms.");
watch = new StopWatch();
watch.start();
Map<Long, LinkedHashMap<BioAssayValueObject, LinkedHashMap<ExperimentalFactor, Double>>> layouts;
layouts = experimentalDesignVisualizationService.sortVectorDataByDesign(dedvs);
time = watch.getTime();
if (time > 100) {
log.info("Ran sortVectorDataByDesign on " + dedvs.size() + " DEDVs for 1 EE" + " in " + time + " ms (times <100ms not reported).");
}
// layouts = experimentalDesignVisualizationService.sortLayoutSamplesByFactor( layouts ); // required? yes, see
// GSE11859
time = watch.getTime();
if (time > 100) {
log.info("Ran sortLayoutSamplesByFactor on " + layouts.size() + " layouts" + " in " + time + " ms (times <100ms not reported).");
}
watch = new StopWatch();
watch.start();
Map<Long, Collection<DifferentialExpressionValueObject>> validatedProbes = getProbeDiffExValidation(genes, threshold, factorMap);
watch.stop();
time = watch.getTime();
log.info("Retrieved " + validatedProbes.size() + " valid probes in " + time + " ms.");
return makeDiffVisCollection(dedvs, new ArrayList<>(geneIds), validatedProbes, layouts);
}
use of ubic.gemma.model.genome.Gene in project Gemma by PavlidisLab.
the class DEDVController method getProbeDiffExValidation.
/**
* This is probably no longer being really used?
*/
private Map<Long, Collection<DifferentialExpressionValueObject>> getProbeDiffExValidation(Collection<Gene> genes, Double threshold, Collection<DiffExpressionSelectedFactorCommand> factorMap) {
if (factorMap == null)
throw new IllegalArgumentException("Factor information is missing, please make sure factors are selected.");
Map<Long, Collection<DifferentialExpressionValueObject>> validatedProbes = new HashMap<>();
Collection<Long> wantedFactors = new HashSet<>();
for (DiffExpressionSelectedFactorCommand factor : factorMap) {
wantedFactors.add(factor.getEfId());
}
for (Gene gene : genes) {
Collection<DifferentialExpressionValueObject> differentialExpression = geneDifferentialExpressionService.getDifferentialExpression(gene, threshold, factorMap);
for (DifferentialExpressionValueObject diffVo : differentialExpression) {
assert diffVo.getCorrP() <= threshold;
Long eeId = diffVo.getExpressionExperiment().getId();
if (!validatedProbes.containsKey(eeId)) {
validatedProbes.put(eeId, new HashSet<DifferentialExpressionValueObject>());
}
Collection<ExperimentalFactorValueObject> factors = diffVo.getExperimentalFactors();
for (ExperimentalFactorValueObject fac : factors) {
if (wantedFactors.contains(fac.getId())) {
validatedProbes.get(eeId).add(diffVo);
}
}
}
}
return validatedProbes;
}
Aggregations