Skip to main content

Python library for NCBI taxonomy database.

Project description

TaxTree: Python library for NCBI taxonomy database

Supported features:

  1. download data from NCBI automatically.
  2. use SQLite and SQLAlchemy to persist data.
  3. retrieve ancestor taxonomy in any rank.

installation

pip install taxtree

usage

initialize database

Just run:

taxtree
  1. All data were saved to ~/.taxtree
  2. Downloaded taxdmp.zip path: ~/.taxtree/taxdmp.zip
  3. Persistent data file path: ~/.taxtree/taxtree.db

search taxonomy

from taxtree import get_scoped_session, Tax

with get_scoped_session() as session:
    tax = session.query(Tax).filter_by(tax_id='9606').first()

get ancestor

from taxtree import get_scoped_session, Tax, KINGDOM, PHYLUM

with get_scoped_session() as session:
    tax = session.query(Tax).filter_by(tax_id='9606').first()
    kingdom_tax = tax.get_ancestor(KINGDOM)
    phylum_tax = tax.get_ancestor(PHYLUM)

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

taxtree-1.0.4.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distributions

taxtree-1.0.4-py2.7.egg (3.6 kB view hashes)

Uploaded Source

taxtree-1.0.4-py2-none-any.whl (3.7 kB view hashes)

Uploaded Python 2

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