# HG changeset patch
# User bgruening
# Date 1527683234 14400
# Node ID 4aadc6731c0179739cc4fe94f2b7a48f6c8c81ae
# Parent d149f9ce0b3411dcf6a51c2001661296916226c7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 4ed8c4f6ef9ece81797a398b17a99bbaf49a6978
diff -r d149f9ce0b34 -r 4aadc6731c01 main_macros.xml
--- a/main_macros.xml Tue May 22 19:33:26 2018 -0400
+++ b/main_macros.xml Wed May 30 08:27:14 2018 -0400
@@ -16,6 +16,47 @@
return y
+## generate an instance for one of sklearn.feature_selection classes
+## must call "@COLUMNS_FUNCTION@"
+
+def feature_selector(inputs):
+ selector = inputs["selected_algorithm"]
+ selector = getattr(sklearn.feature_selection, selector)
+ options = inputs["options"]
+
+ if inputs['selected_algorithm'] == 'SelectFromModel':
+ 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'))
+ new_selector = selector(fitted_estimator, prefit=True, **options)
+ else:
+ estimator=inputs["estimator"]
+ if inputs["extra_estimator"]["has_estimator"]=='no':
+ estimator=inputs["extra_estimator"]["new_estimator"]
+ estimator=eval(estimator.replace('__dq__', '"').replace("__sq__","'"))
+ new_selector = selector(estimator, **options)
+
+ elif inputs['selected_algorithm'] in ['RFE', 'RFECV']:
+ if 'scoring' in options and (not options['scoring'] or options['scoring'] == 'None'):
+ options['scoring'] = None
+ estimator=inputs["estimator"]
+ if inputs["extra_estimator"]["has_estimator"]=='no':
+ estimator=inputs["extra_estimator"]["new_estimator"]
+ estimator=eval(estimator.replace('__dq__', '"').replace("__sq__","'"))
+ new_selector = selector(estimator, **options)
+
+ elif inputs['selected_algorithm'] == "VarianceThreshold":
+ new_selector = selector(**options)
+
+ else:
+ score_func = inputs["score_func"]
+ score_func = getattr(sklearn.feature_selection, score_func)
+ new_selector = selector(score_func, **options)
+
+ return new_selector
+
+
python
@@ -794,6 +835,13 @@
+
+
+
+
+
+
+
@@ -975,8 +1023,8 @@
-
-
+
+
diff -r d149f9ce0b34 -r 4aadc6731c01 test-data/mv_result07.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/mv_result07.tabular Wed May 30 08:27:14 2018 -0400
@@ -0,0 +1,1 @@
+0.7824428015300172