Class GeneOntologyServiceImpl
- java.lang.Object
-
- ubic.basecode.ontology.jena.AbstractOntologyService
-
- ubic.basecode.ontology.jena.AbstractOntologyMemoryBackedService
-
- ubic.gemma.core.ontology.providers.GeneOntologyServiceImpl
-
- All Implemented Interfaces:
DisposableBean
,InitializingBean
,OntologyService
,GeneOntologyService
@Service public class GeneOntologyServiceImpl extends AbstractOntologyMemoryBackedService implements GeneOntologyService, InitializingBean, DisposableBean
Holds a complete copy of the GeneOntology. This gets loaded on startup.- Author:
- pavlidis
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GeneOntologyServiceImpl.GOAspect
-
Nested classes/interfaces inherited from interface ubic.basecode.ontology.providers.OntologyService
OntologyService.InferenceMode, OntologyService.LanguageLevel
-
-
Field Summary
-
Fields inherited from interface ubic.gemma.core.ontology.providers.GeneOntologyService
BASE_GO_URI
-
-
Constructor Summary
Constructors Constructor Description GeneOntologyServiceImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
static String
asRegularGoId(String uri)
static String
asRegularGoId(OntologyTerm term)
static String
asRegularGoId(Characteristic term)
Map<Long,Collection<OntologyTerm>>
calculateGoTermOverlap(Long queryGene, Collection<Long> geneIds)
Map<Long,Collection<OntologyTerm>>
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.Collection<OntologyTerm>
calculateGoTermOverlap(Gene queryGene1, Gene queryGene2)
void
clearCaches()
Primarily here for testing, to recover memory.Collection<OntologyTerm>
computeOverlap(Collection<OntologyTerm> masterTerms, Collection<OntologyTerm> comparisonTerms)
void
destroy()
Collection<OntologyTerm>
findTerm(String queryString)
Search by inexact stringSet<OntologyTerm>
getAllParents(Collection<OntologyTerm> entries)
Set<OntologyTerm>
getAllParents(Collection<OntologyTerm> entries, boolean includePartOf)
Collection<Gene>
getGenes(String goId, Taxon taxon)
Collection<OntologyTerm>
getGOTerms(Long gene, boolean includePartOf, GeneOntologyServiceImpl.GOAspect goAspect)
Collection<OntologyTerm>
getGOTerms(Gene gene)
Collection<OntologyTerm>
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.protected String
getOntologyName()
protected String
getOntologyUrl()
GeneOntologyServiceImpl.GOAspect
getTermAspect(String goId)
GeneOntologyServiceImpl.GOAspect
getTermAspect(Characteristic goId)
String
getTermDefinition(String goId)
Return a definition for a GO Id.OntologyTerm
getTermForId(String goId)
String
getTermName(String goId)
Return human-readable term ("protein kinase") for a GO Id.GeneOntologyTermValueObject
getValueObject(OntologyTerm term)
Converts the given Ontology Term to a Gene Ontology Value Object.List<GeneOntologyTermValueObject>
getValueObjects(Collection<OntologyTerm> terms)
Converts the given collection of Ontology Terms to Gene Ontology Value Objects.List<GeneOntologyTermValueObject>
getValueObjects(Gene gene)
Returns GO Terms VOs for the given Gene.void
initialize(InputStream stream, boolean forceIndexing)
boolean
isBiologicalProcess(OntologyTerm term)
-
Methods inherited from class ubic.basecode.ontology.jena.AbstractOntologyMemoryBackedService
loadModel, loadModelFromStream
-
Methods inherited from class ubic.basecode.ontology.jena.AbstractOntologyService
cancelInitializationThread, findIndividuals, findResources, findTerm, findUsingAlternativeId, getAdditionalPropertyUris, getAllURIs, getCacheName, getChildren, getDescription, getInferenceMode, getLanguageLevel, getName, getParents, getProcessImports, getResource, getTerm, getTermIndividuals, index, initialize, isEnabled, isInitializationThreadAlive, isInitializationThreadCancelled, isOntologyLoaded, isSearchEnabled, loadTermsInNameSpace, setAdditionalPropertyUris, 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 ubic.gemma.core.ontology.providers.GeneOntologyService
getTerm
-
Methods inherited from interface ubic.basecode.ontology.providers.OntologyService
cancelInitializationThread, findIndividuals, findIndividuals, findResources, findResources, findTerm, findUsingAlternativeId, getAdditionalPropertyUris, getAllURIs, getChildren, getChildren, getDescription, getInferenceMode, getLanguageLevel, getName, getParents, getParents, getProcessImports, getResource, getTermIndividuals, index, initialize, isEnabled, isInitializationThreadAlive, isInitializationThreadCancelled, isOntologyLoaded, isSearchEnabled, loadTermsInNameSpace, setAdditionalPropertyUris, setInferenceMode, setLanguageLevel, setProcessImports, setSearchEnabled, startInitializationThread, waitForInitializationThread
-
-
-
-
Method Detail
-
asRegularGoId
public static String asRegularGoId(Characteristic term)
- Parameters:
term
- the term- Returns:
- Usual formatted GO id, e.g., GO:0039392
-
asRegularGoId
public static String asRegularGoId(OntologyTerm term)
- Parameters:
term
- ontology term- Returns:
- Usual formatted GO id, e.g., GO:0039392
-
getOntologyName
protected String getOntologyName()
- Specified by:
getOntologyName
in classAbstractOntologyService
-
getOntologyUrl
protected String getOntologyUrl()
- Overrides:
getOntologyUrl
in classAbstractOntologyMemoryBackedService
-
afterPropertiesSet
public void afterPropertiesSet() throws InterruptedException
- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Throws:
InterruptedException
-
destroy
public void destroy() throws Exception
- Specified by:
destroy
in interfaceDisposableBean
- Throws:
Exception
-
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
public Collection<OntologyTerm> calculateGoTermOverlap(Gene queryGene1, Gene queryGene2)
- 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<OntologyTerm> findTerm(String queryString) throws OntologySearchException
Description copied from interface:GeneOntologyService
Search by inexact string- Specified by:
findTerm
in interfaceGeneOntologyService
- Specified by:
findTerm
in interfaceOntologyService
- Parameters:
queryString
- query string- Returns:
- ontology terms
- Throws:
OntologySearchException
-
getAllParents
public Set<OntologyTerm> getAllParents(Collection<OntologyTerm> entries)
- 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
public Set<OntologyTerm> getAllParents(Collection<OntologyTerm> entries, boolean includePartOf)
- Specified by:
getAllParents
in interfaceGeneOntologyService
-
getGenes
public Collection<Gene> getGenes(String goId, Taxon taxon)
- Specified by:
getGenes
in interfaceGeneOntologyService
- Parameters:
goId
- go idtaxon
- taxon- 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
-
getGOTerms
public Collection<OntologyTerm> getGOTerms(Gene gene)
- 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, 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
-
getGOTerms
public Collection<OntologyTerm> getGOTerms(Long gene, boolean includePartOf, GeneOntologyServiceImpl.GOAspect goAspect)
- Parameters:
gene
- genegoAspect
- go aspectincludePartOf
- include part of- Returns:
- collection of ontology terms
-
getTermAspect
public GeneOntologyServiceImpl.GOAspect getTermAspect(Characteristic goId)
- Specified by:
getTermAspect
in interfaceGeneOntologyService
-
getTermAspect
public GeneOntologyServiceImpl.GOAspect getTermAspect(String goId)
- Specified by:
getTermAspect
in interfaceGeneOntologyService
- Parameters:
goId
- GO ID e.g. GO:0038128 (not URI)- Returns:
- aspect if found, null otherwise
-
getTermDefinition
public String getTermDefinition(String goId)
Description copied from interface:GeneOntologyService
Return a definition for a GO Id.- Specified by:
getTermDefinition
in interfaceGeneOntologyService
- Parameters:
goId
- e.g. GO:0094491- Returns:
- Definition or null if there is no definition.
-
getTermForId
public OntologyTerm getTermForId(String goId)
- Specified by:
getTermForId
in interfaceGeneOntologyService
- Parameters:
goId
- e.g. GO_0001312- Returns:
- null if not found
-
getTermName
public String getTermName(String goId)
Description copied from interface:GeneOntologyService
Return human-readable term ("protein kinase") for a GO Id.- Specified by:
getTermName
in interfaceGeneOntologyService
- Parameters:
goId
- go id- Returns:
- term name
-
getValueObject
public GeneOntologyTermValueObject getValueObject(OntologyTerm term)
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
public List<GeneOntologyTermValueObject> getValueObjects(Collection<OntologyTerm> terms)
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
public List<GeneOntologyTermValueObject> getValueObjects(Gene gene)
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
public boolean isBiologicalProcess(OntologyTerm term)
- 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
public void initialize(InputStream stream, boolean forceIndexing)
- Specified by:
initialize
in interfaceOntologyService
- Overrides:
initialize
in classAbstractOntologyService
-
-