Skip to main content

No project description provided

Project description

Python PyPI

Biolink Model Toolkit

Biolink Model Toolkit (BMT): A Python API for working with the Biolink Model.

BMT provides utility functions to look up Biolink Model for classes, relations, and properties based on Biolink CURIEs or external CURIEs that have been mapped to Biolink Model.

Note: Each release of BMT is pinned to a specific version of the Biolink Model to ensure consistency.

Installation

For users

BMT is available on PyPI and can be installed via pip:

pip install bmt

For developers

You can install BMT from GitHub as follows:

# clone the repo
git clone https://github.com/biolink/biolink-model-toolkit

# cd into the folder
cd biolink-model-toolkit

# install
python setup.py install

Documentation

The technical documentation for BMT can be found at https://biolink.github.io/biolink-model-toolkit/

Usage

BMT provides convenience methods to operate on the Biolink Model.

Using this toolkit you can,

  • Get Biolink Model elements corresponding to a given Biolink class or slot name
  • Get Biolink Model elements corresponding to a given external CURIE/IRI
  • Get ancestors for a given Biolink Model element
  • Get descendants for a given Biolink Model element
  • Get parent for a given Biolink Model element
  • Get children for a given Biolink Model element
  • Check whether a given Biolink Model element is part of a specified subset

Using the Toolkit class

The main entrypoint is the Toolkit class that provides various methods for accessing and working with the Biolink Model.

Getting a Biolink Model element based on its name

from bmt import Toolkit
t = Toolkit()
element = t.get_element('gene') # This returns the element for 'biolink:Gene'

Get a Biolink Model element based on its mappings

from bmt import Toolkit
t = Toolkit()
element_name = t.get_element_by_mapping('SEMMEDDB:CAUSES') # This returns 'causes'
element = t.get_element(element_name)

element_name = t.get_element_by_mapping('RO:0002410') # This returns 'causes'
element = t.get_element(element_name)

Get ancestors for a given Biolink Model element

from bmt import Toolkit
t = Toolkit()
ancestors = t.get_ancestors('gene')

The above returns a list of ancestors: ['gene', 'gene or gene product', 'macromolecular machine', 'genomic entity', 'molecular entity', 'biological entity', 'named thing']

Get descendants for a given Biolink Model element

from bmt import Toolkit
t = Toolkit()
descendants = t.get_descendants('gene or gene product')

The above returns a list of descendants: ['gene', 'gene product', 'gene product isoform', 'RNA product', 'noncoding RNA product', 'microRNA', 'RNA product isoform', 'transcript', 'protein', 'protein isoform']

Check whether a given string is a valid Biolink Model category

from bmt import Toolkit
t = Toolkit()
t.is_category('gene') # True
t.is_category('treats') # False

Check whether a given string is a valid Biolink Model predicate

from bmt import Toolkit
t = Toolkit()
t.is_predicate('related to') # True
t.is_predicate('interacts with') # True
t.is_predicate('disease') # False

Using the Toolkit class with different versions of Biolink Model

BMT is pinned to a specific version of Biolink Model at each release. This can be configured to use your custom version of Biolink Model YAML:

from bmt import Toolkit
t = Toolkit('/path/to/biolink-model.yaml')

The path can be a file path or a URL.

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

bmt-0.8.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

bmt-0.8.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file bmt-0.8.0.tar.gz.

File metadata

  • Download URL: bmt-0.8.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.5

File hashes

Hashes for bmt-0.8.0.tar.gz
Algorithm Hash digest
SHA256 608113e4d45a327e345ea1e5f90972d528e84409b163f632101f992a7713cbb9
MD5 4cf3e562e9d6f3a26b72c3b46e9be83f
BLAKE2b-256 d1d9d4480e47ec179c253934794d3dd0e7c808e5446cd439a11ec616bffc4b41

See more details on using hashes here.

Provenance

File details

Details for the file bmt-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: bmt-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.5

File hashes

Hashes for bmt-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db59c0153226990231da8d33984ea883c125613c4b1748e3d66f8433cdbca45d
MD5 ba9370a523dd89464a496fc720e46485
BLAKE2b-256 f7d368a4420e1c4022c11b04bff2734ba825ad3f597e9751f54046cd922cae62

See more details on using hashes here.

Provenance

Supported by

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