# HG changeset patch # User bgruening # Date 1531468605 14400 # Node ID fd7a054ffdbdb7694fcfe7e46e5ac57782eed1d5 # Parent 57a7471292df1c31cd464abad85270410bd7b3e0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit f54ff2ba2f8e7542d68966ce5a6b17d7f624ac48 diff -r 57a7471292df -r fd7a054ffdbd main_macros.xml --- a/main_macros.xml Tue Jul 10 03:13:16 2018 -0400 +++ b/main_macros.xml Fri Jul 13 03:56:45 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 57a7471292df -r fd7a054ffdbd model_validation.xml --- a/model_validation.xml Tue Jul 10 03:13:16 2018 -0400 +++ b/model_validation.xml Fri Jul 13 03:56:45 2018 -0400 @@ -22,7 +22,7 @@ import pickle import numpy as np import sklearn.model_selection -from sklearn import svm, linear_model, ensemble +from sklearn import svm, linear_model, ensemble, preprocessing from sklearn.pipeline import Pipeline @COLUMNS_FUNCTION@ @@ -30,7 +30,8 @@ @FEATURE_SELECTOR_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) input_type = params["input_options"]["selected_input"] if input_type=="tabular": @@ -49,7 +50,7 @@ parse_dates=True ) else: - X = mmread(open("$input_options.infile1", 'r')) + X = mmread("$input_options.infile1") header = 'infer' if params["input_options"]["header2"] else None column_option = params["input_options"]["column_selector_options_2"]["selected_column_selector_option2"] @@ -75,10 +76,17 @@ pipeline_steps = [] +## Set up pre_processor and add to pipeline steps. +if params['pre_processing']['do_pre_processing'] == 'Yes': + preprocessor = params["pre_processing"]["pre_processors"]["selected_pre_processor"] + pre_processor_options = params["pre_processing"]["pre_processors"]["options"] + my_class = getattr(preprocessing, preprocessor) + pipeline_steps.append( ('pre_processor', my_class(**pre_processor_options)) ) + ## Set up feature selector and add to pipeline steps. if params['feature_selection']['do_feature_selection'] == 'Yes': feature_selector = feature_selector(params['feature_selection']['feature_selection_algorithms']) - pipeline_steps.append( ('feature_selector', feature_selector)) + pipeline_steps.append( ('feature_selector', feature_selector) ) ## Set up estimator and add to pipeline. estimator=params["model_validation_functions"]["estimator"] @@ -138,6 +146,19 @@ + + +