# HG changeset patch # User fubar # Date 1618274079 0 # Node ID 7805fdac70ed2b7060f27245d1f00237c8580e9a # Parent 1f353bee783f07353ba9bfc23e1154d5aaa275b9 Uploaded diff -r 1f353bee783f -r 7805fdac70ed toolfactory/rgToolFactory2.py --- a/toolfactory/rgToolFactory2.py Sat Apr 10 01:59:56 2021 +0000 +++ b/toolfactory/rgToolFactory2.py Tue Apr 13 00:34:39 2021 +0000 @@ -28,12 +28,15 @@ import tempfile import time +from bioblend import ConnectionError +from bioblend import toolshed + import galaxyxml.tool as gxt import galaxyxml.tool.parameters as gxtp + import lxml + import yaml -from bioblend import ConnectionError -from bioblend import toolshed myversion = "V2.2 February 2021" verbose = True @@ -76,7 +79,7 @@ """ - def __init__(self, args=None): + def __init__(self, args=None): # noqa """ prepare command line cl for running the tool here and prepare elements needed for galaxyxml tool generation @@ -229,20 +232,25 @@ clsuffix = [] xclsuffix = [] for i, p in enumerate(self.infiles): + nam = p["infilename"] if p["origCL"].strip().upper() == "STDIN": appendme = [ - p["infilename"], - p["infilename"], - "< %s" % p["infilename"], + nam, + nam, + "< %s" % nam, ] xappendme = [ - p["infilename"], - p["infilename"], - "< $%s" % p["infilename"], + nam, + nam, + "< $%s" % nam, ] else: + rep = p["repeat"] == "1" + over = "" + if rep: + over = f'#for $rep in $R_{nam}:\n--{nam} "$rep.{nam}"\n#end for' appendme = [p["CL"], p["CL"], ""] - xappendme = [p["CL"], "$%s" % p["CL"], ""] + xappendme = [p["CL"], "$%s" % p["CL"], over] clsuffix.append(appendme) xclsuffix.append(xappendme) for i, p in enumerate(self.outfiles): @@ -256,7 +264,7 @@ nam = p["name"] rep = p["repeat"] == "1" if rep: - over = f" #for $rep in $R_{nam}:\n--{nam} $rep.{nam}\n#end for" + over = f'#for $rep in $R_{nam}:\n--{nam} "$rep.{nam}"\n#end for' else: over = p["override"] clsuffix.append([p["CL"], nam, over]) @@ -423,7 +431,7 @@ return ndash def doXMLparam(self): - """flake8 made me do this...""" + """Add all needed elements to tool""" # noqa for p in self.outfiles: newname = p["name"] newfmt = p["format"] @@ -486,7 +494,7 @@ newname = p["infilename"] newfmt = p["format"] ndash = self.getNdash(newname) - reps = p.get("repeat", 0) == 1 + reps = p.get("repeat", "0") == "1" if not len(p["label"]) > 0: alab = p["CL"] else: @@ -674,7 +682,7 @@ tp = gxtp.TestOutput(name=newname, value="%s_sample" % newname) self.testparam.append(tp) - def makeXML(self): + def makeXML(self): # noqa """ Create a Galaxy xml tool wrapper for the new script Uses galaxyhtml @@ -712,6 +720,10 @@ safertext = safertext + "\n".join(scr) self.newtool.help = safertext self.newtool.version_command = f'echo "{self.args.tool_version}"' + std = gxtp.Stdios() + std1 = gxtp.Stdio() + std.append(std1) + self.newtool.stdios = std requirements = gxtp.Requirements() if self.args.packages: for d in self.args.packages.split(","): @@ -725,7 +737,7 @@ requirements.append( gxtp.Requirement("package", packg.strip(), ver.strip()) ) - self.newtool.requirements = requirements + self.newtool.requirements = requirements if self.args.parampass == "0": self.doNoXMLparam() else: @@ -1124,9 +1136,6 @@ r.moveRunOutputs() r.makeToolTar() else: - # r.planemo_test(genoutputs=True) # this fails :( - see PR - # r.moveRunOutputs() - # r.makeToolTar(report_fail=False) r.planemo_test_once() r.moveRunOutputs() r.makeToolTar(report_fail=True) diff -r 1f353bee783f -r 7805fdac70ed toolfactory/rgToolFactory2.xml --- a/toolfactory/rgToolFactory2.xml Sat Apr 10 01:59:56 2021 +0000 +++ b/toolfactory/rgToolFactory2.xml Tue Apr 13 00:34:39 2021 +0000 @@ -180,8 +180,8 @@ - galaxyxml - bioblend + + bioblend ephemeris planemo