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
HPOTerm
s.-
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: Union[int, str]) → pyhpo.term.HPOTerm[source]¶ Matches a single HPO term based on its name, synonym or id
- Parameters
query (str or int) –
str HPO term
Scoliosis
str synonym
Curved spine
str HPO-ID
HP:0002650
int HPO term id
2650
- Returns
A single matching HPO term instance
- Return type
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¶
-
OntologyClass.
match
(query: str) → pyhpo.term.HPOTerm[source]¶ Matches a single HPO term based on its name
- Parameters
query (str) – HPO term to match e.g: Abnormality of the nervous system
- Returns
A single matching HPO term instance
- Return type
path¶
-
OntologyClass.
path
(query1: Union[int, str], query2: Union[int, str]) → Tuple[int, Tuple[pyhpo.term.HPOTerm, …], int, int][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
- 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¶
-
OntologyClass.
search
(query: str) → Iterator[pyhpo.term.HPOTerm][source]¶ Iterator function for substring search for terms and synonyms in the ontology
- Parameters
query (str) – Term to search for
- Yields
HPOTerm – Every matching HPO term instance
synonym_match¶
-
OntologyClass.
synonym_match
(query: str) → pyhpo.term.HPOTerm[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¶
-
OntologyClass.
synonym_search
(term: pyhpo.term.HPOTerm, query: str) → bool[source]¶ Indicates whether a term has a synonym that contains the query. Substring search in synonym
- Parameters
term (HPOTerm) – Term to check
query (str) – Synonym substring
- Returns
Indicates if
term
containsquery
as a synonym- Return type
bool
to_dataframe¶
-
OntologyClass.
to_dataframe
() → pandas.core.frame.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
str
The HPO Term ID “HP:0000003” (used as index)name
str
The HPO Term name “Multicystic kidney dysplasia”parents
str
Concatenated list of direct parents of HPO terms. Separated by|
children
str
Concatenated list of direct children of HPO terms. Separated by|
ic_omim
float
Information-content (based on associated OMIM diseases)ic_gene
float
Information-content (based on associated genes)dTop_l
int
Maximum distance to root term (viapyhpo.term.longest_path_to_root()
)dTop_s
int
Shortest distance to root term (viapyhpo.term.shortest_path_to_root()
)dBottom
int
Longest graph of children nodes (viapyhpo.term.longest_path_to_bottom()
)genes
str
Concatenated list of associated genes. Separated by|
diseases
str
Concatenated list of associated OMIM diseases. Separated by|
- Return type
DataFrame