Ontologyο
The Ontology contains all HPOTerm s and thus reflects the full ontology including links and information about inheritance
Ontology classο
- class pyhpo.ontology.OntologyClass[source]ο
A linked and indexed list of interconnected
HPOTerms.- genesο
Set of all genes associated with the HPOTerms
- Type:
set
- omim_diseasesο
Set of all OMIM-diseases associated with the HPOTerms
- Type:
set
- omim_excluded_diseasesο
Set of all excluded OMIM-diseases associated with the HPOTerms
- Type:
set
get_hpo_objectο
- OntologyClass.get_hpo_object(query)[source]ο
Matches a single HPO term based on its name, synonym or id
- Parameters:
query (str or int) β
str HPO term
Scoliosisstr synonym
Curved spinestr HPO-ID
HP:0002650int HPO term id
2650
- Returns:
A single matching HPO term instance
- Return type:
- Raises:
RuntimeError β No HPO term is found for the provided query
TypeError β The provided query is an unsupported type and canβt be properly converted
ValueError β The provided HPO ID cannot be converted to the correct integer representation
Example
# Search by ID (int) >>> ontology.get_hpo_object(3) HP:0000003 | Multicystic kidney dysplasia # Search by HPO-ID (string) >>> ontology.get_hpo_object('HP:0000003') HP:0000003 | Multicystic kidney dysplasia # Search by term (string) >>> ontology.get_hpo_object('Multicystic kidney dysplasia') HP:0000003 | Multicystic kidney dysplasia # Search by synonym (string) >>> ontology.get_hpo_object('Multicystic renal dysplasia') HP:0000003 | Multicystic kidney dysplasia
matchο
pathο
- OntologyClass.path(query1, query2)[source]ο
Returns the shortest connection between two HPO terms
- Parameters:
query1 (str or int) β HPO term 1, synonym or HPO-ID (HP:00001) to match HPO term id (Integer based) e.g: Abnormality of the nervous system
query2 (str or int) β HPO term 2, synonym or HPO-ID (HP:00001) to match HPO term id (Integer based) e.g: Abnormality of the nervous system
- Return type:
Tuple[int,Tuple[HPOTerm,...],int,int]- Returns:
int β Length of path
tuple β Tuple of HPOTerms in the path
int β Number of steps from term-1 to the common parent
int β Number of steps from term-2 to the common parent
searchο
synonym_matchο
- OntologyClass.synonym_match(query)[source]ο
Searches for actual and synonym term matches If a match is found in any term, that one is returned If no actual match is found, the first match with synonyms is considered
- Parameters:
query (str) β Term to search for
- Returns:
A single HPO term instance
- Return type:
synonym_searchο
to_dataframeο
- OntologyClass.to_dataframe()[source]ο
Creates a Pandas DataFrame from the most important features
Each HPO term is one row, the features are present in columns
- Returns:
The DataFrame of HPO-Terms and their attributes in the following columns
id
strThe HPO Term ID βHP:0000003β (used as index)name
strThe HPO Term name βMulticystic kidney dysplasiaβparents
strConcatenated list of direct parents of HPO terms. Separated by|children
strConcatenated list of direct children of HPO terms. Separated by|ic_omim
floatInformation-content (based on associated OMIM diseases)ic_gene
floatInformation-content (based on associated genes)dTop_l
intMaximum distance to root term (viapyhpo.term.longest_path_to_root())dTop_s
intShortest distance to root term (viapyhpo.term.shortest_path_to_root())dBottom
intLongest graph of children nodes (viapyhpo.term.longest_path_to_bottom())genes
strConcatenated list of associated genes. Separated by|diseases
strConcatenated list of associated OMIM diseases. Separated by|
- Return type:
DataFrame