Mercurial > repos > devteam > data_manager_build_kraken_database
annotate data_manager/make_json.py @ 8:1d616842e1db draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken_database/ commit 8b77954efb8d46dfb3bec5421819076f3757ad06"
author | iuc |
---|---|
date | Sun, 26 Jan 2020 14:34:23 +0000 (2020-01-26) |
parents | 6f0294046f41 |
children | 1e701a731d48 |
rev | line source |
---|---|
5
6f0294046f41
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken_database/ commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents:
0
diff
changeset
|
1 import argparse |
0 | 2 import json |
3 import os | |
4 import shutil | |
5 | |
6 | |
7 def main(args): | |
8 data_manager_entry = {} | |
9 data_manager_entry['value'] = args.database.lower() | |
10 data_manager_entry['name'] = args.database | |
11 data_manager_entry['path'] = '.' | |
12 data_manager_json = dict(data_tables=dict(kraken_databases=data_manager_entry)) | |
13 params = json.loads(open(args.output).read()) | |
14 target_directory = params['output_data'][0]['extra_files_path'] | |
15 os.mkdir(target_directory) | |
16 output_path = os.path.join(os.getcwd(), 'kraken-database') | |
17 for filename in os.listdir(output_path): | |
18 shutil.move(os.path.join(output_path, filename), target_directory) | |
8
1d616842e1db
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken_database/ commit 8b77954efb8d46dfb3bec5421819076f3757ad06"
iuc
parents:
5
diff
changeset
|
19 with open(args.output, 'w') as out: |
1d616842e1db
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken_database/ commit 8b77954efb8d46dfb3bec5421819076f3757ad06"
iuc
parents:
5
diff
changeset
|
20 out.write(json.dumps(data_manager_json, sort_keys=True)) |
0 | 21 |
5
6f0294046f41
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken_database/ commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents:
0
diff
changeset
|
22 |
0 | 23 if __name__ == '__main__': |
5
6f0294046f41
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken_database/ commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents:
0
diff
changeset
|
24 parser = argparse.ArgumentParser(description='Create data manager json.') |
6f0294046f41
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken_database/ commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents:
0
diff
changeset
|
25 parser.add_argument('--db', dest='database', action='store', help='Database name') |
6f0294046f41
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken_database/ commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents:
0
diff
changeset
|
26 parser.add_argument('--out', dest='output', action='store', help='JSON filename') |
6f0294046f41
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken_database/ commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents:
0
diff
changeset
|
27 args = parser.parse_args() |
0 | 28 main(args) |