diff rgToolFactory.py @ 41:8d28e32c71ff draft

Uploaded
author fubar
date Fri, 29 Aug 2014 01:50:44 -0400
parents 8603867451d8
children 7b34711416d2
line wrap: on
line diff
--- a/rgToolFactory.py	Thu Aug 28 06:18:31 2014 -0400
+++ b/rgToolFactory.py	Fri Aug 29 01:50:44 2014 -0400
@@ -7,6 +7,10 @@
 # Licensed under the LGPL
 # suggestions for improvement and bug fixes welcome at https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home
 #
+# August 2014 
+# merged John Chilton's citation addition and ideas from Marius van den Beek to enable arbitrary
+# data types for input and output - thanks!
+#
 # march 2014
 # had to remove dependencies because cross toolshed dependencies are not possible - can't pre-specify a toolshed url for graphicsmagick and ghostscript
 # grrrrr - night before a demo
@@ -197,8 +201,8 @@
             a('-') # stdin
         a(opts.input_tab)
         a(opts.output_tab)
-        self.outFormats = 'tabular' # TODO make this an option at tool generation time
-        self.inputFormats = 'tabular,txt' # TODO make this an option at tool generation time
+        self.outputFormat = self.opts.output_format
+        self.inputFormats = self.opts.input_formats 
         self.test1Input = '%s_test1_input.xls' % self.toolname
         self.test1Output = '%s_test1_output.xls' % self.toolname
         self.test1HTML = '%s_test1_output.html' % self.toolname
@@ -290,17 +294,17 @@
         tooltestsTabOnly = """
         <tests>
         <test>
-        <param name="input1" value="%(test1Input)s" ftype="tabular"/>
+        <param name="input1" value="%(test1Input)s" ftype="%(inputFormats)s"/>
         <param name="job_name" value="test1"/>
         <param name="runMe" value="$runMe"/>
-        <output name="tab_file" file="%(test1Output)s" ftype="tabular"/>
+        <output name="tab_file" file="%(test1Output)s" ftype="%(outputFormat)s"/>
         </test>
         </tests>
         """
         tooltestsHTMLOnly = """
         <tests>
         <test>
-        <param name="input1" value="%(test1Input)s" ftype="tabular"/>
+        <param name="input1" value="%(test1Input)s" ftype="%(inputFormats)s"/>
         <param name="job_name" value="test1"/>
         <param name="runMe" value="$runMe"/>
         <output name="html_file" file="%(test1HTML)s" ftype="html" lines_diff="5"/>
@@ -309,15 +313,17 @@
         """
         tooltestsBoth = """<tests>
         <test>
-        <param name="input1" value="%(test1Input)s" ftype="tabular"/>
+        <param name="input1" value="%(test1Input)s" ftype="%(inputFormats)s"/>
         <param name="job_name" value="test1"/>
         <param name="runMe" value="$runMe"/>
-        <output name="tab_file" file="%(test1Output)s" ftype="tabular" />
+        <output name="tab_file" file="%(test1Output)s" ftype="%(outputFormat)s" />
         <output name="html_file" file="%(test1HTML)s" ftype="html" lines_diff="10"/>
         </test>
         </tests>
         """
         xdict = {}
+        xdict['outputFormat'] = self.outputFormat
+        xdict['inputFormats'] = self.inputFormats
         xdict['requirements'] = ''
         if self.opts.make_HTML:
             if self.opts.include_dependencies == "yes":
@@ -383,7 +389,7 @@
             xdict['command_outputs'] += ' --output_dir "./"' 
         if self.opts.output_tab <> 'None':
             xdict['command_outputs'] += ' --output_tab "$tab_file"'
-            xdict['outputs'] += ' <data format="%s" name="tab_file" label="${job_name}"/>\n' % self.outFormats
+            xdict['outputs'] += ' <data format="%s" name="tab_file" label="${job_name}"/>\n' % self.outputFormat
         xdict['command'] = newCommand % xdict
         xmls = newXML % xdict
         xf = open(self.xmlfile,'w')
@@ -693,7 +699,9 @@
     a('--output_dir',default='./')
     a('--output_html',default=None)
     a('--input_tab',default="None")
+    a('--input_formats',default="tabular,text")
     a('--output_tab',default="None")
+    a('--output_format',default="tabular")
     a('--user_email',default='Unknown')
     a('--bad_user',default=None)
     a('--make_Tool',default=None)