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

Changeset 7:1fcf3fda325f (2014-03-19)
Previous changeset 6:cb4937b0c21d (2013-02-24) Next changeset 8:78c04d9fe621 (2014-03-19)
Commit message:
major fixes with GS and graphicsmagick dependencies included
added:
README.txt
images/dynamicScriptTool.png
rgToolFactory.py
rgToolFactory.xml
tool_dependencies.xml
removed:
fubar-galaxytoolfactory-58871556de57/README.txt
fubar-galaxytoolfactory-58871556de57/images/dynamicScriptTool.png
fubar-galaxytoolfactory-58871556de57/rgToolFactory.py
fubar-galaxytoolfactory-58871556de57/rgToolFactory.xml
b
diff -r cb4937b0c21d -r 1fcf3fda325f README.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/README.txt Wed Mar 19 21:06:28 2014 -0400
[
b'@@ -0,0 +1,297 @@\n+# WARNING before you start\n+# Install this tool on a private Galaxy ONLY\n+# Please NEVER on a public or production instance\n+\n+Please cite:\n+http://bioinformatics.oxfordjournals.org/cgi/reprint/bts573?ijkey=lczQh1sWrMwdYWJ&keytype=ref \n+if you use this tool in your published work.\n+\n+*Short Story*\n+\n+This is an unusual Galaxy tool that exposes unrestricted and therefore extremely dangerous\n+scripting to designated administrative users of a Galaxy server, allowing them to run scripts \n+in R, python, sh and perl over a single input data set, writing a single new data set as output.\n+\n+In addition, this tool optionally generates very simple new Galaxy tools, that effectively\n+freeze the supplied script into a new, ordinary Galaxy tool that runs it over a single input file, \n+working just like any other Galaxy tool for your users. \n+\n+To use the ToolFactory, you should have prepared a script to paste into a text box,\n+and a small test input example ready to select from your history to test your new script.\n+There is an example in each scripting language on the Tool Factory form. You can just\n+cut and paste these to try it out - remember to select the right interpreter please. You\'ll\n+also need to create a small test data set using the Galaxy history add new data tool.\n+\n+If the script fails somehow, use the "redo" button on the tool output in your history to\n+recreate the form complete with broken script. Fix the bug and execute again. Rinse, wash, repeat.\n+\n+Once the script runs sucessfully, a new Galaxy tool that runs your script can be generated.\n+Select the "generate" option and supply some help text and names. The new tool will be\n+generated in the form of a new Galaxy datatype - toolshed.gz - as the name suggests,\n+it\'s an archive ready to upload to a Galaxy ToolShed as a new tool repository.\n+\n+Once it\'s in a ToolShed, it can be installed into any local Galaxy server from\n+the server administrative interface.\n+\n+Once the new tool is installed, local users can run it - each time, the script that was supplied\n+when it was built will be executed with the input chosen from the user\'s history. In other words,\n+the tools you generate with the ToolFactory run just like any other Galaxy tool,\n+but run your script every time. \n+\n+Tool factory tools are perfect for workflow components. One input, one output, no variables.\n+\n+*Reasons to read further*\n+\n+If you use Galaxy to support your research;\n+\n+You and fellow users are sometimes forced to take data out of Galaxy, process it with ugly\n+little perl/awk/sed/R... scripts and put it back;\n+\n+You do this when you can\'t do some transformation in Galaxy (the 90/10 rule);\n+\n+You don\'t have enough developer resources for wrapping dozens of even relatively simple tools;\n+\n+Your research and your institution would be far better off if those feral scripts were all tucked \n+safely in your local toolshed and Galaxy histories.\n+\n+*The good news* If it can be trivially scripted, it can be running safely in your\n+local Galaxy via your own local toolshed in a few minutes - with functional tests.\n+\n+\n+*Value proposition* The ToolFactory allows Galaxy to efficiently take over most of your lab\'s \n+dark script matter, making it reproducible in Galaxy and shareable through the ToolShed.\n+\n+That\'s what this tool does. You paste a simple script and the tool returns \n+a new, real Galaxy tool, ready to be installed from the local toolshed to local servers.\n+Scripts can be wrapped and online literally within minutes.\n+\n+*To fully and safely exploit the awesome power* of this tool, Galaxy and the ToolShed,\n+you should be a developer installing this tool on a private/personal/scratch local instance where you \n+are an admin_user. Then, if you break it, you get to keep all the pieces\n+see https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home\n+\n+** Installation **\n+This is a Galaxy tool. You can install it most conveniently using the administrative "Search and browse tool sheds" link.\n+Find'..b'ple without any input file - generates a random heatmap pdf - you must make sure the option to create an HTML output file is\n+turned on for this to work. The heatmap will be presented as a thumbnail linked to the pdf in the resulting HTML page::\n+\n+ # note this script takes NO input or output because it generates random data\n+ foo = data.frame(a=runif(100),b=runif(100),c=runif(100),d=runif(100),e=runif(100),f=runif(100))\n+ bar = as.matrix(foo)\n+ pdf( "heattest.pdf" )\n+ heatmap(bar,main=\'Random Heatmap\')\n+ dev.off()\n+\n+A Python example that reverses each row of a tabular file. You\'ll need to remove the leading spaces for this to work if cut\n+and pasted into the script box. Note that you can already do this in Galaxy by setting up the cut columns tool with the\n+correct number of columns in reverse order,but this script will work for any number of columns so is completely generic::\n+\n+# reverse order of columns in a tabular file\n+import sys\n+inp = sys.argv[1]\n+outp = sys.argv[2]\n+i = open(inp,\'r\')\n+o = open(outp,\'w\')\n+for row in i:\n+    rs = row.rstrip().split(\'\\t\')\n+    rs.reverse()\n+    o.write(\'\\t\'.join(rs))\n+    o.write(\'\\n\')\n+i.close()\n+o.close()\n+\n+\n+Galaxy as an IDE for developing API scripts\n+If you need to develop Galaxy API scripts and you like to live dangerously, please read on.\n+\n+Galaxy as an IDE?\n+Amazingly enough, blend-lib API scripts run perfectly well *inside* Galaxy when pasted into a Tool Factory form. No need to generate a new tool. Galaxy+Tool_Factory = IDE I think we need a new t-shirt. Seriously, it is actually quite useable.\n+\n+Why bother - what\'s wrong with Eclipse\n+Nothing. But, compared with developing API scripts in the usual way outside Galaxy, you get persistence and other framework benefits plus at absolutely no extra charge, a ginormous security problem if you share the history or any outputs because they contain the api script with key so development servers only please!\n+\n+Workflow\n+Fire up the Tool Factory in Galaxy.\n+\n+Leave the input box empty, set the interpreter to python, paste and run an api script - eg working example (substitute the url and key) below.\n+\n+It took me a few iterations to develop the example below because I know almost nothing about the API. I started with very simple code from one of the samples and after each run, the (edited..) api script is conveniently recreated using the redo button on the history output item. So each successive version of the developing api script you run is persisted - ready to be edited and rerun easily. It is \'\'very\'\' handy to be able to add a line of code to the script and run it, then view the output to (eg) inspect dicts returned by API calls to help move progressively deeper iteratively.\n+\n+Give the below a whirl on a private clone (install the tool factory from the main toolshed) and try adding complexity with few rerun/edit/rerun cycles.\n+\n+Eg tool factory api script\n+import sys\n+from blend.galaxy import GalaxyInstance\n+ourGal = \'http://x.x.x.x:xxxx\'\n+ourKey = \'xxx\'\n+gi = GalaxyInstance(ourGal, key=ourKey)\n+libs = gi.libraries.get_libraries()\n+res = []\n+# libs looks like\n+# u\'url\': u\'/galaxy/api/libraries/441d8112651dc2f3\', u\'id\': u\'441d8112651dc2f3\', u\'name\':.... u\'Demonstration sample RNA data\',\n+for lib in libs:  \n+    res.append(\'%s:\\n\' % lib[\'name\'])\n+    res.append(str(gi.libraries.show_library(lib[\'id\'],contents=True)))\n+outf=open(sys.argv[2],\'w\')\n+outf.write(\'\\n\'.join(res))\n+outf.close()\n+\n+**Attribution** \n+Creating re-usable tools from scripts: The Galaxy Tool Factory \n+Ross Lazarus; Antony Kaspi; Mark Ziemann; The Galaxy Team\n+Bioinformatics 2012; doi: 10.1093/bioinformatics/bts573\n+\n+http://bioinformatics.oxfordjournals.org/cgi/reprint/bts573?ijkey=lczQh1sWrMwdYWJ&keytype=ref\n+\n+**Licensing**\n+Copyright Ross Lazarus 2010\n+ross lazarus at g mail period com\n+\n+All rights reserved.\n+\n+Licensed under the LGPL\n+\n+**Obligatory screenshot**\n+\n+http://bitbucket.org/fubar/galaxytoolmaker/src/fda8032fe989/images/dynamicScriptTool.png\n+\n'
b
diff -r cb4937b0c21d -r 1fcf3fda325f fubar-galaxytoolfactory-58871556de57/README.txt
--- a/fubar-galaxytoolfactory-58871556de57/README.txt Sun Feb 24 17:15:29 2013 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
[
b'@@ -1,297 +0,0 @@\n-# WARNING before you start\n-# Install this tool on a private Galaxy ONLY\n-# Please NEVER on a public or production instance\n-\n-Please cite:\n-http://bioinformatics.oxfordjournals.org/cgi/reprint/bts573?ijkey=lczQh1sWrMwdYWJ&keytype=ref \n-if you use this tool in your published work.\n-\n-*Short Story*\n-\n-This is an unusual Galaxy tool that exposes unrestricted and therefore extremely dangerous\n-scripting to designated administrative users of a Galaxy server, allowing them to run scripts \n-in R, python, sh and perl over a single input data set, writing a single new data set as output.\n-\n-In addition, this tool optionally generates very simple new Galaxy tools, that effectively\n-freeze the supplied script into a new, ordinary Galaxy tool that runs it over a single input file, \n-working just like any other Galaxy tool for your users. \n-\n-To use the ToolFactory, you should have prepared a script to paste into a text box,\n-and a small test input example ready to select from your history to test your new script.\n-There is an example in each scripting language on the Tool Factory form. You can just\n-cut and paste these to try it out - remember to select the right interpreter please. You\'ll\n-also need to create a small test data set using the Galaxy history add new data tool.\n-\n-If the script fails somehow, use the "redo" button on the tool output in your history to\n-recreate the form complete with broken script. Fix the bug and execute again. Rinse, wash, repeat.\n-\n-Once the script runs sucessfully, a new Galaxy tool that runs your script can be generated.\n-Select the "generate" option and supply some help text and names. The new tool will be\n-generated in the form of a new Galaxy datatype - toolshed.gz - as the name suggests,\n-it\'s an archive ready to upload to a Galaxy ToolShed as a new tool repository.\n-\n-Once it\'s in a ToolShed, it can be installed into any local Galaxy server from\n-the server administrative interface.\n-\n-Once the new tool is installed, local users can run it - each time, the script that was supplied\n-when it was built will be executed with the input chosen from the user\'s history. In other words,\n-the tools you generate with the ToolFactory run just like any other Galaxy tool,\n-but run your script every time. \n-\n-Tool factory tools are perfect for workflow components. One input, one output, no variables.\n-\n-*Reasons to read further*\n-\n-If you use Galaxy to support your research;\n-\n-You and fellow users are sometimes forced to take data out of Galaxy, process it with ugly\n-little perl/awk/sed/R... scripts and put it back;\n-\n-You do this when you can\'t do some transformation in Galaxy (the 90/10 rule);\n-\n-You don\'t have enough developer resources for wrapping dozens of even relatively simple tools;\n-\n-Your research and your institution would be far better off if those feral scripts were all tucked \n-safely in your local toolshed and Galaxy histories.\n-\n-*The good news* If it can be trivially scripted, it can be running safely in your\n-local Galaxy via your own local toolshed in a few minutes - with functional tests.\n-\n-\n-*Value proposition* The ToolFactory allows Galaxy to efficiently take over most of your lab\'s \n-dark script matter, making it reproducible in Galaxy and shareable through the ToolShed.\n-\n-That\'s what this tool does. You paste a simple script and the tool returns \n-a new, real Galaxy tool, ready to be installed from the local toolshed to local servers.\n-Scripts can be wrapped and online literally within minutes.\n-\n-*To fully and safely exploit the awesome power* of this tool, Galaxy and the ToolShed,\n-you should be a developer installing this tool on a private/personal/scratch local instance where you \n-are an admin_user. Then, if you break it, you get to keep all the pieces\n-see https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home\n-\n-** Installation **\n-This is a Galaxy tool. You can install it most conveniently using the administrative "Search and browse tool sheds" link.\n-Find'..b'ple without any input file - generates a random heatmap pdf - you must make sure the option to create an HTML output file is\n-turned on for this to work. The heatmap will be presented as a thumbnail linked to the pdf in the resulting HTML page::\n-\n- # note this script takes NO input or output because it generates random data\n- foo = data.frame(a=runif(100),b=runif(100),c=runif(100),d=runif(100),e=runif(100),f=runif(100))\n- bar = as.matrix(foo)\n- pdf( "heattest.pdf" )\n- heatmap(bar,main=\'Random Heatmap\')\n- dev.off()\n-\n-A Python example that reverses each row of a tabular file. You\'ll need to remove the leading spaces for this to work if cut\n-and pasted into the script box. Note that you can already do this in Galaxy by setting up the cut columns tool with the\n-correct number of columns in reverse order,but this script will work for any number of columns so is completely generic::\n-\n-# reverse order of columns in a tabular file\n-import sys\n-inp = sys.argv[1]\n-outp = sys.argv[2]\n-i = open(inp,\'r\')\n-o = open(outp,\'w\')\n-for row in i:\n-    rs = row.rstrip().split(\'\\t\')\n-    rs.reverse()\n-    o.write(\'\\t\'.join(rs))\n-    o.write(\'\\n\')\n-i.close()\n-o.close()\n-\n-\n-Galaxy as an IDE for developing API scripts\n-If you need to develop Galaxy API scripts and you like to live dangerously, please read on.\n-\n-Galaxy as an IDE?\n-Amazingly enough, blend-lib API scripts run perfectly well *inside* Galaxy when pasted into a Tool Factory form. No need to generate a new tool. Galaxy+Tool_Factory = IDE I think we need a new t-shirt. Seriously, it is actually quite useable.\n-\n-Why bother - what\'s wrong with Eclipse\n-Nothing. But, compared with developing API scripts in the usual way outside Galaxy, you get persistence and other framework benefits plus at absolutely no extra charge, a ginormous security problem if you share the history or any outputs because they contain the api script with key so development servers only please!\n-\n-Workflow\n-Fire up the Tool Factory in Galaxy.\n-\n-Leave the input box empty, set the interpreter to python, paste and run an api script - eg working example (substitute the url and key) below.\n-\n-It took me a few iterations to develop the example below because I know almost nothing about the API. I started with very simple code from one of the samples and after each run, the (edited..) api script is conveniently recreated using the redo button on the history output item. So each successive version of the developing api script you run is persisted - ready to be edited and rerun easily. It is \'\'very\'\' handy to be able to add a line of code to the script and run it, then view the output to (eg) inspect dicts returned by API calls to help move progressively deeper iteratively.\n-\n-Give the below a whirl on a private clone (install the tool factory from the main toolshed) and try adding complexity with few rerun/edit/rerun cycles.\n-\n-Eg tool factory api script\n-import sys\n-from blend.galaxy import GalaxyInstance\n-ourGal = \'http://x.x.x.x:xxxx\'\n-ourKey = \'xxx\'\n-gi = GalaxyInstance(ourGal, key=ourKey)\n-libs = gi.libraries.get_libraries()\n-res = []\n-# libs looks like\n-# u\'url\': u\'/galaxy/api/libraries/441d8112651dc2f3\', u\'id\': u\'441d8112651dc2f3\', u\'name\':.... u\'Demonstration sample RNA data\',\n-for lib in libs:  \n-    res.append(\'%s:\\n\' % lib[\'name\'])\n-    res.append(str(gi.libraries.show_library(lib[\'id\'],contents=True)))\n-outf=open(sys.argv[2],\'w\')\n-outf.write(\'\\n\'.join(res))\n-outf.close()\n-\n-**Attribution** \n-Creating re-usable tools from scripts: The Galaxy Tool Factory \n-Ross Lazarus; Antony Kaspi; Mark Ziemann; The Galaxy Team\n-Bioinformatics 2012; doi: 10.1093/bioinformatics/bts573\n-\n-http://bioinformatics.oxfordjournals.org/cgi/reprint/bts573?ijkey=lczQh1sWrMwdYWJ&keytype=ref\n-\n-**Licensing**\n-Copyright Ross Lazarus 2010\n-ross lazarus at g mail period com\n-\n-All rights reserved.\n-\n-Licensed under the LGPL\n-\n-**Obligatory screenshot**\n-\n-http://bitbucket.org/fubar/galaxytoolmaker/src/fda8032fe989/images/dynamicScriptTool.png\n-\n'
b
diff -r cb4937b0c21d -r 1fcf3fda325f fubar-galaxytoolfactory-58871556de57/images/dynamicScriptTool.png
b
Binary file fubar-galaxytoolfactory-58871556de57/images/dynamicScriptTool.png has changed
b
diff -r cb4937b0c21d -r 1fcf3fda325f fubar-galaxytoolfactory-58871556de57/rgToolFactory.py
--- a/fubar-galaxytoolfactory-58871556de57/rgToolFactory.py Sun Feb 24 17:15:29 2013 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
[
b'@@ -1,576 +0,0 @@\n-# rgToolFactory.py\n-# see https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home\n-# \n-# copyright ross lazarus (ross stop lazarus at gmail stop com) May 2012\n-# \n-# all rights reserved\n-# Licensed under the LGPL\n-# suggestions for improvement and bug fixes welcome at https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home\n-#\n-# January 2013\n-# problem pointed out by Carlos Borroto\n-# added escaping for <>$ - thought I did that ages ago...\n-#\n-# August 11 2012 \n-# changed to use shell=False and cl as a sequence\n-\n-# This is a Galaxy tool factory for simple scripts in python, R or whatever ails ye.\n-# It also serves as the wrapper for the new tool.\n-# \n-# you paste and run your script\n-# Only works for simple scripts that read one input from the history.\n-# Optionally can write one new history dataset,\n-# and optionally collect any number of outputs into links on an autogenerated HTML page.\n-\n-# DO NOT install on a public or important site - please.\n-\n-# installed generated tools are fine if the script is safe.\n-# They just run normally and their user cannot do anything unusually insecure\n-# but please, practice safe toolshed.\n-# Read the fucking code before you install any tool \n-# especially this one\n-\n-# After you get the script working on some test data, you can\n-# optionally generate a toolshed compatible gzip file\n-# containing your script safely wrapped as an ordinary Galaxy script in your local toolshed for\n-# safe and largely automated installation in a production Galaxy.\n-\n-# If you opt for an HTML output, you get all the script outputs arranged\n-# as a single Html history item - all output files are linked, thumbnails for all the pdfs.\n-# Ugly but really inexpensive.\n-# \n-# Patches appreciated please. \n-#\n-#\n-# long route to June 2012 product\n-# Behold the awesome power of Galaxy and the toolshed with the tool factory to bind them\n-# derived from an integrated script model  \n-# called rgBaseScriptWrapper.py\n-# Note to the unwary:\n-#   This tool allows arbitrary scripting on your Galaxy as the Galaxy user\n-#   There is nothing stopping a malicious user doing whatever they choose\n-#   Extremely dangerous!!\n-#   Totally insecure. So, trusted users only\n-#\n-# preferred model is a developer using their throw away workstation instance - ie a private site.\n-# no real risk. The universe_wsgi.ini admin_users string is checked - only admin users are permitted to run this tool.\n-#\n-\n-import sys \n-import shutil \n-import subprocess \n-import os \n-import time \n-import tempfile \n-import optparse\n-import tarfile\n-import re\n-import shutil\n-import math\n-\n-progname = os.path.split(sys.argv[0])[1] \n-myversion = \'V000.2 June 2012\' \n-verbose = False \n-debug = False\n-toolFactoryURL = \'https://bitbucket.org/fubar/galaxytoolfactory\'\n-\n-def timenow():\n-    """return current time as a string\n-    """\n-    return time.strftime(\'%d/%m/%Y %H:%M:%S\', time.localtime(time.time()))\n-\n-cheetah_escape_table = {\n-     "$": "\\$"\n-     }\n-\n-cheetah_unescape_table = {\n-     "\\$": "$"\n-     }\n-\n-def html_escape(t):\n-     """Unescape \\$ first in case already done\n-     cheetah barfs if any $ without \\\n-     xml parsing is controlled with <![CDATA[...]]>\n-     """\n-     text = t\n-     for k in cheetah_unescape_table.keys():\n-          text = text.replace(k,cheetah_unescape_table[k])\n-     for k in cheetah_escape_table.keys():\n-          text = text.replace(k,cheetah_escape_table[k])\n-     return text\n-\n-\n-class ScriptRunner:\n-    """class is a wrapper for an arbitrary script\n-    """\n-\n-    def __init__(self,opts=None,treatbashSpecial=True):\n-        """\n-        cleanup inputs, setup some outputs\n-        \n-        """\n-        self.treatbashSpecial = treatbashSpecial\n-        if opts.output_dir: # simplify for the tool tarball\n-            os.chdir(opts.output_dir)\n-        self.thumbformat = \'jpg\'\n-        self.opts = opts\n-        self.toolname = re.sub(\'[^a-zA-Z0-9_]+\', \'\', opts.tool_name) # a sanitizer now does this but..\n-        sel'..b'- please confirm that parameters are sane</div>\' % self.opts.interpreter)\n-        rlog = open(self.tlog,\'r\').readlines()\n-        rlog = [x for x in rlog if x.strip() > \'\']\n-        if len(rlog) > 1:\n-            html.append(\'<div class="toolFormTitle">%s log</div><pre>\\n\' % self.opts.interpreter)\n-            html += rlog\n-            html.append(\'</pre>\\n\')\n-        html.append(galhtmlattr % (self.toolname))\n-        html.append(galhtmlpostfix)\n-        htmlf = file(self.opts.output_html,\'w\')\n-        htmlf.write(\'\\n\'.join(html))\n-        htmlf.write(\'\\n\')\n-        htmlf.close()\n-        self.html = html\n-\n-\n-    def run(self):\n-        """\n-        scripts must be small enough not to fill the pipe!\n-        """\n-        if self.treatbashSpecial and self.opts.interpreter in [\'bash\',\'sh\']:\n-          retval = self.runBash()\n-        else:\n-            if self.opts.output_dir:\n-                sto = open(self.tlog,\'w\')\n-                sto.write(\'## Toolfactory generated command line = %s\\n\' % \' \'.join(self.cl))\n-                sto.flush()\n-                p = subprocess.Popen(self.cl,shell=False,stdout=sto,stderr=sto,stdin=subprocess.PIPE,cwd=self.opts.output_dir)\n-            else:\n-                p = subprocess.Popen(self.cl,shell=False,stdin=subprocess.PIPE)\n-            p.stdin.write(self.script)\n-            p.stdin.close()\n-            retval = p.wait()\n-            if self.opts.output_dir:\n-                sto.close()\n-            if self.opts.make_HTML:\n-                self.makeHtml()\n-        return retval\n-\n-    def runBash(self):\n-        """\n-        cannot use - for bash so use self.sfile\n-        """\n-        if self.opts.output_dir:\n-            s = \'## Toolfactory generated command line = %s\\n\' % \' \'.join(self.cl)\n-            sto = open(self.tlog,\'w\')\n-            sto.write(s)\n-            sto.flush()\n-            p = subprocess.Popen(self.cl,shell=False,stdout=sto,stderr=sto,cwd=self.opts.output_dir)\n-        else:\n-            p = subprocess.Popen(self.cl,shell=False)            \n-        retval = p.wait()\n-        if self.opts.output_dir:\n-            sto.close()\n-        if self.opts.make_HTML:\n-            self.makeHtml()\n-        return retval\n-  \n-\n-def main():\n-    u = """\n-    This is a Galaxy wrapper. It expects to be called by a special purpose tool.xml as:\n-    <command interpreter="python">rgBaseScriptWrapper.py --script_path "$scriptPath" --tool_name "foo" --interpreter "Rscript"\n-    </command>\n-    """\n-    op = optparse.OptionParser()\n-    a = op.add_option\n-    a(\'--script_path\',default=None)\n-    a(\'--tool_name\',default=None)\n-    a(\'--interpreter\',default=None)\n-    a(\'--output_dir\',default=None)\n-    a(\'--output_html\',default=None)\n-    a(\'--input_tab\',default="None")\n-    a(\'--output_tab\',default="None")\n-    a(\'--user_email\',default=\'Unknown\')\n-    a(\'--bad_user\',default=None)\n-    a(\'--make_Tool\',default=None)\n-    a(\'--make_HTML\',default=None)\n-    a(\'--help_text\',default=None)\n-    a(\'--tool_desc\',default=None)\n-    a(\'--new_tool\',default=None)\n-    a(\'--tool_version\',default=None)\n-    opts, args = op.parse_args()\n-    assert not opts.bad_user,\'UNAUTHORISED: %s is NOT authorized to use this tool until Galaxy admin adds %s to admin_users in universe_wsgi.ini\' % (opts.bad_user,opts.bad_user)\n-    assert opts.tool_name,\'## Tool Factory expects a tool name - eg --tool_name=DESeq\'\n-    assert opts.interpreter,\'## Tool Factory wrapper expects an interpreter - eg --interpreter=Rscript\'\n-    assert os.path.isfile(opts.script_path),\'## Tool Factory wrapper expects a script path - eg --script_path=foo.R\'\n-    if opts.output_dir:\n-        try:\n-            os.makedirs(opts.output_dir)\n-        except:\n-            pass\n-    r = ScriptRunner(opts)\n-    if opts.make_Tool:\n-        retcode = r.makeTooltar()\n-    else:\n-        retcode = r.run()\n-    os.unlink(r.sfile)\n-    if retcode:\n-        sys.exit(retcode) # indicate failure to job runner\n-\n-\n-if __name__ == "__main__":\n-    main()\n-\n-\n'
b
diff -r cb4937b0c21d -r 1fcf3fda325f fubar-galaxytoolfactory-58871556de57/rgToolFactory.xml
--- a/fubar-galaxytoolfactory-58871556de57/rgToolFactory.xml Sun Feb 24 17:15:29 2013 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
[
b'@@ -1,277 +0,0 @@\n-<tool id="rgTF" name="Tool Factory" version="0.10">\n-  <description>Makes scripts into tools</description>\n-  <command interpreter="python">\n-#if ( $__user_email__ not in $__admin_users__ ):\n-     rgToolFactory.py --bad_user $__user_email__\n-  #else:\n-    rgToolFactory.py --script_path "$runme" --interpreter "$interpreter" \n-     --tool_name "$tool_name"  --user_email "$__user_email__"\n-    #if $make_TAB.value=="yes":\n-       --output_tab "$tab_file"\n-    #end if\n-    #if $makeMode.make_Tool=="yes":\n-      --make_Tool "$makeMode.make_Tool"\n-      --tool_desc "$makeMode.tool_desc"\n-      --tool_version "$makeMode.tool_version"\n-      --new_tool "$new_tool"\n-      --help_text "$helpme"\n-    #end if\n-    #if $make_HTML.value=="yes":\n-      --output_dir "$html_file.files_path" --output_html "$html_file" --make_HTML "yes"\n-    #end if\n-    #if $input1 != \'None\':\n-       --input_tab "$input1"\n-    #end if\n-#end if \n-  </command>\n-  <inputs>\n-    <param name="input1"  type="data"  label="Select an input file from your history" optional="true" size="120"\n-       help="Most scripts will need an input - your script MUST be ready for whatever format you choose"/>\n-    <param name="tool_name" type="text" value="My dynamic script"   label="New tool ID and title for outputs" size="60"\n-         help="This will become the toolshed repository name so please choose thoughtfully to avoid namespace clashes with other tool writers">\n-        <sanitizer invalid_char="">\n-            <valid initial="string.letters,string.digits"/>\n-        </sanitizer>\n-    </param>\n-    <conditional name="makeMode">\n-        <param name="make_Tool" type="select" label="Create a tar.gz file ready for local toolshed entry" help="Ready to deploy securely!" size="60">\n-        <option value="yes">Generate a Galaxy ToolShed compatible toolshed.gz</option>\n-        <option value="" selected="true">No. Just run the script please</option>\n-        </param>\n-        <when value = "yes">\n-            <param name="tool_version" label="Tool Version - bump this to warn users trying to redo old analyses" type="text" value="0.01"\n-            help="If you change your script and regenerate the \'same\' tool, you should inform Galaxy (and users) by changing (bumping is traditional) this number"/>\n-            <param name="tool_desc" label="Tool Description" type="text" value="" size="40" \n-             help="Supply a brief tool description for the Galaxy tool menu entry (optional - appears after the tool name)" />\n-            <param name="help_text" label="Tool form documentation and help text for users" type="text" area="true" \n-             size="8x120" value="**What it Does**" \n-             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" >           \n-                <sanitizer>\n-                    <valid initial="string.printable">\n-                    </valid>\n-                    <mapping initial="none"/>\n-                </sanitizer>\n-            </param>\n-        </when>\n-        <when value = "">\n-        </when>\n-    </conditional> \n-    <param name="make_HTML" type="select" label="Create an HTML report with links to all output files and thumbnail links to PDF images" size="60"\n-         help="Recommended for presenting complex outputs in an accessible manner. Turn off for simple tools so they just create one output">\n-        <option value="yes">Yes, arrange all outputs in an HTML output</option>\n-        <option value="" selected="true">No, no HTML output file thanks</option>\n-    </param>\n-\n-\n-    <param name="make_TAB" type="select" label="Create a new (default tabular) history output" \n-         help="This is useful if your script creates a single new tabular file you want to appear in the history after the tool executes">\n-        <option value="yes" selected="true">My script writes to a new history output</option>\n-        <optio'..b'mples**\n-<![CDATA[\n-\n-Each of these following trivial examples can be cut and pasted into the script box for testing.\n-Please make sure you choose the appropriate interpreter and upload and select a suitable small matching test data input\n-\n-A simple Rscript "filter" showing how the command line parameters can be handled, takes an input file, does something (transpose in this case) and \n-writes the results to a new tabular file. Note the use of colClasses to ensure that no fiddling takes place with numeric values by treating everything\n-as a string::\n-\n- # transpose a tabular input file and write as a tabular output file\n- ourargs = commandArgs(TRUE)\n- inf = ourargs[1]\n- outf = ourargs[2]\n- inp = read.table(inf,head=F,row.names=NULL,sep=\'\\t\',colClasses="character")\n- outp = t(inp)\n- write.table(outp,outf, quote=FALSE, sep="\\t",row.names=F,col.names=F)\n-\n-Calculate a multiple test adjusted p value from a column of p values - for this script to be useful, it needs the right column for the input to be specified in the code for the\n-given input file type(s) specified when the tool is generated ::\n-\n- # use p.adjust - assumes a HEADER row and column 1 - please fix for any real use\n- column = 1 # adjust if necessary for some other kind of input\n- ourargs = commandArgs(TRUE)\n- inf = ourargs[1]\n- outf = ourargs[2]\n- inp = read.table(inf,head=T,row.names=NULL,sep=\'\\t\')\n- p = inp[,column]\n- q = p.adjust(p,method=\'BH\')\n- outp = cbind(inp,\'BH Adjusted p-value\'=q)\n- write.table(outp,outf, quote=FALSE, sep="\\t",row.names=F,col.names=T) \n-\n-\n-A demonstration Rscript example takes no input file but generates some random data based pdf images\n-You must make sure the option to create an HTML output file is\n-turned on for this to work. Images (pdf) are linked via thumbnails and\n-all files have a link on the resulting HTML page::\n-\n- # note this script takes NO input or output because it generates random data\n- foo = data.frame(a=runif(100),b=runif(100),c=runif(100),d=runif(100),e=runif(100),f=runif(100))\n- bar = as.matrix(foo)\n- pdf( "heattest.pdf" )\n- heatmap(bar,main=\'Random Heatmap\')\n- dev.off()\n- for (i in 1:49) {\n-     foo = runif(100)\n-     bar = rnorm(100)\n-     pdf(paste(\'yet\',i,"anotherplot.pdf",sep=\'_\'))\n-     plot(foo,bar,main=paste("Foo by Bar plot #",i),col="maroon", pch=3,cex=0.6)\n-     dev.off()\n- }\n-\n-A Python example that reverses each row of a tabular file (you\'ll need to remove the leading spaces \n-for this to work if cut and pasted into the script box)::\n-\n- # reverse order of columns in a tabular file\n- import sys\n- inp = sys.argv[1]\n- outp = sys.argv[2]\n- i = open(inp,\'r\')\n- o = open(outp,\'w\')\n- for row in i:\n-     rs = row.rstrip().split(\'\\t\')\n-     rs.reverse()\n-     o.write(\'\\t\'.join(rs))\n-     o.write(\'\\n\')\n- i.close()\n- o.close()\n- \n-A trivial shell script example to show that it works::\n-\n- #!/bin/bash\n- INF=$1\n- OUTF=$2\n- cut -c2,4,6,8,10,12 $INF > $OUTF \n-\n-A trivial perl script example to show that even perl works::\n-\n- #\n- # change all occurances of a string in a file to another string\n- #\n- $oldfile = $ARGV[0];\n- $newfile = $ARGV[1];\n- $old = "gene";\n- $new = "foo";\n- open(OF, $oldfile);\n- open(NF, ">$newfile");\n- # read in each line of the file\n- while ($line = <OF>) {\n-    $line =~ s/$old/$new/;\n-    print NF $line;\n- }\n- close(OF);\n- close(NF);\n-\n-]]>\n-\n-**Citation**\n-\n-\n-Paper_ :\n-\n-Creating re-usable tools from scripts: The Galaxy Tool Factory\n-Ross Lazarus; Antony Kaspi; Mark Ziemann; The Galaxy Team\n-Bioinformatics 2012; doi: 10.1093/bioinformatics/bts573\n-\n-\n-**Licensing** \n-\n-Copyright Ross Lazarus (ross period lazarus at gmail period com) May 2012\n-All rights reserved.\n-Licensed under the LGPL_\n-\n-.. _LGPL: http://www.gnu.org/copyleft/lesser.html\n-.. _GTF:  https://bitbucket.org/fubar/galaxytoolfactory\n-.. _GTFI:  https://bitbucket.org/fubar/galaxytoolfactory/issues\n-.. _Paper: http://bioinformatics.oxfordjournals.org/cgi/reprint/bts573?ijkey=lczQh1sWrMwdYWJ&amp;keytype=ref\n-\n-\n-</help>\n-\n-</tool>\n-\n-\n'
b
diff -r cb4937b0c21d -r 1fcf3fda325f images/dynamicScriptTool.png
b
Binary file images/dynamicScriptTool.png has changed
b
diff -r cb4937b0c21d -r 1fcf3fda325f rgToolFactory.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/rgToolFactory.py Wed Mar 19 21:06:28 2014 -0400
[
b'@@ -0,0 +1,638 @@\n+# rgToolFactory.py\n+# see https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home\n+# \n+# copyright ross lazarus (ross stop lazarus at gmail stop com) May 2012\n+# \n+# all rights reserved\n+# Licensed under the LGPL\n+# suggestions for improvement and bug fixes welcome at https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home\n+#\n+# march 2014\n+# added ghostscript and graphicsmagick as dependencies \n+# fixed a wierd problem where gs was trying to use the new_files_path from universe (database/tmp) as ./database/tmp\n+# errors ensued\n+#\n+# august 2013\n+# found a problem with GS if $TMP or $TEMP missing - now inject /tmp and warn\n+#\n+# july 2013\n+# added ability to combine images and individual log files into html output\n+# just make sure there\'s a log file foo.log and it will be output\n+# together with all images named like "foo_*.pdf\n+# otherwise old format for html\n+#\n+# January 2013\n+# problem pointed out by Carlos Borroto\n+# added escaping for <>$ - thought I did that ages ago...\n+#\n+# August 11 2012 \n+# changed to use shell=False and cl as a sequence\n+\n+# This is a Galaxy tool factory for simple scripts in python, R or whatever ails ye.\n+# It also serves as the wrapper for the new tool.\n+# \n+# you paste and run your script\n+# Only works for simple scripts that read one input from the history.\n+# Optionally can write one new history dataset,\n+# and optionally collect any number of outputs into links on an autogenerated HTML page.\n+\n+# DO NOT install on a public or important site - please.\n+\n+# installed generated tools are fine if the script is safe.\n+# They just run normally and their user cannot do anything unusually insecure\n+# but please, practice safe toolshed.\n+# Read the fucking code before you install any tool \n+# especially this one\n+\n+# After you get the script working on some test data, you can\n+# optionally generate a toolshed compatible gzip file\n+# containing your script safely wrapped as an ordinary Galaxy script in your local toolshed for\n+# safe and largely automated installation in a production Galaxy.\n+\n+# If you opt for an HTML output, you get all the script outputs arranged\n+# as a single Html history item - all output files are linked, thumbnails for all the pdfs.\n+# Ugly but really inexpensive.\n+# \n+# Patches appreciated please. \n+#\n+#\n+# long route to June 2012 product\n+# Behold the awesome power of Galaxy and the toolshed with the tool factory to bind them\n+# derived from an integrated script model  \n+# called rgBaseScriptWrapper.py\n+# Note to the unwary:\n+#   This tool allows arbitrary scripting on your Galaxy as the Galaxy user\n+#   There is nothing stopping a malicious user doing whatever they choose\n+#   Extremely dangerous!!\n+#   Totally insecure. So, trusted users only\n+#\n+# preferred model is a developer using their throw away workstation instance - ie a private site.\n+# no real risk. The universe_wsgi.ini admin_users string is checked - only admin users are permitted to run this tool.\n+#\n+\n+import sys \n+import shutil \n+import subprocess \n+import os \n+import time \n+import tempfile \n+import optparse\n+import tarfile\n+import re\n+import shutil\n+import math\n+\n+progname = os.path.split(sys.argv[0])[1] \n+myversion = \'V001.1 March 2014\' \n+verbose = False \n+debug = False\n+toolFactoryURL = \'https://bitbucket.org/fubar/galaxytoolfactory\'\n+\n+def timenow():\n+    """return current time as a string\n+    """\n+    return time.strftime(\'%d/%m/%Y %H:%M:%S\', time.localtime(time.time()))\n+\n+html_escape_table = {\n+     "&": "&amp;",\n+     ">": "&gt;",\n+     "<": "&lt;",\n+     "$": "\\$"\n+     }\n+\n+def html_escape(text):\n+     """Produce entities within text."""\n+     return "".join(html_escape_table.get(c,c) for c in text)\n+\n+def cmd_exists(cmd):\n+     return subprocess.call("type " + cmd, shell=True, \n+           stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0\n+\n+\n+class ScriptRunner:\n+    """class is a wrapper for an arbitrary script\n+    """\n+\n+    def __init__(self,opts=None,treatbashSpecial'..b'he display\n+        else:\n+            html.append(\'<div class="warningmessagelarge">### Error - %s returned no files - please confirm that parameters are sane</div>\' % self.opts.interpreter)\n+        html.append(galhtmlpostfix)\n+        htmlf = file(self.opts.output_html,\'w\')\n+        htmlf.write(\'\\n\'.join(html))\n+        htmlf.write(\'\\n\')\n+        htmlf.close()\n+        self.html = html\n+\n+\n+    def run(self):\n+        """\n+        scripts must be small enough not to fill the pipe!\n+        """\n+        if self.treatbashSpecial and self.opts.interpreter in [\'bash\',\'sh\']:\n+          retval = self.runBash()\n+        else:\n+            if self.opts.output_dir:\n+                ste = open(self.elog,\'w\')\n+                sto = open(self.tlog,\'w\')\n+                sto.write(\'## Toolfactory generated command line = %s\\n\' % \' \'.join(self.cl))\n+                sto.flush()\n+                p = subprocess.Popen(self.cl,shell=False,stdout=sto,stderr=ste,stdin=subprocess.PIPE,cwd=self.opts.output_dir)\n+            else:\n+                p = subprocess.Popen(self.cl,shell=False,stdin=subprocess.PIPE)\n+            p.stdin.write(self.script)\n+            p.stdin.close()\n+            retval = p.wait()\n+            if self.opts.output_dir:\n+                sto.close()\n+                ste.close()\n+                err = open(self.elog,\'r\').readlines()\n+                if retval <> 0 and err: # problem\n+                    print >> sys.stderr,err\n+            if self.opts.make_HTML:\n+                self.makeHtml()\n+        return retval\n+\n+    def runBash(self):\n+        """\n+        cannot use - for bash so use self.sfile\n+        """\n+        if self.opts.output_dir:\n+            s = \'## Toolfactory generated command line = %s\\n\' % \' \'.join(self.cl)\n+            sto = open(self.tlog,\'w\')\n+            sto.write(s)\n+            sto.flush()\n+            p = subprocess.Popen(self.cl,shell=False,stdout=sto,stderr=sto,cwd=self.opts.output_dir)\n+        else:\n+            p = subprocess.Popen(self.cl,shell=False)            \n+        retval = p.wait()\n+        if self.opts.output_dir:\n+            sto.close()\n+        if self.opts.make_HTML:\n+            self.makeHtml()\n+        return retval\n+  \n+\n+def main():\n+    u = """\n+    This is a Galaxy wrapper. It expects to be called by a special purpose tool.xml as:\n+    <command interpreter="python">rgBaseScriptWrapper.py --script_path "$scriptPath" --tool_name "foo" --interpreter "Rscript"\n+    </command>\n+    """\n+    op = optparse.OptionParser()\n+    a = op.add_option\n+    a(\'--script_path\',default=None)\n+    a(\'--tool_name\',default=None)\n+    a(\'--interpreter\',default=None)\n+    a(\'--output_dir\',default=None)\n+    a(\'--output_html\',default=None)\n+    a(\'--input_tab\',default="None")\n+    a(\'--output_tab\',default="None")\n+    a(\'--user_email\',default=\'Unknown\')\n+    a(\'--bad_user\',default=None)\n+    a(\'--make_Tool\',default=None)\n+    a(\'--make_HTML\',default=None)\n+    a(\'--help_text\',default=None)\n+    a(\'--tool_desc\',default=None)\n+    a(\'--new_tool\',default=None)\n+    a(\'--tool_version\',default=None)\n+    opts, args = op.parse_args()\n+    assert not opts.bad_user,\'UNAUTHORISED: %s is NOT authorized to use this tool until Galaxy admin adds %s to admin_users in universe_wsgi.ini\' % (opts.bad_user,opts.bad_user)\n+    assert opts.tool_name,\'## Tool Factory expects a tool name - eg --tool_name=DESeq\'\n+    assert opts.interpreter,\'## Tool Factory wrapper expects an interpreter - eg --interpreter=Rscript\'\n+    assert os.path.isfile(opts.script_path),\'## Tool Factory wrapper expects a script path - eg --script_path=foo.R\'\n+    if opts.output_dir:\n+        try:\n+            os.makedirs(opts.output_dir)\n+        except:\n+            pass\n+    r = ScriptRunner(opts)\n+    if opts.make_Tool:\n+        retcode = r.makeTooltar()\n+    else:\n+        retcode = r.run()\n+    os.unlink(r.sfile)\n+    if retcode:\n+        sys.exit(retcode) # indicate failure to job runner\n+\n+\n+if __name__ == "__main__":\n+    main()\n+\n+\n'
b
diff -r cb4937b0c21d -r 1fcf3fda325f rgToolFactory.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/rgToolFactory.xml Wed Mar 19 21:06:28 2014 -0400
[
b'@@ -0,0 +1,283 @@\n+<tool id="rgTF" name="Tool Factory" version="0.10">\n+  <description>Makes scripts into tools</description>\n+   <requirements>\n+      <requirement type="package" version="9.10">ghostscript</requirement>\n+      <requirement type="package" version="1.3.18">graphicsmagick</requirement>\n+      <requirement type="package" version="1.1">toolfact</requirement>\n+  </requirements>\n+  <command interpreter="python">\n+#if ( $__user_email__ not in $__admin_users__ ):\n+     rgToolFactory.py --bad_user $__user_email__\n+  #else:\n+    rgToolFactory.py --script_path "$runme" --interpreter "$interpreter" \n+     --tool_name "$tool_name"  --user_email "$__user_email__"\n+    #if $make_TAB.value=="yes":\n+       --output_tab "$tab_file"\n+    #end if\n+    #if $makeMode.make_Tool=="yes":\n+      --make_Tool "$makeMode.make_Tool"\n+      --tool_desc "$makeMode.tool_desc"\n+      --tool_version "$makeMode.tool_version"\n+      --new_tool "$new_tool"\n+      --help_text "$helpme"\n+    #end if\n+    #if $make_HTML.value=="yes":\n+      --output_dir "$html_file.files_path" --output_html "$html_file" --make_HTML "yes"\n+    #end if\n+    #if $input1 != \'None\':\n+       --input_tab "$input1"\n+    #end if\n+#end if \n+  </command>\n+  <inputs>\n+    <param name="input1"  type="data"  label="Select an input file from your history" optional="true" size="120"\n+       help="Most scripts will need an input - your script MUST be ready for whatever format you choose"/>\n+    <param name="tool_name" type="text" value="My dynamic script"   label="New tool ID and title for outputs" size="60"\n+         help="This will become the toolshed repository name so please choose thoughtfully to avoid namespace clashes with other tool writers">\n+        <sanitizer invalid_char="">\n+            <valid initial="string.letters,string.digits"/>\n+        </sanitizer>\n+    </param>\n+    <conditional name="makeMode">\n+        <param name="make_Tool" type="select" label="Create a tar.gz file ready for local toolshed entry" help="Ready to deploy securely!" size="60">\n+        <option value="yes">Generate a Galaxy ToolShed compatible toolshed.gz</option>\n+        <option value="" selected="true">No. Just run the script please</option>\n+        </param>\n+        <when value = "yes">\n+            <param name="tool_version" label="Tool Version - bump this to warn users trying to redo old analyses" type="text" value="0.01"\n+            help="If you change your script and regenerate the \'same\' tool, you should inform Galaxy (and users) by changing (bumping is traditional) this number"/>\n+            <param name="tool_desc" label="Tool Description" type="text" value="" size="40" \n+             help="Supply a brief tool description for the Galaxy tool menu entry (optional - appears after the tool name)" />\n+            <param name="help_text" label="Tool form documentation and help text for users" type="text" area="true" \n+             size="8x120" value="**What it Does**" \n+             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" >           \n+                <sanitizer>\n+                    <valid initial="string.printable">\n+                    </valid>\n+                    <mapping initial="none"/>\n+                </sanitizer>\n+            </param>\n+        </when>\n+        <when value = "">\n+        </when>\n+    </conditional> \n+    <param name="make_HTML" type="select" label="Create an HTML report with links to all output files and thumbnail links to PDF images" size="60"\n+         help="Recommended for presenting complex outputs in an accessible manner. Turn off for simple tools so they just create one output">\n+        <option value="yes">Yes, arrange all outputs in an HTML output</option>\n+        <option value="" selected="true">No, no HTML output file thanks</option>\n+    </param>\n+\n+\n+    <param name="make_TAB" type="select" label="Create a new (default tabular) '..b'lowing trivial examples can be cut and pasted into the script box for testing.\n+Please make sure you choose the appropriate interpreter and upload and select a suitable small matching test data input\n+\n+A simple Rscript "filter" showing how the command line parameters can be handled, takes an input file, does something (transpose in this case) and \n+writes the results to a new tabular file. Note the use of colClasses to ensure that no fiddling takes place with numeric values by treating everything\n+as a string::\n+\n+ # transpose a tabular input file and write as a tabular output file\n+ ourargs = commandArgs(TRUE)\n+ inf = ourargs[1]\n+ outf = ourargs[2]\n+ inp = read.table(inf,head=F,row.names=NULL,sep=\'\\t\',colClasses="character")\n+ outp = t(inp)\n+ write.table(outp,outf, quote=FALSE, sep="\\t",row.names=F,col.names=F)\n+\n+Calculate a multiple test adjusted p value from a column of p values - for this script to be useful, it needs the right column for the input to be specified in the code for the\n+given input file type(s) specified when the tool is generated ::\n+\n+ # use p.adjust - assumes a HEADER row and column 1 - please fix for any real use\n+ column = 1 # adjust if necessary for some other kind of input\n+ ourargs = commandArgs(TRUE)\n+ inf = ourargs[1]\n+ outf = ourargs[2]\n+ inp = read.table(inf,head=T,row.names=NULL,sep=\'\\t\')\n+ p = inp[,column]\n+ q = p.adjust(p,method=\'BH\')\n+ outp = cbind(inp,\'BH Adjusted p-value\'=q)\n+ write.table(outp,outf, quote=FALSE, sep="\\t",row.names=F,col.names=T) \n+\n+\n+A demonstration Rscript example takes no input file but generates some random data based pdf images\n+You must make sure the option to create an HTML output file is\n+turned on for this to work. Images (pdf) are linked via thumbnails and\n+all files have a link on the resulting HTML page::\n+\n+ # note this script takes NO input or output because it generates random data\n+ for (i in 1:10) {\n+    foo = runif(100)\n+    bar = rnorm(100)\n+    pdf(paste(\'yet\',i,"anotherplot.pdf",sep=\'_\'))\n+    plot(foo,bar,main=paste("Foo by Bar plot #",i),col="maroon", pch=3,cex=0.6)\n+    dev.off()\n+    foo = data.frame(a=runif(100),b=runif(100),c=runif(100),d=runif(100),e=runif(100),f=runif(100))\n+    bar = as.matrix(foo)\n+    pdf(paste(\'yet\',i,"anotherheatmap.pdf",sep=\'_\'))\n+    heatmap(bar,main=\'Random Heatmap\')\n+    dev.off()\n+ }\n+\n+\n+A Python example that reverses each row of a tabular file (you\'ll need to remove the leading spaces \n+for this to work if cut and pasted into the script box)::\n+\n+ # reverse order of columns in a tabular file\n+ import sys\n+ inp = sys.argv[1]\n+ outp = sys.argv[2]\n+ i = open(inp,\'r\')\n+ o = open(outp,\'w\')\n+ for row in i:\n+     rs = row.rstrip().split(\'\\t\')\n+     rs.reverse()\n+     o.write(\'\\t\'.join(rs))\n+     o.write(\'\\n\')\n+ i.close()\n+ o.close()\n+ \n+A trivial shell script example to show that it works::\n+\n+ #!/bin/bash\n+ INF=$1\n+ OUTF=$2\n+ cut -c2,4,6,8,10,12 $INF > $OUTF \n+\n+A trivial perl script example to show that even perl works::\n+\n+ #\n+ # change all occurances of a string in a file to another string\n+ #\n+ $oldfile = $ARGV[0];\n+ $newfile = $ARGV[1];\n+ $old = "gene";\n+ $new = "foo";\n+ open(OF, $oldfile);\n+ open(NF, ">$newfile");\n+ # read in each line of the file\n+ while ($line = <OF>) {\n+    $line =~ s/$old/$new/;\n+    print NF $line;\n+ }\n+ close(OF);\n+ close(NF);\n+\n+]]>\n+\n+**Citation**\n+\n+\n+Paper_ :\n+\n+Creating re-usable tools from scripts: The Galaxy Tool Factory\n+Ross Lazarus; Antony Kaspi; Mark Ziemann; The Galaxy Team\n+Bioinformatics 2012; doi: 10.1093/bioinformatics/bts573\n+\n+\n+**Licensing** \n+\n+Copyright Ross Lazarus (ross period lazarus at gmail period com) May 2012\n+All rights reserved.\n+Licensed under the LGPL_\n+\n+.. _LGPL: http://www.gnu.org/copyleft/lesser.html\n+.. _GTF:  https://bitbucket.org/fubar/galaxytoolfactory\n+.. _GTFI:  https://bitbucket.org/fubar/galaxytoolfactory/issues\n+.. _Paper: http://bioinformatics.oxfordjournals.org/cgi/reprint/bts573?ijkey=lczQh1sWrMwdYWJ&amp;keytype=ref\n+\n+\n+</help>\n+\n+</tool>\n+\n+\n'
b
diff -r cb4937b0c21d -r 1fcf3fda325f tool_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml Wed Mar 19 21:06:28 2014 -0400
b
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="ghostscript" version="9.10">
+        <repository changeset_revision="a285e78179bd" name="package_ghostscript_9_10" owner="devteam" prior_installation_required="True" toolshed="http://toolshed.g2.bx.psu.edu/" />
+    </package>
+    <package name="graphicsmagick" version="1.3.18">
+        <repository changeset_revision="4ce7b22bf603" name="package_graphicsmagick_1_3" owner="iuc" prior_installation_required="True" toolshed="http://toolshed.g2.bx.psu.edu/" />
+    </package>
+    <package name="toolfact" version="1.1">
+        <readme>
+            Only Admins can use this tool generator but please do NOT install on a public facing Galaxy as it exposes unrestricted scripting as your Galaxy user
+       </readme>
+    </package>
+</tool_dependency>