# HG changeset patch
# User ross lazarus ross.lazarus@gmail.com
# Date 1338897298 -36000
# Node ID a87a262220a4c2feab716150c3a0b73cb57e0b3f
# Parent 943d4f0ee7c11edfa2954142ca5c943eee1bbf21
Adding proof of concept for optional output formats.
Updated readme again
diff -r 943d4f0ee7c1 -r a87a262220a4 README.txt
--- a/README.txt Mon Jun 04 21:32:24 2012 +1000
+++ b/README.txt Tue Jun 05 21:54:58 2012 +1000
@@ -1,63 +1,83 @@
-## WARNING before you start
-## Install on a private Galaxy ONLY
-## Please NEVER on a public or production instance
-# To fully and safely exploit the awesome power of Galaxy with this tool installed
-# you should be a developer installing this tool on a
-# personal/scratch local instance - ie a private site
-# because then, if you break it, you get to keep all the pieces
-# see https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home
+# WARNING before you start
+# Install on a private Galaxy ONLY
+# Please NEVER on a public or production instance
+
+*Read on if* You use a production Galaxy;
+Your users sometimes take data out of Galaxy, process it with ugly
+little perl/awk/sed/R... scripts and put it back;
+They do this when they can't do some transformation in Galaxy (the 90/10 rule);
+You don't have enough developer resources for wrapping dozens of even relatively simple tools;
+Your institution would be better off if those nasty, feral scripts were all tucked safely in
+a local toolshed.
+
+*The good news* If it can be trivially scripted, it can be running safely in your
+local Galaxy via your own local toolshed.
+That's what this tool does. You paste a simple script and the tool returns
+a new, real Galaxy tool, ready to be installed from the local toolshed to local servers.
+Scripts can be wrapped and online literally within minutes.
+
+*To fully and safely exploit the awesome power* of Galaxy with this tool installed
+you should be a developer installing this tool on a
+personal/scratch local instance - ie a private site
+because then, if you break it, you get to keep all the pieces
+see https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home
+
+*To make the tool work* If not already there, please add:
+
+to your local data_types_conf.xml
+Then, PUT some IDs in the list in the XML before you restart Galaxy to load this new tool please
+otherwise, the tool won't run for anybody.
+
+*What it does* This is a tool factory for simple scripts in python, R or whatever ails ye.
+LIMITED to simple scripts that read one input from the history.
+Optionally can write one new history dataset,
+and optionally collect any number of outputs into links on an autogenerated HTML page.
+Generated tools can be edited and enhanced like any Galaxy tool, so start small and build up
+A generated script gets you a serious leg up to a more complex one.
-# this is a tool factory for simple scripts in python, R or whatever ails ye.
-# LIMITED to simple scripts that read one input from the history.
-# Optionally can write one new history dataset,
-# and optionally collect any number of outputs into links on an autogenerated HTML page.
-# Generated tools can be edited and enhanced like any Galaxy tool, so start small and build up
-# A generated script gets you a serious leg up to a more complex one.
-#
-# you paste and run your script
-# you fix the syntax errors and eventually it runs
-# that's kind of cool, but
-# now things get even more interesting.
-# Once the script works on some test data, you can
-# optionally generate a toolshed compatible gzip file
-# containing your script neatly wrapped as an ordinary Galaxy script in your
-# local toolshed forsafe and largely automated installation in a production Galaxy.
-# tests are being worked on - should be done soon
-#
-# installed generated tools are fine if the script is safe.
-# They just run normally and their user cannot do anything unusually insecure
-# but please, practice safe toolshed.
-# Read the fucking code before you install any tool.
-# Especially this one - it is really scary.
+*What you do* You paste and run your script
+you fix the syntax errors and eventually it runs
+that's pretty good because you can use the redo button
+to rerun it and edit the script as you debug - cool, but
+now the power really kicks in, because
+once the script works on some test data, you can
+generate a toolshed compatible gzip file
+containing your script neatly wrapped and hidden safely inside an ordinary Galaxy script in your
+local toolshed. That means safe and largely automated installation in any production Galaxy configured
+to use your toolshed or the tool
+Automated build for tests still being worked on - should be done soon
+
+*Generated tool Security* Once you install a generated tool, it's just
+another tool - assuming the script is safe. They just run normally and their user cannot do anything unusually insecure
+but please, practice safe toolshed.
+Read the fucking code before you install any tool.
+Especially this one - it is really scary.
+
+If you opt for an HTML output, you get all the script outputs arranged
+as a single Html history item - all output files are linked, thumbnails for all the pdfs.
+Ugly but really inexpensive.
-# If you opt for an HTML output, you get all the script outputs arranged
-# as a single Html history item - all output files are linked, thumbnails for all the pdfs.
-# Ugly but really inexpensive.
-#
-# Patches welcome please.
-#
-#
-# long route to June 2012 product
-# derived from an integrated script model
-# called rgBaseScriptWrapper.py
-# Note to the unwary:
-# This tool allows arbitrary scripting on your Galaxy as the Galaxy user
-# There is nothing stopping a malicious user doing whatever they choose
-# Extremely dangerous!!
-# Totally insecure. So, trusted users only
-#
-# a list in the xml source file is searched for users permitted to run this tool.
-# PUT some IDs in the list in the XML before you restart Galaxy to load this new tool please
-# otherwise, the tool won't run for anybody.
-#
+Patches welcome please.
+
-#
-# copyright ross lazarus (ross stop lazarus at gmail stop com) May 2012
-#
-# all rights reserved
-# Licensed under the LGPL if you want to improve it, feel free https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home
+long route to June 2012 product
+derived from an integrated script model
+called rgBaseScriptWrapper.py
+Note to the unwary:
+ This tool allows arbitrary scripting on your Galaxy as the Galaxy user
+ There is nothing stopping a malicious user doing whatever they choose
+ Extremely dangerous!!
+ Totally insecure. So, trusted users only
-# Material for our more enthusiastic readers continues below
+
+
+
+copyright ross lazarus (ross stop lazarus at gmail stop com) May 2012
+
+all rights reserved
+Licensed under the LGPL if you want to improve it, feel free https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home
+
+Material for our more enthusiastic readers continues below
**Motivation** Simple transformation, filtering or reporting scripts get written, run and lost every day in most busy labs
- even ours where Galaxy is in use. This 'dark script matter' is pervasive and generally not reproducible.
diff -r 943d4f0ee7c1 -r a87a262220a4 rgToolFactory.py
--- a/rgToolFactory.py Mon Jun 04 21:32:24 2012 +1000
+++ b/rgToolFactory.py Tue Jun 05 21:54:58 2012 +1000
@@ -1,27 +1,54 @@
# rgToolFactory.py
-# derived from
-# rgBaseScriptWrapper.py
-# but designed to run arbitrary user supplied code
-# extremely dangerous!!
-# trusted users only - private site only
-# a list in the xml is searched for users permitted to run this tool.
-# DO NOT install on a public or important site - local instance only
-# generated tools are fine as they just run normally and their user cannot do anything unusually insecure
+# https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home
+
+# this is a tool factory for simple scripts in python, R or whatever ails ye.
+# you paste and run your script
+# Only works for simple scripts that read one input from the history.
+# Optionally can write one new history dataset,
+# and optionally collect any number of outputs into links on an autogenerated HTML page.
+
+# DO NOT install on a public or important site - please.
+
+# installed generated tools are fine if the script is safe.
+# They just run normally and their user cannot do anything unusually insecure
+# but please, practice safe toolshed.
+# Read the fucking code before you install any tool
+# especially this one
+
+# After you get the script working on some test data, you can
+# optionally generate a toolshed compatible gzip file
+# containing your script safely wrapped as an ordinary Galaxy script in your local toolshed for
+# safe and largely automated installation in a production Galaxy.
+
+# If you opt for an HTML output, you get all the script outputs arranged
+# as a single Html history item - all output files are linked, thumbnails for all the pdfs.
+# Ugly but really inexpensive.
+#
+# Patches appreciated please.
#
-# copyright ross lazarus (ross.lazarus@gmail.com) May 2012
+#
+# long route to June 2012 product
+# Behold the awesome power of Galaxy and the toolshed with the tool factory binds to bind them
+# derived from an integrated script model
+# called rgBaseScriptWrapper.py
+# Note to the unwary:
+# This tool allows arbitrary scripting on your Galaxy as the Galaxy user
+# There is nothing stopping a malicious user doing whatever they choose
+# Extremely dangerous!!
+# Totally insecure. So, trusted users only
+#
+# preferred model is a developer using their throw away workstation instance - ie a private site.
+# no real risk.
+# a list in the xml source file is searched for users permitted to run this tool.
+# PUT some IDs in the list in the XML before you restart Galaxy to load this new tool please
+# otherwise, the tool won't run for anybody.
+#
+
+#
+# copyright ross lazarus (ross stop lazarus at gmail stop com) May 2012
#
# all rights reserved
-# Licensed under the LGPL for your pleasure
-# Derived from rgDGE.py in May 2012
-# generalized to run required interpreter
-# to make your own tools based on a given script and interpreter such as perl or python
-# clone this and the corresponding xml wrapper
-# replace the parameters/inputs/outputs and the configfile contents with your script
-# Use the $foo syntax to place your parameter values inside the script to assign them - at run time, the script will be used as a template
-# and returned as part of the output to the user - with the right values for all the parameters.
-# Note that this assumes you want all the outputs arranged as a single Html file output
-# after this generic script runner runs your script with the specified interpreter,
-# it will collect all output files into the specified output_html, making thumbnails for all the pdfs it finds and making links for all the other files.
+# Licensed under the LGPL if you want to improve it, feel free https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home
import sys
import shutil
@@ -52,7 +79,7 @@
def __init__(self,opts=None):
"""
- run the script
+ cleanup inputs, setup some outputs
"""
if opts.output_dir: # simplify for the tool tarball
@@ -93,8 +120,7 @@
def makeXML(self):
"""
Create a Galaxy xml tool wrapper for the new script as a string to write out
- fixme - use templating or something less fugly than this.
- Here's an example of what we produce
+ fixme - use templating or something less fugly than this example of what we produce
a tabular file
@@ -293,7 +319,7 @@