HPOTermο
- class HPOTermο
- all_parentsο
A set of all parents
- Returns
All direct and indirect parents
- Return type
Set[
HPOTerm]
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(108) term.all_parents # >> {large set}
- categoriesο
A list of the root phenotypical or modifier categories the term belongs to
- Returns
The root phenotypical terms or modifier categories
- Return type
Set[
HPOTerm]- Raises
NameError β Ontology not yet constructed
KeyError β No HPO term is found for the provided query
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(10049) for cat in term.categories: print(cat.name)
- child_of(other)ο
Returns true if the term is a child of
other- Parameters
other (
HPOTerm) β The other HPOTerm- Returns
Whether the term is a child of
other- Return type
bool
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(10049) term2 = Ontology.hpo(118) term.child_of(term2) # >> True
- childrenο
A set of direct children
- Returns
All direct children
- Return type
Set[
HPOTerm]
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(1) term.children # >> {<HpoTerm (HP:0000005)>, <HpoTerm (HP:0000118)>, <HpoTerm (HP:0012823)>, <HpoTerm (HP:0032443)>, <HpoTerm (HP:0040279)>, <HpoTerm (HP:0032223)>}
- common_ancestors(other)ο
Returns common ancestor
HPOTermNote
If the two terms have a parent - child relation, the parent term will be included in the output as a
common ancestor.- Parameters
other (
HPOTerm) β The other HPOTerm- Returns
All terms that are common ancestors
- Return type
set[
HPOTerm]
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(2650) term2 = Ontology.hpo(9121) term.common_ancestors(term2) # >> {<HpoTerm (HP:0000001)>, <HpoTerm (HP:0011842)>, # >> <HpoTerm (HP:0033127)>, <HpoTerm (HP:0000118)>, # >> <HpoTerm (HP:0000924)>}
- count_parents()ο
Returns the number of direct parents of the term
- Returns
The number of parents of the term
- Return type
int
Examples
from pyhpo import Ontology Ontology() Ontology.hpo(100490).count_parents() # >> 3
- genesο
Returns a set of associated genes
The list includes βinheritedβ genes that are not directly linked to the term, but to one of its children
- Returns
All associated genes
- Return type
Set[
pyhpo.Gene]
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(188) for gene in term.genes: print(gene.name)
- idο
Returns the HPO Term ID
- Returns
The term identifier, e.g.:
HP:0011968- Return type
str
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(11968) term.id # >> 'HP:0011968'
- information_contentο
Returns the Information Content of the HPO Term
- Returns
The termβs information content
- Return type
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(11968) term.information_content.omim # >> 2.5363943576812744 term.information_content.gene # >> 1.457185983657837
- is_obsoleteο
Indicates if the term is flagged as obsolete
Obsolete terms are ususally not linked to parents or children and should not be used.
In most cases, you can find a replacement using
HPOTerm::replaced_by()- Returns
True if the term is obsolete
- Return type
bool
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(10049) term.is_obsolete # ==> False
- nameο
Returns the name of the HPO Term
- Returns
The term name, e.g.:
Feeding difficulties- Return type
str
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(11968) term.name # >> 'Feeding difficulties'
- omim_diseasesο
Returns a set of associated OMIM diseases
The list includes βinheritedβ diseases that are not directly linked to the term, but to one of its children
- Returns
All associated Omim diseases
- Return type
Set[
pyhpo.Omim]
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(188) for disease in term.omim_diseases: print(disease.name)
- orpha_diseasesο
Returns a set of associated ORPHA diseases
The list includes βinheritedβ diseases that are not directly linked to the term, but to one of its children
- Returns
All associated Orpha diseases
- Return type
Set[
pyhpo.Orpha]
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(188) for disease in term.orpha_diseases: print(disease.name)
- parent_ids()ο
Returns a list of all direct parentβs HPO-IDs
- Returns
A list of
intrepresentations of the parent terms- Return type
List[int]
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(10049) term.parent_ids() # >> [3026, 5914]
- parent_of(other)ο
Returns true if the term is a parent of
other- Parameters
other (
HPOTerm) β The other HPOTerm- Returns
Whether the term is a parent of
other- Return type
bool
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(10049) term2 = Ontology.hpo(118) term2.parent_of(term) # >> True
- parentsο
A set of direct parents
- Returns
All direct parents
- Return type
Set[
HPOTerm]
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(108) term.parents # >> {<HpoTerm (HP:0011035)>, <HpoTerm (HP:0000107)>, <HpoTerm (HP:0100957)>}
- path_to_other(other)ο
Calculates the shortest path to another HPO Term
Note
This method is only partially implemented: The returned path is correct, but it will always indicate
0for the sub-paths distances.- Parameters
other (
HPOTerm) β The other HPOTerm- Returns
int β The number of terms between self and the other term (excluding
self, but includingother)List[
HPOTerm] β The terms between and includingselfandotherint β Always
0int β Always
0
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(40064) term2 = Ontology.hpo(769) term.path_to_other(term2) # >> ( # >> 2, # >> [<HpoTerm (HP:0040064)>, <HpoTerm (HP:0000118)>, <HpoTerm (HP:0000769)>], # >> 0, # >> 0 # >> )
- replace()ο
Returns the replacement term, if the term is obsolete
- Returns
The HPOterm
- Return type
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(100637) replacement = term.replace() replacement.id # >> 'HP:0012720'
- replaced_byο
Returns the replacement term name, if the term is obsolete
- Returns
The HPO term id, e.g.
HP:0003026- Return type
str
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(100637) term.replaced_by # >> 'HP:0012720'
- shortest_path_to_parent(other)ο
Calculates the shortest path to an ancestor HPO Term
If other is not a parent term, the distance will be Inf.
As a minor difference to PyHPO, this method does not return a Tuple, but a list of terms.
- Parameters
other (
HPOTerm) β The other HPOTerm- Returns
float β The number of terms between self and the other term. If
otheris not a parent, it returnsInfList[
HPOTerm] β The terms between self andother
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(100490) term2 = Ontology.hpo(1) term.shortest_path_to_parent(term2) # >> ( # >> 8.0, # >> [ # >> <HpoTerm (HP:0006261)>, <HpoTerm (HP:0005918)>, # >> <HpoTerm (HP:0001167)>, <HpoTerm (HP:0001155)>, # >> <HpoTerm (HP:0002817)>, <HpoTerm (HP:0040064)>, # >> <HpoTerm (HP:0000118)>, <HpoTerm (HP:0000001)> # >> ] # >> )
- shortest_path_to_root()ο
Returns the number of terms between self and the root term
- Returns
The number of terms between self and the root term
- Return type
int
Examples
from pyhpo import Ontology Ontology() Ontology.hpo(100490).shortest_path_to_root() # >> 8
- similarity_score(other, kind, method)ο
Calculates the similarity score of two HPO Terms
- Parameters
other (
HPOTerm) β The other HPOTermkind (str, default:
omim) βWhich kind of information content to use for similarity calculation
Available options:
omim
orpha
gene
method (str, default graphic) β
The method to use to calculate the similarity.
Available options:
resnik - Resnik P, Proceedings of the 14th IJCAI, (1995)
lin - Lin D, Proceedings of the 15th ICML, (1998)
jc - Jiang J, Conrath D, ROCLING X, (1997) This is different to PyHPO
jc2 - Jiang J, Conrath D, ROCLING X, (1997) Same as jc, but kept for backwards compatibility
rel - Relevance measure - Schlicker A, et.al., BMC Bioinformatics, (2006)
ic - Information coefficient - Li B, et. al., arXiv, (2010)
graphic - Graph based Information coefficient - Deng Y, et. al., PLoS One, (2015)
dist - Distance between terms
- Returns
The similarity score
- Return type
float
- Raises
KeyError β Invalid
kindRuntimeError β Invalid
method
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(11968) term.similarity_score(Ontology.hpo(1743) # compare HP:0011968 and HP:0001743 using Gene term.similarity_score(Ontology.hpo(1743), kind="gene")
- similarity_scores(others, kind, method)ο
Calculates the similarity score between the term and a batch of other terms
This method is useful if you want to compare the term to thousands of other terms. It will utilize all avaible CPU for parallel processing.
- Parameters
others (List[
HPOTerm]) β Lost ofHPOTermto calculate similarity tokind (str, default:
omim) βWhich kind of information content to use for similarity calculation
Available options:
omim
orpha
gene
method (str, default graphic) β
The method to use to calculate the similarity.
Available options:
resnik - Resnik P, Proceedings of the 14th IJCAI, (1995)
lin - Lin D, Proceedings of the 15th ICML, (1998)
jc - Jiang J, Conrath D, ROCLING X, (1997) This is different to PyHPO
jc2 - Jiang J, Conrath D, ROCLING X, (1997) Same as jc, but kept for backwards compatibility
rel - Relevance measure - Schlicker A, et.al., BMC Bioinformatics, (2006)
ic - Information coefficient - Li B, et. al., arXiv, (2010)
graphic - Graph based Information coefficient - Deng Y, et. al., PLoS One, (2015)
dist - Distance between terms
- Returns
The similarity scores
- Return type
List[float]
- Raises
KeyError β Invalid
kindRuntimeError β Invalid
method
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(11968) term.similarity_scores(list(Ontology))
- toJSON(verbose)ο
Returns a dict/JSON representation the HPOTerm
- Parameters
verbose (bool) β if extra attributes should be included
- Returns
Dict representation of the
HPOTermwith the following keys:- namestr
The name of the HPO term
- idstr
The HPO term ID e.g.:
HP:0000265
- intint
Integer of the term ID, e.g.:
265
- synonymlist[str]
Not implemented, will always be
[]
- commentstr
Not implemented, will always be
""
- definitionstr
Not implemented, will always be
""
- xreflist[str]
Not implemented, will always be
[]
- is_alist[str]
Not implemented, will always be
[]
- icdict[str, float]
The information content scores, see
pyhpo.InformationContent
- Return type
Dict
Examples
from pyhpo import Ontology Ontology() term = Ontology.hpo(118) term.toJSON() # >> {'name': 'Phenotypic abnormality', 'id': 'HP:0000118', 'int': 118} Ontology.hpo(265).toJSON(True) # >> { # >> 'name': 'Mastoiditis', # >> 'id': 'HP:0000265', # >> 'int': 265, # >> 'synonym': [], # >> 'comment': '', # >> 'definition': '', # >> 'xref': [], # >> 'is_a': [], # >> 'ic': { # >> 'gene': 6.7086944580078125, # >> 'omim': 7.392647743225098, # >> 'orpha': 0.0, # >> 'decipher': 0.0 # >> } # >> }
- class InformationContentο
Holds the information content for an
HPOTerm- customο
Returns the custom defined information content
- geneο
Returns the gene - based information content
- omimο
Returns the Omim disease - based information content
- orphaο
Returns the Orpha disease - based information content