Mercurial > repos > bgruening > scipy_sparse
comparison sparse.xml @ 20:01c0f1b60556 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit f54ff2ba2f8e7542d68966ce5a6b17d7f624ac48
| author | bgruening |
|---|---|
| date | Fri, 13 Jul 2018 03:53:34 -0400 |
| parents | 1191a102a5c1 |
| children | 0d9666476157 |
comparison
equal
deleted
inserted
replaced
| 19:431aaea47521 | 20:01c0f1b60556 |
|---|---|
| 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"> |
