comparison toolfactory/rgToolFactory2.py @ 39:2cd6555baf44 draft

Uploaded
author fubar
date Wed, 12 Aug 2020 19:00:44 -0400
parents a30536c100bf
children
comparison
equal deleted inserted replaced
38:a30536c100bf 39:2cd6555baf44
15 # 3. Rewrite bits using galaxyxml functions where that makes sense - done 15 # 3. Rewrite bits using galaxyxml functions where that makes sense - done
16 # 16 #
17 # removed all the old complications including making the new tool use this same script 17 # removed all the old complications including making the new tool use this same script
18 # galaxyxml now generates the tool xml https://github.com/hexylena/galaxyxml 18 # galaxyxml now generates the tool xml https://github.com/hexylena/galaxyxml
19 # No support for automatic HTML file creation from arbitrary outputs 19 # No support for automatic HTML file creation from arbitrary outputs
20 # TODO: add option to run that code as a post execution hook 20 # essential problem is to create two command lines - one for the tool xml and a different
21 # TODO: add additional history input parameters - currently only one 21 # one to run the executable with the supplied test data and settings
22 # Be simpler to write the tool, then run it with planemo and soak up the test outputs.
23
22 24
23 25
24 import argparse 26 import argparse
25 import logging 27 import logging
26 import os 28 import os
247 self.escapedScript = "%s" % "\n".join( 249 self.escapedScript = "%s" % "\n".join(
248 [" %s" % html_escape(x) for x in rx] 250 [" %s" % html_escape(x) for x in rx]
249 ) 251 )
250 art = "%s.%s" % (self.tool_name, self.args.interpreter_name) 252 art = "%s.%s" % (self.tool_name, self.args.interpreter_name)
251 artifact = open(art, "wb") 253 artifact = open(art, "wb")
254 if self.args.interpreter_name == "python":
255 artifact.write(bytes("#!/usr/bin/env python\n", "utf8"))
252 artifact.write(bytes(self.script, "utf8")) 256 artifact.write(bytes(self.script, "utf8"))
253 artifact.close() 257 artifact.close()
254 aCL(self.args.interpreter_name) 258 aCL(self.args.interpreter_name)
255 aCL(self.sfile) 259 aCL(self.sfile)
256 260
539 "Created by %s at %s using the Galaxy Tool Factory." 543 "Created by %s at %s using the Galaxy Tool Factory."
540 % (self.args.user_email, timenow()) 544 % (self.args.user_email, timenow())
541 ) 545 )
542 self.tool.add_comment("Source in git at: %s" % (toolFactoryURL)) 546 self.tool.add_comment("Source in git at: %s" % (toolFactoryURL))
543 self.tool.add_comment( 547 self.tool.add_comment(
544 "Cite: Creating re-usable tools from scripts doi: 10.1093/bioinformatics/bts573" 548 "Cite: Creating re-usable tools from scripts doi: \
549 10.1093/bioinformatics/bts573"
545 ) 550 )
546 exml = self.tool.export() 551 exml = self.tool.export()
547 xf = open('%s.xml' % self.tool_name, "w") 552 xf = open('%s.xml' % self.tool_name, "w")
548 xf.write(exml) 553 xf.write(exml)
549 xf.write("\n") 554 xf.write("\n")