Mercurial > repos > fubar > toolfactory
comparison rgToolFactory.py @ 19:4bfe405f76ed draft
Uploaded
| author | fubar |
|---|---|
| date | Sun, 23 Mar 2014 07:46:57 -0400 |
| parents | a986c9f88d38 |
| children | 812871c1eaec |
comparison
equal
deleted
inserted
replaced
| 18:a986c9f88d38 | 19:4bfe405f76ed |
|---|---|
| 253 <configfiles> | 253 <configfiles> |
| 254 <configfile name="runMe"> | 254 <configfile name="runMe"> |
| 255 %(script)s | 255 %(script)s |
| 256 </configfile> | 256 </configfile> |
| 257 </configfiles> | 257 </configfiles> |
| 258 | |
| 258 %(tooltests)s | 259 %(tooltests)s |
| 260 | |
| 259 <help> | 261 <help> |
| 260 | 262 |
| 261 %(help)s | 263 %(help)s |
| 262 | 264 |
| 263 </help> | 265 </help> |
| 265 | 267 |
| 266 newCommand="""<command interpreter="python"> | 268 newCommand="""<command interpreter="python"> |
| 267 %(toolname)s.py --script_path "$runMe" --interpreter "%(interpreter)s" | 269 %(toolname)s.py --script_path "$runMe" --interpreter "%(interpreter)s" |
| 268 --tool_name "%(toolname)s" %(command_inputs)s %(command_outputs)s | 270 --tool_name "%(toolname)s" %(command_inputs)s %(command_outputs)s |
| 269 </command>""" # may NOT be an input or htmlout | 271 </command>""" # may NOT be an input or htmlout |
| 270 tooltestsTabOnly = """<tests><test> | 272 tooltestsTabOnly = """ |
| 273 <tests> | |
| 274 <test> | |
| 271 <param name="input1" value="%(test1Input)s" ftype="tabular"/> | 275 <param name="input1" value="%(test1Input)s" ftype="tabular"/> |
| 272 <param name="job_name" value="test1"/> | 276 <param name="job_name" value="test1"/> |
| 273 <param name="runMe" value="$runMe"/> | 277 <param name="runMe" value="$runMe"/> |
| 274 <output name="tab_file" file="%(test1Output)s" ftype="tabular"/> | 278 <output name="tab_file" file="%(test1Output)s" ftype="tabular"/> |
| 275 </test></tests>""" | 279 </test> |
| 276 tooltestsHTMLOnly = """<tests><test> | 280 </tests> |
| 281 """ | |
| 282 tooltestsHTMLOnly = """ | |
| 283 <tests> | |
| 284 <test> | |
| 277 <param name="input1" value="%(test1Input)s" ftype="tabular"/> | 285 <param name="input1" value="%(test1Input)s" ftype="tabular"/> |
| 278 <param name="job_name" value="test1"/> | 286 <param name="job_name" value="test1"/> |
| 279 <param name="runMe" value="$runMe"/> | 287 <param name="runMe" value="$runMe"/> |
| 280 <output name="html_file" file="%(test1HTML)s" ftype="html" lines_diff="5"/> | 288 <output name="html_file" file="%(test1HTML)s" ftype="html" lines_diff="5"/> |
| 281 </test></tests>""" | 289 </test> |
| 282 tooltestsBoth = """<tests><test> | 290 </tests> |
| 291 """ | |
| 292 tooltestsBoth = """<tests> | |
| 293 <test> | |
| 283 <param name="input1" value="%(test1Input)s" ftype="tabular"/> | 294 <param name="input1" value="%(test1Input)s" ftype="tabular"/> |
| 284 <param name="job_name" value="test1"/> | 295 <param name="job_name" value="test1"/> |
| 285 <param name="runMe" value="$runMe"/> | 296 <param name="runMe" value="$runMe"/> |
| 286 <output name="tab_file" file="%(test1Output)s" ftype="tabular" /> | 297 <output name="tab_file" file="%(test1Output)s" ftype="tabular" /> |
| 287 <output name="html_file" file="%(test1HTML)s" ftype="html" lines_diff="10"/> | 298 <output name="html_file" file="%(test1HTML)s" ftype="html" lines_diff="10"/> |
| 288 </test></tests>""" | 299 </test> |
| 300 </tests> | |
| 301 """ | |
| 289 xdict = {} | 302 xdict = {} |
| 290 xdict['requirements'] = '' | 303 xdict['requirements'] = '' |
| 291 if self.opts.make_HTML: | 304 if self.opts.make_HTML: |
| 292 xdict['requirements'] = protorequirements | 305 xdict['requirements'] = protorequirements |
| 293 xdict['tool_version'] = self.opts.tool_version | 306 xdict['tool_version'] = self.opts.tool_version |
| 302 xdict['tooltests'] = tooltestsTabOnly % xdict | 315 xdict['tooltests'] = tooltestsTabOnly % xdict |
| 303 xdict['script'] = self.escapedScript | 316 xdict['script'] = self.escapedScript |
| 304 # configfile is least painful way to embed script to avoid external dependencies | 317 # configfile is least painful way to embed script to avoid external dependencies |
| 305 # but requires escaping of <, > and $ to avoid Mako parsing | 318 # but requires escaping of <, > and $ to avoid Mako parsing |
| 306 if self.opts.help_text: | 319 if self.opts.help_text: |
| 307 xdict['help'] = open(self.opts.help_text,'r').read() | 320 xdict['help'] = open(self.opts.help_text,'r').readlines() |
| 308 xdict['help'] = '\n'.join([x.lstrip(x) for x in xdict['help']]) | 321 xdict['help'] = ''.join([x.lstrip(x) for x in xdict['help']]) |
| 309 else: | 322 else: |
| 310 xdict['help'] = 'Please ask the tool author for help as none was supplied at tool generation\n' | 323 xdict['help'] = 'Please ask the tool author for help as none was supplied at tool generation\n' |
| 311 coda = ['**Script**','Pressing execute will run the following code over your input file and generate some outputs in your history::'] | 324 coda = ['**Script**','Pressing execute will run the following code over your input file and generate some outputs in your history::'] |
| 312 coda.append(self.indentedScript) | 325 coda.append(self.indentedScript) |
| 313 coda.append('**Attribution** This Galaxy tool was created by %s at %s\nusing the Galaxy Tool Factory.' % (self.opts.user_email,timenow())) | 326 coda.append('**Attribution** This Galaxy tool was created by %s at %s\nusing the Galaxy Tool Factory.' % (self.opts.user_email,timenow())) |
