Created
March 5, 2015 19:44
-
-
Save adamrp/ccb08c74778bea2f7f1c to your computer and use it in GitHub Desktop.
Adds taxonomy level prefixes smilar to Greengenes' to RDP output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from sys import argv | |
prefixes = ['k__', 'p__', 'c__', 'o__', 'f__', 'g__', 's__'] | |
with open(argv[1], 'U') as input_f, open(argv[2], 'w') as output_f: | |
for line in input_f: | |
otu_id, tax, p = line.strip().split('\t') | |
tax = '; '.join([''.join(x) for x in zip(prefixes, tax.split(';'))]) | |
output_f.write('\t'.join([otu_id, tax, p]) + '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment