comparison 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
comparison
equal deleted inserted replaced
14:f2707c822dee 15:bf3a5f8a66a2
22 from scipy import sparse 22 from scipy import sparse
23 from scipy.io import mmread 23 from scipy.io import mmread
24 from scipy.io import mmwrite 24 from scipy.io import mmwrite
25 25
26 input_json_path = sys.argv[1] 26 input_json_path = sys.argv[1]
27 params = json.load(open(input_json_path, "r")) 27 with open(input_json_path, "r") as param_handler:
28 params = json.load(param_handler)
28 29
29 sparse_iter = [] 30 sparse_iter = []
30 #for $i, $s in enumerate( $sparse_functions.sparse_inputs ) 31 #for $i, $s in enumerate( $sparse_functions.sparse_inputs )
31 sparse_index=$i 32 sparse_index=$i
32 sparse_path="${s.input.file_name}" 33 sparse_path="${s.input.file_name}"
33 sparse_iter.append(mmread(open(sparse_path, 'r'))) 34 sparse_iter.append(mmread(sparse_path))
34 #end for 35 #end for
35 36
36 my_function = getattr(sparse, params["sparse_functions"]["selected_function"]) 37 my_function = getattr(sparse, params["sparse_functions"]["selected_function"])
37 my_sparse = my_function(sparse_iter) 38 my_sparse = my_function(sparse_iter)
38 mmwrite(open("$outfile", 'w+'), my_sparse) 39 with open("$outfile", "w+") as out_handler:
40 mmwrite(out_handler, my_sparse)
39 ]]> 41 ]]>
40 </configfile> 42 </configfile>
41 </configfiles> 43 </configfiles>
42 <inputs> 44 <inputs>
43 <conditional name="sparse_functions"> 45 <conditional name="sparse_functions">