# HG changeset patch
# User fubar
# Date 1618010592 0
# Node ID 72d190989c6832a93b22acecb02f735dbd1339db
# Parent e8e8071c9d0ccd9bd08a378a1f815b4ee20c9d62
Uploaded
diff -r e8e8071c9d0c -r 72d190989c68 toolfactory/rgToolFactory2.py
--- a/toolfactory/rgToolFactory2.py Tue Apr 06 03:12:56 2021 +0000
+++ b/toolfactory/rgToolFactory2.py Fri Apr 09 23:23:12 2021 +0000
@@ -44,7 +44,6 @@
debug = True
toolFactoryURL = "https://github.com/fubar2/toolfactory"
foo = len(lxml.__version__)
-# fug you, flake8. Say my name!
FAKEEXE = "~~~REMOVE~~~ME~~~"
# need this until a PR/version bump to fix galaxyxml prepending the exe even
# with override.
@@ -216,7 +215,7 @@
aXCL(c)
def clsimple(self):
- """no parameters - uses < and > for i/o"""
+ """no parameters or repeats - uses < and > for i/o"""
aCL = self.cl.append
aXCL = self.xmlcl.append
if len(self.infiles) > 0:
@@ -258,13 +257,17 @@
clsuffix.append([p["name"], p["name"], ""])
xclsuffix.append([p["name"], "$%s" % p["name"], ""])
for p in self.addpar:
- clsuffix.append([p["CL"], p["name"], p["override"]])
- xclsuffix.append([p["CL"], '"$%s"' % p["name"], p["override"]])
+ nam = p["name"]
+ rep = p["repeat"] == "1"
+ if rep:
+ over = f" #for $rep in $R_{nam}:\n--{nam} $rep.{nam}\n#end for"
+ else:
+ over = p["override"]
+ clsuffix.append([p["CL"], nam, over])
+ xclsuffix.append([p["CL"], nam, over])
for p in self.selpar:
clsuffix.append([p["CL"], p["name"], p["override"]])
xclsuffix.append([p["CL"], '"$%s"' % p["name"], p["override"]])
- clsuffix.sort()
- xclsuffix.sort()
self.xclsuffix = xclsuffix
self.clsuffix = clsuffix
@@ -296,8 +299,13 @@
clsuffix.append([p["CL"], p["name"], ""])
xclsuffix.append([p["CL"], "$%s" % p["name"], ""])
for p in self.addpar:
- clsuffix.append([p["CL"], p["name"], p["override"]])
- xclsuffix.append([p["CL"], '"$%s"' % p["name"], p["override"]])
+ nam = p["name"]
+ rep = p["repeat"] == "1" # repeats make NO sense
+ if rep:
+ print(f'### warning. Repeats for {nam} ignored - not permitted in positional parameter command lines!')
+ over = p["override"]
+ clsuffix.append([p["CL"], nam, over])
+ xclsuffix.append([p["CL"], nam, over])
for p in self.selpar:
clsuffix.append([p["CL"], p["name"], p["override"]])
xclsuffix.append([p["CL"], '"$%s"' % p["name"], p["override"]])
@@ -388,12 +396,14 @@
for (k, v, koverride) in self.xclsuffix:
if koverride > "":
k = koverride
- elif len(k.strip()) == 1:
- k = "-%s" % k
+ aXCL(k)
else:
- k = "--%s" % k
- aXCL(k)
- aXCL(v)
+ if len(k.strip()) == 1:
+ k = "-%s" % k
+ else:
+ k = "--%s" % k
+ aXCL(k)
+ aXCL(v)
for (k, v, koverride) in self.clsuffix:
if koverride > "":
k = koverride
@@ -480,6 +490,7 @@
newname = p["infilename"]
newfmt = p["format"]
ndash = self.getNdash(newname)
+ reps = p.get("repeat",0) == 1
if not len(p["label"]) > 0:
alab = p["CL"]
else:
@@ -501,9 +512,18 @@
else:
aninput.positional = int(p["origCL"])
aninput.command_line_override = "$%s" % newname
- self.tinputs.append(aninput)
- tparm = gxtp.TestParam(name=newname, value="%s_sample" % newname)
- self.testparam.append(tparm)
+ if reps:
+ repe = gxtp.Repeat(name=f"R_{newname}", title=f"Add as many {newlabel} as needed")
+ repe.append(aninput)
+ self.tinputs.append(repe)
+ tparm = gxtp.TestRepeat(name=f"R_{newname}")
+ tparm2 = gxtp.TestParam(newname, value="%s_sample" % newname)
+ tparm.append(tparm2)
+ self.testparam.append(tparm)
+ else:
+ self.tinputs.append(aninput)
+ tparm = gxtp.TestParam(newname, value="%s_sample" % newname)
+ self.testparam.append(tparm)
for p in self.addpar:
newname = p["name"]
newval = p["value"]
@@ -512,6 +532,7 @@
newtype = p["type"]
newcl = p["CL"]
oldcl = p["origCL"]
+ reps = p["repeat"] == "1"
if not len(newlabel) > 0:
newlabel = newname
ndash = self.getNdash(newname)
@@ -556,9 +577,18 @@
aparm.positional = self.is_positional
if self.is_positional:
aparm.positional = int(oldcl)
- self.tinputs.append(aparm)
- tparm = gxtp.TestParam(newname, value=newval)
- self.testparam.append(tparm)
+ if reps:
+ repe = gxtp.Repeat(name=f"R_{newname}", title=f"Add as many {newlabel} as needed")
+ repe.append(aparm)
+ self.tinputs.append(repe)
+ tparm = gxtp.TestRepeat(name=f"R_{newname}")
+ tparm2 = gxtp.TestParam(newname, value=newval)
+ tparm.append(tparm2)
+ self.testparam.append(tparm)
+ else:
+ self.tinputs.append(aparm)
+ tparm = gxtp.TestParam(newname, value=newval)
+ self.testparam.append(tparm)
for p in self.selpar:
newname = p["name"]
newval = p["value"]
@@ -606,8 +636,11 @@
)
collect.append(disc)
self.toutputs.append(collect)
- tparm = gxtp.TestOutputCollection(newname)
- self.testparam.append(tparm)
+ try:
+ tparm = gxtp.TestOutputCollection(newname) # broken until PR merged.
+ self.testparam.append(tparm)
+ except Exception:
+ print("#### WARNING: Galaxyxml version does not have the PR merged yet - tests for collections must be over-ridden until then!")
def doNoXMLparam(self):
"""filter style package - stdin to stdout"""
diff -r e8e8071c9d0c -r 72d190989c68 toolfactory/rgToolFactory2.xml
--- a/toolfactory/rgToolFactory2.xml Tue Apr 06 03:12:56 2021 +0000
+++ b/toolfactory/rgToolFactory2.xml Fri Apr 09 23:23:12 2021 +0000
@@ -81,7 +81,7 @@
-
+
@@ -173,14 +173,14 @@
help="Using positional parameters, enter the integer ordinal for this parameter on the command line. Using Argparse style, '--' will be prepended on the CL" value="" />
-
+
- galaxyxml
+ galaxyxml
bioblend
ephemeris
planemo
@@ -253,7 +253,7 @@
#end for
#end if
#for $intab in $io_param.ppass.io.history_inputs:
---input_files '{"name": "$intab.input_files", "CL": "$intab.input_CL", "format": "$intab.input_formats", "label": "$intab.input_label", "help": "$intab.input_help"}'
+--input_files '{"name": "$intab.input_files", "CL": "$intab.input_CL", "format": "$intab.input_formats", "label": "$intab.input_label", "help": "$intab.input_help", "repeat": "$intab.input_repeat"}'
#end for
#for $otab in $io_param.ppass.io.history_outputs:
--output_files '{"name": "$otab.history_name", "format": "$otab.history_format", "CL": "$otab.history_CL", "test": "$otab.history_test"}'