# HG changeset patch # User greg # Date 1666125448 0 # Node ID 53652e89e4151bce4128b729c1990d611218a613 Uploaded diff -r 000000000000 -r 53652e89e415 .shed.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.shed.yml Tue Oct 18 20:37:28 2022 +0000 @@ -0,0 +1,13 @@ +name: data_manager_pima_pv_downloader +owner: iuc +description: Data manager to download the PIMA plasmids_and_vectors.fasta files for use by the PIMA pipeline tools. +homepage_url: https://github.com/appliedbinf/pima_md +long_description: | + PIMA (Plasmid, Integrations, Mutations, and Antibiotic) resistance annotation pipeline is a high-throughput + sequence analysis pipeline. PIMA is an end-to-end solution encompassing all the steps required to transform + raw ONT output into high-quality annotated assemblies. PIMA supports providing optional Illumina paired end + reads for polishing and error correcting assemblies. +remote_repository_url: "https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_pima_pv_downloader" +type: unrestricted +categories: +- Data Managers diff -r 000000000000 -r 53652e89e415 data_manager/pima_pv_downloader.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager/pima_pv_downloader.py Tue Oct 18 20:37:28 2022 +0000 @@ -0,0 +1,62 @@ +import argparse +import datetime +import json +import os +import sys + +from urllib.request import Request, urlopen + + +def url_download(url, workdir): + file_path = os.path.abspath(os.path.join(workdir, os.path.basename(url))) + src = None + dst = None + try: + req = Request(url) + src = urlopen(req) + with open(file_path, 'wb') as dst: + while True: + chunk = src.read(2**10) + if chunk: + dst.write(chunk) + else: + break + except Exception as e: + sys.exit(str(e)) + finally: + if src: + src.close() + return file_path + + +def download(url, out_file): + today = datetime.datetime.utcnow().strftime("%Y-%m-%d") + + with open(out_file) as fh: + params = json.load(fh) + + workdir = params['output_data'][0]['extra_files_path'] + os.makedirs(workdir) + file_path = url_download(url, workdir) + value = '%s_pima_plasmids_and_values' % today + name = '%s %s' % (today, os.path.basename(file_path)) + + data_manager_json = {"data_tables": {}} + data_manager_entry = {} + data_manager_entry['value'] = value + data_manager_entry['name'] = name + data_manager_entry['path'] = file_path + data_manager_json["data_tables"]["vsnp_genbank"] = data_manager_entry + + with open(out_file, 'w') as fh: + json.dump(data_manager_json, fh, sort_keys=True) + + +parser = argparse.ArgumentParser() + +parser.add_argument('--url', dest='url', help='URL to download plasmids_and_vectors.fasta file') +parser.add_argument('--out_file', dest='out_file', help='JSON output file') + +args = parser.parse_args() + +download(args.url, args.out_file) diff -r 000000000000 -r 53652e89e415 data_manager/pima_pv_downloader.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager/pima_pv_downloader.xml Tue Oct 18 20:37:28 2022 +0000 @@ -0,0 +1,30 @@ + + Download plasmids_and_vectors.fasta files + + python + + + + + + + + + + + + + + + + + + 10.1038/s41598-019-49700-1 + + diff -r 000000000000 -r 53652e89e415 data_manager_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager_conf.xml Tue Oct 18 20:37:28 2022 +0000 @@ -0,0 +1,20 @@ + + + + + + + + + + ${path} + pima_pv/${value}/pima_pv/${name} + + ${GALAXY_DATA_MANAGER_DATA_PATH}/pima_pv/${value}/pima_pv/${name} + abspath + + + + + + diff -r 000000000000 -r 53652e89e415 test-data/pima_pv.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/pima_pv.json Tue Oct 18 20:37:28 2022 +0000 @@ -0,0 +1,1 @@ +{"data_tables": {"pima_pv": diff -r 000000000000 -r 53652e89e415 test-data/pima_pv.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/pima_pv.loc Tue Oct 18 20:37:28 2022 +0000 @@ -0,0 +1,12 @@ +# This is a sample file distributed with Galaxy that enables tools +# to use a selected PIMA plasmids_and_vectors.fasta file. The pima_pv.loc +# file has this format (longer white space characters are TAB characters): +# +# +# +# So, for example, if you have the plasmids_and_vectors.fasta files stored in +# /depot/data2/galaxy/pima_pv/, +# then the pima_pv.loc entry would look like this: +# +# 2022-10-18 PIMA plasmids_and_vectors.fasta /depot/data2/galaxy/pima_pv +2022-10-18 2022-10-18 plasmids_and_vectors.fasta ${__HERE__} diff -r 000000000000 -r 53652e89e415 tool-data/pima_pv.loc.sample --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool-data/pima_pv.loc.sample Tue Oct 18 20:37:28 2022 +0000 @@ -0,0 +1,3 @@ +## PIMA plasmids_and_vectors.fasta files +#Value Name Path +#2022-10-18 plasmids_and_vectors.fasta (2022-10-18) /depot/data2/galaxy/tool-data/pima_pv/2022-10-18 diff -r 000000000000 -r 53652e89e415 tool_data_table_conf.xml.sample --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_data_table_conf.xml.sample Tue Oct 18 20:37:28 2022 +0000 @@ -0,0 +1,8 @@ + + + + value, name, path + +
+
+ diff -r 000000000000 -r 53652e89e415 tool_data_table_conf.xml.test --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_data_table_conf.xml.test Tue Oct 18 20:37:28 2022 +0000 @@ -0,0 +1,7 @@ + + + + value, name, path + +
+