diff svm.xml @ 4:41d0edb7d1fc draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 8cf3d813ec755166ee0bd517b4ecbbd4f84d4df1
author bgruening
date Thu, 23 Aug 2018 16:14:13 -0400
parents 297541cc26d0
children 1c5989b930e3
line wrap: on
line diff
--- a/svm.xml	Fri Aug 17 12:26:01 2018 -0400
+++ b/svm.xml	Thu Aug 23 16:14:13 2018 -0400
@@ -19,9 +19,9 @@
 import json
 import sklearn.svm
 import pandas
-import pickle
 
-execfile("$__tool_directory__/utils.py")
+execfile("$__tool_directory__/sk_whitelist.py")
+execfile("$__tool_directory__/utils.py", globals())
 
 input_json_path = sys.argv[1]
 with open(input_json_path, "r") as param_handler:
@@ -30,7 +30,7 @@
 #if $selected_tasks.selected_task == "load":
 
 with open("$infile_model", 'rb') as model_handler:
-    classifier_object = pickle.load(model_handler)
+    classifier_object = SafePickler.load(model_handler)
 
 header = 'infer' if params["selected_tasks"]["header"] else None
 data = pandas.read_csv("$selected_tasks.infile_data", sep='\t', header=header, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False)
@@ -55,7 +55,7 @@
 classifier_object.fit(X, y)
 
 with open("$outfile_fit", 'wb') as out_handler:
-    pickle.dump(classifier_object, out_handler)
+    pickle.dump(classifier_object, out_handler, pickle.HIGHEST_PROTOCOL)
 
 #end if
 
@@ -122,7 +122,7 @@
             <param name="selected_task" value="train"/>
             <param name="selected_algorithm" value="SVC"/>
             <param name="random_state" value="5"/>
-            <output name="outfile_fit" file="svc_model01.txt"/>
+            <output name="outfile_fit" file="svc_model01.txt" compare="sim_size" delta="1"/>
         </test>
         <test>
             <param name="infile1" value="train_set.tabular" ftype="tabular"/>
@@ -134,7 +134,7 @@
             <param name="selected_task" value="train"/>
             <param name="selected_algorithm" value="NuSVC"/>
             <param name="random_state" value="5"/>
-            <output name="outfile_fit" file="svc_model02.txt"/>
+            <output name="outfile_fit" file="svc_model02.txt" compare="sim_size" delta="1"/>
         </test>
         <test>
             <param name="infile1" value="train_set.tabular" ftype="tabular"/>
@@ -146,24 +146,24 @@
             <param name="selected_task" value="train"/>
             <param name="selected_algorithm" value="LinearSVC"/>
             <param name="random_state" value="5"/>
-            <output name="outfile_fit" file="svc_model03.txt"/>
+            <output name="outfile_fit" file="svc_model03.txt" compare="sim_size" delta="1"/>
         </test>
         <test>
-            <param name="infile_model" value="svc_model01.txt" ftype="txt"/>
+            <param name="infile_model" value="svc_model01.txt" ftype="zip"/>
             <param name="infile_data" value="test_set.tabular" ftype="tabular"/>
             <param name="header" value="True"/>
             <param name="selected_task" value="load"/>
             <output name="outfile_predict" file="svc_prediction_result01.tabular"/>
         </test>
         <test>
-            <param name="infile_model" value="svc_model02.txt" ftype="txt"/>
+            <param name="infile_model" value="svc_model02.txt" ftype="zip"/>
             <param name="infile_data" value="test_set.tabular" ftype="tabular"/>
             <param name="header" value="True"/>
             <param name="selected_task" value="load"/>
             <output name="outfile_predict" file="svc_prediction_result02.tabular"/>
         </test>
         <test>
-            <param name="infile_model" value="svc_model03.txt" ftype="txt"/>
+            <param name="infile_model" value="svc_model03.txt" ftype="zip"/>
             <param name="infile_data" value="test_set.tabular" ftype="tabular"/>
             <param name="header" value="True"/>
             <param name="selected_task" value="load"/>