Next changeset 1:87613ace5113 (2012-08-11) |
Commit message:
Uploaded from test toolshed |
added:
fubar-galaxytoolfactory-25646561839c/README.txt fubar-galaxytoolfactory-25646561839c/images/dynamicScriptTool.png fubar-galaxytoolfactory-25646561839c/rgToolFactory.py fubar-galaxytoolfactory-25646561839c/rgToolFactory.xml |
b |
diff -r 000000000000 -r 2686fd3d0112 fubar-galaxytoolfactory-25646561839c/README.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fubar-galaxytoolfactory-25646561839c/README.txt Sun Jul 08 04:58:23 2012 -0400 |
[ |
b'@@ -0,0 +1,233 @@\n+# WARNING before you start\n+# Install on a private Galaxy ONLY\n+# Please NEVER on a public or production instance\n+\n+*Short Story*\n+This is an unusual Galaxy tool that generates very simple but potentially\n+very useful local Galaxy tools that run the user supplied script (R, python, perl...) over a single input file.\n+Whenever you run this tool, 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+\n+If the script runs sucessfully, a new Galaxy tool that runs your script can be generated.\n+The new tool is in the form of a special 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 your 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+*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 safely in\n+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 dark script matter,\n+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 are an admin_user.\n+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 the Galaxy Test toolshed (not main) and search for the toolfactory repository.\n+Open it and review the code and select the option to install it.\n+\n+If you can\'t get the tool that way, the xml and py files here need to be copied into a new tools subdirectory such as tools/toolfactory\n+Your tool_conf.xml needs a new entry pointing to the xml file - something like::\n+\n+ <section name="Tool building tools" id="toolbuilders">\n+ <tool file="toolfactory/rgToolFactory.xml"/>\n+ </section>\n+\n+If not already there (I just added it to datatypes_conf.xml.sample), please add:\n+<datatype extension="toolshed.gz" type="galaxy.datatypes.binary:Binary" mimetype="multipart/x-gzip" subclass="True" />\n+to your local data_types_conf.xml. \n+\n+Ensure that html sanitization is set to False and uncommented in universe_wsgi.ini\n+\n+You\'ll have to restart the server for the new tool to be available.\n+\n+Of course, R, python, perl etc are needed on your path if you want to test scripts using those interpreters.\n+Adding new ones to this tool code should be easy enough. Please make suggestions as bitbucket issues and code.\n+The HTML file code auto'..b'\n+\n+**Motivation** Simple transformation, filtering or reporting scripts get written, run and lost every day in most busy labs \n+- even ours where Galaxy is in use. This \'dark script matter\' is pervasive and generally not reproducible.\n+\n+**Benefits** For our group, this allows Galaxy to fill that important dark script gap - all those "small" bioinformatics \n+tasks. Once a user has a working R (or python or perl) script that does something Galaxy cannot currently do (eg transpose a \n+tabular file) and takes parameters the way Galaxy supplies them (see example below), they:\n+\n+1. Install the tool factory on a personal private instance\n+\n+2. Upload a small test data set\n+\n+3. Paste the script into the \'script\' text box and iteratively run the insecure tool on test data until it works right - \n+there is absolutely no reason to do this anywhere other than on a personal private instance. \n+\n+4. Once it works right, set the \'Generate toolshed gzip\' option and run it again. \n+\n+5. A toolshed style gzip appears ready to upload and install like any other Toolshed entry. \n+\n+6. Upload the new tool to the toolshed\n+\n+7. Ask the local admin to check the new tool to confirm it\'s not evil and install it in the local production galaxy\n+\n+**Simple examples on the tool form**\n+\n+A simple Rscript "filter" showing how the command line parameters can be handled, takes an input file, \n+does something (transpose in this case) and writes the results to a new tabular file::\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\')\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,\n+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+ fdrmeth = \'BH\'\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=fdrmeth)\n+ newval = paste(fdrmeth,\'p-value\',sep=\'_\')\n+ q = data.frame(q)\n+ names(q) = newval\n+ outp = cbind(inp,newval=q)\n+ write.table(outp,outf, quote=FALSE, sep="\\t",row.names=F,col.names=T) \n+\n+\n+\n+Another Rscript example 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+**Attribution** Copyright Ross Lazarus (ross period lazarus at gmail period com) May 2012\n+\n+All rights reserved.\n+\n+Licensed under the LGPL\n+\n+\n+**Obligatory screenshot**\n+\n+http://bitbucket.org/fubar/galaxytoolmaker/src/fda8032fe989/images/dynamicScriptTool.png\n+\n' |
b |
diff -r 000000000000 -r 2686fd3d0112 fubar-galaxytoolfactory-25646561839c/images/dynamicScriptTool.png |
b |
Binary file fubar-galaxytoolfactory-25646561839c/images/dynamicScriptTool.png has changed |
b |
diff -r 000000000000 -r 2686fd3d0112 fubar-galaxytoolfactory-25646561839c/rgToolFactory.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fubar-galaxytoolfactory-25646561839c/rgToolFactory.py Sun Jul 08 04:58:23 2012 -0400 |
[ |
b'@@ -0,0 +1,502 @@\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+# 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 binds 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+\n+class ScriptRunner:\n+ """class is a wrapper for an arbitrary script\n+ """\n+\n+ def __init__(self,opts=None):\n+ """\n+ cleanup inputs, setup some outputs\n+ \n+ """\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+ self.toolid = self.toolname\n+ s = open(self.opts.script_path,\'r\').readlines()\n+ self.script = \'\'.join(s)\n+ self.indentedScript = \'\'.join([\' %s\' % x for x in s]) # for restructured text in help\n+ self.myname = sys.argv[0] # get our name because we write ourselves out as a tool later\n+ self.pyfile = self.myname # crude but efficient - the cruft won\'t hurt much\n+ self.xmlfile = \'%s.xml\' % self.toolname\n+ self.sfile = \'%s.%s\' % (self.toolname,opts.interpreter)\n+ if opts.output_dir: # may not want these complexities \n+ self.tlog = os.path.join(opts.output_dir,"%s_runner.log" % self.toolname)\n+ artifactpath = os.path.join(opts.output_dir,\'%s_run.script\' % self.toolname) \n+ artifact = open('..b' s += \'</tr>\\n\'\n+ ntogo = 0\n+ if i < (npdf - 1): # more to come\n+ s += \'<tr>\'\n+ ntogo = nacross\n+ else:\n+ ntogo -= 1\n+ html.append(s)\n+ if html[-1].strip().endswith(\'</tr>\'):\n+ html.append(\'</table></div>\\n\')\n+ else:\n+ if ntogo > 0: # pad\n+ html.append(\'<td> </td>\'*ntogo)\n+ html.append(\'</tr></table></div>\\n\')\n+ if len(fhtml) > 0:\n+ fhtml.insert(0,\'<div><table class="colored" cellpadding="3" cellspacing="3"><tr><th>Output File Name (click to view)</th><th>Size</th></tr>\\n\')\n+ fhtml.append(\'</table></div><br/>\')\n+ html += fhtml # add all non-pdf files to the end of the 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+ 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+ """\n+ if self.opts.output_dir:\n+ sto = open(self.tlog,\'w\')\n+ p = subprocess.Popen(\' \'.join(self.cl),shell=True,stdout=sto,stderr=sto,stdin=subprocess.PIPE,cwd=self.opts.output_dir)\n+ else:\n+ p = subprocess.Popen(\' \'.join(self.cl),shell=True,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+\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+ 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 000000000000 -r 2686fd3d0112 fubar-galaxytoolfactory-25646561839c/rgToolFactory.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fubar-galaxytoolfactory-25646561839c/rgToolFactory.xml Sun Jul 08 04:58:23 2012 -0400 |
[ |
b'@@ -0,0 +1,226 @@\n+<tool id="rgTF" name="Tool Factory" version="0.07">\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" 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" 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+\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+ <option value="">I only want an HTM'..b'ause\n+it will become the input for the generated functional test.\n+\n+.. class:: warningmark\n+\n+**Note to system administrators** This tool offers *NO* built in protection against malicious scripts. It should only be installed on private/personnal Galaxy instances.\n+Admin_users will have the power to do anything they want as the Galaxy user if you install this tool.\n+\n+The tools generated by this tool will run just as securely as any other normal installed Galaxy tool but like any other new tools, should always be checked carefully before installation.\n+We recommend that you follow the good code hygiene practices associated with safe toolshed.\n+\n+.. class:: warningmark\n+\n+**Use on public servers** is STRONGLY discouraged for obvious reasons\n+\n+**Scripting conventions** The pasted script will be executed with the path to the (optional) input tabular data file path or NONE if you do not select one, and the path to the optional\n+output file or None if none is wanted, as the first and second command line parameters. The script must deal appropriately with these - see Rscript examples below.\n+Note that if an optional HTML output is selected, all the output files created by the script will be nicely presented as links, with pdf images linked as thumbnails in that output.\n+This can be handy for complex scripts creating lots of output.\n+\n+**Simple examples**\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 writes the results to a new tabular file::\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\')\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 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+\n+**Attribution** Copyright Ross Lazarus (ross period lazarus at gmail period com) May 2012\n+\n+All rights reserved.\n+\n+Licensed under the LGPL_\n+\n+.. _LGPL: http://www.gnu.org/copyleft/lesser.html\n+\n+</help>\n+\n+</tool>\n+\n+\n' |