comparison data_manager/make_json.py @ 10:1e701a731d48 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken_database/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
author iuc
date Sun, 22 Nov 2020 12:41:47 +0000
parents 1d616842e1db
children
comparison
equal deleted inserted replaced
9:c668a45d8a55 10:1e701a731d48
8 data_manager_entry = {} 8 data_manager_entry = {}
9 data_manager_entry['value'] = args.database.lower() 9 data_manager_entry['value'] = args.database.lower()
10 data_manager_entry['name'] = args.database 10 data_manager_entry['name'] = args.database
11 data_manager_entry['path'] = '.' 11 data_manager_entry['path'] = '.'
12 data_manager_json = dict(data_tables=dict(kraken_databases=data_manager_entry)) 12 data_manager_json = dict(data_tables=dict(kraken_databases=data_manager_entry))
13 params = json.loads(open(args.output).read()) 13 with open(args.output) as fh:
14 params = json.load(fh)
14 target_directory = params['output_data'][0]['extra_files_path'] 15 target_directory = params['output_data'][0]['extra_files_path']
15 os.mkdir(target_directory) 16 os.mkdir(target_directory)
16 output_path = os.path.join(os.getcwd(), 'kraken-database') 17 output_path = os.path.join(os.getcwd(), 'kraken-database')
17 for filename in os.listdir(output_path): 18 for filename in os.listdir(output_path):
18 shutil.move(os.path.join(output_path, filename), target_directory) 19 shutil.move(os.path.join(output_path, filename), target_directory)
19 with open(args.output, 'w') as out: 20 with open(args.output, 'w') as fh:
20 out.write(json.dumps(data_manager_json, sort_keys=True)) 21 json.dump(data_manager_json, fh, sort_keys=True)
21 22
22 23
23 if __name__ == '__main__': 24 if __name__ == '__main__':
24 parser = argparse.ArgumentParser(description='Create data manager json.') 25 parser = argparse.ArgumentParser(description='Create data manager json.')
25 parser.add_argument('--db', dest='database', action='store', help='Database name') 26 parser.add_argument('--db', dest='database', action='store', help='Database name')