Skip to main content

An Intuitive Way to Parse and Use Obo-Formatted Ontologies

Project description

obonetx: an intuitive way to use obonet for OBO-formatted ontologies

ObonetX is built on top of obonet and provides an intuitive way to use obo-formatted ontologies. Obonet parses an obo ontology into a networkx graph and expects users to call networkx functions to access ontology resources. While this approach takes full advantages of the power of networkx, it is not easy for users who are not familiar with networkx and not intuitive to manage an ontology. This package provides a wrapper of networkx graph models as an Ontology class and simplies the way to use an ontology. Many ideas are from phenol, a java package for parsing and accessing ontologies.

Usage

Parse and use the Human Phenotype Ontology

from obonetx.ontology import Ontology

# use an url or file path
hpo_url = 'http://purl.obolibrary.org/obo/hp.obo'
hpo = Ontology(hpo_url)

# show root id
hpo.get_root_id()

# show all terms (term id as a set)
hpo.terms()

# show ancestor terms for HP:3000072 Abnormal levator palpebrae superioris morphology, excluding itself
hpo.ancestors(term_id='HP:3000072', include_self=False)

# show descendants of HP:0008050 Abnormality of the palpebral fissures, excluding itself
hpo.descendants(term_id='HP:0008050', include_self=False)

# show parents of HP:3000072 Abnormal levator palpebrae superioris morphology, excluding itself
hpo.parents(term_id='HP:3000072', include_self=False)

# show children of HP:3000072 Abnormal levator palpebrae superioris morphology, excluding itself
hpo.children(term_id='HP:3000072', include_self=False)

# check if there is a path between two terms
hpo.exists_path(src_id='HP:3000072', dest_id='HP:0000492')

# check if two terms are siblings
hpo.terms_are_siblings(t1='HP:3000072', t2='HP:0000492')

# retrieve a map from term_id to term_label
hpo.term_id_2_label_map()

# retrieve the underlying networkx graph model
hpo.nx_graph()

Contributing

We welcome feature suggestions and community contributions.

Installation

Install from pypi

pip install obonetx

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

obonetx-0.3.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

obonetx-0.3-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file obonetx-0.3.tar.gz.

File metadata

  • Download URL: obonetx-0.3.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.7

File hashes

Hashes for obonetx-0.3.tar.gz
Algorithm Hash digest
SHA256 f8f1b38eb6d06f860977a9e90fad1b371d87a16cac601487aafa787d998f4e32
MD5 bbf6266e1d70417e4b0bccb326388079
BLAKE2b-256 7a87fa5f3959d99fa25f47e2a08aac495ad651d07b5b376a7e59f41098a577ae

See more details on using hashes here.

File details

Details for the file obonetx-0.3-py3-none-any.whl.

File metadata

  • Download URL: obonetx-0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.7

File hashes

Hashes for obonetx-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f078399993bb3eccf9bbf131a86ea6d98bc4e4b99e473bd264d3f10531ebc413
MD5 fb97d4002bc6f57e4a5e04e6d5b4200e
BLAKE2b-256 cba09922c2c95241a4db8676f746f974ae252431d26d88f2a458fea77613128d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page