Tool:Taxonomylite - Simple One File No Dependencies On Disk NCBI Taxonomy Traversal Library for Python
0
3
Entering edit mode
9.0 years ago
mobiusklein ▴ 180

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
NCBI-Taxonomy Database Python • 2.0k views
ADD COMMENT
0
Entering edit mode

neat utility. I need this every so often and getting it otherwise is very tedious.

ADD REPLY

Login before adding your answer.

Traffic: 2577 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6