Mercurial > repos > earlhaminst > ete
comparison ete_init_taxdb.py @ 2:03c10736e497 draft
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/ete commit 91b634b8f9b131045bbbbf43cc8edbea59ac686b-dirty
author | earlhaminst |
---|---|
date | Tue, 07 Nov 2017 11:45:13 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1:a4ba317fc713 | 2:03c10736e497 |
---|---|
1 import optparse | |
2 | |
3 import ete3.ncbi_taxonomy | |
4 from six.moves.urllib.request import urlretrieve | |
5 | |
6 parser = optparse.OptionParser() | |
7 parser.add_option('-t', '--taxdump', dest='taxdump', default=None, | |
8 help='NCBI taxdump (tar.gz) will be downloaded if not given') | |
9 parser.add_option('-d', '--database', dest="database", default=None, | |
10 help='ETE sqlite data base to use (default: ~/.etetoolkit/taxa.sqlite)') | |
11 options, args = parser.parse_args() | |
12 if options.database is None: | |
13 parser.error("-d option must be specified") | |
14 if options.taxdump is not None: | |
15 taxdump = options.taxdump | |
16 else: | |
17 urlretrieve("http://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz", "taxdump.tar.gz") | |
18 taxdump = "taxdump.tar.gz" | |
19 | |
20 # will remove a taxdump.tar.gz file at the end | |
21 # which will lead to an errmessage if not present | |
22 # if the tool is run on a taxdump in the current dir it will be | |
23 # deleted in the end | |
24 ete3.ncbi_taxonomy.ncbiquery.update_db(dbfile=options.database, targz_file=taxdump) |