comparison data_manager/data_manager.py @ 1:15b97817550a draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_fetch_busco/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
author iuc
date Sun, 22 Nov 2020 12:47:50 +0000
parents 53eec20e8fb6
children 2b4526fdf7fb
comparison
equal deleted inserted replaced
0:53eec20e8fb6 1:15b97817550a
48 data_manager_entry = {} 48 data_manager_entry = {}
49 data_manager_entry['value'] = args.name.lower() 49 data_manager_entry['value'] = args.name.lower()
50 data_manager_entry['name'] = args.name 50 data_manager_entry['name'] = args.name
51 data_manager_entry['path'] = '.' 51 data_manager_entry['path'] = '.'
52 data_manager_json = dict(data_tables=dict(busco=data_manager_entry)) 52 data_manager_json = dict(data_tables=dict(busco=data_manager_entry))
53 params = json.loads(open(args.output).read()) 53 with open(args.output) as fh:
54 params = json.load(fh)
54 target_directory = params['output_data'][0]['extra_files_path'] 55 target_directory = params['output_data'][0]['extra_files_path']
55 os.mkdir(target_directory) 56 os.mkdir(target_directory)
56 output_path = os.path.abspath(os.path.join(os.getcwd(), 'busco')) 57 output_path = os.path.abspath(os.path.join(os.getcwd(), 'busco'))
57 for filename in os.listdir(workdir): 58 for filename in os.listdir(workdir):
58 shutil.move(os.path.join(output_path, filename), target_directory) 59 shutil.move(os.path.join(output_path, filename), target_directory)
59 file(args.output, 'w').write(json.dumps(data_manager_json)) 60 with open(args.output, 'w') as fh:
61 json.dump(data_manager_json, fh, sort_keys=True)
60 62
61 63
62 if __name__ == '__main__': 64 if __name__ == '__main__':
63 parser = argparse.ArgumentParser(description='Create data manager json.') 65 parser = argparse.ArgumentParser(description='Create data manager json.')
64 parser.add_argument('--out', dest='output', action='store', help='JSON filename') 66 parser.add_argument('--out', dest='output', action='store', help='JSON filename')