Mercurial > repos > earlhaminst > ete
diff ete_init_taxdb.py @ 15:1e85af7a29c4 draft default tip
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/main/tools/ete commit 6e40bbe92367310e9d3ec69571d08eb49af7c0a6-dirty
author | earlhaminst |
---|---|
date | Mon, 24 Feb 2025 16:34:12 +0000 |
parents | 03c10736e497 |
children |
line wrap: on
line diff
--- a/ete_init_taxdb.py Thu Mar 07 19:39:30 2024 +0000 +++ b/ete_init_taxdb.py Mon Feb 24 16:34:12 2025 +0000 @@ -1,24 +1,32 @@ import optparse +from urllib.request import urlretrieve -import ete3.ncbi_taxonomy -from six.moves.urllib.request import urlretrieve +from ete3.ncbi_taxonomy.ncbiquery import update_db parser = optparse.OptionParser() -parser.add_option('-t', '--taxdump', dest='taxdump', default=None, - help='NCBI taxdump (tar.gz) will be downloaded if not given') -parser.add_option('-d', '--database', dest="database", default=None, - help='ETE sqlite data base to use (default: ~/.etetoolkit/taxa.sqlite)') +parser.add_option( + "-t", + "--taxdump", + dest="taxdump", + default=None, + help="NCBI taxdump (tar.gz), will be downloaded if not given", +) +parser.add_option( + "-d", + "--database", + dest="database", + default=None, + help="ETE sqlite data base to create", +) options, args = parser.parse_args() if options.database is None: parser.error("-d option must be specified") if options.taxdump is not None: taxdump = options.taxdump else: - urlretrieve("http://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz", "taxdump.tar.gz") + urlretrieve( + "https://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz", "taxdump.tar.gz" + ) taxdump = "taxdump.tar.gz" -# will remove a taxdump.tar.gz file at the end -# which will lead to an errmessage if not present -# if the tool is run on a taxdump in the current dir it will be -# deleted in the end -ete3.ncbi_taxonomy.ncbiquery.update_db(dbfile=options.database, targz_file=taxdump) +update_db(dbfile=options.database, targz_file=taxdump)