diff sparse.xml @ 15:bf3a5f8a66a2 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit f54ff2ba2f8e7542d68966ce5a6b17d7f624ac48
author bgruening
date Fri, 13 Jul 2018 03:56:58 -0400
parents 58812a9f83ed
children f9a2fe161db4
line wrap: on
line diff
--- a/sparse.xml	Tue Jul 10 03:13:29 2018 -0400
+++ b/sparse.xml	Fri Jul 13 03:56:58 2018 -0400
@@ -24,18 +24,20 @@
 from scipy.io import mmwrite
 
 input_json_path = sys.argv[1]
-params = json.load(open(input_json_path, "r"))
+with open(input_json_path, "r") as param_handler:
+    params = json.load(param_handler)
 
 sparse_iter = []
 #for $i, $s in enumerate( $sparse_functions.sparse_inputs )
 sparse_index=$i
 sparse_path="${s.input.file_name}"
-sparse_iter.append(mmread(open(sparse_path, 'r')))
+sparse_iter.append(mmread(sparse_path))
 #end for
 
 my_function = getattr(sparse, params["sparse_functions"]["selected_function"])
 my_sparse = my_function(sparse_iter)
-mmwrite(open("$outfile", 'w+'), my_sparse) 
+with open("$outfile", "w+") as out_handler:
+    mmwrite(out_handler, my_sparse)
             ]]>
         </configfile>
     </configfiles>