use of ubic.gemma.model.genome.Taxon in project Gemma by PavlidisLab.
the class ExpressionExperimentSearchServiceImpl method initialSearch.
private Map<Class<?>, List<SearchResult>> initialSearch(String query, Long taxonId) {
SearchSettings settings = SearchSettingsImpl.expressionExperimentSearch(query);
// add searching for experimentSets
settings.setSearchExperimentSets(true);
Taxon taxonParam;
if (taxonId != null) {
taxonParam = taxonService.load(taxonId);
settings.setTaxon(taxonParam);
}
return searchService.search(settings);
}
use of ubic.gemma.model.genome.Taxon in project Gemma by PavlidisLab.
the class GeneSetValueObjectHelperImpl method fillSessionBoundValueObject.
private void fillSessionBoundValueObject(SessionBoundGeneSetValueObject sbgsvo, GeneSet gs) {
sbgsvo.setName(gs.getName());
sbgsvo.setDescription(gs.getDescription());
// GO group gene sets don't have ids
if (gs.getId() == null) {
sbgsvo.setSize(gs.getMembers() != null ? gs.getMembers().size() : 0);
} else {
// this case may never happen as this is only called from convertToGoValueObject() leaving here in case
// this method is ever called from somewhere else
sbgsvo.setSize(this.geneSetService.getSize(new GeneSetValueObject(gs.getId())));
}
Collection<Long> gids = new HashSet<>();
for (GeneSetMember gm : gs.getMembers()) {
gids.add(gm.getGene().getId());
}
sbgsvo.setGeneIds(gids);
Taxon tax = this.geneSetService.getTaxon(gs);
if (tax != null) {
while (tax.getParentTaxon() != null) {
tax = tax.getParentTaxon();
}
sbgsvo.setTaxonId(tax.getId());
sbgsvo.setTaxonName(tax.getCommonName());
}
sbgsvo.setId(new Long(-1));
sbgsvo.setModified(false);
}
use of ubic.gemma.model.genome.Taxon 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.Taxon in project Gemma by PavlidisLab.
the class ArrayDesignSequenceAssociationCli method doWork.
@Override
protected Exception doWork(String[] args) {
try {
Exception err = this.processCommandLine(args);
if (err != null)
return err;
// this is kind of an oddball function of this tool.
if (this.hasOption('s')) {
BioSequence updated = arrayDesignSequenceProcessingService.processSingleAccession(this.sequenceId, new String[] { "nt", "est_others", "est_human", "est_mouse" }, null, force);
if (updated != null) {
AbstractCLI.log.info("Updated or created " + updated);
}
return null;
}
for (ArrayDesign arrayDesign : this.arrayDesignsToProcess) {
arrayDesign = this.thaw(arrayDesign);
SequenceType sequenceTypeEn = SequenceType.fromString(sequenceType);
if (sequenceTypeEn == null) {
AbstractCLI.log.error("No sequenceType " + sequenceType + " found");
this.bail(ErrorCode.INVALID_OPTION);
}
if (this.hasOption('f')) {
try (InputStream sequenceFileIs = FileTools.getInputStreamFromPlainOrCompressedFile(sequenceFile)) {
if (sequenceFileIs == null) {
AbstractCLI.log.error("No file " + sequenceFile + " was readable");
this.bail(ErrorCode.INVALID_OPTION);
return null;
}
Taxon taxon = null;
if (this.hasOption('t')) {
taxon = taxonService.findByCommonName(this.taxonName);
if (taxon == null) {
throw new IllegalArgumentException("No taxon named " + taxonName);
}
}
AbstractCLI.log.info("Processing ArrayDesign...");
arrayDesignSequenceProcessingService.processArrayDesign(arrayDesign, sequenceFileIs, sequenceTypeEn, taxon);
this.audit(arrayDesign, "Sequences read from file: " + sequenceFile);
}
} else if (this.hasOption('i')) {
try (InputStream idFileIs = FileTools.getInputStreamFromPlainOrCompressedFile(idFile)) {
if (idFileIs == null) {
AbstractCLI.log.error("No file " + idFile + " was readable");
this.bail(ErrorCode.INVALID_OPTION);
}
Taxon taxon = null;
if (this.hasOption('t')) {
taxon = taxonService.findByCommonName(this.taxonName);
if (taxon == null) {
throw new IllegalArgumentException("No taxon named " + taxonName);
}
}
AbstractCLI.log.info("Processing ArrayDesign...");
arrayDesignSequenceProcessingService.processArrayDesign(arrayDesign, idFileIs, new String[] { "nt", "est_others", "est_human", "est_mouse" }, null, taxon, force);
this.audit(arrayDesign, "Sequences identifiers from file: " + idFile);
}
} else {
AbstractCLI.log.info("Retrieving sequences from BLAST databases");
arrayDesignSequenceProcessingService.processArrayDesign(arrayDesign, new String[] { "nt", "est_others", "est_human", "est_mouse" }, null, force);
this.audit(arrayDesign, "Sequence looked up from BLAST databases");
}
}
} catch (Exception e) {
AbstractCLI.log.error(e, e);
return e;
}
return null;
}
use of ubic.gemma.model.genome.Taxon in project Gemma by PavlidisLab.
the class GeneMultifunctionalityPopulationServiceImpl method updateMultifunctionality.
@Override
public void updateMultifunctionality() {
for (Taxon t : taxonService.loadAll()) {
GeneMultifunctionalityPopulationServiceImpl.log.info("Processing multifunctionality for " + t);
this.updateMultifunctionality(t);
}
}
Aggregations