Class GeneOntologyServiceImpl
java.lang.Object
ubic.basecode.ontology.providers.AbstractDelegatingOntologyService
ubic.gemma.core.ontology.providers.GeneOntologyServiceImpl
- All Implemented Interfaces:
AutoCloseable
,org.springframework.beans.factory.InitializingBean
,OntologyService
,GeneOntologyService
@Service
@ParametersAreNonnullByDefault
public class GeneOntologyServiceImpl
extends AbstractDelegatingOntologyService
implements GeneOntologyService, org.springframework.beans.factory.InitializingBean
- Author:
- pavlidis
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface ubic.basecode.ontology.providers.OntologyService
OntologyService.InferenceMode, OntologyService.LanguageLevel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
calculateGoTermOverlap
(Long queryGene, Collection<Long> geneIds) calculateGoTermOverlap
(Gene queryGene, Collection<Long> geneIds) Given a query Gene, and a collection of gene ids calculates the go term overlap for each pair of queryGene and gene in the given collection.calculateGoTermOverlap
(Gene queryGene1, Gene queryGene2) void
Primarily here for testing, to recover memory.computeOverlap
(Collection<OntologyTerm> masterTerms, Collection<OntologyTerm> comparisonTerms) getAllParents
(Collection<OntologyTerm> entries) getAllParents
(Collection<OntologyTerm> entries, boolean includePartOf) Find genes for a given GO term by GO ID.getGenes
(OntologyTerm term, Taxon taxon) Find genes for a given of GO term.getGOTerms
(Gene gene) getGOTerms
(Gene gene, boolean includePartOf, GeneOntologyServiceImpl.GOAspect goAspect) Get all GO terms for a gene, including parents of terms via is-a relationships; and optionally also parents via part-of relationships.getResource
(String goId) Retrieve a GO resource by ID or URI.Retrieve a GO term by ID or URI.getTermAspect
(String goId) getTermAspect
(Characteristic goId) getTermDefinition
(String goId) Return a definition for a GO ID.getTermIndividuals
(String goId) Retrieve a GO individuals by ID or URI.getValueObject
(OntologyTerm term) Converts the given Ontology Term to a Gene Ontology Value Object.getValueObjects
(Collection<OntologyTerm> terms) Converts the given collection of Ontology Terms to Gene Ontology Value Objects.getValueObjects
(Gene gene) Returns GO Terms VOs for the given Gene.void
initialize
(InputStream stream, boolean forceIndexing) boolean
Methods inherited from class ubic.basecode.ontology.providers.AbstractDelegatingOntologyService
cancelInitializationThread, close, findIndividuals, findResources, findTerm, findUsingAlternativeId, getAdditionalPropertyUris, getAllURIs, getChildren, getDescription, getExcludedWordsFromStemming, getInferenceMode, getLanguageLevel, getName, getParents, getProcessImports, index, initialize, isEnabled, isInitializationThreadAlive, isInitializationThreadCancelled, isOntologyLoaded, isSearchEnabled, loadTermsInNameSpace, setAdditionalPropertyUris, setExcludedWordsFromStemming, setInferenceMode, setLanguageLevel, setProcessImports, setSearchEnabled, startInitializationThread, toString, waitForInitializationThread
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.AutoCloseable
close
Methods inherited from interface ubic.basecode.ontology.providers.OntologyService
cancelInitializationThread, findIndividuals, findIndividuals, findResources, findResources, findTerm, findUsingAlternativeId, getAdditionalPropertyUris, getAllURIs, getChildren, getChildren, getDescription, getExcludedWordsFromStemming, getInferenceMode, getLanguageLevel, getName, getParents, getParents, getProcessImports, index, initialize, isEnabled, isInitializationThreadAlive, isInitializationThreadCancelled, isOntologyLoaded, isSearchEnabled, loadTermsInNameSpace, setAdditionalPropertyUris, setExcludedWordsFromStemming, setInferenceMode, setLanguageLevel, setProcessImports, setSearchEnabled, startInitializationThread, waitForInitializationThread
-
Constructor Details
-
GeneOntologyServiceImpl
@Autowired public GeneOntologyServiceImpl(@Value("${url.geneOntology}") String ontologyUrl, @Value("${load.geneOntology}") boolean loadOntology)
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
calculateGoTermOverlap
public Map<Long,Collection<OntologyTerm>> calculateGoTermOverlap(Gene queryGene, Collection<Long> geneIds) Description copied from interface:GeneOntologyService
Given a query Gene, and a collection of gene ids calculates the go term overlap for each pair of queryGene and gene in the given collection. Returns a Map<Gene,Collection<OntologyEntries>>. The key is the gene (from the [queryGene,gene] pair) and the values are a collection of the overlapping ontology entries.
- Specified by:
calculateGoTermOverlap
in interfaceGeneOntologyService
- Parameters:
queryGene
- query genegeneIds
- gene ids- Returns:
- map of gene ids to collections of ontologyTerms. This will always be populated but collection values will be empty when there is no overlap.
-
calculateGoTermOverlap
- Specified by:
calculateGoTermOverlap
in interfaceGeneOntologyService
- Parameters:
queryGene1
- query gene 1queryGene2
- query gene 2- Returns:
- Collection>OntologyEntries<s
-
calculateGoTermOverlap
public Map<Long,Collection<OntologyTerm>> calculateGoTermOverlap(Long queryGene, Collection<Long> geneIds) - Specified by:
calculateGoTermOverlap
in interfaceGeneOntologyService
-
computeOverlap
public Collection<OntologyTerm> computeOverlap(Collection<OntologyTerm> masterTerms, Collection<OntologyTerm> comparisonTerms) - Specified by:
computeOverlap
in interfaceGeneOntologyService
-
findTerm
public Collection<OntologySearchResult<OntologyTerm>> findTerm(String queryString, int maxResults) throws OntologySearchException - Specified by:
findTerm
in interfaceOntologyService
- Throws:
OntologySearchException
-
getAllParents
- Specified by:
getAllParents
in interfaceGeneOntologyService
- Parameters:
entries
- NOTE terms that are in this collection are NOT explicitly included; however, some of them may be included incidentally if they are parents of other terms in the collection.- Returns:
- ontology terms
-
getAllParents
- Specified by:
getAllParents
in interfaceGeneOntologyService
-
getResource
Description copied from interface:GeneOntologyService
Retrieve a GO resource by ID or URI.- Specified by:
getResource
in interfaceGeneOntologyService
- Specified by:
getResource
in interfaceOntologyService
- Overrides:
getResource
in classAbstractDelegatingOntologyService
-
getTerm
Description copied from interface:GeneOntologyService
Retrieve a GO term by ID or URI.- Specified by:
getTerm
in interfaceGeneOntologyService
- Specified by:
getTerm
in interfaceOntologyService
- Overrides:
getTerm
in classAbstractDelegatingOntologyService
-
getTermIndividuals
Description copied from interface:GeneOntologyService
Retrieve a GO individuals by ID or URI.- Specified by:
getTermIndividuals
in interfaceGeneOntologyService
- Specified by:
getTermIndividuals
in interfaceOntologyService
- Overrides:
getTermIndividuals
in classAbstractDelegatingOntologyService
-
getGenes
Description copied from interface:GeneOntologyService
Find genes for a given of GO term.- Specified by:
getGenes
in interfaceGeneOntologyService
- Returns:
- Collection of all genes in the given taxon that are annotated with the given id, including its child terms in the hierarchy, or null if the GO term is not found
-
getGenes
Description copied from interface:GeneOntologyService
Find genes for a given GO term by GO ID.- Specified by:
getGenes
in interfaceGeneOntologyService
- Parameters:
goId
- a GO ID (i.e. GO:000001) or URI- See Also:
-
getGOTerms
- Specified by:
getGOTerms
in interfaceGeneOntologyService
- Parameters:
gene
- Take a gene and return a set of all GO terms including the parents of each GO term- Returns:
- ontology terms
-
getGOTerms
public Collection<OntologyTerm> getGOTerms(Gene gene, boolean includePartOf, @Nullable GeneOntologyServiceImpl.GOAspect goAspect) Description copied from interface:GeneOntologyService
Get all GO terms for a gene, including parents of terms via is-a relationships; and optionally also parents via part-of relationships.- Specified by:
getGOTerms
in interfaceGeneOntologyService
- Parameters:
gene
- geneincludePartOf
- include part ofgoAspect
- limit only to the given aspect (pass null to use all)- Returns:
- ontology terms
-
getTermAspect
- Specified by:
getTermAspect
in interfaceGeneOntologyService
-
getTermAspect
- Specified by:
getTermAspect
in interfaceGeneOntologyService
- Parameters:
goId
- GO ID e.g. GO:0038128 or URI- Returns:
- aspect if found, null otherwise
-
getTermDefinition
Description copied from interface:GeneOntologyService
Return a definition for a GO ID.- Specified by:
getTermDefinition
in interfaceGeneOntologyService
- Parameters:
goId
- e.g. GO:0094491 or URI- Returns:
- Definition or null if there is no definition.
-
getValueObject
Description copied from interface:GeneOntologyService
Converts the given Ontology Term to a Gene Ontology Value Object.- Specified by:
getValueObject
in interfaceGeneOntologyService
- Parameters:
term
- the term to be converted.- Returns:
- value object representing the given term.
-
getValueObjects
Description copied from interface:GeneOntologyService
Converts the given collection of Ontology Terms to Gene Ontology Value Objects.- Specified by:
getValueObjects
in interfaceGeneOntologyService
- Parameters:
terms
- the terms to be converted.- Returns:
- collection of value objects representing the given terms.
-
getValueObjects
Description copied from interface:GeneOntologyService
Returns GO Terms VOs for the given Gene.- Specified by:
getValueObjects
in interfaceGeneOntologyService
- Parameters:
gene
- the Gene to retrieve GO Terms for and convert them to VOs.- Returns:
- Gene Ontology VOs representing all GO Terms associated with the given gene.
-
isBiologicalProcess
- Specified by:
isBiologicalProcess
in interfaceGeneOntologyService
-
clearCaches
public void clearCaches()Description copied from interface:GeneOntologyService
Primarily here for testing, to recover memory.- Specified by:
clearCaches
in interfaceGeneOntologyService
-
initialize
- Specified by:
initialize
in interfaceOntologyService
- Overrides:
initialize
in classAbstractDelegatingOntologyService
-