Mercurial > repos > iuc > data_manager_mapseq
annotate data_manager_fetch_mapseq_db.py @ 1:4cd97cc67061 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 373300c0508fc239fa6d1c8a0351fa9cbb9c0426
author | iuc |
---|---|
date | Sat, 23 Mar 2024 07:20:14 +0000 |
parents | dbf2735e8480 |
children | 23511530b8fd |
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 = { |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
13 "mgnify_lsu": "ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/pipeline-5.0/ref-dbs/silva_lsu-20200130.tar.gz", |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
14 "mgnify_ssu": "ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/pipeline-5.0/ref-dbs/silva_ssu-20200130.tar.gz", |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
15 "mgnify_its_unite": "ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/pipeline-5.0/ref-dbs/UNITE-20200214.tar.gz", |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
16 "mgnify_its_itsonedb": "ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/pipeline-5.0/ref-dbs/ITSoneDB-20200214.tar.gz", |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
17 "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
|
18 } |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
19 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
20 DB_names = { |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
21 "mgnify_lsu": "MGnify LSU (v5.0.7) - silva_lsu-20200130", |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
22 "mgnify_ssu": "MGnify SSU (v5.0.7) - silva_ssu-20200130", |
1
4cd97cc67061
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 373300c0508fc239fa6d1c8a0351fa9cbb9c0426
iuc
parents:
0
diff
changeset
|
23 "mgnify_its_unite": "MGnify ITS UNITE (v5.0.7) - UNITE-20200214", |
4cd97cc67061
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 373300c0508fc239fa6d1c8a0351fa9cbb9c0426
iuc
parents:
0
diff
changeset
|
24 "mgnify_its_itsonedb": "MGnify ITS ITSonedb (v5.0.7) - ITSoneDB-20200214", |
0
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
25 "test_lsu": "Trimmed LSU Test DB", |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
26 } |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
27 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
28 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
29 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
|
30 """ |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
31 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
|
32 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
|
33 """ |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
34 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
35 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
|
36 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
37 os.makedirs(tmp_path, exist_ok=True) |
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 # download data |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
40 filename = wget.download(url, out=tmp_path) |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
41 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
|
42 tar = tarfile.open(tarfile_path) |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
43 tar.extractall(extract_path) |
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 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
|
46 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
|
47 else: |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
48 for folder in os.listdir(extract_path): |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
49 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
|
50 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
51 print(f"Copy data to {dest_path}") |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
52 shutil.copytree(folder_path, dest_path) |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
53 print("Done !") |
1
4cd97cc67061
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 373300c0508fc239fa6d1c8a0351fa9cbb9c0426
iuc
parents:
0
diff
changeset
|
54 |
0
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
55 shutil.rmtree(tmp_path) |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
56 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
57 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
58 def main(): |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
59 # Parse Command Line |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
60 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
|
61 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
|
62 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
|
63 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
|
64 parser.add_argument( |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
65 "--test", |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
66 action="store_true", |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
67 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
|
68 ) |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
69 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
70 args = parser.parse_args() |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
71 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
72 # 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
|
73 # 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
|
74 # to store the DB data |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
75 with open(args.output) as fh: |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
76 params = json.load(fh) |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
77 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
78 print(params) |
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 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
|
81 os.mkdir(workdir) |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
82 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
83 time = datetime.utcnow().strftime("%Y-%m-%d") |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
84 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
|
85 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
86 # output paths |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
87 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
|
88 tmp_path = os.path.join(workdir, "tmp") |
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 # create DB |
1
4cd97cc67061
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 373300c0508fc239fa6d1c8a0351fa9cbb9c0426
iuc
parents:
0
diff
changeset
|
91 if args.test: |
0
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
92 url = DB_paths["test_lsu"] |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
93 else: |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
94 url = DB_paths[args.db_type] |
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 # download data |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
97 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
|
98 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
99 db_name = DB_names[args.db_type] |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
100 # 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
|
101 data_manager_entry = { |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
102 "data_tables": { |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
103 "mapseq_db": { |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
104 "value": db_value, |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
105 "name": f"{db_name} downloaded at {time}", |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
106 "version": args.version, |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
107 "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 } |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
110 } |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
111 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
112 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
|
113 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
|
114 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
115 |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
116 if __name__ == "__main__": |
dbf2735e8480
planemo upload for repository https://github.com/galaxyproject/tools-iuc/ commit 66e797aaa79b92c282a8127260cdfd5702207e35
iuc
parents:
diff
changeset
|
117 main() |