JAL-3806 require mapping extent covers both sequence’s dataset sequence to avoid...
authorJim Procter <j.procter@dundee.ac.uk>
Fri, 4 Feb 2022 13:13:02 +0000 (13:13 +0000)
committerJim Procter <j.procter@dundee.ac.uk>
Fri, 4 Feb 2022 13:18:53 +0000 (13:18 +0000)
src/jalview/datamodel/AlignedCodonFrame.java
src/jalview/util/MappingUtils.java

index 3c33063..eda1a13 100644 (file)
@@ -445,7 +445,9 @@ public class AlignedCodonFrame
     SequenceI ds = seq.getDatasetSequence();
     for (SequenceToSequenceMapping ssm : mappings)
     {
-      if (ssm.fromSeq == seq || ssm.fromSeq == ds)
+      if (ssm.covers(seq,true,true))
+      {
+      if ((ssm.fromSeq == seq || ssm.fromSeq == ds))
       {
         codon = ssm.mapping.map.locateInTo(index, index);
         if (codon != null)
@@ -456,7 +458,7 @@ public class AlignedCodonFrame
           }
         }
       }
-      else if (ssm.mapping.to == seq || ssm.mapping.to == ds)
+      else if ((ssm.mapping.to == seq || ssm.mapping.to == ds))
       {
         {
           codon = ssm.mapping.map.locateInFrom(index, index);
@@ -468,7 +470,7 @@ public class AlignedCodonFrame
             }
           }
         }
-      }
+      }}
     }
   }
 
index 03a32c9..c66fe00 100644 (file)
@@ -380,6 +380,7 @@ public final class MappingUtils
             List<AlignedCodonFrame> mapping = Arrays
                     .asList(new AlignedCodonFrame[]
                     { acf });
+            // locate start 
             SearchResultsI sr = buildSearchResults(selected,
                     startResiduePos, mapping);
             for (SearchResultMatchI m : sr.getResults())
@@ -387,6 +388,7 @@ public final class MappingUtils
               mappedStartResidue = m.getStart();
               mappedEndResidue = m.getEnd();
             }
+            // locate end - allowing for adjustment of start range
             sr = buildSearchResults(selected, endResiduePos, mapping);
             for (SearchResultMatchI m : sr.getResults())
             {