Previous changeset 4:c1a9e644d580 (2015-12-03) |
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/weblogo3 commit d0f167e74e705788adcd9c846db011aee490074b |
modified:
rgWebLogo3.py rgWebLogo3.xml |
removed:
tool_dependencies.xml |
b |
diff -r c1a9e644d580 -r dc25a5169a91 rgWebLogo3.py --- a/rgWebLogo3.py Thu Dec 03 15:55:38 2015 -0500 +++ b/rgWebLogo3.py Fri Nov 17 10:19:39 2017 -0500 |
[ |
b'@@ -1,12 +1,17 @@\n-"""\n # modified june 2 ross lazarus to add units option at Assaf Gordon\'s suggestion\n # rgWebLogo3.py\n # wrapper to check that all fasta files are same length\n \n-"""\n-import optparse, os, sys, subprocess, tempfile\n+from __future__ import print_function\n \n-WEBLOGO = \'weblogo\' # executable name for weblogo3 - confusing isn\'t it?\n+import optparse\n+import os\n+import subprocess\n+import sys\n+import tempfile\n+\n+WEBLOGO = \'weblogo\' # executable name for weblogo3 - confusing isn\'t it?\n+\n \n class WL3:\n """\n@@ -15,13 +20,13 @@\n FASTASTARTSYM = \'>\'\n badseq = \'## error - sequences in file %s are not all the same length - cannot proceed. Please read the tool documentation carefully\'\n \n- def __init__(self,opts=None):\n- assert opts<>None,\'WL3 class needs opts passed in - got None\'\n+ def __init__(self, opts=None):\n+ assert opts is not None, \'WL3 class needs opts passed in - got None\'\n self.opts = opts\n- self.fastaf = file(self.opts.input,\'r\')\n+ self.fastaf = open(self.opts.input, \'r\')\n self.clparams = {}\n \n- def whereis(self,program):\n+ def whereis(self, program):\n for path in os.environ.get(\'PATH\', \'\').split(\':\'):\n if os.path.exists(os.path.join(path, program)) and not os.path.isdir(os.path.join(path, program)):\n return os.path.join(path, program)\n@@ -32,64 +37,62 @@\n """\n wl = self.whereis(WEBLOGO)\n if not wl:\n- print >> sys.stderr, \'## rgWebLogo3.py error - cannot locate the weblogo binary %s on the current path\' % WEBLOGO\n- print >> sys.stderr, \'## Please ensure it is installed and working from http://code.google.com/p/weblogo\'\n+ print(\'## rgWebLogo3.py error - cannot locate the weblogo binary %s on the current path\' % (WEBLOGO), file=sys.stderr)\n+ print(\'## Please ensure it is installed and working from https://github.com/weblogo/weblogo\', file=sys.stderr)\n sys.exit(1)\n- cll = [WEBLOGO,]\n+ cll = [WEBLOGO, ]\n cll += [\' \'.join(it) for it in list(self.clparams.items())]\n cl = \' \'.join(cll)\n assert cl > \'\', \'runCL needs a command line as clparms\'\n- fd,templog = tempfile.mkstemp(suffix=\'rgtempRun.txt\')\n- tlf = open(templog,\'w\')\n+ fd, templog = tempfile.mkstemp(suffix=\'rgtempRun.txt\')\n+ tlf = open(templog, \'w\')\n process = subprocess.Popen(cl, shell=True, stderr=tlf, stdout=tlf)\n rval = process.wait()\n tlf.close()\n- tlogs = \'\'.join(open(templog,\'r\').readlines())\n+ tlogs = \'\'.join(open(templog, \'r\').readlines())\n if len(tlogs) > 1:\n- s = \'## executing %s returned status %d and log (stdout/stderr) records: \\n%s\\n\' % (cl,rval,tlogs)\n+ s = \'## executing %s returned status %d and log (stdout/stderr) records: \\n%s\\n\' % (cl, rval, tlogs)\n else:\n- s = \'## executing %s returned status %d. Nothing appeared on stderr/stdout\\n\' % (cl,rval)\n- os.unlink(templog) # always\n- if rval <> 0:\n- print >> sys.stderr, \'## rgWebLogo3.py error - executing %s returned error code %d\' % (cl,rval)\n- print >> sys.stderr, \'## This may be a data problem or a tool dependency (%s) installation problem\' % WEBLOGO\n- print >> sys.stderr, \'## Please ensure %s is correctly installed and working on the command line -see http://code.google.com/p/weblogo\' % WEBLOGO\n+ s = \'## executing %s returned status %d. Nothing appeared on stderr/stdout\\n\' % (cl, rval)\n+ os.unlink(templog) # always\n+ if rval != 0:\n+ print(\'## rgWebLogo3.py error - executing %s returned error code %d\' % (cl, rval), file=sys.stderr)\n+ print(\'## This may be a data problem or a tool dependency (%s) installation problem\' % WEBLOGO, file=sys.stderr)\n+ print(\'## Please ensure %s is correctly installed and working on the command line -see https://github.com/weblogo/web'..b' else:\n aseq.append(row.strip())\n- \n- if seqname <> None: # last one\n- l = len(\'\'.join(aseq))\n- yield (seqname,l)\n- \n- \n+\n+ if seqname is not None: # last one\n+ las = len(\'\'.join(aseq))\n+ yield (seqname, las)\n+\n def fcheck(self):\n """ are all fasta sequence same length?\n might be mongo big\n@@ -97,61 +100,50 @@\n flen = None\n lasti = None\n f = self.iter_fasta()\n- for i,(seqname,seqlen) in enumerate(f):\n+ for i, (seqname, seqlen) in enumerate(f):\n lasti = i\n if i == 0:\n flen = seqlen\n else:\n- if seqlen <> flen:\n- print >> sys.stderr,self.badseq % self.opts.input\n+ if seqlen != flen:\n+ print(self.badseq % self.opts.input, file=sys.stderr)\n sys.exit(1)\n- return \'# weblogo input %s has %d sequences all of length %d\' % (self.opts.input, lasti+1, flen)\n-\n+ return \'# weblogo input %s has %d sequences all of length %d\' % (self.opts.input, lasti + 1, flen)\n \n def run(self):\n check = self.fcheck()\n self.clparams[\'-f\'] = self.opts.input\n self.clparams[\'-o\'] = self.opts.output\n- self.clparams[\'-t\'] = \'"%s"\' % self.opts.logoname # must be wrapped as a string \n- self.clparams[\'-F\'] = self.opts.outformat \n- if self.opts.size <> None:\n+ self.clparams[\'-t\'] = \'"%s"\' % self.opts.logoname # must be wrapped as a string\n+ self.clparams[\'-F\'] = self.opts.outformat\n+ if self.opts.size is not None:\n self.clparams[\'-s\'] = self.opts.size\n- if self.opts.lower <> None:\n+ if self.opts.lower is not None:\n self.clparams[\'-l\'] = self.opts.lower\n- if self.opts.upper <> None:\n- self.clparams[\'-u\'] = self.opts.upper \n- if self.opts.colours <> None:\n+ if self.opts.upper is not None:\n+ self.clparams[\'-u\'] = self.opts.upper\n+ if self.opts.colours is not None:\n self.clparams[\'-c\'] = self.opts.colours\n- if self.opts.units <> None:\n+ if self.opts.units is not None:\n self.clparams[\'-U\'] = self.opts.units\n s = self.runCL()\n- return check,s\n+ return check, s\n \n \n if __name__ == \'__main__\':\n- \'\'\'\n- called as\n-<command interpreter="python"> \n- rgWebLogo3.py --outformat $outformat -s $size -i $input -o $output -t "$logoname" -c "$colours"\n-#if $range.mode == \'part\'\n--l "$range.seqstart" -u "$range.seqend"\n-#end if\n- </command>\n-\n- \'\'\'\n op = optparse.OptionParser()\n op.add_option(\'-i\', \'--input\', default=None)\n op.add_option(\'-F\', \'--outformat\', default=\'png\')\n- op.add_option(\'-s\', \'--size\', default=None) \n+ op.add_option(\'-s\', \'--size\', default=None)\n op.add_option(\'-o\', \'--output\', default=\'rgWebLogo3\')\n op.add_option(\'-t\', \'--logoname\', default=\'rgWebLogo3\')\n op.add_option(\'-c\', \'--colours\', default=None)\n op.add_option(\'-l\', \'--lower\', default=None)\n- op.add_option(\'-u\', \'--upper\', default=None) \n- op.add_option(\'-U\', \'--units\', default=None) \n+ op.add_option(\'-u\', \'--upper\', default=None)\n+ op.add_option(\'-U\', \'--units\', default=None)\n opts, args = op.parse_args()\n- assert opts.input <> None,\'weblogo3 needs a -i parameter with a fasta input file - cannot open\'\n- assert os.path.isfile(opts.input),\'weblogo3 needs a valid fasta input file - cannot open %s\' % opts.input\n+ assert opts.input is not None, \'weblogo3 needs a -i parameter with a fasta input file - cannot open\'\n+ assert os.path.isfile(opts.input), \'weblogo3 needs a valid fasta input file - cannot open %s\' % opts.input\n w = WL3(opts)\n- checks,s = w.run()\n- print >> sys.stdout, checks # for info\n+ checks, s = w.run()\n+ print(checks, file=sys.stdout) # for info\n' |
b |
diff -r c1a9e644d580 -r dc25a5169a91 rgWebLogo3.xml --- a/rgWebLogo3.xml Thu Dec 03 15:55:38 2015 -0500 +++ b/rgWebLogo3.xml Fri Nov 17 10:19:39 2017 -0500 |
[ |
b'@@ -1,106 +1,104 @@\n-<tool id="rgweblogo3" name="Sequence Logo" version="0.4">\n- <description>generator for fasta (eg Clustal alignments)</description>\n- <requirements>\n- <requirement type="package" version="1.7.1">numpy</requirement>\n- <requirement type="package" version="3.3">weblogo</requirement>\n- <requirement type="package" version="9.10">ghostscript</requirement>\n- </requirements>\n- <command interpreter="python"> \n- rgWebLogo3.py -F $outformat -s $size -i $input -o $output -t "$logoname" -c "$colours" -U "$units"\n-#if $range.mode == \'part\'\n--l "$range.seqstart" -u "$range.seqend"\n-#end if\n- </command>\n- <inputs>\n- <page>\n- <param format="fasta" name="input" type="data" label="Fasta File" />\n- <param name="logoname" label="Title for output Sequence Logo" type="text" value="Galaxy-Rgenetics Sequence Logo" />\n- <param name="outformat" type="select" label="Output format for image (or text report)" >\n- <option value="png" selected="True">PNG screen quality</option>\n- <option value="png_print">High quality printable PNG</option>\n- <option value="pdf">PDF</option>\n- <option value="jpeg">JPG</option>\n- <option value="eps">EPS</option>\n- <option value="logodata">Text (shows the detailed calculations for each position - no image)</option>\n- </param>\n- <param name="units" type="select" label="Display Units"\n- help="What the height of each logo element depicts - eg bits of entropy (default)">\n- <option value="bits" selected="True">Entropy (bits)</option>\n- <option value="probability">Probability</option>\n- <option value="nats">Nats</option>\n- <option value="kT">kT</option>\n- <option value="kJ/mol">kJ/mol</option>\n- <option value="kcal/mol">kcal/mol</option>\n- </param>\n- <param name="colours" type="select" label="Colour scheme for output Sequence Logo" \n- help="Note that some of these only make sense for protein sequences!">\n- <option value="auto" selected="True">Default automatic colour selection</option>\n- <option value="base pairing">Base pairing</option>\n- <option value="charge">Charge colours</option>\n- <option value="chemistry">Chemistry colours</option>\n- <option value="classic">Classical colours</option>\n- <option value="hydrophobicity">Hydrophobicity</option>\n- <option value="monochrome">monochrome</option>\n- </param>\n+<tool id="rgweblogo3" name="Sequence Logo" version="3.5.0">\n+ <description>generator for fasta (eg Clustal alignments)</description>\n+ <requirements>\n+ <requirement type="package" version="3.5.0">weblogo</requirement>\n+ </requirements>\n+ <command><![CDATA[\n+ python \'$__tool_directory__/rgWebLogo3.py\'\n+ -F $outformat\n+ -s $size\n+ -i \'$input\'\n+ -o \'$output\'\n+ -t \'$logoname\'\n+ -c \'$colours\'\n+ -U \'$units\'\n \n- \n- <conditional name="range">\n- <param name="mode" type="select" label="Include entire sequence (default) or specify a subsequence range to use">\n- <option value="complete" selected="true">complete sequence</option>\n- <option value="part">Only use a part of the sequence</option>\n+ #if $range.mode == \'part\'\n+ -l \'$range.seqstart\' -u \'$range.seqend\'\n+ #end if\n+ ]]></command>\n+ <inputs>\n+ <param format="fasta" name="input" type="data" label="Fasta File" />\n+ <param name="logoname" label="Title for output Sequence Logo" type="text" value="Galaxy-Rgenetics Sequence Logo" />\n+ <param name="outformat" type="select" label="Output format for image (or text report)" >\n+ <option value="png" selected="True">PNG screen quality</option>\n+ <option value="png_print">High quality printable PNG</option>\n+ <option value="pdf">PDF</option>\n+ <option value="jpeg">JPG</option>\n+ <option value="eps">EPS</option>\n+ <option val'..b'Include entire sequence (default) or specify a subsequence range to use">\n+ <option value="complete" selected="true">complete sequence</option>\n+ <option value="part">Only use a part of the sequence</option>\n+ </param>\n+ <when value="complete" />\n+ <when value="part">\n+ <param name="seqstart" type="integer" value="1" help="WARNING: Specifying indexes outside the sequence lengths will cause unpredictable but bad consequences!"\n+ label="Index (eg 1=first letter) of the start of the sequence range to include in the logo" />\n+ <param name="seqend" type="integer" value="99999" label="Index (eg 75=75th letter) of the end of the sequence range to include in the logo" />\n+ </when>\n+ </conditional>\n+ <param name="size" type="select" label="Output weblogo size" >\n+ <option value="large" selected="True">Large</option>\n+ <option value="medium">Medium</option>\n+ <option value="small">Small</option>\n+ </param>\n+ </inputs>\n+ <outputs>\n+ <data format="pdf" name="output" label="${logoname}_output.${outformat}">\n+ <change_format>\n+ <when input="outformat" value="png_print" format="png" />\n+ <when input="outformat" value="png" format="png" />\n+ <when input="outformat" value="jpeg" format="jpg" />\n+ <when input="outformat" value="eps" format="eps" />\n+ <when input="outformat" value="logodata" format="txt" />\n+ </change_format>\n+ </data>\n+ </outputs>\n+ <tests>\n+ <test>\n+ <param name="input" value="rgClustal_testout.fasta" />\n+ <param name="logoname" value="Galaxy/Rgenetics weblogo" />\n+ <param name="outformat" value="jpeg" />\n+ <param name="mode" value="complete" />\n+ <param name="size" value="medium" />\n+ <param name="colours" value="auto" />\n+ <param name="units" value="bits" />\n+ <output name="output" file="rgWebLogo3_test.jpg" ftype="jpg" compare="sim_size" delta="10000" />\n+ </test>\n+ <test>\n+ <param name="input" value="rgClustal_testout.fasta" />\n+ <param name="logoname" value="Galaxy/Rgenetics weblogo" />\n+ <param name="outformat" value="png" />\n+ <param name="mode" value="complete" />\n+ <param name="size" value="medium" />\n+ <param name="colours" value="auto" />\n+ <param name="units" value="probability" />\n+ <output name="output" file="rgWebLogo3_test2.png" ftype="png" compare="sim_size" delta="10000" />\n+ </test>\n+ </tests>\n+ <help><![CDATA[\n **Note**\n \n This tool uses Weblogo3_ in Galaxy to generate a sequence logo. The input file must be a fasta file in your current history.\n@@ -119,8 +117,8 @@\n 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\n and refuse to call the weblogo3 executable if irregular length sequences are detected.\n \n-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 \n-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 \n+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\n+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\n sequences are the same length!\n \n ----\n@@ -135,8 +133,8 @@\n \n .. _LGPL: http://www.gnu.org/copyleft/lesser.html\n \n- </help>\n-\n+ ]]></help>\n+ <citations>\n+ <citation type="doi">10.1101/gr.849004</citation>\n+ </citations>\n </tool>\n-\n-\n' |
b |
diff -r c1a9e644d580 -r dc25a5169a91 tool_dependencies.xml --- a/tool_dependencies.xml Thu Dec 03 15:55:38 2015 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,12 +0,0 @@ -<?xml version="1.0"?> -<tool_dependency> - <package name="ghostscript" version="9.10"> - <repository changeset_revision="a285e78179bd" name="package_ghostscript_9_10" owner="devteam" toolshed="https://toolshed.g2.bx.psu.edu" /> - </package> - <package name="numpy" version="1.7.1"> - <repository changeset_revision="300877695495" name="package_numpy_1_7" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" /> - </package> - <package name="weblogo" version="3.3"> - <repository changeset_revision="648e4b32f15c" name="package_weblogo_3_3" owner="devteam" toolshed="https://toolshed.g2.bx.psu.edu" /> - </package> -</tool_dependency> |