Hello, I'm posting to announce the release of a small Python library called Taxonomylite, a library for traversing NCBI taxonomy hierarchies and searching for related taxon id numbers or names.
PyPI Link - https://pypi.python.org/pypi/taxonomylite/1.0.4
GitHub - https://github.com/mobiusklein/taxonomylite
A simple one-file solution for those times when you want to check if one organism is a descended from another, but don't need a full phylogenetic tree manipulation library.
The library is just a single file that depends only upon the standard library. You can easily embed it in another library by copying this script.
Example Usage:
#!python
from taxonomylite import Taxonomy
# Create a new database from NCBI sources
# This process may take some time.
taxa_db = Taxonomy.from_source("taxonomy.db")
tid = taxa_db.tid_to_name("Felidae")
immediate_children = taxa_db.children(tid)
# [338151, 338152, 338153, 339610]
all_children = taxa_db.children(tid, deep=True)
# [9682, 9683, 9685, 9687, 9688, 9689, 9690, 9691, 9692, 9693, ...]
print taxa_db.tid_to_rank(db.name_to_tid("Panthera leo leo"))
# subspecies
neat utility. I need this every so often and getting it otherwise is very tedious.