# HG changeset patch # User bgruening # Date 1531468544 14400 # Node ID dad38f036e835cf774e73c1b51bad2ddaefe7d4b # Parent f9def78f6cd565fe854ca6b2e3c8fec9b5e85d8d planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit f54ff2ba2f8e7542d68966ce5a6b17d7f624ac48 diff -r f9def78f6cd5 -r dad38f036e83 main_macros.xml --- a/main_macros.xml Tue Jul 10 03:12:09 2018 -0400 +++ b/main_macros.xml Fri Jul 13 03:55:44 2018 -0400 @@ -35,7 +35,8 @@ if not options['threshold'] or options['threshold'] == 'None': options['threshold'] = None if 'extra_estimator' in inputs and inputs['extra_estimator']['has_estimator'] == 'no_load': - fitted_estimator = pickle.load(open("inputs['extra_estimator']['fitted_estimator']", 'r')) + with open("inputs['extra_estimator']['fitted_estimator']", 'rb') as model_handler: + fitted_estimator = pickle.load(model_handler) new_selector = selector(fitted_estimator, prefit=True, **options) else: estimator=inputs["estimator"] @@ -83,7 +84,7 @@ parse_dates=True ) else: - X = mmread(open(file1, 'r')) + X = mmread(file1) header = 'infer' if params["selected_tasks"]["selected_algorithms"]["input_options"]["header2"] else None column_option = params["selected_tasks"]["selected_algorithms"]["input_options"]["column_selector_options_2"]["selected_column_selector_option2"] @@ -432,19 +433,6 @@ - - - - - - - - - - - - - @@ -472,13 +460,13 @@ - + - + @@ -553,11 +541,6 @@ - - - - -
@@ -822,9 +805,17 @@ + + + + + + + + + -
@@ -834,7 +825,6 @@
-
@@ -854,7 +844,6 @@
-
@@ -865,14 +854,12 @@
-
-
@@ -885,6 +872,41 @@ + + + + +
+
+
+ +
+ + +
+
+ +
+ + + +
+
+ +
+ + + + +
+
+
+
+ @@ -892,6 +914,7 @@ + @@ -1014,6 +1037,7 @@ + @@ -1023,6 +1047,7 @@ + @@ -1032,6 +1057,7 @@ + @@ -1039,6 +1065,7 @@ + @@ -1047,6 +1074,7 @@ + diff -r f9def78f6cd5 -r dad38f036e83 pre_process.xml --- a/pre_process.xml Tue Jul 10 03:12:09 2018 -0400 +++ b/pre_process.xml Fri Jul 13 03:55:44 2018 -0400 @@ -24,19 +24,32 @@ from scipy.io import mmwrite from sklearn import preprocessing +@COLUMNS_FUNCTION@ + 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) #if $input_type.selected_input_type == "sparse": -X = mmread(open("$infile", 'r')) +X = mmread("$infile") #else: -X = pandas.read_csv("$infile", sep='\t', header=None, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False ) -#end if - -#if $input_type.pre_processors.infile_transform.ext == 'txt': -y = mmread(open("$infile", 'r')) -#else: -y = pandas.read_csv("$infile", sep='\t', header=None, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False ) +header = 'infer' if params["input_type"]["header1"] else None +column_option = params["input_type"]["column_selector_options_1"]["selected_column_selector_option"] +if column_option in ["by_index_number", "all_but_by_index_number", "by_header_name", "all_but_by_header_name"]: + c = params["input_type"]["column_selector_options_1"]["col1"] +else: + c = None +X = read_columns( + "$input_type.infile", + c = c, + c_option = column_option, + sep='\t', + header=header, + parse_dates=True, + encoding=None, + index_col=None, + tupleize_cols=False +) #end if preprocessor = params["input_type"]["pre_processors"]["selected_pre_processor"] @@ -45,17 +58,19 @@ my_class = getattr(preprocessing, preprocessor) estimator = my_class(**options) estimator.fit(X) -result = estimator.transform(y) +result = estimator.transform(X) -#if $input_type.pre_processors.infile_transform.ext == 'txt': -mmwrite(open("$outfile_transform" , 'w+'), result) +#if $input_type.selected_input_type == "sparse": +with open("$outfile_transform", "w+") as transform_handler: + mmwrite(transform_handler, result) #else: res = pandas.DataFrame(result) res.to_csv(path_or_buf = "$outfile_transform", sep="\t", index=False, header=None) #end if #if $save: -pickle.dump(estimator,open("$outfile_fit", 'w+'), pickle.HIGHEST_PROTOCOL) +with open("$outfile_fit", 'wb') as out_handler: + pickle.dump(estimator, out_handler, pickle.HIGHEST_PROTOCOL) #end if ]]> @@ -67,49 +82,14 @@ - + + + + + - - - - - - - - - -
-
-
- - -
- - -
-
- - -
- - - -
-
- - -
- - - - -
-
-
+ +
@@ -133,7 +113,7 @@ - + @@ -142,7 +122,7 @@ - + @@ -151,7 +131,7 @@ - + @@ -160,7 +140,7 @@ - + @@ -169,7 +149,6 @@ - @@ -178,7 +157,6 @@ - @@ -188,8 +166,8 @@ - + @@ -197,7 +175,6 @@ - @@ -206,7 +183,6 @@ - diff -r f9def78f6cd5 -r dad38f036e83 test-data/mv_result07.tabular --- a/test-data/mv_result07.tabular Tue Jul 10 03:12:09 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -0.7824428015300172