JAL-3748 make findAlignedSequence require mapped from/to to properly contain the...
authorJim Procter <jprocter@issues.jalview.org>
Wed, 16 Sep 2020 16:43:18 +0000 (17:43 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Wed, 16 Sep 2020 16:43:18 +0000 (17:43 +0100)
src/jalview/datamodel/AlignedCodonFrame.java

index d1b12d3..c3d17dc 100644 (file)
@@ -474,7 +474,9 @@ public class AlignedCodonFrame
      */
     for (SequenceToSequenceMapping ssm : mappings)
     {
-      if (ssm.fromSeq == seq || ssm.fromSeq == seq.getDatasetSequence())
+      int mStart=ssm.getMapping().getMap().getFromLowest(),mEnd=ssm.getMapping().map.getFromHighest();
+      if ((ssm.fromSeq == seq || ssm.fromSeq == seq.getDatasetSequence())
+              && seq.getStart()>=mStart && seq.getEnd()<=mEnd)
       {
         for (SequenceI sourceAligned : al.getSequences())
         {
@@ -495,8 +497,10 @@ public class AlignedCodonFrame
      */
     for (SequenceToSequenceMapping ssm : mappings)
     {
-      if (ssm.mapping.to == seq
+      int mStart=ssm.getMapping().getMap().getToLowest(),mEnd=ssm.getMapping().map.getToHighest();
+      if ((ssm.mapping.to == seq
               || ssm.mapping.to == seq.getDatasetSequence())
+              && seq.getStart()>=mStart && seq.getEnd()<=mEnd)
       {
         for (SequenceI sourceAligned : al.getSequences())
         {