Skip to main content

Python bindings to the MIBiG taxon handling

Project description

taxa-py

MIBiG taxonomy handling python bindings

This package is designed to help MIBiG-related python code to handle NCBI taxid lookups using NCBI taxdump data.

This package contains the python bindings for the MIBiG taxa-rs package to manage a local JSON-based cache of interesting taxa, allowing bulk database imports to speed up compared to parsing directly from the taxdump files.

Installation

To install taxa-py, run the following (assuming you are in a python virtualenv):

pip install mibig-taxa

Usage

To create a cache file, first grab the latest taxdump collection and extract it. You'll also need a directory containing the MIBiG BGC entry JSON files.

Then run the following:

from mibig_taxa import TaxonCache

cache = TaxonCache()
cache.initialise(
    taxdump="path/to/taxa/rankedlineage.dmp",
    merged_id_dump="path/to/taxa/merged.dmp",
    datadir="path/to/mibig-json/data"
)

# Save the cache to a file for later use
cache.save("my_cache.json")

If you want to use the cache in a different process, simply load the cache like this:

from mibig_taxa import TaxonCache

cache = TaxonCache("my_cache.json")

# Or, if you prefer the longer form
cache = TaxonCache()
cache.load("my_cache.json")

To get an ID mapping, use

from mibig_taxa import TaxonCache

cache = TaxonCache("my_cache.json")

id_to_map = 123456
name = get_name_by_id(id_to_map)

print(f"Taxon with ID {id_to_map} is called {name}")

If you want to transparently support deprecated IDs, also set the allow_deprecated argument to True:

from mibig_taxa import TaxonCache

cache = TaxonCache("my_cache.json")

deprecated_id_to_map = 123456
name = get_name_by_id(deprecated_id_to_map, allow_deprecated=True)

print(f"Taxon with deprecated ID {deprecated_id_to_map} is called {name}")

To get the mapping to an antiSMASH --taxon value, use:

from mibig_taxa import TaxonCache

cache = TaxonCache("my_cache.json")

tax_id = 123456
as_taxon = cache.get_antismash_taxon(tax_id)

print(f"For antiSMASH, use --taxon {as_taxon} with tax_id {tax_id}")

You can also grab individual entries directly:

from mibig_taxa import TaxonCache

cache = TaxonCache("my_cache.json")

tax_id = 123456
entry = cache.get(tax_id)

# "class" is a reserved keyword in python, can't use it directly
entry_class = getattr(entry, "class")

print(f"{entry.superkingdom} > {entry.kingdom} > {entry.phylum} > {entry_class} > {entry.order} > {entry.family} > {entry.name}")

License

Licensed under the Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as Apache-2.0, without any additional terms or conditions.

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

mibig_taxa-0.1.4.tar.gz (8.8 kB view details)

Uploaded Source

Built Distributions

mibig_taxa-0.1.4-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.1 MB view details)

Uploaded PyPy manylinux: glibc 2.5+ x86-64

mibig_taxa-0.1.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.5+ x86-64

mibig_taxa-0.1.4-cp310-none-win_amd64.whl (211.5 kB view details)

Uploaded CPython 3.10 Windows x86-64

mibig_taxa-0.1.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.5+ x86-64

mibig_taxa-0.1.4-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (624.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

mibig_taxa-0.1.4-cp39-none-win_amd64.whl (211.6 kB view details)

Uploaded CPython 3.9 Windows x86-64

mibig_taxa-0.1.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.5+ x86-64

mibig_taxa-0.1.4-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (625.1 kB view details)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

mibig_taxa-0.1.4-cp38-none-win_amd64.whl (211.5 kB view details)

Uploaded CPython 3.8 Windows x86-64

mibig_taxa-0.1.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.5+ x86-64

mibig_taxa-0.1.4-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (625.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

mibig_taxa-0.1.4-cp37-none-win_amd64.whl (211.6 kB view details)

Uploaded CPython 3.7 Windows x86-64

mibig_taxa-0.1.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.5+ x86-64

mibig_taxa-0.1.4-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (624.5 kB view details)

Uploaded CPython 3.7m macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

mibig_taxa-0.1.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.5+ x86-64

File details

Details for the file mibig_taxa-0.1.4.tar.gz.

File metadata

  • Download URL: mibig_taxa-0.1.4.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for mibig_taxa-0.1.4.tar.gz
Algorithm Hash digest
SHA256 77bce4c03d90822eff0309b3709aa452c5a0d53ede0d27fc9b03e16a5e3dc505
MD5 527c2bf8e319fa231692ed908659a559
BLAKE2b-256 b12441e480ed408e937ae8024358378b2f24a15dd102f961bd7238d8436417e2

See more details on using hashes here.

File details

Details for the file mibig_taxa-0.1.4-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for mibig_taxa-0.1.4-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a12c7bd080b2d1b7be128c920902931a14f40bc955eeab9081115d0d8d05e450
MD5 1005d0e70a46f044d2d9c666067e0298
BLAKE2b-256 375b880d9daf3725eeae0101757b5dcdce14a496887f6cdc99a704ba8652977f

See more details on using hashes here.

File details

Details for the file mibig_taxa-0.1.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for mibig_taxa-0.1.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5e656de38b8ac0de3bc5a96397af77a44dd6cd662ae9181471d509d25cd25cf4
MD5 f68a89c228fee12e4de377f67e4a79cc
BLAKE2b-256 c90b23609d31b2c3fd086f9a8538f3aaa7128510ffb0f3caf8c9bdec6b5e6fdd

See more details on using hashes here.

File details

Details for the file mibig_taxa-0.1.4-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for mibig_taxa-0.1.4-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 9136000b5cbbf55f3636b735cb93e8837d14a044d19f8ff3a210314aced18424
MD5 9c8acebd4a857cb66b3ca52e42fc811e
BLAKE2b-256 24413a8e21647df53ccadc903a21226c843fa77b379f86815628626d8dbe4d2b

See more details on using hashes here.

File details

Details for the file mibig_taxa-0.1.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for mibig_taxa-0.1.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8f87cd025c3e2d4f243fa1edc07f71a49285716b219b8ccb0db9df8d2d884e39
MD5 46b94a343648686216a501acd0671af3
BLAKE2b-256 24eec83fa9df92e02baf1bdf92d252deb293ef07adf5e317207a3fc3451b6277

See more details on using hashes here.

File details

Details for the file mibig_taxa-0.1.4-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for mibig_taxa-0.1.4-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 2331be2afb92fe9bf1332a9b0b17c8f501cd8832e5ff832f170198f6e7af9a9b
MD5 4dcafaa715d74433dee737d3e4593718
BLAKE2b-256 1778a62e5a2b0de444f48916220f28db4f3a72c4a0fe442c06226d2854652fe2

See more details on using hashes here.

File details

Details for the file mibig_taxa-0.1.4-cp39-none-win_amd64.whl.

File metadata

  • Download URL: mibig_taxa-0.1.4-cp39-none-win_amd64.whl
  • Upload date:
  • Size: 211.6 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for mibig_taxa-0.1.4-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 b4bc9d49c8ab9c7458a2cdb46fd3b1b083559daee042a831e558cc863e930c09
MD5 10af6d705c2288b597289203c5fdab47
BLAKE2b-256 acbd365fac0d92e335a53481f5718f7efc7d296cc59bc7e65283cfa53c3be988

See more details on using hashes here.

File details

Details for the file mibig_taxa-0.1.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for mibig_taxa-0.1.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 2902935f26fc56942ea50fdb423a150a71f90b54839a0e58fcfd90230d078142
MD5 2ea9db5f1c2c87db70cc46feda64598b
BLAKE2b-256 4b1e11620ab139809db2582cf8044aaa00ed2fc1fdd34604d38d720fc04562b9

See more details on using hashes here.

File details

Details for the file mibig_taxa-0.1.4-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for mibig_taxa-0.1.4-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 694ac70d39f08501656cf24f9c27f274aee7f3159156e27618b8eda61f55a65e
MD5 c89fb7b4a04e2f1287b7103767778bfa
BLAKE2b-256 e96b711f4f4f7cea0098618a4a63f5625d45b29b86f6201a914dfbfd64ae161d

See more details on using hashes here.

File details

Details for the file mibig_taxa-0.1.4-cp38-none-win_amd64.whl.

File metadata

  • Download URL: mibig_taxa-0.1.4-cp38-none-win_amd64.whl
  • Upload date:
  • Size: 211.5 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for mibig_taxa-0.1.4-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 6a25af64eaa01cc4c21bd8d67e3dcbba49a6b49d8df24302a96c070a0044679e
MD5 c19c982771d1d99bf598c914633ca149
BLAKE2b-256 c6c96f5c60deee8901329c8d7410861cf3a363d9ceca09732621136dd6ff348f

See more details on using hashes here.

File details

Details for the file mibig_taxa-0.1.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for mibig_taxa-0.1.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a05bee664f1d2109f91ff6d3ad1857a3b1f50aa12808cb6dd25bf1afa099c632
MD5 d04199eeaa98eab7086371e4b3ae1b06
BLAKE2b-256 4fa1fda27190d5b291c9869bbde7c6592456c4b471ba1c8421fbd9aaac70d1a8

See more details on using hashes here.

File details

Details for the file mibig_taxa-0.1.4-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for mibig_taxa-0.1.4-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 22f11c78aa8083a202546ab8b61e3c3f12becc30ff659b158c79ce212bb4b332
MD5 ddfe7982c263ade7c50feee1cb797883
BLAKE2b-256 a5eb2e43c2da1c8d928f13c3e1f8b9633be3681400c6de38cc6c3e2e60bf6ade

See more details on using hashes here.

File details

Details for the file mibig_taxa-0.1.4-cp37-none-win_amd64.whl.

File metadata

  • Download URL: mibig_taxa-0.1.4-cp37-none-win_amd64.whl
  • Upload date:
  • Size: 211.6 kB
  • Tags: CPython 3.7, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for mibig_taxa-0.1.4-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 ff2eb8f64ee669adae4b350a003edf506118f383ab14ae097aa159febddede7c
MD5 8d927b241bc173c77eab9243840571c8
BLAKE2b-256 53392a1331519630f3b3105a7056bdda7c3229d664ec02a3b025996bf1782542

See more details on using hashes here.

File details

Details for the file mibig_taxa-0.1.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for mibig_taxa-0.1.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 337f47e86bc6996b7020eac22394570b88bdfd9da1cd62f9890005d66f12782c
MD5 4f0d7dd735099a4360371a9935f0bd60
BLAKE2b-256 b8e8f8b6a4af022664c42837193d62ed77b9f63f317634e5276f5631f253cd05

See more details on using hashes here.

File details

Details for the file mibig_taxa-0.1.4-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for mibig_taxa-0.1.4-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 4ea5aa9e3ba1e46995b9a95fc3b7d267406ab3805f5b3023251c7566263dc08b
MD5 68e756525dc395c750fb2bb9f7655683
BLAKE2b-256 2e90f5d35f9d3e50ed596b7345a19483b72166d5cc0773b154e1d4251ed598fe

See more details on using hashes here.

File details

Details for the file mibig_taxa-0.1.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for mibig_taxa-0.1.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f9451c6b1186cefbccfd621e1f9a6835f24850bf9d6cfbb58fd10c6f6331c94a
MD5 fc5a70cb9152f2408fbebe1393b87dae
BLAKE2b-256 c04809430f748457350da929bbbf814e30018bc26e538080a7a6d066c312b993

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