def main(args): if not args: if ask('Download latest ncbi taxonomy dump file?', ['y', 'n']) == 'y': status = os.system('wget ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz') if status == 0: update('taxdump.tar.gz') else: fname = ask_filename('path to tar.gz file containing ncbi taxonomy dump:') update(fname) else: update(args[0])
CREATE TABLE merged (taxid_old INT, taxid_new INT); CREATE INDEX spname1 ON species (spname COLLATE NOCASE); CREATE INDEX spname2 ON synonym (spname COLLATE NOCASE); .separator '\t' .import taxa.tab species .import syn.tab synonym .import merged.tab merged """ CMD.write(cmd) CMD.close() os.system("sqlite3 taxa.sqlite < commands.tmp") os.system("rm syn.tab merged.tab taxa.tab commands.tmp") print "Creating extended newick file with the whole NCBI tree [ncbi.nw]" t.write(outfile="ncbi.nw", features=["name", "taxname"]) if __name__ == '__main__': if len(sys.argv) == 1: if ask('Download latest ncbi taxonomy dump file?', ['y', 'n']) == 'y': status = os.system('wget ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz') if status == 0: update('taxdump.tar.gz') else: fname = ask_filename('path to tar.gz file containing ncbi taxonomy dump:') update(fname) else: update(sys.argv[1])