# HG changeset patch
# User fubar
# Date 1386205086 18000
# Node ID a76ecde597e1cca64cf57ce324921ca63b4e005d
# Parent cec2527697f6480c732f521d1f6c6cb5da6a79b9
Uploaded
diff -r cec2527697f6 -r a76ecde597e1 rgweblogo/README
--- a/rgweblogo/README Tue Jun 07 17:43:58 2011 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-This is a Galaxy tool wrapper for weblogo3 already available as a web app at the site below but neat as a Galaxy tool
-
-It generates sequence logos from fasta files such as the alignments generated by clustalw
-
-Note that the image for the help must be in static/images for it to show up on the tool form - it's the same image as goes in test-data
-
-**Installation**
-
-Make sure weblogo3 is installed in your system python and is available on the path for all your nodes
-
-Move the test data files to your galaxy root test-data
-Move the xml file to a subdirectory of your tools folder (eg rgenetics/) and then add a line in your tool_conf.xml to point there.
-Run
-sh run_functional_tests.sh -id weblogo3
-to make sure the tests work
-
-then restart Galaxy and you should be good to go.
-
-
-**Attribution**
-
-Source for the weblogo3 python executable is at http://weblogo.berkeley.edu
-
-Written by Ross Lazarus for the Rgenetics project
-
-Copyright Ross Lazarus at gmail com 2011
-
-All rights reserved.
-
-Released under the LGPL - see http://www.gnu.org/copyleft/lesser.html
diff -r cec2527697f6 -r a76ecde597e1 rgweblogo/rgClustal_testout.fasta
--- a/rgweblogo/rgClustal_testout.fasta Tue Jun 07 17:43:58 2011 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
->c_briggsae-chrII_+_
----ATGAGCTTCCACAAAAGCATGAGCTTT
-CTCAGCTTCTGCCACATCAGCATTCAAATG
-ATC
->c_brenneri-Cbre_Contig60_+_
----ATGAGCCTCCACAACAGCATGATTTTT
-CTCGGCTTCCGCCACATCCGCATTCAAATG
-ATC
->c_remanei-Crem_Contig172_-_
----ATGAGCCTCTACAACCGCATGATTCTT
-TTCAGCCTCTGCCACGTCCGCATTCAAATG
-CTC
->c_elegans-II_+_
----ATGAGCCTCTACTACAGCATGATTCTT
-CTCAGCTTCTGCAACGTCAGCATTCAGATG
-ATC
->c_briggsae-chrII_+_bar
----CCGGAGTCGATCCCTGAAT--------
-------------------------------
----
->c_brenneri-Cbre_Contig60fee_+_
----ACGAAGTCGATCCCTGAAA--------
--TCAGATGAGCGGTTGACCA---GAGAACA
-ACC
->c_remanei-Crem_Contig172zot_-_
----ACGAAGTCGGTCCCTATAAGGTATGAT
-TTTATATGA----TGTACCATAAGGAAATA
-GTC
->c_elegans-II_+_meh
----ACGAAGTCGGTCCCTGAAC--AATTAT
-TT----TGA----TATA---GAAAGAAACG
-GTA
->c_briggsae-chrIfooI_+_
-CGCACAAATATGATGCACAAATCCACAACC
-TAAAGCATCTCCGATAACGTTGACCGAAGT
----
->c_brenneri-Cbre_Contig60gak_+_
-CGCACAAATGTAGTGGACAAATCCGCATCC
-CAAAGCGTCTCCGATAACATTTACCGAAGT
----
->c_remanei-Crem_Contig172foo_-_
-AGCACAAATGTAATGAACGAATCCGCATCC
-CAACGCATCGCCAATCACATTCACAGATGT
----
->c_elegans-II_+_more
-TGCACAAATGTGATGAACGAATCCACATCC
-CAATGCATCACCGATCACATTGACAGATGT
----
diff -r cec2527697f6 -r a76ecde597e1 rgweblogo/rgWebLogo3.xml
--- a/rgweblogo/rgWebLogo3.xml Tue Jun 07 17:43:58 2011 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-
- generator for fasta (eg Clustal alignments)
-
- weblogo -F $outformat -s $size -f $input -o $output -t "$logoname"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-**Note**
-
-This tool uses Weblogo3_ in Galaxy to generate a sequence logo. The input file must be a fasta file in your current history.
-
-A typical output looks like this
-
-.. image:: ./static/images/rgWebLogo3_test.jpg
-
-----
-
-**Why use WebLogo in Galaxy?**
-
-Weblogo3_ is a good example of an easy to use tool and there are plenty of other web accessible weblogo generator sites available.
-
-However, none of those offer the combination of:
-
-1) persistence of analyses and data in multiple shareable histories, pages and libraries
-
-2) convenient access to shared data libraries, workflows and user controlled pages, and to 3rd party data sources like UCSC tables.
-
-3) analyses integrated with many other applicable generic and specialized tools already available for downstream processing.
-
-that you get for free when you use Galaxy. No muss; no fuss.
-
-----
-
-**Attribution**
-
-Weblogo attribution and associated documentation are available at Weblogo3_
-
-This wrapper was written by Ross Lazarus for the rgenetics project and the source code is licensed under the LGPL_ like other rgenetics artefacts
-
-.. _Weblogo3: http://weblogo.berkeley.edu/
-
-.. _LGPL: http://www.gnu.org/copyleft/lesser.html
-
-
-
-
-
-
diff -r cec2527697f6 -r a76ecde597e1 rgweblogo/rgWebLogo3_test.jpg
Binary file rgweblogo/rgWebLogo3_test.jpg has changed
diff -r cec2527697f6 -r a76ecde597e1 weblogo3-91fa0a8ce39d/rgweblogo/README
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/weblogo3-91fa0a8ce39d/rgweblogo/README Wed Dec 04 19:58:06 2013 -0500
@@ -0,0 +1,38 @@
+This is a Galaxy tool wrapper for weblogo3 already available as a web app at the site below but neat as a Galaxy tool
+Last updated by Ross to install iuc ghostscript and numpy dependencies.
+
+Weblogo generates sequence logos from fasta files such as the alignments generated by clustalw
+
+Note that the image for the help must be in static/images for it to show up on the tool form - it's the same image as goes in test-data
+
+**Automated Installation**
+As a Galaxy admin, use the admin menu and select the search ToolShed option. This tool should be on the main toolshed - if not try the test toolshed.
+Select it and choose "preview and install" - the process of downloading and installing weblogo3.3 and this wrapper should take a few minutes at most.
+
+** Manual Installation**
+
+Don't.
+
+If you insist,
+Make sure weblogo3 is installed in your system python and is available on the path for all your nodes
+
+Move the test data files to your galaxy root test-data
+Move the xml file to a subdirectory of your tools folder (eg rgenetics/) and then add a line in your tool_conf.xml to point there.
+Run
+sh run_functional_tests.sh -id weblogo3
+to make sure the tests work
+
+then restart Galaxy and you should be good to go.
+
+
+**Attribution**
+
+Source for the weblogo3 python executable is at http://weblogo.berkeley.edu
+
+Galaxy tool wrapper written by Ross Lazarus for the Rgenetics project
+
+Copyright Ross Lazarus at gmail com 2011
+
+All rights reserved.
+
+Released under the LGPL - see http://www.gnu.org/copyleft/lesser.html
diff -r cec2527697f6 -r a76ecde597e1 weblogo3-91fa0a8ce39d/rgweblogo/rgWebLogo3.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/weblogo3-91fa0a8ce39d/rgweblogo/rgWebLogo3.py Wed Dec 04 19:58:06 2013 -0500
@@ -0,0 +1,157 @@
+"""
+# modified june 2 ross lazarus to add units option at Assaf Gordon's suggestion
+# rgWebLogo3.py
+# wrapper to check that all fasta files are same length
+
+"""
+import optparse, os, sys, subprocess, tempfile
+
+WEBLOGO = 'weblogo' # executable name for weblogo3 - confusing isn't it?
+
+class WL3:
+ """
+ simple wrapper class to check fasta sequence lengths are all identical
+ """
+ FASTASTARTSYM = '>'
+ badseq = '## error - sequences in file %s are not all the same length - cannot proceed. Please read the tool documentation carefully'
+
+ def __init__(self,opts=None):
+ assert opts<>None,'WL3 class needs opts passed in - got None'
+ self.opts = opts
+ self.fastaf = file(self.opts.input,'r')
+ self.clparams = {}
+
+ def whereis(self,program):
+ for path in os.environ.get('PATH', '').split(':'):
+ if os.path.exists(os.path.join(path, program)) and not os.path.isdir(os.path.join(path, program)):
+ return os.path.join(path, program)
+ return None
+
+ def runCL(self):
+ """ construct and run a command line
+ """
+ wl = self.whereis(WEBLOGO)
+ if not wl:
+ print >> sys.stderr, '## rgWebLogo3.py error - cannot locate the weblogo binary %s on the current path' % WEBLOGO
+ print >> sys.stderr, '## Please ensure it is installed and working from http://code.google.com/p/weblogo'
+ sys.exit(1)
+ cll = [WEBLOGO,]
+ cll += [' '.join(it) for it in list(self.clparams.items())]
+ cl = ' '.join(cll)
+ assert cl > '', 'runCL needs a command line as clparms'
+ fd,templog = tempfile.mkstemp(suffix='rgtempRun.txt')
+ tlf = open(templog,'w')
+ process = subprocess.Popen(cl, shell=True, stderr=tlf, stdout=tlf)
+ rval = process.wait()
+ tlf.close()
+ tlogs = ''.join(open(templog,'r').readlines())
+ if len(tlogs) > 1:
+ s = '## executing %s returned status %d and log (stdout/stderr) records: \n%s\n' % (cl,rval,tlogs)
+ else:
+ s = '## executing %s returned status %d. Nothing appeared on stderr/stdout\n' % (cl,rval)
+ os.unlink(templog) # always
+ if rval <> 0:
+ print >> sys.stderr, '## rgWebLogo3.py error - executing %s returned error code %d' % (cl,rval)
+ print >> sys.stderr, '## This may be a data problem or a tool dependency (%s) installation problem' % WEBLOGO
+ print >> sys.stderr, '## Please ensure %s is correctly installed and working on the command line -see http://code.google.com/p/weblogo' % WEBLOGO
+ sys.exit(1)
+ return s
+
+
+ def iter_fasta(self):
+ """
+ generator for fasta sequences from a file
+ """
+ aseq = []
+ seqname = None
+ for i,row in enumerate(self.fastaf):
+ if row.startswith(self.FASTASTARTSYM):
+ if seqname <> None: # already in a sequence
+ s = ''.join(aseq)
+ l = len(s)
+ yield (seqname,l)
+ seqname = row[1:].strip()
+ aseq = []
+ else:
+ if i > 0:
+ print >> sys.stderr,'Invalid fasta file %s - does not start with %s - please read the tool documentation carefully' % (self.opts.input,self.FASTASTARTSYM)
+ sys.exit(1)
+ else:
+ seqname = row[1:].strip()
+ else: # sequence row
+ if seqname == None:
+ print >> sys.stderr,'Invalid fasta file %s - does not start with %s - please read the tool documentation carefully' % (self.opts.input,self.FASTASTARTSYM)
+ sys.exit(1)
+ else:
+ aseq.append(row.strip())
+
+ if seqname <> None: # last one
+ l = len(''.join(aseq))
+ yield (seqname,l)
+
+
+ def fcheck(self):
+ """ are all fasta sequence same length?
+ might be mongo big
+ """
+ flen = None
+ lasti = None
+ f = self.iter_fasta()
+ for i,(seqname,seqlen) in enumerate(f):
+ lasti = i
+ if i == 0:
+ flen = seqlen
+ else:
+ if seqlen <> flen:
+ print >> sys.stderr,self.badseq % self.opts.input
+ sys.exit(1)
+ return '# weblogo input %s has %d sequences all of length %d' % (self.opts.input,lasti,flen)
+
+
+ def run(self):
+ check = self.fcheck()
+ self.clparams['-f'] = self.opts.input
+ self.clparams['-o'] = self.opts.output
+ self.clparams['-t'] = '"%s"' % self.opts.logoname # must be wrapped as a string
+ self.clparams['-F'] = self.opts.outformat
+ if self.opts.size <> None:
+ self.clparams['-s'] = self.opts.size
+ if self.opts.lower <> None:
+ self.clparams['-l'] = self.opts.lower
+ if self.opts.upper <> None:
+ self.clparams['-u'] = self.opts.upper
+ if self.opts.colours <> None:
+ self.clparams['-c'] = self.opts.colours
+ if self.opts.units <> None:
+ self.clparams['-U'] = self.opts.units
+ s = self.runCL()
+ return check,s
+
+
+if __name__ == '__main__':
+ '''
+ called as
+
+ rgWebLogo3.py --outformat $outformat -s $size -i $input -o $output -t "$logoname" -c "$colours"
+#if $range.mode == 'part'
+-l "$range.seqstart" -u "$range.seqend"
+#end if
+
+
+ '''
+ op = optparse.OptionParser()
+ op.add_option('-i', '--input', default=None)
+ op.add_option('-F', '--outformat', default='png')
+ op.add_option('-s', '--size', default=None)
+ op.add_option('-o', '--output', default='rgWebLogo3')
+ op.add_option('-t', '--logoname', default='rgWebLogo3')
+ op.add_option('-c', '--colours', default=None)
+ op.add_option('-l', '--lower', default=None)
+ op.add_option('-u', '--upper', default=None)
+ op.add_option('-U', '--units', default=None)
+ opts, args = op.parse_args()
+ assert opts.input <> None,'weblogo3 needs a -i parameter with a fasta input file - cannot open'
+ assert os.path.isfile(opts.input),'weblogo3 needs a valid fasta input file - cannot open %s' % opts.input
+ w = WL3(opts)
+ checks,s = w.run()
+ print >> sys.stdout, checks # for info
diff -r cec2527697f6 -r a76ecde597e1 weblogo3-91fa0a8ce39d/rgweblogo/rgWebLogo3.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/weblogo3-91fa0a8ce39d/rgweblogo/rgWebLogo3.xml Wed Dec 04 19:58:06 2013 -0500
@@ -0,0 +1,145 @@
+
+
+
+
+
+ package_weblogo
+ numpy
+ ghostscript
+
+ Generator from fasta
+
+ rgWebLogo3.py -F $outformat -s $size -i $input -o $output -t "$logoname" -c "$colours" -U "$units"
+#if $range.mode == 'part'
+-l "$range.seqstart" -u "$range.seqend"
+#end if
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+**Note**
+
+This tool uses Weblogo3_ in Galaxy to generate a sequence logo. The input file must be a fasta file in your current history.
+
+It is recommended for (eg) viewing multiple sequence alignments output from the clustalw tool - set the output to fasta and feed
+it in to this tool.
+
+A typical output looks like this
+
+.. image:: $PATH_TO_IMAGES/rgWebLogo3_test.jpg
+
+----
+
+**Warning about input Fasta format files**
+
+The Weblogo3 program used by this tool will fail if your fasta sequences are not all EXACTLY the same length. The tool will provide a warning
+and refuse to call the weblogo3 executable if irregular length sequences are detected.
+
+Fasta alignments from the companion ClustalW Galaxy tool will work but many other fasta files may cause this tool to fail - please do not file
+a Galaxy bug report - this is a feature of the tool and a problem with your source data - not a tool error - please make certain all your fasta
+sequences are exactly the same length!
+
+
+**Attribution**
+
+Weblogo attribution and associated documentation are available at Weblogo3_
+
+This Galaxy wrapper calls their software so depends on it and their license for your legal comfort.
+The wrapper was written by Ross Lazarus for the rgenetics project and the source code is licensed under the LGPL_ like other rgenetics artefacts
+
+.. _Weblogo3: http://weblogo.threeplusone.com/manual.html
+
+.. _LGPL: http://www.gnu.org/copyleft/lesser.html
+
+
+
+
+
+
diff -r cec2527697f6 -r a76ecde597e1 weblogo3-91fa0a8ce39d/rgweblogo/test-data/rgClustal_testout.fasta
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/weblogo3-91fa0a8ce39d/rgweblogo/test-data/rgClustal_testout.fasta Wed Dec 04 19:58:06 2013 -0500
@@ -0,0 +1,48 @@
+>c_briggsae-chrII_+_
+---ATGAGCTTCCACAAAAGCATGAGCTTT
+CTCAGCTTCTGCCACATCAGCATTCAAATG
+ATC
+>c_brenneri-Cbre_Contig60_+_
+---ATGAGCCTCCACAACAGCATGATTTTT
+CTCGGCTTCCGCCACATCCGCATTCAAATG
+ATC
+>c_remanei-Crem_Contig172_-_
+---ATGAGCCTCTACAACCGCATGATTCTT
+TTCAGCCTCTGCCACGTCCGCATTCAAATG
+CTC
+>c_elegans-II_+_
+---ATGAGCCTCTACTACAGCATGATTCTT
+CTCAGCTTCTGCAACGTCAGCATTCAGATG
+ATC
+>c_briggsae-chrII_+_bar
+---CCGGAGTCGATCCCTGAAT--------
+------------------------------
+---
+>c_brenneri-Cbre_Contig60fee_+_
+---ACGAAGTCGATCCCTGAAA--------
+-TCAGATGAGCGGTTGACCA---GAGAACA
+ACC
+>c_remanei-Crem_Contig172zot_-_
+---ACGAAGTCGGTCCCTATAAGGTATGAT
+TTTATATGA----TGTACCATAAGGAAATA
+GTC
+>c_elegans-II_+_meh
+---ACGAAGTCGGTCCCTGAAC--AATTAT
+TT----TGA----TATA---GAAAGAAACG
+GTA
+>c_briggsae-chrIfooI_+_
+CGCACAAATATGATGCACAAATCCACAACC
+TAAAGCATCTCCGATAACGTTGACCGAAGT
+---
+>c_brenneri-Cbre_Contig60gak_+_
+CGCACAAATGTAGTGGACAAATCCGCATCC
+CAAAGCGTCTCCGATAACATTTACCGAAGT
+---
+>c_remanei-Crem_Contig172foo_-_
+AGCACAAATGTAATGAACGAATCCGCATCC
+CAACGCATCGCCAATCACATTCACAGATGT
+---
+>c_elegans-II_+_more
+TGCACAAATGTGATGAACGAATCCACATCC
+CAATGCATCACCGATCACATTGACAGATGT
+---
diff -r cec2527697f6 -r a76ecde597e1 weblogo3-91fa0a8ce39d/rgweblogo/test-data/rgWebLogo3_test.jpg
Binary file weblogo3-91fa0a8ce39d/rgweblogo/test-data/rgWebLogo3_test.jpg has changed
diff -r cec2527697f6 -r a76ecde597e1 weblogo3-91fa0a8ce39d/rgweblogo/test-data/rgWebLogo3_test2.png
Binary file weblogo3-91fa0a8ce39d/rgweblogo/test-data/rgWebLogo3_test2.png has changed
diff -r cec2527697f6 -r a76ecde597e1 weblogo3-91fa0a8ce39d/rgweblogo/tool_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/weblogo3-91fa0a8ce39d/rgweblogo/tool_dependencies.xml Wed Dec 04 19:58:06 2013 -0500
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ http://weblogo.googlecode.com/files/weblogo-3.3.tar.gz
+ echo `ls -lt` && echo `pwd`
+
+
+
+
+
+
+
+
+
+
+ $INSTALL_DIR/lib/python
+ export PYTHONPATH=$INSTALL_DIR/lib/python:$PYTHONPATH_NUMPY:$PYTHONPATH &&
+ python setup.py install --home $INSTALL_DIR --install-scripts $INSTALL_DIR/bin
+
+ $INSTALL_DIR/lib/python
+ $ENV[PYTHONPATH_NUMPY]
+ $ENV[PATH_NUMPY]
+ $INSTALL_DIR/bin
+ $INSTALL_DIR/bin/weblogo
+
+
+
+
+ weblogo3 is a python version of the old weblogo2.8 or so. Requires numpy and ghostscript so these are installed if not already on your system - if that happens, please be patient
+ while numpy compiles - especially if the ATLAS libraries are being installed - which is not at present.
+
+
+