Repository 'tool_factory_2'
hg clone https://toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_2

Changeset 112:5509dc4c1cf2 (2020-11-29)
Previous changeset 111:223b78754735 (2020-11-29) Next changeset 113:6873c211b250 (2020-12-01)
Commit message:
Uploaded
modified:
toolfactory/rgToolFactory2.py
toolfactory/rgToolFactory2.xml
b
diff -r 223b78754735 -r 5509dc4c1cf2 toolfactory/rgToolFactory2.py
--- a/toolfactory/rgToolFactory2.py Sun Nov 29 07:51:53 2020 +0000
+++ b/toolfactory/rgToolFactory2.py Sun Nov 29 10:34:48 2020 +0000
[
b'@@ -14,16 +14,11 @@\n # 2. Fix planemo so the toolfactory function works\n # 3. Rewrite bits using galaxyxml functions where that makes sense - done\n #\n-# removed all the old complications including making the new tool use this same script\n-# galaxyxml now generates the tool xml https://github.com/hexylena/galaxyxml\n-# No support for automatic HTML file creation from arbitrary outputs\n-# essential problem is to create two command lines - one for the tool xml and a different\n-# one to run the executable with the supplied test data and settings\n-# Be simpler to write the tool, then run it with planemo and soak up the test outputs.\n-# well well. sh run_tests.sh --id rgtf2 --report_file tool_tests_tool_conf.html functional.test_toolbox\n-# does the needful. Use GALAXY_TEST_SAVE /foo to save outputs - only the tar.gz - not the rest sadly\n-# GALAXY_TEST_NO_CLEANUP GALAXY_TEST_TMP_DIR=wherever\n-# planemo test --engine docker_galaxy --test_data ./test-data/ --docker_extra_volume ./test-data rgToolFactory2.xml\n+# uses planemo in a biodocker sort of image as a requirement\n+# otherwise planemo seems to leak dependencies back into the\n+# calling venv. Hilarity ensues.\n+\n+\n \n import argparse\n import copy\n@@ -58,10 +53,6 @@\n debug = True\n toolFactoryURL = "https://github.com/fubar2/toolfactory"\n ourdelim = "~~~"\n-ALOT = 10000000  # srsly. command or test overrides use read() so just in case\n-STDIOXML = """<stdio>\n-<exit_code range="100:" level="debug" description="shite happens" />\n-</stdio>"""\n \n # --input_files="$intab.input_files~~~$intab.input_CL~~~$intab.input_formats\\\n #~~~$intab.input_label~~~$intab.input_help"\n@@ -263,12 +254,12 @@\n                 clsuffix.append(appendme)\n                 xclsuffix.append(xappendme)\n             for i, p in enumerate(self.outfiles):\n-                if p[OCLPOS] == "STDOUT":\n+                if p[OOCLPOS] == "STDOUT":\n                     self.lastclredirect = [">", p[ONAMEPOS]]\n                     self.lastxclredirect = [">", "$%s" % p[OCLPOS]]\n-                else:\n-                    clsuffix.append([p[OOCLPOS], p[OCLPOS], p[ONAMEPOS], ""])\n-                    xclsuffix.append([p[OOCLPOS], p[OCLPOS], "$%s" % p[ONAMEPOS], ""])\n+                else: #   for (o_v, k, v, koverride) in self.xclsuffix:\n+                    clsuffix.append([p[ONAMEPOS], p[ONAMEPOS], p[ONAMEPOS], ""])\n+                    xclsuffix.append([p[ONAMEPOS], p[ONAMEPOS], "$%s" % p[ONAMEPOS], ""])\n             for p in self.addpar:\n                 clsuffix.append([p[AOCLPOS], p[ACLPOS], p[AVALPOS], p[AOVERPOS]])\n                 xclsuffix.append(\n@@ -296,7 +287,7 @@\n         tscript.write(self.script)\n         tscript.close()\n         self.escapedScript = [cheetah_escape(x) for x in rx]\n-        self.spacedScript = [f"    {x}" for x in rx]\n+        self.spacedScript = [f"    {x}" for x in rx if x.strip() > ""]\n         art = "%s.%s" % (self.tool_name, self.executeme)\n         artifact = open(art, "wb")\n         artifact.write(bytes(\'\\n\'.join(self.escapedScript),\'utf8\'))\n@@ -330,7 +321,7 @@\n                     p[ONAMEPOS],\n                 )\n             p.append(p[OCLPOS]) # keep copy\n-            if p[OCLPOS].isdigit() or p[OCLPOS] == "STDOUT":\n+            if p[OOCLPOS].isdigit() or p[OOCLPOS] == "STDOUT":\n                 scl = p[ONAMEPOS]\n                 p[OCLPOS] = scl\n             self.outfiles[i] = p\n@@ -378,12 +369,20 @@\n         if self.lastxclredirect:\n             aXCL(self.lastxclredirect[0])\n             aXCL(self.lastxclredirect[1])\n+        if os.path.exists(self.tlog):\n+            tout = open(self.tlog, "a")\n+        else:\n+            tout = open(self.tlog, "w")\n+        tout.write(f" #### clpositional: self.clsuffix = {self.clsuffix} and self.xclsuffix = {self.xclsuffix}")\n+        tout.close()\n+\n \n     def clargparse(self):\n         """argparse style"""\n         aCL = self.cl.append\n         aXCL = self.xmlcl.append\n         # inputs then params in argparse named form\n+\n         for (o_v, k, v, kover'..b' = os.path.join(self.testdir, self.newtarpath)\n-                shutil.copyfile(src, dest)\n-            else:\n-                tout.write(\n-                    "No toolshed archive found after first ephemeris test - not a good sign"\n-                )\n-            ephouts = os.path.join(jobdir, "working", "tfout", "test-data")\n-            with os.scandir(ephouts) as outs:\n-                for entry in outs:\n-                    if not entry.is_file():\n-                        continue\n-                    dest = os.path.join(self.tooloutdir, entry.name)\n-                    src = os.path.join(ephouts, entry.name)\n-                    shutil.copyfile(src, dest)\n-        else:\n-            subp = subprocess.run(\n-                cll,\n-                env=self.ourenv,\n-                cwd=self.ourcwd,\n-                shell=False,\n-                stderr=tout,\n-                stdout=tout,\n-            )\n-            tout.write("eph_test Ran %s got %d" % (" ".join(cll), subp.returncode))\n-        tout.close()\n-        return subp.returncode\n-\n-    def planemo_test_biocontainer(self, genoutputs=True):\n-        """planemo is a requirement so is available for testing but testing in a biocontainer\n-                requires some fiddling to use the hacked galaxy-central .venv\n-\n-                Planemo runs:\n-        python ./scripts/functional_tests.py -v --with-nosehtml --html-report-file\n-        /export/galaxy-central/database/job_working_directory/000/17/working/TF_run_report_tempdir/tacrev_planemo_test_report.html\n-        --with-xunit --xunit-file /tmp/tmpt90p7f9h/xunit.xml --with-structureddata\n-        --structured-data-file\n-        /export/galaxy-central/database/job_working_directory/000/17/working/tfout/tool_test_output.json functional.test_toolbox\n-\n-\n-                for the planemo-biocontainer,\n-                planemo test --conda_dependency_resolution --skip_venv --galaxy_root /galthrow/ rgToolFactory2.xml\n-\n-        """\n-        xreal = "%s.xml" % self.tool_name\n-        tool_test_path = os.path.join(\n-            self.repdir, f"{self.tool_name}_planemo_test_report.html"\n-        )\n-        if os.path.exists(self.tlog):\n-            tout = open(self.tlog, "a")\n-        else:\n-            tout = open(self.tlog, "w")\n-        if genoutputs:\n-            dummy, tfile = tempfile.mkstemp()\n-            cll = [\n-                ".",\n-                os.path.join(self.args.galaxy_root, ".venv", "bin", "activate"),\n-                "&&",\n-                "planemo",\n-                "test",\n-                "--test_data",\n-                self.testdir,\n-                "--test_output",\n-                tool_test_path,\n-                "--skip_venv",\n-                "--galaxy_root",\n-                self.args.galaxy_root,\n-                "--update_test_data",\n-                xreal,\n-            ]\n-            subp = subprocess.run(\n-                cll,\n-                env=self.ourenv,\n-                shell=False,\n-                cwd=self.tooloutdir,\n-                stderr=dummy,\n-                stdout=dummy,\n-            )\n-\n-        else:\n-            cll = [\n-                ".",\n-                os.path.join(self.args.galaxy_root, ".venv", "bin", "activate"),\n-                "&&",\n-                "planemo",\n-                "test",\n-                "--test_data",\n-                os.path.self.testdir,\n-                "--test_output",\n-                os.path.tool_test_path,\n-                "--skip_venv",\n-                "--galaxy_root",\n-                self.args.galaxy_root,\n-                xreal,\n-            ]\n-            subp = subprocess.run(\n-                cll,\n-                env=self.ourenv,\n-                shell=False,\n-                cwd=self.tooloutdir,\n-                stderr=tout,\n-                stdout=tout,\n-            )\n-        tout.close()\n-        return subp.returncode\n-\n     def writeShedyml(self):\n         """for planemo"""\n         yuser = self.args.user_email.split("@")[0]\n'
b
diff -r 223b78754735 -r 5509dc4c1cf2 toolfactory/rgToolFactory2.xml
--- a/toolfactory/rgToolFactory2.xml Sun Nov 29 07:51:53 2020 +0000
+++ b/toolfactory/rgToolFactory2.xml Sun Nov 29 10:34:48 2020 +0000
[
@@ -241,8 +241,8 @@
     optional="false" help="Use :[ver] for specific version - 'bwa:0.17.0'. Default is latest. Will be used every time the tool is (re)run. Only Conda is currently supported"  />
 
     <conditional name="usescript">
-        <param name="choosescript" type="select" display="radio" label="Supply a script to either a dependency (e.g. python/R/bash) or a system executable such as Bash"
-        help = "For script interpreters like Python or bash. Parameters and i/o specified below must match script's expectations - if you pass parameters, the script must deal with them">
+        <param name="choosescript" type="select" display="radio" label="Supply a script for a dependency (e.g. python/R/bash) or a system executable such as Bash"
+        help = "For script interpreters like Python or bash, parameters and i/o specified below must match script's expectations - if you pass parameters, the script must deal with them">
             <option value="no">No script required for this tool - just pass parameters on the command line to the first dependency listed above</option>
             <option value="yes" selected="true">Yes, a script is ready to be pasted below</option>
         </param>
@@ -251,7 +251,7 @@
             <param name="scriptrunner" type="hidden"  value="" />
         </when>
         <when value="yes">
-            <param name="scriptrunner" type="text" value=""   label="Interpreter for the script pasted below - eg bash or python. Can be one of the dependencies named above or a system executable"
+            <param name="scriptrunner" type="text" value=""   label="Interpreter for the script - eg bash or python. Can be one of the dependencies named above or a system executable"
              help="Scripts are interpreted by the executable named here. Use bash for bash scripts, or a conda dependency such as R or Python for those scripts">
             <sanitizer invalid_char="">
                 <valid initial="string.letters,string.digits">
@@ -259,7 +259,7 @@
                 </valid>
             </sanitizer>
             </param>
-            <param name="dynScript" type="text" area="True" value="" label="Script for executable below to interpret. It can be one of the Conda dependency names "
+            <param name="dynScript" type="text" area="True" value="" label="Script for executable above to interpret. It can be one of the Conda dependency names "
              help="Script must handle all i/o and parameters as specified below using the parameters and passing method chosen below">
               <sanitizer>
                  <valid initial="string.printable">