From: gmungoc Date: Fri, 13 Mar 2015 09:04:01 +0000 (+0000) Subject: JAL-1684 allow X in protein to map to untranslatable in DNA (grc in X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=53079f65dd7c537f74906971666b253599b4c0ad;p=jalview.git JAL-1684 allow X in protein to map to untranslatable in DNA (grc in EMBLCDS AAK20930) --- diff --git a/src/jalview/analysis/AlignmentUtils.java b/src/jalview/analysis/AlignmentUtils.java index 26b1beb..15b3fe4 100644 --- a/src/jalview/analysis/AlignmentUtils.java +++ b/src/jalview/analysis/AlignmentUtils.java @@ -409,17 +409,24 @@ public class AlignmentUtils { int aaResidue = 0; for (int i = cdnaStart; i < cdnaSeqChars.length - 2 - && aaResidue < aaSeqChars.length; i += 3) + && aaResidue < aaSeqChars.length; i += 3, aaResidue++) { String codon = String.valueOf(cdnaSeqChars, i, 3); final String translated = ResidueProperties.codonTranslate( codon); + /* + * ? allow X in protein to match untranslatable in dna ? + */ + final char aaRes = aaSeqChars[aaResidue]; + if (translated == null && aaRes == 'X') + { + continue; + } if (translated == null - || !(aaSeqChars[aaResidue] == translated.charAt(0))) + || !(aaRes == translated.charAt(0))) { return false; } - aaResidue++; } // fail if we didn't match all of the aa sequence return (aaResidue == aaSeqChars.length);