Mercurial > repos > iuc > data_manager_manual
annotate data_manager/data_manager_manual.py @ 6:0bed5ee5b74a draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 0642e0e809847dfedffa3156d455c9b1a0ca2959"
author | iuc |
---|---|
date | Sun, 02 Feb 2020 17:34:49 -0500 |
parents | 744f607fac50 |
children | 2445a874543a |
rev | line source |
---|---|
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
1 #!/usr/bin/env python |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
2 # Dan Blankenberg |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
3 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
4 import json |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
5 import logging |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
6 import optparse |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
7 import os |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
8 import shutil |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
9 import tempfile |
1
6524e573d9c2
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9e376934d399042eabcd4129e23beda60917273d
iuc
parents:
0
diff
changeset
|
10 from xml.etree.ElementTree import tostring |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
11 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
12 try: |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
13 # For Python 3.0 and later |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
14 from shutil import unpack_archive |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
15 except ImportError: |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
16 # Fall back to Python 2 import |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
17 from setuptools.archive_util import unpack_archive |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
18 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
19 try: |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
20 # For Python 3.0 and later |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
21 from urllib.request import urlretrieve |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
22 from urllib.parse import urlsplit |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
23 except ImportError: |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
24 # Fall back to Python 2 imports |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
25 from urllib import urlretrieve |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
26 from urlparse import urlsplit |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
27 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
28 _log_name = __name__ |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
29 if _log_name == '__builtin__': |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
30 _log_name = 'toolshed.installed.manual.data.manager' |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
31 log = logging.getLogger(_log_name) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
32 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
33 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
34 # --- These methods are called by/within the Galaxy Application |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
35 def exec_before_job(app, inp_data, out_data, param_dict, tool=None, **kwd): |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
36 # Look for any data tables that haven't been defined for this data manager before and dynamically add them to Galaxy |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
37 param_dict = dict(**param_dict) |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
38 data_tables_param = param_dict.get('data_tables', []) |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
39 if not isinstance(data_tables_param, list): |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
40 data_tables_param = [data_tables_param] |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
41 if tool: |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
42 tool_shed_repository = tool.tool_shed_repository |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
43 else: |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
44 tool_shed_repository = None |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
45 tdtm = None |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
46 data_manager = app.data_managers.get_manager(tool.data_manager_id, None) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
47 for data_table_param in data_tables_param: |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
48 data_table_name = data_table_param.get('data_table_name') |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
49 if data_table_name: |
3
31f44a9f507e
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit a0d52600f3f1c622760362e255520b956dd48e6a"
iuc
parents:
2
diff
changeset
|
50 # the 'data_table_name' value in data_table_param is a SelectToolParameter, |
31f44a9f507e
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit a0d52600f3f1c622760362e255520b956dd48e6a"
iuc
parents:
2
diff
changeset
|
51 # to get the selected value we need to cast data_table_name to string |
31f44a9f507e
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit a0d52600f3f1c622760362e255520b956dd48e6a"
iuc
parents:
2
diff
changeset
|
52 data_table_name = str(data_table_name) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
53 # get data table managed by this data Manager |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
54 data_table = app.tool_data_tables.get_tables().get(data_table_name) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
55 if data_table: |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
56 data_table_filename = data_table.get_filename_for_source(data_manager, None) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
57 if not data_table_filename: |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
58 if tdtm is None: |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
59 from tool_shed.tools import data_table_manager |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
60 tdtm = data_table_manager.ToolDataTableManager(app) |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
61 target_dir, tool_path, relative_target_dir = tdtm.get_target_install_dir(tool_shed_repository) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
62 # Dynamically add this data table |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
63 log.debug("Attempting to dynamically create a missing Tool Data Table named %s." % data_table_name) |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
64 repo_info = tdtm.generate_repository_info_elem_from_repository(tool_shed_repository, parent_elem=None) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
65 if repo_info is not None: |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
66 repo_info = tostring(repo_info) |
5
744f607fac50
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit de6f0a7b126cc5abaee41c73cf2a9876ab0b437e"
iuc
parents:
4
diff
changeset
|
67 tmp_file = tempfile.NamedTemporaryFile(mode="w") |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
68 tmp_file.write(__get_new_xml_definition(app, data_table, data_manager, repo_info, target_dir)) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
69 tmp_file.flush() |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
70 app.tool_data_tables.add_new_entries_from_config_file(tmp_file.name, None, app.config.shed_tool_data_table_config, persist=True) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
71 tmp_file.close() |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
72 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
73 |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
74 def __get_new_xml_definition(app, data_table, data_manager, repo_info=None, location_file_dir=None): |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
75 sub_dict = {'table_name': data_table.name, 'comment_char': '', 'columns': '', 'file_path': ''} |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
76 sub_dict.update(data_manager.get_tool_shed_repository_info_dict()) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
77 if data_table.comment_char: |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
78 sub_dict['comment_char'] = 'comment_char="%s"' % (data_table.comment_char) |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
79 for i, name in enumerate(data_table.get_column_name_list()): |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
80 if name is not None: |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
81 sub_dict['columns'] = "%s\n%s" % (sub_dict['columns'], '<column name="%s" index="%s" />' % (name, i)) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
82 location_file_dir = location_file_dir or app.config.galaxy_data_manager_data_path |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
83 for filename in data_table.filenames.keys(): |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
84 sub_dict['file_path'] = os.path.basename(filename) |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
85 sub_dict['file_path'] = os.path.join(location_file_dir, sub_dict['file_path']) # os.path.abspath? |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
86 if not os.path.exists(sub_dict['file_path']): |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
87 # Create empty file |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
88 log.debug("Attempting to create a missing location file %s." % sub_dict['file_path']) |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
89 open(sub_dict['file_path'], 'wb+').close() |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
90 break |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
91 sub_dict['repo_info'] = repo_info or '' |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
92 return """ |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
93 <tables><table name="%(table_name)s" %(comment_char)s> |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
94 %(columns)s |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
95 <file path="%(file_path)s" /> |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
96 %(repo_info)s |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
97 </table></tables> |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
98 """ % sub_dict |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
99 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
100 |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
101 def galaxy_code_get_available_data_tables(trans): |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
102 # list of data tables |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
103 return [(x, x, False) for x in trans.app.tool_data_tables.get_tables().keys()] |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
104 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
105 |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
106 def galaxy_code_get_available_data_table_columns(trans, data_table_name): |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
107 return [(x, x, True) for x in trans.app.tool_data_tables.get(data_table_name).get_column_name_list()] |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
108 # --- End Galaxy called Methods --- |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
109 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
110 |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
111 def get_data_table_entries(params, galaxy_data_manager_data_path): |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
112 rval = {} |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
113 data_tables = params.get('data_tables', []) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
114 for data_table in data_tables: |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
115 entry_dict = {} |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
116 for column in data_table.get('columns', []): |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
117 value = column.get('data_table_column_value', '') |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
118 if column.get('is_path', {}).get('is_path_selector') == 'yes' and column.get('is_path', {}).get('abspath') == 'abspath': |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
119 value = os.path.abspath(os.path.join(galaxy_data_manager_data_path, value)) |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
120 entry_dict[column.get('data_table_column_name', '')] = value |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
121 data_table_name = data_table['data_table_name'] |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
122 rval[data_table_name] = rval.get(data_table_name, []) |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
123 rval[data_table_name].append(entry_dict) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
124 return rval |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
125 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
126 |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
127 def get_file_content(params, target_directory): |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
128 directory_content = params.get('directory_content', []) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
129 for content in directory_content: |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
130 target_path = os.path.join(target_directory, content.get('subdir', '')) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
131 try: |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
132 os.makedirs(target_path) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
133 except OSError: |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
134 pass |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
135 if content.get('file_source', {}).get('file_source_selector') == 'URL': |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
136 (filename, headers) = urlretrieve(content.get('file_source', {}).get('file_URL')) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
137 try: |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
138 bname = headers['Content-Disposition'] |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
139 except KeyError: |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
140 bname = os.path.basename(urlsplit(content.get('file_source', {}).get('file_URL')).path) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
141 else: |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
142 filename = content.get('file_source', {}).get('file_history') |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
143 bname = os.path.basename(filename) |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
144 file_action = content.get('file_action', {}).get('file_action_selector') |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
145 if file_action == 'unpack': |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
146 unpack_archive(filename, target_path) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
147 else: |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
148 filename_override = content.get('file_action', {}).get('filename_override') |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
149 if filename_override: |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
150 target_path = os.path.join(target_path, filename_override) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
151 else: |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
152 target_path = os.path.join(target_path, bname) |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
153 shutil.copyfile(filename, target_path) |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
154 return len(directory_content) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
155 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
156 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
157 def main(): |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
158 parser = optparse.OptionParser() |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
159 parser.add_option('', '--galaxy_data_manager_data_path', dest='galaxy_data_manager_data_path', default='', help='Root path for galaxy_data_manager_data_path') |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
160 (options, args) = parser.parse_args() |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
161 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
162 filename = args[0] |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
163 |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
164 with open(filename) as fh: |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
165 params = json.loads(fh.read()) |
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
166 target_directory = params['output_data'][0]['extra_files_path'] |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
167 |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
168 data_table_entries = get_data_table_entries(params['param_dict'], options.galaxy_data_manager_data_path) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
169 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
170 # save info to json file |
4
1ed87dee9e68
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit b775a4c6248f00430a9ab1b2a4e1afa255ac57a2"
iuc
parents:
3
diff
changeset
|
171 with open(filename, 'w') as fh: |
1ed87dee9e68
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit b775a4c6248f00430a9ab1b2a4e1afa255ac57a2"
iuc
parents:
3
diff
changeset
|
172 fh.write(json.dumps({"data_tables": data_table_entries}, sort_keys=True)) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
173 |
2
1c1e228884d3
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit f2ab0315fa6df9e3e917bbc112e29f384c3affba"
iuc
parents:
1
diff
changeset
|
174 get_file_content(params['param_dict'], target_directory) |
0
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
175 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
176 |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
177 if __name__ == "__main__": |
81ed42c0721a
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff
changeset
|
178 main() |