changeset 135:7805fdac70ed draft

Uploaded
author fubar
date Tue, 13 Apr 2021 00:34:39 +0000
parents 1f353bee783f
children 94f5560de46d
files toolfactory/rgToolFactory2.py toolfactory/rgToolFactory2.xml
diffstat 2 files changed, 29 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- 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 @@
   </macros>
 
 <requirements>
-   <requirement type="package" version="0.4.13">galaxyxml</requirement>
-   <requirement type="package" version="0.14.0">bioblend</requirement>
+   <!-- <requirement type="package" version="0.4.13">galaxyxml</requirement> -->
+   <requirement type="package" version="0.15.0">bioblend</requirement>
    <requirement type="package" version="0.10.6">ephemeris</requirement>
    <requirement type="package" version="0.74.3">planemo</requirement>
 </requirements>