comparison rgToolFactory.py @ 41:8d28e32c71ff draft

Uploaded
author fubar
date Fri, 29 Aug 2014 01:50:44 -0400
parents 8603867451d8
children 7b34711416d2
comparison
equal deleted inserted replaced
40:8603867451d8 41:8d28e32c71ff
4 # copyright ross lazarus (ross stop lazarus at gmail stop com) May 2012 4 # copyright ross lazarus (ross stop lazarus at gmail stop com) May 2012
5 # 5 #
6 # all rights reserved 6 # all rights reserved
7 # Licensed under the LGPL 7 # Licensed under the LGPL
8 # suggestions for improvement and bug fixes welcome at https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home 8 # suggestions for improvement and bug fixes welcome at https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home
9 #
10 # August 2014
11 # merged John Chilton's citation addition and ideas from Marius van den Beek to enable arbitrary
12 # data types for input and output - thanks!
9 # 13 #
10 # march 2014 14 # march 2014
11 # had to remove dependencies because cross toolshed dependencies are not possible - can't pre-specify a toolshed url for graphicsmagick and ghostscript 15 # had to remove dependencies because cross toolshed dependencies are not possible - can't pre-specify a toolshed url for graphicsmagick and ghostscript
12 # grrrrr - night before a demo 16 # grrrrr - night before a demo
13 # added dependencies to a tool_dependencies.xml if html page generated so generated tool is properly portable 17 # added dependencies to a tool_dependencies.xml if html page generated so generated tool is properly portable
195 a(self.sfile) 199 a(self.sfile)
196 else: 200 else:
197 a('-') # stdin 201 a('-') # stdin
198 a(opts.input_tab) 202 a(opts.input_tab)
199 a(opts.output_tab) 203 a(opts.output_tab)
200 self.outFormats = 'tabular' # TODO make this an option at tool generation time 204 self.outputFormat = self.opts.output_format
201 self.inputFormats = 'tabular,txt' # TODO make this an option at tool generation time 205 self.inputFormats = self.opts.input_formats
202 self.test1Input = '%s_test1_input.xls' % self.toolname 206 self.test1Input = '%s_test1_input.xls' % self.toolname
203 self.test1Output = '%s_test1_output.xls' % self.toolname 207 self.test1Output = '%s_test1_output.xls' % self.toolname
204 self.test1HTML = '%s_test1_output.html' % self.toolname 208 self.test1HTML = '%s_test1_output.html' % self.toolname
205 209
206 def makeXML(self): 210 def makeXML(self):
288 --tool_name "%(toolname)s" %(command_inputs)s %(command_outputs)s """ 292 --tool_name "%(toolname)s" %(command_inputs)s %(command_outputs)s """
289 # may NOT be an input or htmlout - appended later 293 # may NOT be an input or htmlout - appended later
290 tooltestsTabOnly = """ 294 tooltestsTabOnly = """
291 <tests> 295 <tests>
292 <test> 296 <test>
293 <param name="input1" value="%(test1Input)s" ftype="tabular"/> 297 <param name="input1" value="%(test1Input)s" ftype="%(inputFormats)s"/>
294 <param name="job_name" value="test1"/> 298 <param name="job_name" value="test1"/>
295 <param name="runMe" value="$runMe"/> 299 <param name="runMe" value="$runMe"/>
296 <output name="tab_file" file="%(test1Output)s" ftype="tabular"/> 300 <output name="tab_file" file="%(test1Output)s" ftype="%(outputFormat)s"/>
297 </test> 301 </test>
298 </tests> 302 </tests>
299 """ 303 """
300 tooltestsHTMLOnly = """ 304 tooltestsHTMLOnly = """
301 <tests> 305 <tests>
302 <test> 306 <test>
303 <param name="input1" value="%(test1Input)s" ftype="tabular"/> 307 <param name="input1" value="%(test1Input)s" ftype="%(inputFormats)s"/>
304 <param name="job_name" value="test1"/> 308 <param name="job_name" value="test1"/>
305 <param name="runMe" value="$runMe"/> 309 <param name="runMe" value="$runMe"/>
306 <output name="html_file" file="%(test1HTML)s" ftype="html" lines_diff="5"/> 310 <output name="html_file" file="%(test1HTML)s" ftype="html" lines_diff="5"/>
307 </test> 311 </test>
308 </tests> 312 </tests>
309 """ 313 """
310 tooltestsBoth = """<tests> 314 tooltestsBoth = """<tests>
311 <test> 315 <test>
312 <param name="input1" value="%(test1Input)s" ftype="tabular"/> 316 <param name="input1" value="%(test1Input)s" ftype="%(inputFormats)s"/>
313 <param name="job_name" value="test1"/> 317 <param name="job_name" value="test1"/>
314 <param name="runMe" value="$runMe"/> 318 <param name="runMe" value="$runMe"/>
315 <output name="tab_file" file="%(test1Output)s" ftype="tabular" /> 319 <output name="tab_file" file="%(test1Output)s" ftype="%(outputFormat)s" />
316 <output name="html_file" file="%(test1HTML)s" ftype="html" lines_diff="10"/> 320 <output name="html_file" file="%(test1HTML)s" ftype="html" lines_diff="10"/>
317 </test> 321 </test>
318 </tests> 322 </tests>
319 """ 323 """
320 xdict = {} 324 xdict = {}
325 xdict['outputFormat'] = self.outputFormat
326 xdict['inputFormats'] = self.inputFormats
321 xdict['requirements'] = '' 327 xdict['requirements'] = ''
322 if self.opts.make_HTML: 328 if self.opts.make_HTML:
323 if self.opts.include_dependencies == "yes": 329 if self.opts.include_dependencies == "yes":
324 xdict['requirements'] = protorequirements 330 xdict['requirements'] = protorequirements
325 xdict['tool_version'] = self.opts.tool_version 331 xdict['tool_version'] = self.opts.tool_version
381 xdict['outputs'] += ' <data format="html" name="html_file" label="${job_name}.html"/>\n' 387 xdict['outputs'] += ' <data format="html" name="html_file" label="${job_name}.html"/>\n'
382 else: 388 else:
383 xdict['command_outputs'] += ' --output_dir "./"' 389 xdict['command_outputs'] += ' --output_dir "./"'
384 if self.opts.output_tab <> 'None': 390 if self.opts.output_tab <> 'None':
385 xdict['command_outputs'] += ' --output_tab "$tab_file"' 391 xdict['command_outputs'] += ' --output_tab "$tab_file"'
386 xdict['outputs'] += ' <data format="%s" name="tab_file" label="${job_name}"/>\n' % self.outFormats 392 xdict['outputs'] += ' <data format="%s" name="tab_file" label="${job_name}"/>\n' % self.outputFormat
387 xdict['command'] = newCommand % xdict 393 xdict['command'] = newCommand % xdict
388 xmls = newXML % xdict 394 xmls = newXML % xdict
389 xf = open(self.xmlfile,'w') 395 xf = open(self.xmlfile,'w')
390 xf.write(xmls) 396 xf.write(xmls)
391 xf.write('\n') 397 xf.write('\n')
691 a('--tool_name',default=None) 697 a('--tool_name',default=None)
692 a('--interpreter',default=None) 698 a('--interpreter',default=None)
693 a('--output_dir',default='./') 699 a('--output_dir',default='./')
694 a('--output_html',default=None) 700 a('--output_html',default=None)
695 a('--input_tab',default="None") 701 a('--input_tab',default="None")
702 a('--input_formats',default="tabular,text")
696 a('--output_tab',default="None") 703 a('--output_tab',default="None")
704 a('--output_format',default="tabular")
697 a('--user_email',default='Unknown') 705 a('--user_email',default='Unknown')
698 a('--bad_user',default=None) 706 a('--bad_user',default=None)
699 a('--make_Tool',default=None) 707 a('--make_Tool',default=None)
700 a('--make_HTML',default=None) 708 a('--make_HTML',default=None)
701 a('--help_text',default=None) 709 a('--help_text',default=None)