HPO CLI Examples
The Human Phenotype Ontology (HPO) provides a standardized vocabulary of phenotypic abnormalities encountered in human disease. Each term in the HPO describes a phenotypic abnormality, such as Atrial septal defect.
OBO URL https://obofoundry.org/ontology/hp
Initial configuration
Here we set up alias and convenience functions for use in this Jupyter notebook.
First we will set up an alias for accessing the sqlite version of HPO.
Note this only works in a Jupyter notebook context. On the command line, instead do alias hp=runoak -i sqlite:obo:hp
[7]:
from openpyxl.styles.builtins import output
alias hp runoak -i sqlite:obo:hp
[4]:
!mkdir -p output
[6]:
import pandas as pd
Summary Statistics
[9]:
hp statistics --group-by-prefix -O csv -o output/stats.tsv
[10]:
pd.read_csv("output/stats.tsv", sep="\t")
[10]:
id | compared_with | agents | class_count | deprecated_class_count | non_deprecated_class_count | class_count_with_text_definitions | class_count_without_text_definitions | object_property_count | annotation_property_count | ... | class_count_by_subset_inconsistent_with_fma | class_count_by_subset_major_organ | class_count_by_subset_non_informative | class_count_by_subset_organ_slim | class_count_by_subset_pheno_slim | class_count_by_subset_phenotype_rcn | class_count_by_subset_uberon_slim | class_count_by_subset_unverified_taxonomic_grouping | class_count_by_subset_upper_level | class_count_by_subset_vertebrate_core | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | BFO | NaN | NaN | 11 | 0 | 11 | 0 | 11 | 6 | 0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
1 | BSPO | NaN | NaN | 0 | 0 | 0 | 0 | 0 | 26 | 0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
2 | CHEBI | NaN | NaN | 1849 | 1 | 1848 | 1447 | 402 | 0 | 0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
3 | CL | NaN | NaN | 1151 | 1 | 1150 | 1118 | 33 | 3 | 0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
4 | GO | NaN | NaN | 2563 | 2 | 2561 | 2563 | 0 | 0 | 0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
5 | HP | NaN | NaN | 19434 | 446 | 18988 | 16398 | 3036 | 0 | 1 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
6 | HsapDv | NaN | NaN | 12 | 7 | 5 | 12 | 0 | 0 | 0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
7 | IAO | NaN | NaN | 0 | 0 | 0 | 0 | 0 | 0 | 4 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
8 | MPATH | NaN | NaN | 75 | 0 | 75 | 73 | 2 | 0 | 0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
9 | NBO | NaN | NaN | 64 | 0 | 64 | 22 | 42 | 0 | 0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
10 | OMO | NaN | NaN | 0 | 0 | 0 | 0 | 0 | 0 | 4 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
11 | PATO | NaN | NaN | 567 | 0 | 567 | 562 | 5 | 0 | 0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
12 | PR | NaN | NaN | 206 | 0 | 206 | 206 | 0 | 0 | 0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
13 | RO | NaN | NaN | 1 | 0 | 1 | 1 | 0 | 158 | 2 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
14 | UBERON | NaN | NaN | 5605 | 0 | 5605 | 5130 | 475 | 0 | 0 | ... | 2.0 | 23.0 | 49.0 | 135.0 | 1724.0 | 8.0 | 899.0 | 2.0 | 50.0 | 462.0 |
15 | dce | NaN | NaN | 0 | 0 | 0 | 0 | 0 | 0 | 8 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
16 | dcterms | NaN | NaN | 0 | 0 | 0 | 0 | 0 | 0 | 6 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
17 | obo | NaN | NaN | 0 | 0 | 0 | 0 | 0 | 32 | 83 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
18 | oio | NaN | NaN | 0 | 0 | 0 | 0 | 0 | 0 | 19 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
19 | owl | NaN | NaN | 0 | 0 | 0 | 0 | 0 | 0 | 1 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
20 | rdfs | NaN | NaN | 0 | 0 | 0 | 0 | 0 | 0 | 2 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
21 rows × 541 columns
Lookup by Label
[25]:
hp info 'Tibial bowing'
HP:0002982 ! Tibial bowing
[26]:
hp info 'Short tibia' 'Tibial bowing'
HP:0005736 ! Short tibia
HP:0002982 ! Tibial bowing
Search
We can use the OAK search syntax to find labels with a partial match to “tibia”
[11]:
hp info l~tibia
HP:0002982 ! Tibial bowing
HP:0002992 ! Abnormal tibia morphology
HP:0003832 ! Abnormality of the tibial plateaux
HP:0003833 ! Laterally deficient tibial plateaux
HP:0005028 ! Widened proximal tibial metaphyses
HP:0005736 ! Short tibia
HP:0005766 ! Disproportionate shortening of the tibia
HP:0005772 ! Aplasia/Hypoplasia of the tibia
HP:0005892 ! Proximal tibial and fibular fusion
HP:0005929 ! Synostosis involving the tibia
HP:0006379 ! Proximal tibial hypoplasia
HP:0006390 ! Anterior tibial bowing
HP:0006413 ! Broad tibial metaphyses
HP:0006414 ! Distal tibial bowing
HP:0006423 ! Peg-like central prominence of distal tibial metaphyses
HP:0006426 ! Rudimentary to absent tibiae
HP:0006436 ! obsolete Shortening of the tibia
HP:0006456 ! Irregular proximal tibial epiphyses
HP:0006491 ! Abnormal tibial metaphysis morphology
HP:0006508 ! Abnormality of tibial epiphyses
HP:0008963 ! Tibialis muscle weakness
HP:0009556 ! Absent tibia
HP:0009736 ! Tibial pseudarthrosis
HP:0010504 ! Increased length of the tibia
HP:0010591 ! Abnormality of the proximal tibial epiphysis
HP:0010592 ! Abnormality of the distal tibial epiphysis
HP:0011399 ! Tibialis anterior muscle atrophy
HP:0012221 ! Pretibial blistering
HP:0012284 ! Small proximal tibial epiphyses
HP:0012564 ! Premature epimetaphyseal fusion in tibia
HP:0030292 ! Tibial metaphyseal irregularity
HP:0030294 ! Metaphyseal chondromatosis of tibia
HP:0030308 ! Flared distal tibial metaphysis
HP:0031173 ! Tibial spur
HP:0031260 ! Triangular tibia
HP:0031305 ! Tibial arterial calcification
HP:0032538 ! Pretibial dimple
HP:0034372 ! Internal tibial torsion
HP:0034373 ! External tibial torsion
HP:0034517 ! Pretibial hyperpigmentation
HP:0041089 ! Avulsion fractured tibia
HP:0041143 ! Fractured tibia
HP:0100341 ! Tibial deviation of the 4th toe
HP:0100343 ! Tibial deviation of the 3rd toe
HP:0100345 ! Tibial deviation of the 2nd toe
HP:0100347 ! Tibial deviation of the 5th toe
HP:0100499 ! Tibial deviation of toes
HP:0100694 ! Tibial torsion
HP:0200028 ! Pretibial myxedema
HP:6000778 ! Cone-shaped distal tibial epiphysis
HP:6000809 ! Thickened tibial cortex
HP:6000867 ! Delayed tibial epiphyseal ossification
HP:6000886 ! Enlarged distal tibial epiphysis
HP:6000951 ! Flared proximal tibial metaphysis
UBERON:0000313 ! portion of cartilage tissue in tibia
UBERON:0000979 ! tibia
UBERON:0001323 ! tibial nerve
UBERON:0001385 ! tibialis anterior
UBERON:0001545 ! anterior tibial vein
UBERON:0001546 ! posterior tibial vein
UBERON:0001667 ! tibialis posterior
UBERON:0004098 ! tibial plateaux
UBERON:0004383 ! epiphysis of tibia
UBERON:0004405 ! distal epiphysis of tibia
UBERON:0004499 ! skeletal muscle tissue of tibialis anterior
UBERON:0007610 ! tibial artery
UBERON:0008230 ! tibialis
UBERON:0008772 ! proximal epiphysis of tibia
UBERON:0009989 ! condyle of tibia
UBERON:0010370 ! tibial vein
UBERON:0010849 ! tibia cartilage element
UBERON:0010850 ! tibia pre-cartilage condensation
UBERON:0013280 ! diaphysis of tibia
UBERON:0013750 ! metaphysis of tibia
UBERON:0015004 ! tibia endochondral element
UBERON:7500062 ! tibial tuberosity
Note that the OWL version of HP includes merged imports of parts of other ontologies. To constrain search to only HPO we can do a conjunction query with ID space:
[27]:
hp info l~tibia .and i^HP:
HP:0002982 ! Tibial bowing
HP:0002992 ! Abnormal tibia morphology
HP:0003832 ! Abnormality of the tibial plateaux
HP:0003833 ! Laterally deficient tibial plateaux
HP:0005028 ! Widened proximal tibial metaphyses
HP:0005736 ! Short tibia
HP:0005766 ! Disproportionate shortening of the tibia
HP:0005772 ! Aplasia/Hypoplasia of the tibia
HP:0005892 ! Proximal tibial and fibular fusion
HP:0005929 ! Synostosis involving the tibia
HP:0006379 ! Proximal tibial hypoplasia
HP:0006390 ! Anterior tibial bowing
HP:0006413 ! Broad tibial metaphyses
HP:0006414 ! Distal tibial bowing
HP:0006423 ! Peg-like central prominence of distal tibial metaphyses
HP:0006426 ! Rudimentary to absent tibiae
HP:0006436 ! obsolete Shortening of the tibia
HP:0006456 ! Irregular proximal tibial epiphyses
HP:0006491 ! Abnormal tibial metaphysis morphology
HP:0006508 ! Abnormality of tibial epiphyses
HP:0008963 ! Tibialis muscle weakness
HP:0009556 ! Absent tibia
HP:0009736 ! Tibial pseudarthrosis
HP:0010504 ! Increased length of the tibia
HP:0010591 ! Abnormality of the proximal tibial epiphysis
HP:0010592 ! Abnormality of the distal tibial epiphysis
HP:0011399 ! Tibialis anterior muscle atrophy
HP:0012221 ! Pretibial blistering
HP:0012284 ! Small proximal tibial epiphyses
HP:0012564 ! Premature epimetaphyseal fusion in tibia
HP:0030292 ! Tibial metaphyseal irregularity
HP:0030294 ! Metaphyseal chondromatosis of tibia
HP:0030308 ! Flared distal tibial metaphysis
HP:0031173 ! Tibial spur
HP:0031260 ! Triangular tibia
HP:0031305 ! Tibial arterial calcification
HP:0032538 ! Pretibial dimple
HP:0034372 ! Internal tibial torsion
HP:0034373 ! External tibial torsion
HP:0034517 ! Pretibial hyperpigmentation
HP:0041089 ! Avulsion fractured tibia
HP:0041143 ! Fractured tibia
HP:0100341 ! Tibial deviation of the 4th toe
HP:0100343 ! Tibial deviation of the 3rd toe
HP:0100345 ! Tibial deviation of the 2nd toe
HP:0100347 ! Tibial deviation of the 5th toe
HP:0100499 ! Tibial deviation of toes
HP:0100694 ! Tibial torsion
HP:0200028 ! Pretibial myxedema
HP:6000778 ! Cone-shaped distal tibial epiphysis
HP:6000809 ! Thickened tibial cortex
HP:6000867 ! Delayed tibial epiphyseal ossification
HP:6000886 ! Enlarged distal tibial epiphysis
HP:6000951 ! Flared proximal tibial metaphysis
[12]:
hp labels l~tibia > output/search-tibia.tsv
[13]:
pd.read_csv("output/search-tibia.tsv", sep="\t")
[13]:
id | label | |
---|---|---|
0 | HP:0002982 | Tibial bowing |
1 | HP:0002992 | Abnormal tibia morphology |
2 | HP:0003832 | Abnormality of the tibial plateaux |
3 | HP:0003833 | Laterally deficient tibial plateaux |
4 | HP:0005028 | Widened proximal tibial metaphyses |
... | ... | ... |
71 | UBERON:0010850 | tibia pre-cartilage condensation |
72 | UBERON:0013280 | diaphysis of tibia |
73 | UBERON:0013750 | metaphysis of tibia |
74 | UBERON:0015004 | tibia endochondral element |
75 | UBERON:7500062 | tibial tuberosity |
76 rows × 2 columns
Basic Lookup
[14]:
hp info HP:0002982
HP:0002982 ! Tibial bowing
[17]:
hp info HP:0002982 -O obo
[Term]
id: HP:0002982
name: Tibial bowing
def: "A bending or abnormal curvature of the tibia." [orcid:0000-0002-0736-9199]
xref: UMLS:C1837081
subset: hposlim_core
synonym: "Bowed shankbone" EXACT [orcid:0000-0001-5208-3432]
synonym: "Bowed shinbone" EXACT [orcid:0000-0001-5208-3432]
synonym: "Bowed tibia" EXACT []
synonym: "Bowing of the tibia" EXACT []
is_a: HP:0002979 ! Bowing of the legs
is_a: HP:0002992 ! Abnormal tibia morphology
Basic Graph Operations
[21]:
hp ancestors --predicates rdfs:subClassOf HP:0002982
id label
HP:0000001 All
HP:0000118 Phenotypic abnormality
HP:0000924 Abnormality of the skeletal system
HP:0000940 Abnormal diaphysis morphology
HP:0002813 Abnormal limb bone morphology
HP:0002814 Abnormality of the lower limb
HP:0002979 Bowing of the legs
HP:0002981 Abnormality of the calf
HP:0002982 Tibial bowing
HP:0002992 Abnormal tibia morphology
HP:0006487 Bowing of the long bones
HP:0011314 Abnormal long bone morphology
HP:0011842 Abnormal skeletal morphology
HP:0011844 Abnormal appendicular skeleton morphology
HP:0033127 Abnormality of the musculoskeletal system
HP:0040064 Abnormality of limbs
HP:0040068 Abnormality of limb bone
HP:0040069 Abnormal lower limb bone morphology
[19]:
hp descendants -p i HP:0002982
HP:0002982 ! Tibial bowing
HP:0006390 ! Anterior tibial bowing
HP:0006414 ! Distal tibial bowing
Relationships
[24]:
hp relationships HP:0002982
subject predicate object subject_label predicate_label object_label
HP:0002982 rdfs:subClassOf HP:0002979 Tibial bowing None Bowing of the legs
HP:0002982 rdfs:subClassOf HP:0002992 Tibial bowing None Abnormal tibia morphology
Trees
[22]:
hp tree -p i --down HP:0002982
* [] HP:0000001 ! All
* [i] HP:0000118 ! Phenotypic abnormality
* [i] HP:0033127 ! Abnormality of the musculoskeletal system
* [i] HP:0000924 ! Abnormality of the skeletal system
* [i] HP:0011842 ! Abnormal skeletal morphology
* [i] HP:0011844 ! Abnormal appendicular skeleton morphology
* [i] HP:0011314 ! Abnormal long bone morphology
* [i] HP:0000940 ! Abnormal diaphysis morphology
* [i] HP:0006487 ! Bowing of the long bones
* [i] HP:0002979 ! Bowing of the legs
* [i] **HP:0002982 ! Tibial bowing**
* [i] HP:0006414 ! Distal tibial bowing
* [i] HP:0006390 ! Anterior tibial bowing
* [i] HP:0002813 ! Abnormal limb bone morphology
* [i] HP:0000940 ! Abnormal diaphysis morphology
* [i] HP:0006487 ! Bowing of the long bones
* [i] HP:0002979 ! Bowing of the legs
* [i] **HP:0002982 ! Tibial bowing**
* [i] HP:0006414 ! Distal tibial bowing
* [i] HP:0006390 ! Anterior tibial bowing
* [i] HP:0040069 ! Abnormal lower limb bone morphology
* [i] HP:0002992 ! Abnormal tibia morphology
* [i] **HP:0002982 ! Tibial bowing**
* [i] HP:0006414 ! Distal tibial bowing
* [i] HP:0006390 ! Anterior tibial bowing
* [i] HP:0040068 ! Abnormality of limb bone
* [i] HP:0002813 ! Abnormal limb bone morphology
* [i] HP:0000940 ! Abnormal diaphysis morphology
* [i] HP:0006487 ! Bowing of the long bones
* [i] HP:0002979 ! Bowing of the legs
* [i] **HP:0002982 ! Tibial bowing**
* [i] HP:0006414 ! Distal tibial bowing
* [i] HP:0006390 ! Anterior tibial bowing
* [i] HP:0040069 ! Abnormal lower limb bone morphology
* [i] HP:0002992 ! Abnormal tibia morphology
* [i] **HP:0002982 ! Tibial bowing**
* [i] HP:0006414 ! Distal tibial bowing
* [i] HP:0006390 ! Anterior tibial bowing
* [i] HP:0040064 ! Abnormality of limbs
* [i] HP:0040068 ! Abnormality of limb bone
* [i] HP:0002813 ! Abnormal limb bone morphology
* [i] HP:0000940 ! Abnormal diaphysis morphology
* [i] HP:0006487 ! Bowing of the long bones
* [i] HP:0002979 ! Bowing of the legs
* [i] **HP:0002982 ! Tibial bowing**
* [i] HP:0006414 ! Distal tibial bowing
* [i] HP:0006390 ! Anterior tibial bowing
* [i] HP:0040069 ! Abnormal lower limb bone morphology
* [i] HP:0002992 ! Abnormal tibia morphology
* [i] **HP:0002982 ! Tibial bowing**
* [i] HP:0006414 ! Distal tibial bowing
* [i] HP:0006390 ! Anterior tibial bowing
* [i] HP:0002814 ! Abnormality of the lower limb
* [i] HP:0002981 ! Abnormality of the calf
* [i] HP:0002979 ! Bowing of the legs
* [i] **HP:0002982 ! Tibial bowing**
* [i] HP:0006414 ! Distal tibial bowing
* [i] HP:0006390 ! Anterior tibial bowing
* [i] HP:0002992 ! Abnormal tibia morphology
* [i] **HP:0002982 ! Tibial bowing**
* [i] HP:0006414 ! Distal tibial bowing
* [i] HP:0006390 ! Anterior tibial bowing
* [i] HP:0040069 ! Abnormal lower limb bone morphology
* [i] HP:0002992 ! Abnormal tibia morphology
* [i] **HP:0002982 ! Tibial bowing**
* [i] HP:0006414 ! Distal tibial bowing
* [i] HP:0006390 ! Anterior tibial bowing
Graph Visualization
[23]:
hp viz -p i HP:0002982 -o output/graph-tb.png
Semantic Similarity
[29]:
hp similarity "Tibial bowing" @ "Short tibia"
subject_id: HP:0002982
subject_label: Tibial bowing
object_id: HP:0005736
object_label: Short tibia
ancestor_id: HP:0002992
ancestor_label: Abnormal tibia morphology
object_information_content: 13.359841052540446
subject_information_content: 13.359841052540446
ancestor_information_content: 9.659401334399353
jaccard_similarity: 0.56
phenodigm_score: 2.325782609631356
Associations
[32]:
!curl -L -s http://purl.obolibrary.org/obo/hp/hpoa/genes_to_phenotype.txt > output/hpoa_g2p.tsv
[36]:
hp -G hpoa_g2p -g output/hpoa_g2p.tsv associations -Q subject NCBIGene:8192 -O csv > output/assocs-query.tsv
[37]:
pd.read_csv("output/assocs-query.tsv", sep="\t")
[37]:
subject | predicate | object | property_values | subject_label | predicate_label | object_label | negated | publications | evidence_type | supporting_objects | primary_knowledge_source | aggregator_knowledge_source | subject_closure | subject_closure_label | object_closure | object_closure_label | comments | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | NCBIGene:8192 | NaN | HP:0001250 | NaN | CLPP | NaN | Seizure | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
1 | NCBIGene:8192 | NaN | HP:0000013 | NaN | CLPP | NaN | Hypoplasia of the uterus | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
2 | NCBIGene:8192 | NaN | HP:0000007 | NaN | CLPP | NaN | Autosomal recessive inheritance | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
3 | NCBIGene:8192 | NaN | HP:0010464 | NaN | CLPP | NaN | Streak ovary | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
4 | NCBIGene:8192 | NaN | HP:0008232 | NaN | CLPP | NaN | Elevated circulating follicle stimulating horm... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
5 | NCBIGene:8192 | NaN | HP:0011969 | NaN | CLPP | NaN | Elevated circulating luteinizing hormone level | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
6 | NCBIGene:8192 | NaN | HP:0004322 | NaN | CLPP | NaN | Short stature | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
7 | NCBIGene:8192 | NaN | HP:0000786 | NaN | CLPP | NaN | Primary amenorrhea | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
8 | NCBIGene:8192 | NaN | HP:0000815 | NaN | CLPP | NaN | Hypergonadotropic hypogonadism | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
9 | NCBIGene:8192 | NaN | HP:0000252 | NaN | CLPP | NaN | Microcephaly | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
10 | NCBIGene:8192 | NaN | HP:0000407 | NaN | CLPP | NaN | Sensorineural hearing impairment | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
[ ]: