comparison data_manager/kraken2_build_database.py @ 3:19b6a2f0dbe2 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
author iuc
date Sun, 22 Nov 2020 12:45:56 +0000
parents edacc4bcd3cb
children 0eebe086fd58
comparison
equal deleted inserted replaced
2:edacc4bcd3cb 3:19b6a2f0dbe2
290 parser.add_argument('--custom-database-name', dest='custom_database_name', help='Name for custom database (only applies to --database-type custom)') 290 parser.add_argument('--custom-database-name', dest='custom_database_name', help='Name for custom database (only applies to --database-type custom)')
291 parser.add_argument('--skip-maps', dest='skip_maps', action='store_true', help='') 291 parser.add_argument('--skip-maps', dest='skip_maps', action='store_true', help='')
292 parser.add_argument('--clean', dest='clean', action='store_true', help='Clean up extra files') 292 parser.add_argument('--clean', dest='clean', action='store_true', help='Clean up extra files')
293 args = parser.parse_args() 293 args = parser.parse_args()
294 294
295 data_manager_input = json.loads(open(args.data_manager_json).read()) 295 with open(args.data_manager_json) as fh:
296 data_manager_input = json.load(fh)
296 297
297 target_directory = data_manager_input['output_data'][0]['extra_files_path'] 298 target_directory = data_manager_input['output_data'][0]['extra_files_path']
298 299
299 try: 300 try:
300 os.mkdir( target_directory ) 301 os.mkdir(target_directory)
301 except OSError as exc: 302 except OSError as exc:
302 if exc.errno == errno.EEXIST and os.path.isdir( target_directory ): 303 if exc.errno == errno.EEXIST and os.path.isdir(target_directory):
303 pass 304 pass
304 else: 305 else:
305 raise 306 raise
306 307
307 data_manager_output = {} 308 data_manager_output = {}
352 target_directory, 353 target_directory,
353 ) 354 )
354 else: 355 else:
355 sys.exit("Invalid database type") 356 sys.exit("Invalid database type")
356 357
357 open(args.data_manager_json, 'w').write(json.dumps(data_manager_output, sort_keys=True)) 358 with open(args.data_manager_json, 'w') as fh:
359 json.dump(data_manager_output, fh, sort_keys=True)
358 360
359 361
360 if __name__ == "__main__": 362 if __name__ == "__main__":
361 main() 363 main()