Name: taxster
Owner: biocore
Description: taxster: assigning taxonomy to organisms you've never even heard of
Created: 2014-06-05 20:47:44.0
Updated: 2017-12-09 08:45:25.0
Pushed: 2016-03-03 00:42:25.0
Size: 171
Language: Python
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This library contains tools for working with taxonomic assignment data. This should be considered pre-alpha software. Public APIs can and will change!
pip install https://github.com/biocore/taxster/archive/master.zip
This example illustrates how to apply the consensus taxonomy processing described in Bokulich et al (in preparation). It assumes that you have the test data files included in this repository in ./test-data
.
rt taxster
nomy_map = {}
line in open('./test-data/uc/tax-map.tsv', 'U'):
line = line.strip()
if line.startswith('#') or not line:
continue
fields = line.split('\t')
id_ = fields[0]
tax = fields[1].split('; ')
taxonomy_map[id_] = tax
open('./test-data/uc/1.uc', 'U')
ensus_assignments = taxster.uc_consensus_assignments(uc, taxonomy_map)
If you'd then like to write these out to file, you can do the following. This will write the consensus taxonomy assignments to a file that can be used with biom add-metadata
(compatible with biom-format >= 2.1.5, < 2.2.0).
open('uc-consensus-tax.tsv', 'w')
id_, (tax, fraction, hits) in consensus_assignments.items():
tax = '; '.join(tax)
f.write('\t'.join(map(str, [id_, tax, fraction, hits])))
f.write('\n')
ose()
To get help with taxster.uc_consensus_assignments
, call:
(taxster.uc_consensus_assignments)