# HG changeset patch # User peterjc # Date 1417192354 18000 # Node ID a7c7f10488f5f8007ec9d3dce3ef1a554af703f0 # Parent e37a71ffaff232d2e52c0df8256328db75787751 Uploaded v0.0.5, better error messages, embeds citation diff -r e37a71ffaff2 -r a7c7f10488f5 tools/align_back_trans/README.rst --- 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 @@ -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. ======= ====================================================================== diff -r e37a71ffaff2 -r a7c7f10488f5 tools/align_back_trans/align_back_trans.py --- 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: diff -r e37a71ffaff2 -r a7c7f10488f5 tools/align_back_trans/align_back_trans.xml --- 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 @@ - + Gives a codon aware alignment biopython @@ -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 + + 10.7717/peerj.167 + 10.1093/bioinformatics/btp163 +