Repository 'mytoolshed'
hg clone https://toolshed.g2.bx.psu.edu/repos/ambarishk/mytoolshed

Changeset 0:9cc0f9a8912e (2016-04-21)
Commit message:
Uploaded
added:
tool1/test-data/test1_out.log
tool1/test-data/tool1_test1_output.xls
tool1/tool1.py
tool1/tool1.xml
tool1/tool_dependencies.xml
b
diff -r 000000000000 -r 9cc0f9a8912e tool1/test-data/test1_out.log
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool1/test-data/test1_out.log Thu Apr 21 06:45:57 2016 -0400
b
@@ -0,0 +1,2 @@
+## Executing Toolfactory generated command line = python /home/guest/Downloads/ngsap/database/tmp/tool1cCIHZo.python --outpath=/home/guest/Downloads/ngsap/database/files/000/dataset_82.dat
+This is another line
b
diff -r 000000000000 -r 9cc0f9a8912e tool1/tool1.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool1/tool1.py Thu Apr 21 06:45:57 2016 -0400
[
b'@@ -0,0 +1,966 @@\n+# tool1/tool1.py - a self annotated version of rgToolFactory2.py generated by running rgToolFactory2.py\n+# to make a new Galaxy tool called tool1\n+# User admin@ngsap.com at 13/04/2016 19:49:50\n+# rgToolFactoryMultIn.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 2015\n+# unified all setups by passing the script on the cl rather than via a PIPE - no need for treat_bash_special so removed\n+#\n+# in the process of building a complex tool\n+# added ability to choose one of the current toolshed package_r or package_perl or package_python dependencies and source that package\n+# add that package to tool_dependencies\n+# Note that once the generated tool is loaded, it will have that package\'s env.sh loaded automagically so there is no\n+# --envshpath in the parameters for the generated tool and it uses the system one which will be first on the adjusted path.\n+#\n+# sept 2014 added additional params from\n+# https://bitbucket.org/mvdbeek/dockertoolfactory/src/d4863bcf7b521532c7e8c61b6333840ba5393f73/DockerToolFactory.py?at=default\n+# passing them is complex\n+# and they are restricted to NOT contain commas or double quotes to ensure that they can be safely passed together on \n+# the toolfactory command line as a comma delimited double quoted string for parsing and passing to the script\n+# see examples on this tool form\n+\n+# august 2014\n+\n+# Allows arbitrary number of input files\n+# NOTE positional parameters are now passed to script\n+# and output (may be "None") is *before* arbitrary number of inputs\n+#\n+# march 2014\n+# had to remove dependencies because cross toolshed dependencies are not possible - can\'t pre-specify a toolshed url for graphicsmagick and ghostscript\n+# grrrrr - night before a demo\n+# added dependencies to a tool_dependencies.xml if html page generated so generated tool is properly portable\n+#\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'..b'o I\'m keeping with the faith\n+        Feel free to update. \n+        """\n+        if self.opts.envshpath != \'system\':\n+            shell_source(self.opts.envshpath)\n+            # this only happens at tool generation - the generated tool relies on the dependencies all being set up\n+            # at toolshed installation by sourcing local env.sh \n+        if self.opts.output_dir:\n+            ste = open(self.elog,\'wb\')\n+            sto = open(self.tlog,\'wb\')\n+            s = \' \'.join(self.cl)\n+            sto.write(\'## Executing Toolfactory generated command line = %s\\n\' % s)\n+            sto.flush()\n+            p = subprocess.Popen(self.cl,shell=False,stdout=sto,stderr=ste,cwd=self.opts.output_dir)\n+            retval = p.wait()\n+            sto.close()\n+            ste.close()\n+            tmp_stderr = open( self.elog, \'rb\' )\n+            err = \'\'\n+            buffsize = 1048576\n+            try:\n+                while True:\n+                    err += tmp_stderr.read( buffsize )\n+                    if not err or len( err ) % buffsize != 0:\n+                        break\n+            except OverflowError:\n+                pass\n+            tmp_stderr.close()\n+        else:\n+            p = subprocess.Popen(self.cl,shell=False)\n+            retval = p.wait()\n+        if self.opts.output_dir:\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+  \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=\'./\')\n+    a(\'--output_html\',default=None)\n+    a(\'--input_tab\',default=[], action="append") # these are "galaxypath,metadataname" pairs\n+    a("--input_formats",default="tabular")\n+    a(\'--output_tab\',default=None)\n+    a(\'--output_format\',default=\'tabular\')\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+    a(\'--include_dependencies\',default=None)   \n+    a(\'--citations\',default=None)\n+    a(\'--additional_parameters\', dest=\'additional_parameters\', action=\'append\', default=[])\n+    a(\'--edit_additional_parameters\', action="store_true", default=False)\n+    a(\'--envshpath\',default="system")   \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+    opts.input_tab = [x.replace(\'"\',\'\').replace("\'",\'\') for x in opts.input_tab]\n+    for i,x in enumerate(opts.additional_parameters): # remove quotes we need to deal with spaces in CL params\n+        opts.additional_parameters[i] = opts.additional_parameters[i].replace(\'"\',\'\')\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+\n'
b
diff -r 000000000000 -r 9cc0f9a8912e tool1/tool1.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool1/tool1.xml Thu Apr 21 06:45:57 2016 -0400
b
@@ -0,0 +1,74 @@
+<tool id="tool1" name="tool1" version="0.01">
+<description>grep command</description>
+
+<command interpreter="python">
+
+            tool1.py --script_path "$runMe" --interpreter "python" 
+                --tool_name "tool1"
+                
+                 --output_dir "./" --output_tab "$output1"
+            
+</command>
+<inputs>
+<param name="job_name" type="text" size="60" label="Supply a name for the outputs to remind you what they contain" value="tool1"/> 
+
+
+</inputs>
+<outputs>
+ <data format="ab1" name="output1" label="${job_name}"/>
+
+</outputs>
+<configfiles>
+<configfile name="runMe">
+ import re
+ hand = open('/home/guest/word.txt')
+ for line in hand:
+     line = line.rstrip()
+     if re.search('is', line) :
+         print line
+</configfile>
+</configfiles>
+<tests>
+
+            <test>
+            
+            <param name="job_name" value="test1"/>
+            <param name="runMe" value="$runMe"/>
+            <output name="output1="tool1_test1_output.xls" ftype="tabular"/>
+            
+            </test>
+            
+</tests>
+<help>
+
+
+get the line.
+
+**Script**
+Pressing execute will run the following code over your input file and generate some outputs in your history::
+
+
+   import re
+ hand = open('/home/guest/word.txt')
+ for line in hand:
+     line = line.rstrip()
+     if re.search('is', line) :
+         print line
+
+**Attribution**
+This Galaxy tool was created by admin@ngsap.com at 13/04/2016 19:49:50
+using the Galaxy Tool Factory.
+
+See https://bitbucket.org/fubar/galaxytoolfactory for details of that project
+Please cite: Creating re-usable tools from scripts: The Galaxy Tool Factory. Ross Lazarus; Antony Kaspi; Mark Ziemann; The Galaxy Team. 
+Bioinformatics 2012; doi: 10.1093/bioinformatics/bts573
+
+
+This tool was autogenerated from a user provided script using the Galaxy Tool Factory 2
+https://toolshed.g2.bx.psu.edu/view/fubar/tool_factory_2
+</help>
+<citations>
+    
+    <citation type="doi">10.1093/bioinformatics/bts573</citation>
+</citations>
+</tool>
b
diff -r 000000000000 -r 9cc0f9a8912e tool1/tool_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool1/tool_dependencies.xml Thu Apr 21 06:45:57 2016 -0400
b
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+        <tool_dependency>
+                <readme>
+                   
+get the line.
+
+                This file was autogenerated by the Galaxy Tool Factory 2
+               </readme>
+        </tool_dependency>
+