Mercurial > repos > bgruening > sklearn_pairwise_metrics
comparison pairwise_metrics.xml @ 19:49e5ce162e0e draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit f54ff2ba2f8e7542d68966ce5a6b17d7f624ac48
author | bgruening |
---|---|
date | Fri, 13 Jul 2018 03:49:46 -0400 |
parents | 1573e8255a34 |
children | a30fa9604c09 |
comparison
equal
deleted
inserted
replaced
18:ca5debf1fc88 | 19:49e5ce162e0e |
---|---|
20 import pandas | 20 import pandas |
21 import numpy as np | 21 import numpy as np |
22 from sklearn.metrics import pairwise | 22 from sklearn.metrics import pairwise |
23 from sklearn.metrics import pairwise_distances_argmin | 23 from sklearn.metrics import pairwise_distances_argmin |
24 from scipy.io import mmread | 24 from scipy.io import mmread |
25 from scipy.io import mmwrite | |
26 | 25 |
27 input_json_path = sys.argv[1] | 26 input_json_path = sys.argv[1] |
28 params = json.load(open(input_json_path, "r")) | 27 with open(input_json_path, "r") as param_handler: |
28 params = json.load(param_handler) | |
29 | |
29 | 30 |
30 options = params["input_type"]["metric_functions"]["options"] | 31 options = params["input_type"]["metric_functions"]["options"] |
31 metric_function = params["input_type"]["metric_functions"]["selected_metric_function"] | 32 metric_function = params["input_type"]["metric_functions"]["selected_metric_function"] |
32 | 33 |
33 input_iter = [] | 34 input_iter = [] |
34 #for $i, $s in enumerate( $input_type.input_files ) | 35 #for $i, $s in enumerate( $input_type.input_files ) |
35 input_index=$i | 36 input_index=$i |
36 input_path="${s.input.file_name}" | 37 input_path="${s.input.file_name}" |
37 #if $input_type.selected_input_type == "sparse": | 38 #if $input_type.selected_input_type == "sparse": |
38 input_iter.append(mmread(open(input_path, 'r'))) | 39 input_iter.append(mmread(input_path)) |
39 #else: | 40 #else: |
40 input_iter.append(pandas.read_csv(input_path, sep='\t', header=0, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False ).values) | 41 input_iter.append(pandas.read_csv(input_path, sep='\t', header=0, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False ).values) |
41 #end if | 42 #end if |
42 #end for | 43 #end for |
43 | 44 |