JAL-3725 exclude stop codon from CDS-to-protein mapping
[jalview.git] / src / jalview / ws / dbsources / EmblXmlSource.java
index 97d7c9f..c5532f5 100644 (file)
@@ -69,6 +69,7 @@ import jalview.xml.binding.embl.XrefType;
  * 
  * @deprecated endpoint withdrawn August 2020 (JAL-3692), use EmblFlatfileSource
  */
+
 public abstract class EmblXmlSource extends EbiFileRetrievedProxy
 {
   private static final Regex ACCESSION_REGEX = new Regex("^[A-Z]+[0-9]+");
@@ -453,9 +454,9 @@ public abstract class EmblXmlSource extends EbiFileRetrievedProxy
         else
         {
           // final product length truncation check
-          int[] cdsRanges = adjustForProteinLength(translationLength,
+          int [] exons2 = adjustForProteinLength(translationLength,
                   exons);
-          dnaToProteinMapping = new Mapping(product, cdsRanges,
+          dnaToProteinMapping = new Mapping(product, exons2,
                   new int[]
                   { 1, translationLength }, 3, 1);
           if (product != null)
@@ -757,8 +758,7 @@ public abstract class EmblXmlSource extends EbiFileRetrievedProxy
 
   /**
    * Truncates (if necessary) the exon intervals to match 3 times the length of
-   * the protein; also accepts 3 bases longer (for stop codon not included in
-   * protein)
+   * the protein (including truncation for stop codon included in exon)
    * 
    * @param proteinLength
    * @param exon
@@ -775,11 +775,9 @@ public abstract class EmblXmlSource extends EbiFileRetrievedProxy
     int exonLength = MappingUtils.getLength(Arrays.asList(exon));
 
     /*
-     * if exon length matches protein, or is shorter, or longer by the 
-     * length of a stop codon (3 bases), then leave it unchanged
+     * if exon length matches protein, or is shorter, then leave it unchanged
      */
-    if (expectedCdsLength >= exonLength
-            || expectedCdsLength == exonLength - 3)
+    if (expectedCdsLength >= exonLength)
     {
       return exon;
     }