# HG changeset patch # User iuc # Date 1585345823 14400 # Node ID 26a6f95e82c8d31508438dcaa58d881285fbe0a8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2" diff -r 000000000000 -r 26a6f95e82c8 data_manager/data_manager.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager/data_manager.py Fri Mar 27 17:50:23 2020 -0400 @@ -0,0 +1,91 @@ +import argparse +import json +import os +import shutil +import tarfile +try: + # For Python 3.0 and later + from urllib.request import Request, urlopen +except ImportError: + # Fall back to Python 2 imports + from urllib2 import Request, urlopen + +ZENODO = { + "mitos": "2683856", + "mitos2": "3685310" +} +NAMES = { + "mitos1-refdata": "RefSeq39 + MiTFi tRNA models", + "refseq39": "RefSeq39 (equivalent to MITOS1 data)", + "refseq63m": "RefSeq63 Metazoa", + "refseq63f": "RefSeq63 Fungi", + "refseq63o": "RefSeq63 Opisthokonta", + "refseq89m": "RefSeq89 Metazoa", + "refseq89f": "RefSeq89 Fungi", + "refseq89o": "RefSeq89 Opisthokonta" +} + + +def url_download(tpe, db, workdir): + """ + download http://ab.inf.uni-tuebingen.de/data/software/megan6/download/FNAME + to workdir + and unzip + + return the name of the resulting dir + """ + tarfname = os.path.join(workdir, db + ".tar.bz") + if not os.path.exists(workdir): + os.makedirs(workdir) + src = None + dst = None + try: + req = Request("https://zenodo.org/record/{zenodoid}/files/{db}.tar.bz2?download=1".format(zenodoid=ZENODO[tpe], db=db)) + src = urlopen(req) + with open(tarfname, 'wb') as dst: + while True: + chunk = src.read(2**10) + if chunk: + dst.write(chunk) + else: + break + finally: + if src: + src.close() + with tarfile.open(tarfname, "r:bz2") as tar: + dirname = tar.getnames()[0] + tar.extractall(workdir) + os.remove(tarfname) + return dirname + + +def main(tpe, db, outjson): + workdir = os.getcwd() + + path = url_download(tpe, db, workdir) + + data_manager_entry = {} + data_manager_entry['value'] = db + data_manager_entry['name'] = NAMES[db] + data_manager_entry['type'] = tpe + data_manager_entry['path'] = path + data_manager_json = dict(data_tables=dict(mitos=data_manager_entry)) + + with open(outjson) as f: + params = json.loads(f.read()) + target_directory = params['output_data'][0]['extra_files_path'] + os.mkdir(target_directory) + # output_path = os.path.abspath(os.path.join(os.getcwd(), 'mitos')) + shutil.move(os.path.join(workdir, path), target_directory) + with open(outjson, 'w') as fh: + fh.write(json.dumps(data_manager_json, sort_keys=True)) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Create data manager json.') + parser.add_argument('--out', action='store', help='JSON filename') + parser.add_argument('--type', action='store', help='mitos version') + parser.add_argument('--db', action='store', help='db name') + args = parser.parse_args() + + main(args.type, args.db, args.out) diff -r 000000000000 -r 26a6f95e82c8 data_manager/data_manager_mitos.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager/data_manager_mitos.xml Fri Mar 27 17:50:23 2020 -0400 @@ -0,0 +1,86 @@ + + + reference data downloader + + python + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +This data manager downloads MITOS and MITOS2 reference data for use in Galaxy. + +For MITOS the reference data includes + +- protein data bases derived from RefSeq release 39 (see Bernt et al. 2012) +- covariance models for tRNAs and rRNAs as described in Jühling et al 2012 + +Data is downloaded from https://zenodo.org/record/2683856. + +For MITOS2 the reference data sets are available for three different taxons + +- Metazoa +- Fungi +- Opisthokonta + +these have been computed for RefSeq release 63 and 89. In addition the reference data +for MITOS1 has been converted to be usable in MITOS2. +contains + +The reference data sets contain: + +- protein data bases derived from the corresponding RefSeq release Donath et al. 2019 +- covariance models computed for the data in the RefSeq releas based on the MITOS1 models +- in addition for Metazoa Release 63 also hidden markov models are available as described in Al Arab et al. 2017 + +Data is downloaded from https://zenodo.org/record/3685310. + + + 10.1016/j.ympev.2012.08.023 + 10.1093/nar/gkr1131 + 10.1016/j.ympev.2016.09.024 + 10.1093/nar/gkz833 + + + diff -r 000000000000 -r 26a6f95e82c8 data_manager_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager_conf.xml Fri Mar 27 17:50:23 2020 -0400 @@ -0,0 +1,20 @@ + + + + + + + + + + + ${path} + mitos/${path} + + ${GALAXY_DATA_MANAGER_DATA_PATH}/mitos/${path} + abspath + + + + + diff -r 000000000000 -r 26a6f95e82c8 test-data/mitos.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/mitos.loc Fri Mar 27 17:50:23 2020 -0400 @@ -0,0 +1,4 @@ +mitos1-refdata RefSeq39 + MiTFi tRNA models mitos /tmp/tmpbtwefN/tmpiplugx/tmpydhEfm/database/data_manager_tool-datacoy8bz/mitos/mitos1-refdata +mitos1-refdata RefSeq39 + MiTFi tRNA models mitos /tmp/tmpGIPfAb/tmpfKzrSO/tmpOaxm5C/database/data_manager_tool-data6ViNKD/mitos/mitos1-refdata +mitos1-refdata RefSeq39 + MiTFi tRNA models mitos /tmp/tmpoaKkwC/tmprSa8eg/tmpT61Fpn/database/data_manager_tool-data0wohya/mitos/mitos1-refdata +mitos1-refdata RefSeq39 + MiTFi tRNA models mitos /tmp/tmpo_lErk/tmpzfa6qz/tmpCY3yzt/database/data_manager_tool-dataCMEecR/mitos/mitos1-refdata diff -r 000000000000 -r 26a6f95e82c8 test-data/mitos_refseq39.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/mitos_refseq39.json Fri Mar 27 17:50:23 2020 -0400 @@ -0,0 +1,1 @@ +{"data_tables": {"mitos": {"name": "RefSeq39 + MiTFi tRNA models", "path": "mitos1-refdata", "type": "mitos", "value": "mitos1-refdata"}}} \ No newline at end of file diff -r 000000000000 -r 26a6f95e82c8 tool-data/mitos.loc.sample --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool-data/mitos.loc.sample Fri Mar 27 17:50:23 2020 -0400 @@ -0,0 +1,8 @@ +# consists of 4 tab separated columns: +# - value identifier +# - name the name shown in the tool form +# - type mitos/mitos2 +# - path the directory containing the reference data +# +# example: +# mitos1-refdata RefSeq39 + MiTFi tRNA models mitos /tmp/tmpSp4v2Y/tmpR7DRNf/tmp53wbgs/database/data_manager_tool-dataWhw0Ns/mitos/mitos1-refdata diff -r 000000000000 -r 26a6f95e82c8 tool_data_table_conf.xml.sample --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_data_table_conf.xml.sample Fri Mar 27 17:50:23 2020 -0400 @@ -0,0 +1,8 @@ + + + + + value, name, type, path + +
+
diff -r 000000000000 -r 26a6f95e82c8 tool_data_table_conf.xml.test --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_data_table_conf.xml.test Fri Mar 27 17:50:23 2020 -0400 @@ -0,0 +1,7 @@ + + + + value, name, type, path + +
+