changeset 63:b3254219d4fb draft

Uploaded
author fubar
date Tue, 10 Nov 2020 02:33:46 +0000
parents 881bd8c81ac9
children 30847b2e105d
files toolfactory/rgToolFactory2.py toolfactory/rgToolFactory2.xml toolfactory/test-data/pyrevpos.python
diffstat 3 files changed, 282 insertions(+), 188 deletions(-) [+]
line wrap: on
line diff
--- a/toolfactory/rgToolFactory2.py	Mon Oct 26 02:51:54 2020 +0000
+++ b/toolfactory/rgToolFactory2.py	Tue Nov 10 02:33:46 2020 +0000
@@ -23,6 +23,7 @@
 
 
 import argparse
+import copy
 import logging
 import os
 import re
@@ -33,6 +34,9 @@
 import tempfile
 import time
 
+from bioblend import galaxy
+from bioblend import toolshed
+
 import galaxyxml.tool as gxt
 import galaxyxml.tool.parameters as gxtp
 
@@ -154,13 +158,13 @@
         self.cl = []
         self.xmlcl = []
         self.is_positional = self.args.parampass == "positional"
-        if self.args.packages:
-            self.executeme = self.args.packages.split(",")[0].split(":")[0]
-        else:
+        if self.args.sysexe:
             self.executeme = self.args.sysexe
-        assert (
-            self.executeme is not None
-        ), "No system or managed executable passed in. Cannot build"
+        else:
+            if self.args.packages:
+                self.executeme = self.args.packages.split(",")[0].split(":")[0]
+            else:
+                self.executeme = None
         aCL = self.cl.append
         aXCL = self.xmlcl.append
         assert args.parampass in [
@@ -477,9 +481,9 @@
                 )
             aparm.positional = self.is_positional
             if self.is_positional:
-                aninput.positional = int(oldcl)
+                aparm.positional = int(oldcl)
             self.tinputs.append(aparm)
-            self.tparm = gxtp.TestParam(newname, value=newval)
+            tparm = gxtp.TestParam(newname, value=newval)
             self.testparam.append(tparm)
 
     def doNoXMLparam(self):
@@ -508,7 +512,7 @@
             self.tinputs.append(aninput)
             tp = gxtp.TestParam(name=newname, value="%s_sample" % newname)
             self.testparam.append(tp)
-        if len(self.outfiles > 0):
+        if len(self.outfiles) > 0:
             newname = self.outfiles[0][OCLPOS]
             newfmt = self.outfiles[0][OFMTPOS]
             anout = gxtp.OutputData(newname, format=newfmt, num_dashes=0)
@@ -531,8 +535,9 @@
         if self.args.help_text:
             helptext = open(self.args.help_text, "r").readlines()
             safertext = [html_escape(x) for x in helptext]
-            if self.args.script_path:
-                scrpt = self.script.split('\n')
+            if False and self.args.script_path:
+                scrp = self.script.split('\n')
+                scrpt = ['   %s' % x for x in scrp] # try to stop templating
                 scrpt.insert(0,"```\n")
                 if len(scrpt) > 300:
                     safertext = safertext + scrpt[:100] + ['>500 lines - stuff deleted','......'] + scrpt[-100:]
@@ -593,6 +598,7 @@
             part2 = exml.split("</tests>")[1]
             fixed = "%s\n%s\n%s" % (part1, self.test_override, part2)
             exml = fixed
+        exml = exml.replace('range="1:"', 'range="1000:"')
         xf = open("%s.xml" % self.tool_name, "w")
         xf.write(exml)
         xf.write("\n")
@@ -606,8 +612,6 @@
         easiest way to generate test outputs for that case so is
         automagically selected
         """
-        s = "run cl=%s" % str(self.cl)
-        logging.debug(s)
         scl = " ".join(self.cl)
         err = None
         if self.args.parampass != "0":
@@ -623,7 +627,7 @@
                 else:
                     sto = open(self.tlog, "w")
                 sto.write(
-                        "## Executing Toolfactory generated command line = %s\n" % scl
+                       "## Executing Toolfactory generated command line = %s\n" % scl
                 )
             sto.flush()
             p = subprocess.run(self.cl, shell=False, stdout=sto, stderr=ste)
@@ -634,12 +638,15 @@
             if len(self.infiles) > 0:
                 sti = open(self.infiles[0][IPATHPOS], "rb")
             else:
-                sti = sys.stdin    
+                sti = sys.stdin
             if len(self.outfiles) > 0:
                 sto = open(self.outfiles[0][ONAMEPOS], "wb")
             else:
                 sto = sys.stdout
             p = subprocess.run(self.cl, shell=False, stdout=sto, stdin=sti)
+            sto.write(
+              "## Executing Toolfactory generated command line = %s\n" % scl
+            )
             retval = p.returncode
             sto.close()
             sti.close()
@@ -652,83 +659,49 @@
         logging.debug("run done")
         return retval
 
-    def planemo_shedload(self):
+
+    def shedLoad(self):
         """
-        planemo shed_create --shed_target testtoolshed
-        planemo shed_update --check_diff --shed_target testtoolshed
+        {'deleted': False,
+              'description': 'Tools for manipulating data',
+              'id': '175812cd7caaf439',
+              'model_class': 'Category',
+              'name': 'Text Manipulation',
+              'url': '/api/categories/175812cd7caaf439'}]
+
+
         """
         if os.path.exists(self.tlog):
-            tout = open(self.tlog, "a")
-        else:
-            tout = open(self.tlog, "w")
-        cll = ["planemo", "shed_create", "--shed_target", "local"]
-        try:
-            p = subprocess.run(
-                cll, shell=True, cwd=self.tooloutdir, stdout=tout, stderr=tout
-            )
-        except:
-            pass
-        if p.returncode != 0:
-            print("Repository %s exists" % self.args.tool_name)
+            sto = open(self.tlog, "a")
         else:
-            print("initiated %s" % self.args.tool_name)
-        cll = [
-            "planemo",
-            "shed_upload",
-            "--shed_target",
-            "local",
-            "--owner",
-            "fubar",
-            "--name",
-            self.args.tool_name,
-            "--shed_key",
-            self.args.toolshed_api_key,
-            "--tar",
-            self.newtarpath,
-        ]
-        p = subprocess.run(cll, shell=False)
-        print("Ran", " ".join(cll), "got", p.returncode)
-        tout.close()
-        return p.returncode
+            sto = open(self.tlog, "w")
 
-    def planemo_test(self, genoutputs=True):
-        """planemo is a requirement so is available for testing
-        and for generating test outputs if command or test overrides are supplied
-        test outputs are sent to repdir for display
-        """
-        xreal = "%s.xml" % self.tool_name
-        if os.path.exists(self.tlog):
-            tout = open(self.tlog, "a")
+        ts = toolshed.ToolShedInstance(url=self.args.toolshed_url,key=self.args.toolshed_api_key,verify=False)
+        repos = ts.repositories.get_repositories()
+        rnames = [x.get('name','?') for x in repos]
+        rids = [x.get('id','?') for x in repos]
+        sto.write(f'############names={rnames} rids={rids}')
+        cat = 'ToolFactory generated tools'
+        if self.args.tool_name not in rnames:
+            tscat = ts.categories.get_categories()
+            cnames = [x.get('name','?') for x in tscat]
+            cids = [x.get('id','?') for x in tscat]
+            catID = None
+            if cat in cnames:
+                ci = cnames.index(cat)
+                catID = cids[ci]
+            res = ts.repositories.create_repository(name=self.args.tool_name, synopsis='Synopsis:%s' % self.args.tool_desc, description=self.args.tool_desc,
+                          type='unrestricted', remote_repository_url=self.args.toolshed_url,
+                          homepage_url=None, category_ids=catID)
+            tid = res.get('id',None)
+            sto.write(f'##########create res={res}')
         else:
-            tout = open(self.tlog, "w")
-        if genoutputs:
-            cll = [
-                "planemo",
-                "test",
-                "--galaxy_root",
-                self.args.galaxy_root,
-                "--update_test_data",
-                xreal,
-            ]
-        else:
-            cll = ["planemo", "test", "--galaxy_root",
-                self.args.galaxy_root, 
-                xreal,]
-        p = subprocess.run(
-                cll, shell=False, cwd=self.tooloutdir, stderr=tout, stdout=tout
-            )
-        if genoutputs:
-            with os.scandir(self.testdir) as outs:
-                for entry in outs:
-                    if entry.is_file():
-                        dest = os.path.join(self.repdir, entry.name)
-                        src = os.path.join(self.testdir, entry.name)
-                        shutil.copyfile(src, dest)
-                    tout.write(
-                        "Copied output %s to %s after planemo test\n" % (src, dest)
-                    )
-        tout.close()
-        return p.returncode
+             i = rnames.index(self.args.tool_name)
+             tid = rids[i]
+        res = ts.repositories.update_repository(id=tid, tar_ball_path=self.newtarpath, commit_message=None)
+        sto.write(f'#####update res={res}')
+        sto.close()
+
 
     def eph_galaxy_load(self):
         """load the new tool from the local toolshed after planemo uploads it
@@ -751,22 +724,138 @@
             "fubar",
             "--toolshed",
             self.args.toolshed_url,
-            "--section_label",
-            "Generated Tools",
+           "--section_label",
+            "ToolFactory",
 
         ]
-        print("running\n", " ".join(cll))
+        tout.write("running\n%s\n" % " ".join(cll))
         p = subprocess.run(cll, shell=False, stderr=tout, stdout=tout)
-        if p.returncode != 0:
-            print(
-                "Repository %s installation returned %d"
-                % (self.args.tool_name, p.returncode)
-            )
+        tout.write("installed %s - got retcode %d\n" % (self.args.tool_name,p.returncode))
+        tout.close()
+        return p.returncode
+
+
+    def planemo_shedload(self):
+        """
+        planemo shed_create --shed_target testtoolshed
+        planemo shed_init --name=<name>
+                  --owner=<shed_username>
+                  --description=<short description>
+                  [--remote_repository_url=<URL to .shed.yml on github>]
+                  [--homepage_url=<Homepage for tool.>]
+                  [--long_description=<long description>]
+                  [--category=<category name>]*
+        
+        
+        planemo shed_update --check_diff --shed_target testtoolshed
+        """
+        if os.path.exists(self.tlog):
+            tout = open(self.tlog, "a")
         else:
-            print("installed %s" % self.args.tool_name)
+            tout = open(self.tlog, "w")
+        ts = toolshed.ToolShedInstance(url=self.args.toolshed_url,key=self.args.toolshed_api_key,verify=False)
+        repos = ts.repositories.get_repositories()
+        rnames = [x.get('name','?') for x in repos]
+        rids = [x.get('id','?') for x in repos]
+        tout.write(f'############names={rnames} rids={rids}')
+        cat = 'ToolFactory generated tools'
+        if self.args.tool_name not in rnames:
+            cll = ["planemo", "shed_create", "--shed_target", "local", 
+            "--owner","fubar","--name",
+            self.args.tool_name,"--shed_key",
+            self.args.toolshed_api_key,]
+            try:
+                p = subprocess.run(
+                    cll, shell=False, cwd=self.tooloutdir, stdout=tout, stderr=tout
+                )
+            except:
+                pass
+            if p.returncode != 0:
+               tout.write("Repository %s exists" % self.args.tool_name)
+            else:
+                tout.write("initiated %s" % self.args.tool_name)
+        cll = [
+            "planemo",
+            "shed_upload",
+            "--shed_target",
+            "local",
+            "--owner",
+            "fubar",
+            "--name",
+            self.args.tool_name,
+            "--shed_key",
+            self.args.toolshed_api_key,
+            "--tar",
+            self.newtarpath,
+        ]
+        p = subprocess.run(cll, shell=False, stdout=tout, stderr=tout)
+        tout.write("Ran %s got %d" %  (" ".join(cll), p.returncode))
         tout.close()
         return p.returncode
 
+
+    def eph_test(self):
+            """
+            """
+            if os.path.exists(self.tlog):
+                tout = open(self.tlog, "a")
+            else:
+                tout = open(self.tlog, "w")
+            cll = [
+                    "shed-tools",
+                    "test",
+                 "-g",
+                self.args.galaxy_url,
+                "-a",
+                self.args.galaxy_api_key,
+                "--name",
+                self.args.tool_name,
+                "--owner",
+                "fubar",
+                   ]
+            p = subprocess.run(
+                    cll, shell=False, cwd=self.tooloutdir, stderr=tout, stdout=tout
+                )
+            tout.write("eph_test Ran %s got %d" % (" ".join(cll), p.returncode))
+            tout.close()
+            return p.returncode
+
+    def planemo_test(self, genoutputs=True):
+        """planemo is a requirement so is available for testing
+        and for generating test outputs if command or test overrides are supplied
+        test outputs are sent to repdir for display
+        """
+        xreal = "%s.xml" % self.tool_name
+        if os.path.exists(self.tlog):
+            tout = open(self.tlog, "a")
+        else:
+            tout = open(self.tlog, "w")
+        if genoutputs:
+            dummy,tfile = tempfile.mkstemp()
+            cll = [
+                "planemo",
+                "test",
+                "--galaxy_root",
+                self.args.galaxy_root,
+                "--update_test_data",
+                xreal,
+            ]
+            p = subprocess.run(
+                    cll, shell=False, cwd=self.tooloutdir, stderr=dummy, stdout=dummy,
+                )
+            dummy.close() # throw all the log away as it will be rerun after outputs are generated
+        else:
+            cll = ["planemo", "test", "--galaxy_root",
+                self.args.galaxy_root,
+                xreal,]
+            p = subprocess.run(
+                    cll, shell=False, cwd=self.tooloutdir, stderr=tout, stdout=tout
+                )
+        tout.close()
+        return p.returncode
+
+
+
     def writeShedyml(self):
         """for planemo
         """
@@ -872,11 +961,15 @@
     a("--tfout", default="./tfout")
     a("--new_tool", default="new_tool")
     a("--galaxy_url", default="http://localhost:8080")
+    a("--toolshed_url", default="http://localhost:9009") # make sure this is NOT 127.0.0.1 - it won't work if tool_sheds_conf.xml has localhost
+    #a("--galaxy_api_key", default="1e62ddad74fe9bf112859f4e9efea48b")
+    #a("--toolshed_api_key", default="9154c91f2a162bf12fda15764f43846c")
+
+    a("--toolshed_api_key", default="fakekey")
     a("--galaxy_api_key", default="fakekey")
-    a("--toolshed_url", default="http://localhost:9009")
-    a("--toolshed_api_key", default="fakekey")
     a("--galaxy_root", default="/galaxy-central")
 
+
     args = parser.parse_args()
     assert not args.bad_user, (
         'UNAUTHORISED: %s is NOT authorized to use this tool until Galaxy admin adds %s to "admin_users" in the Galaxy configuration file'
@@ -893,32 +986,16 @@
     r = ScriptRunner(args)
     r.writeShedyml()
     r.makeTool()
-    if args.command_override or args.test_override:
-        retcode = r.planemo_test(genoutputs=True)  # this fails :( - see PR
-        r.moveRunOutputs()
-        r.makeToolTar()
-        retcode = r.planemo_test(genoutputs=False)
-        r.moveRunOutputs()
-        if args.make_Tool == "gentestinstall":
-            r.planemo_shedload()
-            r.eph_galaxy_load()
-    else:
-        retcode = r.run()
-        if retcode:
-            sys.stderr.write(
-                "## Run failed with return code %d. Cannot build yet. Please fix and retry"
-                % retcode
-            )
-            sys.exit(1)
-        else:
-            r.moveRunOutputs()
-            r.makeToolTar()
-            if args.make_Tool in ["gentestinstall", "gentest"]:
-                r.planemo_test(genoutputs=False)
-                r.moveRunOutputs()
-                if args.make_Tool == "gentestinstall":
-                    r.planemo_shedload()
-                    r.eph_galaxy_load()
+    retcode = r.planemo_test(genoutputs=True)  # this fails :( - see PR
+    r.moveRunOutputs()
+    r.makeToolTar()
+    retcode = r.planemo_test(genoutputs=False)
+    r.moveRunOutputs()
+    if args.make_Tool == "gentestinstall":
+        retcode = r.planemo_shedload() #r.shedLoad()
+        print(f'planemo_shedload returned {retcode}')
+        r.eph_galaxy_load()
+
 
 
 if __name__ == "__main__":
--- a/toolfactory/rgToolFactory2.xml	Mon Oct 26 02:51:54 2020 +0000
+++ b/toolfactory/rgToolFactory2.xml	Tue Nov 10 02:33:46 2020 +0000
@@ -1,4 +1,4 @@
-<tool id="rgtf2" name="toolfactory" version="2.01" profile="16.04" >
+<tool id="rgtf2" name="toolfactory" version="2.00" profile="16.04" >
   <description>Scripts into tools v2.0</description>
   <macros>
      <xml name="tool_metadata">
@@ -56,7 +56,7 @@
               <mapping initial="none"/>
             </sanitizer>
             </param>
-            <param name="input_help" type="text" value="parameter_help" label="This will become help text on the form."
+            <param name="input_help" type="text" value="" label="This will become help text on the form."
              help="Note that three consecutive ~ cannot be used in this text field - please work around this technical limitation">
             <sanitizer invalid_char="">
               <valid initial="string.printable"> <remove value='~~~'/> </valid>
@@ -85,13 +85,13 @@
      <xml name="additparam">
         <param name="edit_params" type="select" display="radio" label="Add any additional parameters to the generated tool form so they are user editable?"
              help="If no (default), users will NOT be able to alter any additional parameters. If yes, these will appear on the tool form as text fields with no validation or sanitizing">
-            <option value="yes">Yes, allow user to edit all additional parameters on the generated tool form</option>
-            <option value="no" selected="true">No - use the fixed values for all additional parameters - no user editing</option>
+            <option value="yes" selected="true">Yes, allow user to edit all additional parameters on the generated tool form</option>
+            <option value="no">No - use the fixed values for all additional parameters - no user editing</option>
         </param>
 
         <repeat name="additional_parameters" title="Pass additional parameters to the script"
              help="See examples below to see how these can be parsed by scripts in the various languages">
-          <param name="param_name" type="text" value="parameter_name" label="Choose the name for this parameter">
+          <param name="param_name" type="text" value="" label="Choose the name for this parameter - MUST not be blank!">
             <sanitizer invalid_char="">
               <valid initial="string.letters,string.digits"/>
               <mapping initial="none"/>
@@ -109,14 +109,14 @@
               <mapping initial="none"/>
             </sanitizer>
           </param>
-          <param name="param_label" type="text" value="parameter_label" label="Enter this parameter's label for the form"
+          <param name="param_label" type="text" value="" label="Enter this parameter's label for the form"
              help="Note that '~~~' is an internal delimiter so must not appear in this text field - please work around this technical limitation" >
             <sanitizer invalid_char="">
               <valid initial="string.printable"> <remove value='~~~'/> </valid>
               <mapping initial="none"/>
             </sanitizer>
           </param>
-          <param name="param_help" type="text" value="parameter_help" label="Help for this parameter"
+          <param name="param_help" type="text" value="" label="Help for this parameter"
              help="Note that three consecutive ~ cannot be used in this text field - please work around this technical limitation" >
             <sanitizer invalid_char="">
               <valid initial="string.printable"> <remove value='~~~'/> </valid>
@@ -134,8 +134,9 @@
 <requirements>
        <requirement type="package" version="0.72.0" >planemo</requirement>
        <requirement type="package" version="0.4.11" >galaxyxml</requirement>
+
 </requirements>
-  
+
   <command ><![CDATA[
 #import os
 #set dev_env = os.environ.get('GALAXY_DEVELOPMENT_ENVIRONMENT', '0') == '1'
@@ -154,21 +155,23 @@
 --test_override "$testoverride"
        #end if
     #end if
-    #if $interexe.dependency_model == "managed":
---packages "$interexe.packages"
-    #else:
---sysexe "$interexe.sysexe"
+--packages "$packages"
+   #if $usescript.choosescript == "yes":
+--script_path "$runme"
+--sysexe "$usescript.scriptrunner"
     #end if
 --tool_name="$tool_name"  --user_email="$__user_email__" --citations="$citeme"  --parampass="$ppass.parampass"
-   #if $usescript.choosescript == "yes":
---script_path "$runme"
-   #end if
+
    #if str($makeMode.make_Tool)!="runonly":
 --make_Tool="$makeMode.make_Tool"
 --tool_desc="$makeMode.tool_desc"
 --tool_version="$makeMode.tool_version"
 --help_text="$helpme"
 --new_tool="$new_tool"
+--toolshed_api_key="$makeMode.toolshed_apikey"
+--galaxy_api_key="$makeMode.galaxy_apikey"
+--toolshed_url="$makeMode.toolshed_url"
+--galaxy_url="$makeMode.galaxy_url"
    #end if
    #if $ppass.parampass != '0':
      #if str($ppass.edit_params) == "yes":
@@ -184,7 +187,7 @@
      #for $otab in $ppass.history_outputs:
 --output_files "$otab.history_name~~~$otab.history_format~~~$otab.history_CL~~~$otab.history_test"
      #end for
---galaxy_root="$__root_dir__"
+--galaxy_root "$__root_dir__"
  #end if
 ]]></command>
  <configfiles>
@@ -195,12 +198,12 @@
 #if $cover.commover == "yes" and len(str($cover.command_override).strip()) > 1:
 $cover.command_override
 #end if
- </configfile> 
+ </configfile>
  <configfile name="testoverride">
 #if $cover.commover == "yes" and len(str($cover.test_override).strip()) > 1:
 $cover.test_override
 #end if
- </configfile> 
+ </configfile>
  <configfile name="helpme">
     #if $makeMode.make_Tool != "runonly":
 ${makeMode.help_text}
@@ -231,35 +234,29 @@
             </valid>
         </sanitizer>
     </param>
-  
-    <conditional name="interexe">
-        <param name="dependency_model" type="select" label="Dependency model: Conda managed external dependency or existing system executable"
-        help = "If managed, the supplied package will become a requirement so must match the tool dependency resolver package name in conda.">
-            <option value="managed" selected="true" >Use Conda managed dependencies for scripting (python, R,....) or command line packages (bwa,samtools)</option>
-            <option value="system" >Use a non-dependency managed system executable for scripting like bash or command line driven like sed or awk</option>
+    <param name="packages" type="text" value="" label="Conda dependencies as package name[:version, name:version...]. These will always be available when this tool executes"
+    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">
+            <option value="no" selected="true">No script required for this tool - just pass parameters on the command line to the first dependency listed above</option>
+            <option value="yes">Yes, a script is ready to be pasted below</option>
         </param>
-        <when value="managed">
-            <param name="packages" type="text" value="" label="Package name[:version, name:version...] for Conda. First (e.g. python) will be called on generated command line" 
-            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." /> 
-            <param name="sysexe" type="hidden" value="" />
-        </when>
-       <when value="system">
-            <param name="sysexe" type="text" value="" label="System executable to run. OS version - not Conda managed" optional="false"
-            help=".e.g bash, awk or other standard and relatively invariant unix utilities"/>
-            <param name="packages" type="hidden" value="" />
-        </when>
-    </conditional>
-    <conditional name="usescript">
-        <param name="choosescript" type="select" display="radio" label="Run a supplied script if the dependency reads one (e.g. python/R/bash)"
-        help = "For script interpreters like Python or bash. Parameters and i/o below must match script's expectations">
-            <option value="no" selected="true">No script required for the first dependency above - just parameters on the command line</option>
-            <option value="yes">Yes, a script is ready to be pasted below for the chosen package</option>
-        </param> 
         <when value="no">
             <param name="dynScript" type="hidden"  value="" />
+            <param name="scriptrunner" type="hidden"  value="" />
         </when>
         <when value="yes">
-            <param name="dynScript" type="text" area="True" value="" label="Script for first dependency above (e.g. python) to interpret. "
+            <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"
+             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">
+                    <add value="_"/>
+                </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 "
              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">
@@ -269,6 +266,7 @@
              </param>
         </when>
     </conditional>
+
     <conditional name="ppass">
         <param name="parampass"  type="select" display="radio" label="Command line parameter passing method to use">
             <option value="argparse" selected="true">Argparse: passed in the form of --clname value</option>
@@ -294,7 +292,7 @@
         help = "For arbitrary and artfull command lines. All i/o and parameters must be passed. Choose No unless needed. Not for the faint of heart">
             <option value="no" selected="true">No. Use automatically generated command/test XML </option>
             <option value="yes">Yes. XML needed to override autogenerated command and/or test segments will be pasted below</option>
-        </param> 
+        </param>
         <when value="no">
             <param name="command_override" type="hidden"  value="" />
             <param name="test_override" type="hidden"  value="" />
@@ -315,26 +313,57 @@
                  </valid>
                  <mapping initial="none"/>
               </sanitizer>
-            </param> 
+            </param>
         </when>
     </conditional>
 
     <conditional name="makeMode">
         <param name="make_Tool" type="select" display="radio" label="Choose the steps you want to run. The TF Docker container is recommended for local installation"
-          help="Testing and installation in this Galaxy are optional" >
-        <option value="runonly">Run this configuration in Galaxy (will run Planemo if command or test override in play)</option>
-        <option value="generate">Generate a toolshed ready archive.</option>
+          help="Installation in this Galaxy is optional" >
         <option value="gentest" selected="true">Test with planemo after generating.</option>
         <option value="gentestinstall">Install in this Galaxy after generation and testing. Must have local ToolShed as in the TF Docker container</option>
         </param>
-        <when value="runonly"/>
-        <when value="generate">
-            <expand macro="tool_metadata" />
-        </when>
        <when value="gentest">
+           <param name="galaxy_apikey" value="" type="hidden"  ></param>
+           <param name="toolshed_apikey" value="" type="hidden"  ></param>
+           <param name="galaxy_url" value="" type="hidden"  ></param>
+           <param name="toolshed_url" value="" type="hidden"  ></param>
             <expand macro="tool_metadata" />
         </when>
        <when value="gentestinstall">
+            <param name="galaxy_url" type="text" value="http://localhost:8080" label="URL for the Galaxy server where the new tool should be installed"
+             help="Default is localhost">
+              <sanitizer>
+                 <valid initial="string.printable">
+                 </valid>
+                 <mapping initial="none"/>
+              </sanitizer>
+            </param>
+          <param name="galaxy_apikey" type="text" value="" label="API key for the Galaxy to install the new tool"
+             help="Cut and paste from the admin user properties screen">
+              <sanitizer>
+                 <valid initial="string.letters,string.digits">
+                 </valid>
+                 <mapping initial="none"/>
+              </sanitizer>
+            </param>
+           <param name="toolshed_url" type="text" value="http://localhost:9009" label="URL for the Toolshed where the new tool should be installed"
+             help="Default value is localhost:9009">
+              <sanitizer>
+                 <valid initial="string.printable">
+                 </valid>
+                 <mapping initial="none"/>
+              </sanitizer>
+            </param>
+           <param name="toolshed_apikey" type="text" value="" label="API key for the local toolshed to use when installing the tool"
+             help="Cut and paste from the admin user properties screen">
+              <sanitizer>
+                 <valid initial="string.letters,string.digits">
+                 </valid>
+                 <mapping initial="none"/>
+              </sanitizer>
+            </param>
+
             <expand macro="tool_metadata" />
         </when>
     </conditional>
@@ -372,6 +401,7 @@
     <param name="choosescript" value="yes" />
     <param name="script_path" value="$runme"/>
     <output name="new_tool" file="toolfactory_pyrevpos_tgz_sample" compare="sim_size" delta="6000" />
+
 </test>
 </tests>
 <help>
@@ -461,7 +491,7 @@
 
 
 
-Paper_ 
+Paper_
 
 *Licensing*
 
--- a/toolfactory/test-data/pyrevpos.python	Mon Oct 26 02:51:54 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-# reverse order of text by row
-import sys
-inp = sys.argv[1]
-outp = sys.argv[2]
-i = open(inp,'r').readlines()
-o = open(outp,'w')
-for row in i:
-   rs = row.rstrip()
-   rs = list(rs)
-   rs.reverse()
-   o.write(''.join(rs))
-o.close() 
-