Mercurial > repos > peterjc > align_back_trans
changeset 7:a7c7f10488f5 draft
Uploaded v0.0.5, better error messages, embeds citation
author | peterjc |
---|---|
date | Fri, 28 Nov 2014 11:32:34 -0500 |
parents | e37a71ffaff2 |
children | 174a38262fae |
files | tools/align_back_trans/README.rst tools/align_back_trans/align_back_trans.py tools/align_back_trans/align_back_trans.xml |
diffstat | 3 files changed, 26 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/align_back_trans/README.rst Wed Jun 04 08:44:06 2014 -0400 +++ b/tools/align_back_trans/README.rst Fri Nov 28 11:32:34 2014 -0500 @@ -43,11 +43,12 @@ <tool file="align_back_trans/align_back_trans.xml" /> -You will also need to install Biopython 1.62 or later. If you want to run -the unit tests, include this line in ``tools_conf.xml.sample`` and the sample -FASTA files under the ``test-data`` directory. Then:: +You will also need to install Biopython 1.62 or later. - ./run_functional_tests.sh -id align_back_trans +If you wish to run the unit tests, also move/copy the ``test-data/`` files +under Galaxy's ``test-data/`` folder. Then:: + + ./run_tests.sh -id align_back_trans That's it. @@ -63,6 +64,8 @@ v0.0.3 - First official release v0.0.4 - Simplified XML to apply input format to output data. - Fixed error message when sequence length not a multiple of three. +v0.0.5 - More explicit error messages when seqences lengths do not match. + - Tool definition now embeds citation information. ======= ======================================================================
--- a/tools/align_back_trans/align_back_trans.py Wed Jun 04 08:44:06 2014 -0400 +++ b/tools/align_back_trans/align_back_trans.py Fri Nov 28 11:32:34 2014 -0500 @@ -15,8 +15,6 @@ * http://toolshed.g2.bx.psu.edu/view/peterjc/align_back_trans See accompanying text file for licence details (MIT licence). - -This is version 0.0.3 of the script. """ import sys @@ -28,7 +26,7 @@ from Bio.Data.CodonTable import ambiguous_generic_by_id if "-v" in sys.argv or "--version" in sys.argv: - print "v0.0.4" + print "v0.0.5" sys.exit(0) def stop_err(msg, error_level=1): @@ -49,19 +47,20 @@ #Allow this... t = t[:-1] nuc = nuc[:-3] #edit return value - if len(t) != len(p) and p in t: - stop_err("%s translation matched but only as subset of nucleotides, " - "wrong start codon?" % identifier) - if len(t) != len(p) and p[1:] in t: - stop_err("%s translation matched (ignoring first base) but only " - "as subset of nucleotides, wrong start codon?" % identifier) if len(t) != len(p): - stop_err("Inconsistent lengths for %s, ungapped protein %i, " - "tripled %i vs ungapped nucleotide %i" % - (identifier, - len(p), - len(p) * 3, - len(nuc))) + err = ("Inconsistent lengths for %s, ungapped protein %i, " + "tripled %i vs ungapped nucleotide %i." % + (identifier, len(p), len(p) * 3, len(nuc))) + if t.endswith(p): + err += "\nThere are %i extra nucleotides at the start." % (len(t) - len(p)) + elif t.startswith(p): + err += "\nThere are %i extra nucleotides at the end." % (len(t) - len(p)) + elif p in t: + #TODO - Calculate and report the number to trim at start and end? + err += "\nHowever, protein sequence found within translated nucleotides." + elif p[1:] in t: + err += "\nHowever, ignoring first amino acid, protein sequence found within translated nucleotides." + stop_err(err) if t == p:
--- a/tools/align_back_trans/align_back_trans.xml Wed Jun 04 08:44:06 2014 -0400 +++ b/tools/align_back_trans/align_back_trans.xml Fri Nov 28 11:32:34 2014 -0500 @@ -1,4 +1,4 @@ -<tool id="align_back_trans" name="Thread nucleotides onto a protein alignment (back-translation)" version="0.0.4"> +<tool id="align_back_trans" name="Thread nucleotides onto a protein alignment (back-translation)" version="0.0.5"> <description>Gives a codon aware alignment</description> <requirements> <requirement type="package" version="1.63">biopython</requirement> @@ -122,4 +122,8 @@ This tool is available to install into other Galaxy Instances via the Galaxy Tool Shed at http://toolshed.g2.bx.psu.edu/view/peterjc/align_back_trans </help> + <citations> + <citation type="doi">10.7717/peerj.167</citation> + <citation type="doi">10.1093/bioinformatics/btp163</citation> + </citations> </tool>