A Python implementation of the BioPAX object model, and parts of PaxTools.
Project description
PyBioPAX: A python implementation of the BioPAX object model
PyBioPAX implements the BioPAX level 3 object model (http://www.biopax.org/release/biopax-level3-documentation.pdf) as a set of Python classes. It exposes API functions to read OWL files into this object model, and to dump OWL files from this object model. This allows for the processing and creation of BioPAX models natively in Python.
Gyori BM, Hoyt CT (2022). PyBioPAX: biological pathway exchange in Python. Journal of Open Source Software, 7(71), 4136, https://doi.org/10.21105/joss.04136
Installation
PyBioPAX can be installed from PyPI as a package:
$ pip install pybiopax
Usage
Reading an OWL file into a BioPaxModel object:
import pybiopax
model = pybiopax.model_from_owl_file('test.owl')
Writing a BioPaxModel into an OWL file:
import pybiopax
pybiopax.model_to_owl_file(model, 'test.owl')
Querying Pathway Commons to get a BioPaxModel object:
import pybiopax
model = pybiopax.model_from_pc_query('pathsfromto', ['MAP2K1'], ['MAPK1'])
Working with the elements of the Python object model:
import pybiopax
model = pybiopax.model_from_pc_query('pathsfromto', ['MAP2K1'], ['MAPK1'])
# Each BioPaxModel instance has an objects attribute which is a dict
# whose keys are object URIs (strings) and values are BioPaxObject instances.
assert isinstance(model.objects, dict)
assert all(isinstance(obj, pybiopax.biopax.BioPaxObject)
for obj in model.objects.values())
# Let's look at a specific object
bcr = model.objects['BiochemicalReaction_4f689747397d98089c551022a3ae2d88']
# This is a BiochemicalReaction which has a left and a right side. All list/set
# types per the BioPAX specification are represented as lists in the Python
# object model
# Both left and right consist of a single protein
left = bcr.left[0]
assert isinstance(left, pybiopax.biopax.Protein)
assert left.display_name == 'ERK1-2'
right = bcr.right[0]
assert isinstance(right, pybiopax.biopax.Protein)
assert right.display_name == 'ERK1-2-active'
We can also use the pybiopax.paths
module to construct iterators over
objects based on a string specification from a given starting point.
Continuing from the block of code above, we take the BiochemicalReaction
bcr
and link to reactants on its left hand side, then linking to their
entity references, and finally linking back to all the physical entities
that those are references of.
from pybiopax.paths import find_objects
erks = find_objects(bcr, 'left/entity_reference/entity_reference_of')
Contribution and support
To contribute to the code, please submit a pull request after reading the contribution guidelines. To report bugs and issues, or ask questions related to PyBioPAX, please submit an issue.
Funding
Development of this software was supported by the Defense Advanced Research Projects Agency under award W911NF-15-1-0544 and the National Cancer Institute under award U54-CA225088.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pybiopax-0.1.2.tar.gz
.
File metadata
- Download URL: pybiopax-0.1.2.tar.gz
- Upload date:
- Size: 3.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c390ac35fcdf8e290c921137d7a3bf643ad2f8d3092a96dfb6915111ee4f4e15 |
|
MD5 | 3c6687ffd8aba6e1332c0402c9337e1d |
|
BLAKE2b-256 | 8175d891cd9d53364f43e14a572521d85564dcb9595b8c20334800482ccbf1a1 |
File details
Details for the file pybiopax-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: pybiopax-0.1.2-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33a96994bc0488b4ced556bc977bd6dbe5345a06dad0fcd993dab2f6cd6cea96 |
|
MD5 | 113df42d5119f573cd0e12e7e597c01b |
|
BLAKE2b-256 | 2eb5ce9ce782f2f9fb40d09359462f8f88eba2f72c0abb90aa848140798eb165 |