Mercurial > repos > iuc > data_manager_humann2_database_downloader
changeset 5:ff9cf22838d4 draft default tip
"planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/data_managers/data_manager_humann2_database_downloader commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
author | iuc |
---|---|
date | Sun, 22 Nov 2020 12:50:08 +0000 |
parents | 9244804f69a7 |
children | |
files | data_manager/data_manager_humann2_download.py |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/data_manager/data_manager_humann2_download.py Tue Sep 05 13:40:28 2017 -0400 +++ b/data_manager/data_manager_humann2_download.py Sun Nov 22 12:50:08 2020 +0000 @@ -38,7 +38,8 @@ to create it if necessary. """ - params = json.loads(open(jsonfile).read()) + with open(jsonfile) as fh: + params = json.load(fh) return (params['param_dict'], params['output_data'][0]['extra_files_path']) @@ -50,7 +51,7 @@ # >>> add_data_table(d,'my_data') # >>> add_data_table_entry(dict(dbkey='hg19',value='human')) # >>> add_data_table_entry(dict(dbkey='mm9',value='mouse')) -# >>> print str(json.dumps(d)) +# >>> print(json.dumps(d)) def create_data_tables_dict(): """Return a dictionary for storing data table information @@ -109,10 +110,10 @@ target_dir: directory to put copy or link to the data file """ - value = "%s-%s-%s" % (database, build, datetime.date.today().isoformat()) + value = "{}-{}-{}".format(database, build, datetime.date.today().isoformat()) db_target_dir = os.path.join(target_dir, database) build_target_dir = os.path.join(db_target_dir, build) - cmd = "humann2_databases --download %s %s %s --update-config no" % ( + cmd = "humann2_databases --download {} {} {} --update-config no".format( database, build, db_target_dir) @@ -171,6 +172,6 @@ # Write output JSON print("Outputting JSON") - print(str(json.dumps(data_tables))) - open(jsonfile, 'wb').write(json.dumps(data_tables)) + with open(jsonfile, 'w') as fh: + json.dump(data_tables, fh, sort_keys=True) print("Done.")