diff svm.xml @ 5:86eb3864c899 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
author bgruening
date Fri, 16 Feb 2018 09:12:19 -0500
parents 4f1b0620ea89
children b70724d5445e
line wrap: on
line diff
--- a/svm.xml	Thu Jun 23 15:26:50 2016 -0400
+++ b/svm.xml	Fri Feb 16 09:12:19 2018 -0500
@@ -1,11 +1,11 @@
 <tool id="svm_classifier" name="Support vector machines (SVMs)" version="@VERSION@">
     <description>for classification</description>
-    <expand macro="python_requirements"/>
-    <expand macro="macro_stdio"/>
     <macros>
         <import>main_macros.xml</import>
         <!-- macro name="class_weight" argument="class_weight"-->
     </macros>
+    <expand macro="python_requirements"/>
+    <expand macro="macro_stdio"/>
     <version_command>echo "@VERSION@"</version_command>
     <command><![CDATA[
     python "$svc_script" '$inputs'
@@ -27,13 +27,13 @@
 
 #if $selected_tasks.selected_task == "load":
 
-classifier_object = pickle.load(open("$infile_model", 'r'))
+classifier_object = pickle.load(open("$infile_model", 'rb'))
 
 data = pandas.read_csv("$selected_tasks.infile_data", sep='\t', header=0, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False )
 prediction = classifier_object.predict(data)
 prediction_df = pandas.DataFrame(prediction)
 res = pandas.concat([data, prediction_df], axis=1)
-res.to_csv(path_or_buf = "$outfile", sep="\t", index=False)
+res.to_csv(path_or_buf = "$outfile_predict", sep="\t", index=False)
 
 #else:
 
@@ -53,7 +53,7 @@
 classifier_object = my_class(**options)
 classifier_object.fit(data,labels)
 
-pickle.dump(classifier_object,open("$outfile", 'w+'))
+pickle.dump(classifier_object,open("$outfile_fit", 'w+'))
 
 #end if
 
@@ -61,7 +61,7 @@
         </configfile>
     </configfiles>
     <inputs>
-        <expand macro="train_loadConditional">
+        <expand macro="train_loadConditional" model="zip">
             <param name="selected_algorithm" type="select" label="Classifier type">
                 <option value="SVC">C-Support Vector Classification</option>
                 <option value="NuSVC">Nu-Support Vector Classification</option>
@@ -103,48 +103,48 @@
             </when>
         </expand>
     </inputs>
-    <outputs>
-        <data format="txt" name="outfile"/>
-    </outputs>
+
+    <expand macro="output"/>
+
     <tests>
         <test>
             <param name="infile_train" value="train_set.tabular" ftype="tabular"/>
             <param name="selected_task" value="train"/>
             <param name="selected_algorithm" value="SVC"/>
             <param name="random_state" value="5"/>
-            <output name="outfile" file="svc_model01.txt"/>
+            <output name="outfile_fit" file="svc_model01.txt"/>
         </test>
         <test>
             <param name="infile_train" value="train_set.tabular" ftype="tabular"/>
             <param name="selected_task" value="train"/>
             <param name="selected_algorithm" value="NuSVC"/>
             <param name="random_state" value="5"/>
-            <output name="outfile" file="svc_model02.txt"/>
+            <output name="outfile_fit" file="svc_model02.txt"/>
         </test>
         <test>
             <param name="infile_train" value="train_set.tabular" ftype="tabular"/>
             <param name="selected_task" value="train"/>
             <param name="selected_algorithm" value="LinearSVC"/>
             <param name="random_state" value="5"/>
-            <output name="outfile" file="svc_model03.txt"/>
+            <output name="outfile_fit" file="svc_model03.txt"/>
         </test>
         <test>
             <param name="infile_model" value="svc_model01.txt" ftype="txt"/>
             <param name="infile_data" value="test_set.tabular" ftype="tabular"/>
             <param name="selected_task" value="load"/>
-            <output name="outfile" file="svc_prediction_result01.tabular"/>
+            <output name="outfile_predict" file="svc_prediction_result01.tabular"/>
         </test>
         <test>
             <param name="infile_model" value="svc_model02.txt" ftype="txt"/>
             <param name="infile_data" value="test_set.tabular" ftype="tabular"/>
             <param name="selected_task" value="load"/>
-            <output name="outfile" file="svc_prediction_result02.tabular"/>
+            <output name="outfile_predict" file="svc_prediction_result02.tabular"/>
         </test>
         <test>
             <param name="infile_model" value="svc_model03.txt" ftype="txt"/>
             <param name="infile_data" value="test_set.tabular" ftype="tabular"/>
             <param name="selected_task" value="load"/>
-            <output name="outfile" file="svc_prediction_result03.tabular"/>
+            <output name="outfile_predict" file="svc_prediction_result03.tabular"/>
         </test>
     </tests>
     <help><![CDATA[
@@ -173,4 +173,4 @@
     ]]>
     </help>
     <expand macro="sklearn_citation"/>
-</tool>
\ No newline at end of file
+</tool>