annotate data_manager/data_manager.py @ 4:d9339bb8127e draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit a54e50916ebdb0858b049cdc549a43df801e1a71
author iuc
date Tue, 21 May 2024 07:36:28 +0000
parents 14785f8a3725
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
1 import argparse
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
2 import json
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
3 import os
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
4 import shutil
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
5 import tarfile
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
6 try:
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
7 # For Python 3.0 and later
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
8 from urllib.request import Request, urlopen
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
9 except ImportError:
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
10 # Fall back to Python 2 imports
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
11 from urllib2 import Request, urlopen
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
12
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
13 ZENODO = {
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
14 "mitos": "2683856",
2
19d9be08560c "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 2db6284f6077d80d05227180a809b921b4975c60"
iuc
parents: 1
diff changeset
15 "mitos2": "4284483"
0
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
16 }
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
17 NAMES = {
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
18 "mitos1-refdata": "RefSeq39 + MiTFi tRNA models",
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
19 "refseq39": "RefSeq39 (equivalent to MITOS1 data)",
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
20 "refseq63m": "RefSeq63 Metazoa",
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
21 "refseq63f": "RefSeq63 Fungi",
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
22 "refseq63o": "RefSeq63 Opisthokonta",
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
23 "refseq89m": "RefSeq89 Metazoa",
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
24 "refseq89f": "RefSeq89 Fungi",
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
25 "refseq89o": "RefSeq89 Opisthokonta"
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
26 }
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
27
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
28
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
29 def url_download(tpe, db, workdir):
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
30 """
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
31 download http://ab.inf.uni-tuebingen.de/data/software/megan6/download/FNAME
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
32 to workdir
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
33 and unzip
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
34
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
35 return the name of the resulting dir
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
36 """
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
37 tarfname = os.path.join(workdir, db + ".tar.bz")
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
38 if not os.path.exists(workdir):
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
39 os.makedirs(workdir)
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
40 src = None
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
41 dst = None
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
42 try:
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
43 req = Request("https://zenodo.org/record/{zenodoid}/files/{db}.tar.bz2?download=1".format(zenodoid=ZENODO[tpe], db=db))
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
44 src = urlopen(req)
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
45 with open(tarfname, 'wb') as dst:
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
46 while True:
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
47 chunk = src.read(2**10)
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
48 if chunk:
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
49 dst.write(chunk)
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
50 else:
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
51 break
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
52 finally:
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
53 if src:
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
54 src.close()
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
55 with tarfile.open(tarfname, "r:bz2") as tar:
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
56 dirname = tar.getnames()[0]
3
14785f8a3725 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 096286097ed5cdf189a1b68c3fc34d10f4142e54
iuc
parents: 2
diff changeset
57
14785f8a3725 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 096286097ed5cdf189a1b68c3fc34d10f4142e54
iuc
parents: 2
diff changeset
58 def is_within_directory(directory, target):
14785f8a3725 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 096286097ed5cdf189a1b68c3fc34d10f4142e54
iuc
parents: 2
diff changeset
59 abs_directory = os.path.abspath(directory)
14785f8a3725 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 096286097ed5cdf189a1b68c3fc34d10f4142e54
iuc
parents: 2
diff changeset
60 abs_target = os.path.abspath(target)
14785f8a3725 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 096286097ed5cdf189a1b68c3fc34d10f4142e54
iuc
parents: 2
diff changeset
61 prefix = os.path.commonprefix([abs_directory, abs_target])
14785f8a3725 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 096286097ed5cdf189a1b68c3fc34d10f4142e54
iuc
parents: 2
diff changeset
62 return prefix == abs_directory
14785f8a3725 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 096286097ed5cdf189a1b68c3fc34d10f4142e54
iuc
parents: 2
diff changeset
63
14785f8a3725 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 096286097ed5cdf189a1b68c3fc34d10f4142e54
iuc
parents: 2
diff changeset
64 def safe_extract(tar, path=".", members=None, *, numeric_owner=False):
14785f8a3725 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 096286097ed5cdf189a1b68c3fc34d10f4142e54
iuc
parents: 2
diff changeset
65 for member in tar.getmembers():
14785f8a3725 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 096286097ed5cdf189a1b68c3fc34d10f4142e54
iuc
parents: 2
diff changeset
66 member_path = os.path.join(path, member.name)
14785f8a3725 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 096286097ed5cdf189a1b68c3fc34d10f4142e54
iuc
parents: 2
diff changeset
67 if not is_within_directory(path, member_path):
14785f8a3725 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 096286097ed5cdf189a1b68c3fc34d10f4142e54
iuc
parents: 2
diff changeset
68 raise Exception("Attempted Path Traversal in Tar File")
14785f8a3725 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 096286097ed5cdf189a1b68c3fc34d10f4142e54
iuc
parents: 2
diff changeset
69 tar.extractall(path, members, numeric_owner=numeric_owner)
14785f8a3725 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 096286097ed5cdf189a1b68c3fc34d10f4142e54
iuc
parents: 2
diff changeset
70
14785f8a3725 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 096286097ed5cdf189a1b68c3fc34d10f4142e54
iuc
parents: 2
diff changeset
71 safe_extract(tar, workdir)
0
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
72 os.remove(tarfname)
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
73 return dirname
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
74
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
75
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
76 def main(tpe, db, outjson):
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
77 workdir = os.getcwd()
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
78
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
79 path = url_download(tpe, db, workdir)
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
80
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
81 data_manager_entry = {}
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
82 data_manager_entry['value'] = db
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
83 data_manager_entry['name'] = NAMES[db]
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
84 data_manager_entry['type'] = tpe
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
85 data_manager_entry['path'] = path
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
86 data_manager_json = dict(data_tables=dict(mitos=data_manager_entry))
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
87
1
1ff9996995ee "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 0
diff changeset
88 with open(outjson) as fh:
1ff9996995ee "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 0
diff changeset
89 params = json.load(fh)
0
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
90 target_directory = params['output_data'][0]['extra_files_path']
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
91 os.mkdir(target_directory)
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
92 # output_path = os.path.abspath(os.path.join(os.getcwd(), 'mitos'))
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
93 shutil.move(os.path.join(workdir, path), target_directory)
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
94 with open(outjson, 'w') as fh:
1
1ff9996995ee "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 0
diff changeset
95 json.dump(data_manager_json, fh, sort_keys=True)
0
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
96
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
97
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
98 if __name__ == '__main__':
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
99 parser = argparse.ArgumentParser(description='Create data manager json.')
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
100 parser.add_argument('--out', action='store', help='JSON filename')
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
101 parser.add_argument('--type', action='store', help='mitos version')
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
102 parser.add_argument('--db', action='store', help='db name')
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
103 args = parser.parse_args()
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
104
26a6f95e82c8 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mitos commit 791f28c8a7194fdd1ecec05ad166932d461899b2"
iuc
parents:
diff changeset
105 main(args.type, args.db, args.out)