diff toolfactory/rgToolFactory2.xml @ 49:35a912ce0c83 draft

Can now make the bwa example from planemo :)
author fubar
date Thu, 27 Aug 2020 23:11:01 -0400
parents 5a7a5b06bce0
children bf432f4486c7
line wrap: on
line diff
--- a/toolfactory/rgToolFactory2.xml	Sun Aug 23 21:03:48 2020 -0400
+++ b/toolfactory/rgToolFactory2.xml	Thu Aug 27 23:11:01 2020 -0400
@@ -1,9 +1,46 @@
 <tool id="rgTF2" name="toolfactory" version="2.00" profile="16.04" >
   <description>Scripts into tools</description>
   <macros>
+     <xml name="planemo_steps">
+         <param name="tool_version" label="Tool Version - bump this to warn users trying to redo old analyses" type="text" value="0.01"
+            help="If you change your script and regenerate the 'same' tool, you should inform Galaxy (and users) by changing (bumping is traditional) this number"/>
+            <param name="tool_desc" label="Tool Description" type="text" value=""
+             help="Supply a brief tool description for the Galaxy tool menu entry (optional - appears after the tool name)" />
+            <param name="help_text" label="Tool form documentation and help text for users" type="text" area="true"
+            value="**What it Does**"
+             help="Supply user documentation to appear on the new tool form as reStructured text - http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html" >
+                <sanitizer>
+                    <valid initial="string.printable">
+                    </valid>
+                    <mapping initial="none"/>
+                </sanitizer>
+            </param>
+            <repeat name="citations" title="Citation">
+                <conditional name="citation_type">
+                    <param name="type" type="select" display="radio" label="Citation Type">
+                        <option value="doi">DOI</option>
+                        <option value="bibtex">BibTeX</option>
+                    </param>
+                    <when value="doi">
+                        <param name="doi" label="DOI" type="text" value=""
+                        help="Supply a DOI (e.g. doi: 10.1111/j.1740-9713.2007.00258.x) that should be cited when this tool is used in published research." />
+                    </when>
+                    <when value="bibtex">
+                        <param name="bibtex" label="BibTex" type="text" area="true"
+                            help="Supply a BibTex entry that should be cited when this tool is used in published research." value="" >
+                            <sanitizer>
+                                <valid initial="string.printable">
+                                </valid>
+                                <mapping initial="none"/>
+                            </sanitizer>
+                        </param>
+                    </when>
+                </conditional>
+            </repeat>
+     </xml>
      <xml name="io">
         <repeat name="history_inputs" title="Add a data file from your history to pass in to the script. Use the '+' button as needed"
-             help="USE SMALL SAMPLES because these will be used for the new tool's test. The names will become a history item selector as input for users of the new tool you are making">
+             help="USE SMALL SAMPLES for the new tool's test. Prompts will form a history item selector as input for users of this new tool">
             <param name="input_files" type="data" format="data" label="Select an input file from your history" optional="true" multiple="false"
                help=""/>
             <param name="input_formats" type="select" multiple="true" label="Select the datatype(s) that your tool/script accepts as input"
@@ -41,6 +78,8 @@
             </param>
             <param name="history_CL" type="text"  label="Positional: ordinal integer. Argparse: argument name expected for this output parameter. Use STDOUT if '>' required."
               help="If positional parameters, enter the integer ordinal expected for this parameter. If Argparse style, '--' will be prepended or '-' if single character" value=""/>
+            <param name="history_test" type="text"  label="Test pass decision criterion for this output compared to test generation"
+              help="Available options are diff:lines, sim_size" value="diff:2"/>
         </repeat>
      </xml>
      <xml name="additparam">
@@ -84,47 +123,17 @@
               <mapping initial="none"/>
             </sanitizer>
           </param>
-          <param name="param_CL" type="text" label="Positional ordinal or argparse argument name"
+          <param name="param_CL" type="text" label="Positional ordinal | argparse argument name"
               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="" />
           <param name="param_CLprefixed" type="text" label="Override the generated default argparse name prefix if not empty - eg ----foo if needed"
-              help="Some targets like Planemo expect an unadorned action like 'test' before --galaxy_root and so on. " value="" />
-
+              help="Some targets like Planemo expect an unadorned action like 'test' before --galaxy_root." value="" />
         </repeat>
      </xml>
-     <xml name="builtin_dynpar">
-            <param name="exe_package" type="hidden" value="" />
-            <param name="exe_package_version" type="hidden" value="" />
-            <param name="cl_override" type="hidden" value="" />
-            <param name="interpreter_version" type="hidden" value=""/>
-            <param name="dependencies" type="hidden" value="" />
-          <param name="dynScript" label="Cut and paste the script to be executed here" type="text" value="Script goes here" area="True"
-              help="If there are parameters, either positional or argparse style, the script must parse and use them appropriately">
-              <sanitizer>
-                 <valid initial="string.printable">
-                 </valid>
-                 <mapping initial="none"/>
-              </sanitizer>
-          </param>
-    </xml>
-    <xml name="dynpar">
-            <param name="exe_package" type="hidden" value="" />
-            <param name="exe_package_version" type="hidden" value="" />
-            <param name="cl_override" type="hidden" value="" />
-            <param name="dependencies" type="text" value="" label="List additional dependencies - e.g. 'planemo, ephemeris'" help="These will be managed by Conda" />
-          <param name="interpreter_version" type="text" value=""
-          label="Specific interpreter version to match dependency (Conda) repositories - e.g. for python '3.8.5' Latest if empty"/>
-          <param name="dynScript" label="Cut and paste the script to be executed here" type="text" value="Script goes here" area="True"
-              help="If there are parameters, either positional or argparse style, the script must parse and use them appropriately">
-              <sanitizer>
-                 <valid initial="string.printable">
-                 </valid>
-                 <mapping initial="none"/>
-              </sanitizer>
-          </param>
-    </xml>
   </macros>
-   <requirements>
+  <requirements>
       <requirement type="package">python</requirement>
+      <requirement type="package">perl</requirement>
+      <requirement type="package">r-base</requirement>
       <requirement type="package">galaxyxml</requirement>
       <requirement type="package">planemo</requirement>
       <requirement type="package">yaml</requirement>
@@ -137,25 +146,27 @@
 $__tool_directory__/rgToolFactory2.py --bad_user $__user_email__
  #else:
 $__tool_directory__/rgToolFactory2.py
---dependencies "$interexe.dependencies"
---runmode "$interexe.interpreter"
-   #if len(str($interexe.cl_override)) > 0:
---cl_override "$interexe.cl_override"
-   #end if
-   #if str($interexe.interpreter)=="Executable" or str($interexe.interpreter)=="system":
---exe_package="$interexe.exe_package"
-    #if $interexe.exe_package_version:
---exe_package_version="$interexe.exe_package_version"
+    #if len(str($cl_prefix)) > 3:
+--cl_prefix "$cl_prefix"
+    #end if
+    #if $cover.commover == "yes":
+       #if len(str($cover.command_override)) > 10:
+--command_override "$commandoverride"
+       #end if
+       #if len(str($cover.test_override)) > 10:
+--test_override "$testoverride"
+       #end if
     #end if
-   #else:
---interpreter_name="$interexe.interpreter" --script_path "$runme"
-     #if str($interexe.interpreter_version) != 'None':
---interpreter_version="$interexe.interpreter_version"
-     #end if
+    #if $interexe.dependency_model == "managed":
+--packages "$interexe.packages"
+    #else:
+--sysexe "$interexe.sysexe"
+    #end if
+--tool_name="$tool_name"  --user_email="$__user_email__" --citations="$citeme"  --parampass="$ppass.parampass"
+   #if $usescript.choosescript == "yes":
+--script_path "$runme"
    #end if
---tool_name="$tool_name"  --user_email="$__user_email__" --citations="$citeme"  --parampass="$ppass.parampass"
-   #if str($makeMode.make_Tool)=="yes":
---planemo_test "$makeMode.planemo_test"
+   #if str($makeMode.make_Tool)!="runonly":
 --make_Tool="$makeMode.make_Tool"
 --tool_desc="$makeMode.tool_desc"
 --tool_version="$makeMode.tool_version"
@@ -174,28 +185,35 @@
 --input_files="$intab.input_files~~~$intab.input_CL~~~$intab.input_formats~~~$intab.input_label~~~$intab.input_help"
      #end for
      #for $otab in $ppass.history_outputs:
---output_files "$otab.history_name~~~$otab.history_format~~~$otab.history_CL"
+--output_files "$otab.history_name~~~$otab.history_format~~~$otab.history_CL~~~$otab.history_test"
      #end for
  #end if
 ]]></command>
  <configfiles>
   <configfile name="runme">
-
-#if $interexe.interpreter != "Executable" and $interexe.interpreter != "system" :
-${interexe.dynScript}
-#else:
-$tool_name
+#if $usescript.choosescript == 'yes':
+$usescript.dynScript
 #end if
  </configfile>
+ <configfile name="commandoverride">
+#if $cover.commover == "yes" and len(str($cover.command_override).strip()) > 1:
+$cover.command_override
+#end if
+ </configfile> 
+ <configfile name="testoverride">
+#if $cover.commover == "yes" and len(str($cover.test_override).strip()) > 1:
+$cover.test_override
+#end if
+ </configfile> 
  <configfile name="helpme">
-    #if $makeMode.make_Tool == "yes":
+    #if $makeMode.make_Tool != "runonly":
 ${makeMode.help_text}
     #else
 $tool_name help goes here
     #end if
  </configfile>
  <configfile name="citeme">
-#if $makeMode.make_Tool == "yes":
+#if $makeMode.make_Tool != "runonly":
     #for $citation in $makeMode.citations:
         #if $citation.citation_type.type == "bibtex":
             **ENTRY**bibtex
@@ -209,131 +227,135 @@
  </configfile>
   </configfiles>
   <inputs>
-
    <param name="tool_name" type="text" value="tool1"   label="New tool ID and title for outputs"
-         help="This will become the toolshed repository name so choose thoughtfully to avoid namespace clashes with other tool writers. lower case, digits and underscores only">
+         help="Toolshed repository name. Choose thoughtfully to avoid namespace clashes with other tool writers. Lower case, digits and underscores only">
         <sanitizer invalid_char="">
             <valid initial="string.letters,string.digits">
                 <add value="_"/>
             </valid>
         </sanitizer>
     </param>
+  
     <conditional name="interexe">
-        <param name="interpreter" type="select" label="Tool model: For a managed external dependency, choose 'Executable', or choose an interpreter for a script"
-        help = "If executable, the supplied package will become a requirement so must match the tool dependency resolver package name - conda is the default.">
-            <option value="Executable" selected="true">An executable binary to be provided and managed by the Conda dependency management subsystem</option>
-            <option value="python">Use Python to run the script pasted below</option>
-            <option value="r-base">Use R (Rscript) to run the script pasted below</option>
-            <option value="perl">Use a depency managed Perl to run the script pasted below</option>
-            <option value="bash">Use the system bash to run the script pasted below</option>
-            <option value="sh">Use sh to run the script pasted below</option>
-            <option value="system" >Use a different system executable such as sed</option>
+        <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</option>
+            <option value="system" >Use a non-dependency managed system executable like bash or awk</option>
         </param>
-        <when value="Executable">
-            <param name="exe_package" type="text" value="" label="Executable/package name for Ddependency manager - e.g. 'bwa'" optional="false"/>
-            <param name="exe_package_version" type="text" value="" label="Executable/package version to match dependency (Conda) repositories - e.g. for bwa='0.7.17'. Latest if empty" />
-            <param name="cl_override" type="text" value="" label="Command line override prefix - e.g. for ephemeris prepend the specific function such as 'workflow_install'" 
-             help="Some packages like ephemerisand planemo require a sub-command - eg planemo test - before parameters are passed. Supply that here"/>
-            <param name="dependencies" type="hidden" value="" />
+        <when value="managed">
+            <param name="packages" type="text" value="" label="Package name[:version, name:version...] for Conda. First will be called on generated command line" optional="false"
+             help="Use colon to append specific versiion like 'bwa:0.17.0'. Default is latest if no version. Will be used every time the tool is (re)run." /> 
+            <param name="sysexe" type="hidden" value="" />
         </when>
-        <when value="system">
-            <param name="dependencies" type="hidden" value="" />
-            <param name="exe_package" type="text" value="" label="System executable to run - e.g. awk"/>
-            <param name="exe_package_version" type="hidden" value="" />
-            <param name="cl_override" type="text" value="" label="Command line override prefix - e.g. for sed or awk, prepend this before the i/o parameters" 
-             help="This may help finesse a command line - inputs and output will be passed as you specify below"/>
-        </when>
-        <when value = "python">
-           <expand macro="dynpar" />
-        </when>
-        <when value = "r-base">
-           <expand macro="dynpar" />
-        </when>
-        <when value = "perl">
-           <expand macro="dynpar" />
-        </when>
-        <when value = "bash">
-           <expand macro="builtin_dynpar" />
-        </when>
-        <when value = "sh">
-           <expand macro="builtin_dynpar" />
+       <when value="system">
+            <param name="sysexe" type="text" value="" label="System executable to run. Supplied/managed by the operating system - not Conda" 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 = "ppass">
-
+    <conditional name="usescript">
+        <param name="choosescript" type="select" display="radio" label="Choose whether to run a supplied script - useful only if the dependency can use them"
+        help = "Useful for script interpreters like Python or bash. All i/o and parameters must be passed. Choose No unless script is needed.">
+            <option value="no" selected="true">No script required for the first dependency above - just parameters on the command line</option>
+            <option value="yes">A script is ready to be pasted below.</option>
+        </param> 
+        <when value="no">
+            <param name="dynScript" type="hidden"  value="" />
+        </when>
+        <when value="yes">
+            <param name="dynScript" type="text" area="True" value="" label="Script for first dependency to interpret. "
+             help="Script must handle all i/o and parameters as specified below using the parameter passing method chosen above">
+              <sanitizer>
+                 <valid initial="string.printable">
+                 </valid>
+                 <mapping initial="none"/>
+              </sanitizer>
+             </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 style: passed in the form of '--[clname] [value]'</option>
-            <option value="positional">Positional: Passed in the order of positional ordinals '...foo.bam bar.idx zot.xls'</option>
-            <option value="0">No parameters needed because tool reads selected input file from STDIN and writes STDOUT with new history output"</option>
+            <option value="argparse" selected="true">Argparse style: passed in the form of --clname value</option>
+            <option value="positional">Positional: Passed in the order of positional ordinals ...foo.bam bar.idx zot.xls</option>
+            <option value="0">Tool reads selected input file from STDIN and writes STDOUT with new history output with no parameters</option>
         </param>
-        <when value = "argparse">
+        <when value="argparse">
             <expand macro="io" />
             <expand macro="additparam" />
         </when>
-        <when value = "positional">
+        <when value="positional">
             <expand macro="io" />
             <expand macro="additparam" />
         </when>
-        <when value = "0">
+        <when value="0">
              <expand macro="io"/>
         </when>
     </conditional>
-    <conditional name="makeMode">
-        <param name="make_Tool" type="select" display="radio" label="Generate new tool as  a tar.gz file ready to upload to a toolshed repository"
-          help="Generate a toolshed archive - upload to a toolshed from where it can be auto-installed via the Galaxy admin functions" >
-        <option value="yes">Generate a Galaxy ToolShed compatible toolshed.gz</option>
-        <option value="" selected="true">No. Just run the script please</option>
-        </param>
-        <when value = "yes">
-            <param name="planemo_test" type="select" display="radio" label="Use planemo to test the new tool (takes a while..)"
-              help="Planemo will test the tool, upload it to the local toolshed and install to this Galaxy for additional testing" >
-            <option value="yes" selected="true">Test with planemo and install to this Galaxy if passes</option>
-            <option value="">No test/install</option>
-            </param>
-            <param name="tool_version" label="Tool Version - bump this to warn users trying to redo old analyses" type="text" value="0.01"
-            help="If you change your script and regenerate the 'same' tool, you should inform Galaxy (and users) by changing (bumping is traditional) this number"/>
-            <param name="tool_desc" label="Tool Description" type="text" value=""
-             help="Supply a brief tool description for the Galaxy tool menu entry (optional - appears after the tool name)" />
-            <param name="help_text" label="Tool form documentation and help text for users" type="text" area="true"
-            value="**What it Does**"
-             help="Supply the brief user documentation to appear on the new tool form as reStructured text - http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html" >
-                <sanitizer>
-                    <valid initial="string.printable">
-                    </valid>
-                    <mapping initial="none"/>
-                </sanitizer>
-            </param>
-            <repeat name="citations" title="Citation">
-                <conditional name="citation_type">
-                    <param name="type" type="select" display="radio" label="Citation Type">
-                        <option value="doi">DOI</option>
-                        <option value="bibtex">BibTeX</option>
-                    </param>
-                    <when value="doi">
-                        <param name="doi" label="DOI" type="text" value=""
-                        help="Supply a DOI (e.g. doi: 10.1111/j.1740-9713.2007.00258.x) that should be cited when this tool is used in published research." />
-                    </when>
-                    <when value="bibtex">
-                        <param name="bibtex" label="BibTex" type="text" area="true"
-                            help="Supply a BibTex entry that should be cited when this tool is used in published research." value="" >
-                            <sanitizer>
-                                <valid initial="string.printable">
-                                </valid>
-                                <mapping initial="none"/>
-                            </sanitizer>
-                        </param>
-                    </when>
-                </conditional>
-            </repeat>
+    <param name="cl_prefix" type="text" value="" label="Prefix for generated command line. Prepends generated i/o and parameter CL. Use override below to replace completely"
+            help="Text will replace generated executable/script elements. Sometimes required before i/o and parameters in the generated command line." />
+    <conditional name="cover">
+        <param name="commover" type="select" display="radio" label="Add Human wrought code to override the generated XML command and/or test section - DIY"
+        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">Use automatically generated command/test XML </option>
+            <option value="yes">DIY XML needed to replace autogenerated command and/or test segments will be pasted below</option>
+        </param> 
+        <when value="no">
+            <param name="command_override" type="hidden"  value="" />
+            <param name="test_override" type="hidden"  value="" />
         </when>
-        <when value = "">
+        <when value="yes">
+            <param name="command_override" type="text" area="True" value="" label="Optional. Human wrought command element override XML/template - e.g. for bwa"
+             help="For arbitrary and artfull command lines. All i/o and parameters must be passed. Leave blank unless needed. Not for the faint of heart">
+              <sanitizer>
+                 <valid initial="string.printable">
+                 </valid>
+                 <mapping initial="none"/>
+              </sanitizer>
+             </param>
+            <param name="test_override" type="text" area="True" value="" label="Optional. Human wrought test element override XML/template - e.g. for bwa"
+             help="For arbitrary and artfull scripts. Leave blank unless needed. Not for the faint of heart">
+              <sanitizer>
+                 <valid initial="string.printable">
+                 </valid>
+                 <mapping initial="none"/>
+              </sanitizer>
+            </param> 
         </when>
     </conditional>
+
+    <conditional name="makeMode">
+        <param name="make_Tool" type="select" display="radio" label="Choose the steps you want to run. Docker is recommended if you want local installation"
+          help="Testing and installation in this Galaxy is optional. Planemo run must be used if you are providing XML overrides for the command or test sections" >
+        <option value="runonly">Run this configuration. NOT suitable for Executable command/test overriden tools</option>
+        <option value="generate" selected="true">Run and generate toolshed archive containing the new tool. NOT suitable for command/test overriden tools</option>
+        <option value="gentest">Run, generate and test the new tool with planemo. NOT suitable for command/test overriden tools</option>
+        <option value="gentestinstall">Run, generate, planemo test and install (via the local toolshed) the new tool. NOT suitable for command/test overriden tools</option>
+        <option value="planemogenerate">Planemo test twice - once to generate test outputs. Suitable for tools with or without command/test overrides but takes time</option>
+        <option value="planemogeninstall">Planemo test twice and install. Suitable for tools with or without command/test overrides.</option>
+        </param>
+        <when value="runonly"/>
+        <when value="generate">
+            <expand macro="planemo_steps" />
+        </when>
+        <when value="gentest">
+            <expand macro="planemo_steps" />
+        </when>
+       <when value="gentestinstall">
+            <expand macro="planemo_steps" />
+        </when>
+        <when value="planemogenerate">
+            <expand macro="planemo_steps" />
+        </when>
+        <when value="planemogeninstall">
+            <expand macro="planemo_steps" />
+        </when>
+    </conditional>
+
   </inputs>
   <outputs>
 
     <data format="tgz" name="new_tool" label="${tool_name}_toolshed.tgz" >
-        <filter>makeMode['make_Tool'] == "yes"</filter>
+        <filter>makeMode['make_Tool'] != "runonly"</filter>
     </data>
 
   <collection name="TF_run_report" type="list" label="${tool_name} outputs">
@@ -351,7 +373,7 @@
     <param name="input_help" value="help" />
     <param name="tool_name" value="pyrevpos" />
     <param name="parampass" value="positional" />
-    <param name="make_Tool" value="yes" />
+    <param name="make_Tool" value="generate" />
     <param name="tool_version" value="0.01" />
     <param name="tool_desc" value="positional reverse" />
     <param name="help_text" value="help text goes here" />