Metadata-Version: 2.1
Name: obonetx
Version: 0.2
Summary: An Intuitive Way to Parse and Use Obo-Formatted Ontologies
Home-page: https://github.com/kingmanzhang/obonetx
Author: Xingmin (Aaron) Zhang
Author-email: kingmanzhang@gmail.com
License: CC0 1.0
Keywords: obo ontology networkx parser network obonet
Platform: UNKNOWN
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
Classifier: Programming Language :: Python :: 3
Description-Content-Type: text/markdown
Requires-Dist: networkx
Requires-Dist: obonet
Provides-Extra: dev
Requires-Dist: pytest (>=3.7) ; extra == 'dev'
Requires-Dist: pipenv ; extra == 'dev'
Requires-Dist: twine ; extra == 'dev'

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

ObonetX is built on top of [obonet](https://github.com/dhimmel/obonet) and provides an intuitive way to use obo-formatted ontologies. Obonet parses an obo ontology into a [networkx](https://networkx.readthedocs.io/en/stable/overview.html) 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](https://github.com/monarch-initiative/phenol), a java package for parsing and accessing ontologies.

## Usage
Parse and use the Human Phenotype Ontology
```python
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
```bash
pip install obonetx
```





