annotate data_manager_fetch_mapseq_db.py @ 2:23511530b8fd draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
author iuc
date Mon, 30 Sep 2024 10:08:03 +0000
parents 4cd97cc67061
children a0d77af1d226
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
1 #!/usr/bin/env python
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
2
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
3 import argparse
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
4 import json
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
5 import os
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
6 import shutil
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
7 import tarfile
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
8 from datetime import datetime
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
9
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
10 import wget
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
11
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
12 DB_paths = {
2
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
13 "mgnify_v5_lsu": "ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/pipeline-5.0/ref-dbs/silva_lsu-20200130.tar.gz",
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
14 "mgnify_v5_ssu": "ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/pipeline-5.0/ref-dbs/silva_ssu-20200130.tar.gz",
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
15 "mgnify_v5_its_unite": "ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/pipeline-5.0/ref-dbs/UNITE-20200214.tar.gz",
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
16 "mgnify_v5_its_itsonedb": "ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/pipeline-5.0/ref-dbs/ITSoneDB-20200214.tar.gz",
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
17 "mgnify_v6_lsu": "ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/pipelines/tool-dbs/silva-lsu/silva-lsu_138.1.tar.gz",
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
18 "mgnify_v6_ssu": "ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/pipelines/tool-dbs/silva-ssu/silva-ssu_138.1.tar.gz",
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
19 "mgnify_v6_its_unite": "ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/pipelines/tool-dbs/unite/unite_9.0.tar.gz",
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
20 "mgnify_v6_its_itsonedb": "ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/pipelines/tool-dbs/itsonedb/itsonedb_1.141.tar.gz",
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
21 "mgnify_v6_pr2": "ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/pipelines/tool-dbs/pr2/pr2_5.0.0.tar.gz",
0
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
22 "test_lsu": "https://zenodo.org/record/8205348/files/test_lsu.tar.gz",
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
23 }
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
24
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
25 DB_names = {
2
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
26 "mgnify_v5_lsu": "MGnify LSU (v5.0.7) - silva_lsu-20200130",
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
27 "mgnify_v5_ssu": "MGnify SSU (v5.0.7) - silva_ssu-20200130",
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
28 "mgnify_v5_its_unite": "MGnify ITS UNITE (v5.0.7) - UNITE-20200214",
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
29 "mgnify_v5_its_itsonedb": "MGnify ITS ITSonedb (v5.0.7) - ITSoneDB-20200214",
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
30 "mgnify_v6_lsu": "MGnify LSU (v6.0) - silva_lsu-20240702",
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
31 "mgnify_v6_ssu": "MGnify SSU (v6.0) - silva_ssu-20240701",
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
32 "mgnify_v6_its_unite": "MGnify ITS UNITE (v6.0) - UNITE-20240702",
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
33 "mgnify_v6_its_itsonedb": "MGnify ITS ITSonedb (v6.0) - ITSoneDB-20240702",
23511530b8fd planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 960c1f69ec78943dfe72eff0a0992a2ce15d2555
iuc
parents: 1
diff changeset
34 "mgnify_v6_pr2": "MGnify PR2 (v6.0) - PR2-20240702",
0
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
35 "test_lsu": "Trimmed LSU Test DB",
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
36 }
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
37
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
38
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
39 def download_untar_store(url, tmp_path, dest_path):
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
40 """
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
41 Download a tar.gz file containing one folder,
1
4cd97cc67061 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 373300c0508fc239fa6d1c8a0351fa9cbb9c0426
iuc
parents: 0
diff changeset
42 extract that folder and move the content inside dest_path
0
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
43 """
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
44
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
45 extract_path = os.path.join(tmp_path, "extract")
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
46
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
47 os.makedirs(tmp_path, exist_ok=True)
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
48
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
49 # download data
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
50 filename = wget.download(url, out=tmp_path)
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
51 tarfile_path = os.path.join(tmp_path, filename)
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
52 tar = tarfile.open(tarfile_path)
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
53 tar.extractall(extract_path)
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
54
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
55 if len(list(os.listdir(extract_path))) > 1:
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
56 print("More then one folder in zipped file, aborting !")
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
57 else:
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
58 for folder in os.listdir(extract_path):
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
59 folder_path = os.path.join(extract_path, folder)
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
60
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
61 print(f"Copy data to {dest_path}")
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
62 shutil.copytree(folder_path, dest_path)
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
63 print("Done !")
1
4cd97cc67061 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 373300c0508fc239fa6d1c8a0351fa9cbb9c0426
iuc
parents: 0
diff changeset
64
0
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
65 shutil.rmtree(tmp_path)
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
66
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
67
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
68 def main():
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
69 # Parse Command Line
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
70 parser = argparse.ArgumentParser(description="Create data manager JSON.")
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
71 parser.add_argument("--out", dest="output", action="store", help="JSON filename")
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
72 parser.add_argument("--version", dest="version", action="store", help="Version of the DB")
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
73 parser.add_argument("--database-type", dest="db_type", action="store", help="Db type")
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
74 parser.add_argument(
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
75 "--test",
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
76 action="store_true",
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
77 help="option to test the script with an lighted database",
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
78 )
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
79
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
80 args = parser.parse_args()
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
81
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
82 # the output file of a DM is a json containing args that can be used by the DM
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
83 # most tools mainly use these args to find the extra_files_path for the DM, which can be used
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
84 # to store the DB data
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
85 with open(args.output) as fh:
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
86 params = json.load(fh)
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
87
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
88 print(params)
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
89
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
90 workdir = params["output_data"][0]["extra_files_path"]
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
91 os.mkdir(workdir)
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
92
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
93 time = datetime.utcnow().strftime("%Y-%m-%d")
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
94 db_value = f"{args.db_type}_from_{time}"
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
95
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
96 # output paths
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
97 db_path = os.path.join(workdir, db_value)
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
98 tmp_path = os.path.join(workdir, "tmp")
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
99
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
100 # create DB
1
4cd97cc67061 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 373300c0508fc239fa6d1c8a0351fa9cbb9c0426
iuc
parents: 0
diff changeset
101 if args.test:
0
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
102 url = DB_paths["test_lsu"]
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
103 else:
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
104 url = DB_paths[args.db_type]
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
105
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
106 # download data
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
107 download_untar_store(url, tmp_path, db_path)
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
108
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
109 db_name = DB_names[args.db_type]
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
110 # Update Data Manager JSON and write to file
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
111 data_manager_entry = {
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
112 "data_tables": {
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
113 "mapseq_db": {
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
114 "value": db_value,
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
115 "name": f"{db_name} downloaded at {time}",
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
116 "version": args.version,
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
117 "path": db_path,
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
118 }
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
119 }
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
120 }
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
121
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
122 with open(os.path.join(args.output), "w+") as fh:
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
123 json.dump(data_manager_entry, fh, sort_keys=True)
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
124
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
125
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
126 if __name__ == "__main__":
dbf2735e8480 planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff changeset
127 main()