JAL-1684 allow X in protein to map to untranslatable in DNA (grc in
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 13 Mar 2015 09:04:01 +0000 (09:04 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 13 Mar 2015 09:04:01 +0000 (09:04 +0000)
EMBLCDS AAK20930)

src/jalview/analysis/AlignmentUtils.java

index 26b1beb..15b3fe4 100644 (file)
@@ -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);