Mercurial > repos > bgruening > sklearn_numeric_clustering
comparison numeric_clustering.xml @ 15:f02f05990cc9 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit f54ff2ba2f8e7542d68966ce5a6b17d7f624ac48
author | bgruening |
---|---|
date | Fri, 13 Jul 2018 03:55:06 -0400 |
parents | 6bbf5cb20652 |
children | 6ba8d7af7e7a |
comparison
equal
deleted
inserted
replaced
14:6bbf5cb20652 | 15:f02f05990cc9 |
---|---|
23 from scipy.io import mmread | 23 from scipy.io import mmread |
24 | 24 |
25 @COLUMNS_FUNCTION@ | 25 @COLUMNS_FUNCTION@ |
26 | 26 |
27 input_json_path = sys.argv[1] | 27 input_json_path = sys.argv[1] |
28 params = json.load(open(input_json_path, "r")) | 28 with open(input_json_path, "r") as param_handler: |
29 params = json.load(param_handler) | |
30 | |
29 | 31 |
30 selected_algorithm = params["input_types"]["algorithm_options"]["selected_algorithm"] | 32 selected_algorithm = params["input_types"]["algorithm_options"]["selected_algorithm"] |
31 | 33 |
32 my_class = getattr(sklearn.cluster, selected_algorithm) | 34 my_class = getattr(sklearn.cluster, selected_algorithm) |
33 cluster_object = my_class() | 35 cluster_object = my_class() |
34 options = params["input_types"]["algorithm_options"]["options"] | 36 options = params["input_types"]["algorithm_options"]["options"] |
35 | 37 |
36 cluster_object.set_params(**options) | 38 cluster_object.set_params(**options) |
37 | 39 |
38 #if $input_types.selected_input_type == "sparse": | 40 #if $input_types.selected_input_type == "sparse": |
39 data_matrix = mmread(open("$infile", 'r')) | 41 data_matrix = mmread("$infile") |
40 #else: | 42 #else: |
41 data = pandas.read_csv("$infile", sep='\t', header=0, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False ) | 43 data = pandas.read_csv("$infile", sep='\t', header=0, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False ) |
42 header = 'infer' if params["input_types"]["header"] else None | 44 header = 'infer' if params["input_types"]["header"] else None |
43 column_option = params["input_types"]["column_selector_options"]["selected_column_selector_option"] | 45 column_option = params["input_types"]["column_selector_options"]["selected_column_selector_option"] |
44 if column_option in ["by_index_number", "all_but_by_index_number", "by_header_name", "all_but_by_header_name"]: | 46 if column_option in ["by_index_number", "all_but_by_index_number", "by_header_name", "all_but_by_header_name"]: |