Locally-cached NCBI Taxonomy Database for Python 3
Installation:
pip3 install --upgrade git+https://github.com/karolisr/ncbi-taxonomy-local
Initialization:
from ncbi_taxonomy_local import Tax
# Use the SQLite backend:
# - Slightly slower queries
# - Instant loading time
# - Lower RAM usage
tax = Tax()
# or
tax = Tax(backend='SQLite')
# Load entire database into RAM.
# - Faster queries
# - Slower loading time
# - Higher RAM usage
tax = Tax(backend='RAM')
Usage Examples:
tax.taxids_for_name('Solanum')
tax.taxids_for_name('Solanum chilense')
tax.names_for_taxid(3701)
tax.names_for_taxid(3702)
tax.lineage_of_taxids(3701)
tax.common_name_for_taxid(3702)
tax.taxids_for_name('Homo')
tax.taxids_for_name('ape')
tax.scientific_name_for_taxid(9606)
tax.scientific_name_for_taxid(9600)
tax.common_name_for_taxid(9600)
tax.common_name_for_taxid(314295)