Skip to main content

Routines for loading, saving, and manipulating taxonomic trees

Project description

Taxonomy

PyPI version Crates version CircleCI

This is a Rust library for reading, writing, and editing biological taxonomies. There are associated Python bindings for accessing most of the functionality from Python.

This library was developed initially as a component in One Codex's metagenomic classification pipeline before being refactored out, expanded, and open-sourced. It is designed such that it can be used as is with a number of taxonomic formats or the Taxonomy trait it provides can be used to add last common ancestor, traversal, etc. methods to a downstream package's taxonomy implementation.

The library ships with a number of features:

  • Common support for taxonomy handling across Rust and Python
  • Fast and low(er) memory usage
  • NCBI taxonomy, JSON ("tree" and "node_link_data" formats), Newick, and PhyloXML support
  • Easily extensible (in Rust) to support other formats and operations

Python Usage

The Python taxonomy API can open and manipulate all of the formats from the Rust library:

from taxonomy import Taxonomy

tax = Taxonomy.from_newick('(A,(B,C)D)E;')
assert tax.parent('A') == 'E'
assert tax.parent('B') == 'D'

If you have the NCBI taxonomy locally (found on their FTP), you can use that too:

ncbi_tax = Taxonomy.from_ncbi('./nodes.dmp', './names.dmp')
assert tax.name('562') == 'Escherichia coli'
assert tax.rank('562') == 'species'

Note that Taxonomy IDs in NCBI format are integers, but they're converted to strings on import. We find working with "string taxonomy IDs" greatly simplifies interoperation between different taxonomy systems.

Installation

Rust

This library can be added to an existing Cargo.toml file and installed straight from crates.io.

Python

You can install the Python bindings directly from PyPI (binaries are only built for select architextures) with:

pip install taxonomy

Development

Rust

There is a test suite runable with cargo test. To test the Python-bindings you need to use the additional python_test feature: cargo test --features python_test.

Python

To work on the Python library on a Mac OS X/Unix system (requires Python 3):

# you need the nightly version of Rust installed
curl https://sh.rustup.rs -sSf | sh
rustup default nightly

# finally, install the library
maturin install --cargo-extra-args="--features=python"

Building binary wheels and pushing to PyPI

# The Mac build requires switching through a few different python versions
maturin build --cargo-extra-args="--features=python" --release --strip

# The linux build is automated through cross-compiling in a docker image
docker run --rm -v $(pwd):/io konstin2/maturin:master build --cargo-extra-args="--features=python" --release --strip
twine upload target/wheels/*

Other Taxonomy Libraries

There are taxonomic toolkits for other programming languages that offer different features and provided some inspiration for this library:

ETE Toolkit (http://etetoolkit.org/) A Python taxonomy library

Taxize (https://ropensci.github.io/taxize-book/) An R toolkit for working with taxonomic data

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

taxonomy-0.4.0-cp38-cp38-macosx_10_7_x86_64.whl (283.8 kB view details)

Uploaded CPython 3.8 macOS 10.7+ x86-64

taxonomy-0.4.0-cp37-cp37m-manylinux1_x86_64.whl (317.8 kB view details)

Uploaded CPython 3.7m

taxonomy-0.4.0-cp37-cp37m-macosx_10_7_x86_64.whl (283.8 kB view details)

Uploaded CPython 3.7m macOS 10.7+ x86-64

taxonomy-0.4.0-cp36-cp36m-manylinux1_x86_64.whl (317.9 kB view details)

Uploaded CPython 3.6m

taxonomy-0.4.0-cp36-cp36m-macosx_10_7_x86_64.whl (284.0 kB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

taxonomy-0.4.0-cp35-cp35m-manylinux1_x86_64.whl (317.9 kB view details)

Uploaded CPython 3.5m

taxonomy-0.4.0-cp35-cp35m-macosx_10_7_x86_64.whl (283.9 kB view details)

Uploaded CPython 3.5m macOS 10.7+ x86-64

File details

Details for the file taxonomy-0.4.0-cp38-cp38-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: taxonomy-0.4.0-cp38-cp38-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 283.8 kB
  • Tags: CPython 3.8, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

File hashes

Hashes for taxonomy-0.4.0-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 875812aeb9f13300d8660c524d2c567f499064ab5226fbc95948f16b394005ee
MD5 c6de66671643264048713f622dbf1f74
BLAKE2b-256 5b964d147973f246f5d56251cee0d20c57a172279e766965427c7f02d1b8ff75

See more details on using hashes here.

File details

Details for the file taxonomy-0.4.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: taxonomy-0.4.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 317.8 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

File hashes

Hashes for taxonomy-0.4.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b18fb4dbcdd7250f9e7b2d1ca1c7546262ab69de8ba1288b156ae7d7ce766cec
MD5 5c8649695f14e2de5cfd64f037a9b550
BLAKE2b-256 e27b01d5c89ad1cfb35f1d59f71f007d6de4ba86c645751aa301516d4b015d7c

See more details on using hashes here.

File details

Details for the file taxonomy-0.4.0-cp37-cp37m-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: taxonomy-0.4.0-cp37-cp37m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 283.8 kB
  • Tags: CPython 3.7m, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

File hashes

Hashes for taxonomy-0.4.0-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 32dbfaad9b3ea77362befb27de312e25b1afe4169b0b7918c9ccf622c672a316
MD5 a4bb3ba6c6b0bea976824ba01c6c6b11
BLAKE2b-256 ca7eb717fb20424715685866f79b37b25312053d9ca12f2bc11170e8549005dc

See more details on using hashes here.

File details

Details for the file taxonomy-0.4.0-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: taxonomy-0.4.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 317.9 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

File hashes

Hashes for taxonomy-0.4.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5a88e0f798330e3c6663d09b9106a1ff0f367aa3db7afbc4b070eda5adb3559f
MD5 fd5bcad7f1e780117897bd1be28f4dbc
BLAKE2b-256 6fecd7c0657f2d7ae38a6e3ccb4afd4ec682da91150276bd1f3433d0620aa31f

See more details on using hashes here.

File details

Details for the file taxonomy-0.4.0-cp36-cp36m-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: taxonomy-0.4.0-cp36-cp36m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 284.0 kB
  • Tags: CPython 3.6m, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

File hashes

Hashes for taxonomy-0.4.0-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 a5c586ad28b3a5d0ba7b16458ac4d5cf868d7e2876f6d86c2cac377735537b81
MD5 6e39a42e39eba5a341055d980d807bc4
BLAKE2b-256 5de4fd76458f38ae56c9e6b7fbc3dfc29edb119ac245b205ff361ef3c40ea84f

See more details on using hashes here.

File details

Details for the file taxonomy-0.4.0-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: taxonomy-0.4.0-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 317.9 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

File hashes

Hashes for taxonomy-0.4.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4510a731d0c78a325ff775b512b6fd53f5b1e617b759e80a71995dcc24e34f14
MD5 d18cc509199e5303bbd0aef08fe97e7a
BLAKE2b-256 b042a45fd7d92a7c219b70f9b9beb9491b10d5c51b562cc2894232a543bc76a4

See more details on using hashes here.

File details

Details for the file taxonomy-0.4.0-cp35-cp35m-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: taxonomy-0.4.0-cp35-cp35m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 283.9 kB
  • Tags: CPython 3.5m, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

File hashes

Hashes for taxonomy-0.4.0-cp35-cp35m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 242eb9264e6b63e4bd7ba57e9ce471d87beb42a431167953c1fa17604458b42b
MD5 fd52ae6ad441f6923e89377a0d8cab89
BLAKE2b-256 2cefc694b32fd45732ac1a2047c35bdb4ad2d440eed97cca6dc51d5402f3f8e1

See more details on using hashes here.

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