Repository 'data_manager_humann2_database_downloader'
hg clone https://toolshed.g2.bx.psu.edu/repos/iuc/data_manager_humann2_database_downloader

Changeset 5:ff9cf22838d4 (2020-11-22)
Previous changeset 4:9244804f69a7 (2017-09-05)
Commit message:
"planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/data_managers/data_manager_humann2_database_downloader commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
modified:
data_manager/data_manager_humann2_download.py
b
diff -r 9244804f69a7 -r ff9cf22838d4 data_manager/data_manager_humann2_download.py
--- 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.")