diff rgDynamicScriptWrapper.xml @ 0:fda8032fe989

Initial checkin of dynamic script runner. Goal is to add code to generate a new toolshed entry once the script works correctly
author ross lazarus ross.lazarus@gmail.com
date Wed, 30 May 2012 22:36:34 +1000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rgDynamicScriptWrapper.xml	Wed May 30 22:36:34 2012 +1000
@@ -0,0 +1,94 @@
+<tool id="rgDynamic1" name="Dynamic Script Runner" version="0.03">
+  <description>DIY scripting</description>
+  <command interpreter="python">
+#if ( $__user_email__ not in ['rlazarus@bakeridi.edu.au','mziemann@bakeridi.edu.au','akaspi@bakeridi.edu.au'] ):
+     rgDynamicScriptWrapper.py --bad_user $__user_email__
+  #else:
+    rgDynamicScriptWrapper.py --script_path "$runme" --interpreter "$interpreter" 
+     --tool_name "$tool_name"  --input_tab "$input1" --user_email "${__user_email__}"
+    #if $makeHTML.value=="yes":
+      --output_dir "$html_file.files_path" --output_html "$html_file"
+    #end if
+    #if $makeTAB.value=="yes":
+      --output_tab "$tab_file"
+    #end if
+#end if 
+  </command>
+  <inputs>
+    <param name="input1"  type="data" format="tabular" label="Select an optional input tabular file from your history" optional="true"
+       help="Your script probably needs an input - but if not, this can be left unassigned"/>
+    <param name="tool_name" type="text" value="My dynamic script" size="80" label="Title for job outputs" help="Supply a meaningful name here to remind you what the outputs contain"/>
+    <param name="makeHTML" type="select" label="Create an HTML output with all script outputs collected together, with thumbnails of new PDF images, the script and a run log file" 
+         help="This is useful for presenting complex outputs and is not needed if your script doesn't create anything other than a single tabular output">
+        <option value="yes">Yes</option>
+        <option value="" selected="true">No</option>
+    </param>   
+    <param name="makeTAB" type="select" label="Create a new tabular history output" 
+         help="This is useful if your script creates a single new tabular file you want to appear in the history after the tool executes">
+        <option value="yes" selected="true">Yes</option>
+        <option value="">No</option>
+    </param>   
+    <param name="interpreter" type="select" label="Select the interpreter for your code. This must be available on the path of the execution host">
+        <option value="Rscript" selected="true">Rscript</option>
+        <option value="python">python</option>
+        <option value="perl (ugh)">perl</option>
+    </param>   
+    <param name="dynScript" label="Your Script Goes Here" type="text" value="" area="True" size="8x80" width="80" 
+      help="Expect FIRST CL parameter = the optional input tabular file path (or NONE if not specified). Ensure your script writes tabular output to the path in the SECOND command line parameter it gets."/>
+  </inputs>
+  <outputs>
+    <data format="tabular" name="tab_file" label="${tool_name}.xls">
+        <filter> makeTAB=="yes" </filter>
+    </data>
+    <data format="html" name="html_file" label="${tool_name}.html">
+        <filter> makeHTML=="yes" </filter>
+    </data>
+  </outputs>
+<configfiles>
+<configfile name="runme">
+${dynScript}
+</configfile>
+</configfiles>
+<help>
+**What it does**
+This tool enables a user to paste and submit an arbitrary R/python/perl script to run in Galaxy.
+This is (extremely) insecure.
+
+**Restrictions**
+This tool will ONLY work if your user id has been added to the local copy's list of permitted users.
+Ask your friendly Galaxy administrator to edit this tool's source for you if you need this.
+
+**Note to system administrators**
+Under no circumstances should you allow any user to use this tool unless you really, really trust them to do
+no harm.
+
+**Use on public servers** 
+is STRONGLY discouraged for obvious reasons
+
+**Scripting conventions**
+The pasted script will be executed. 
+It will get the path to the (optional) input tabular data file path or NONE if you do not select one
+as the first command line parameter
+
+The script must write it's output as tab delimited text to the path found as the second command line parameter
+Note that if an optional HTML output is selected, all the output files spewed by your script will be nicely presented as links to the user. 
+Any pdf images will automagically be converted to show thumbnails in that output.
+This can be handy for complex scripts creating lots of output.
+
+**Simple Rscript example**
+
+A simple "filter" that takes an input file, does something and writes the results to a new tabular file might look like this::
+
+  ourargs = commandArgs(TRUE)
+  inf = ourargs[1]
+  outf = ourargs[2]
+  inp = read.table(inf,head=F,row.names=NULL,sep='\t')
+  inp[,5] = runif ( nrow(inp) )
+  write.table(inp,outf, quote=FALSE, sep="\t",row.names=F,col.names=F)
+
+
+</help>
+
+</tool>
+
+