JAL-4182 patch - map selection group onto sequence positions - fixes failing test..
authorJames Procter <j.procter@dundee.ac.uk>
Mon, 15 May 2023 13:54:24 +0000 (14:54 +0100)
committerJames Procter <j.procter@dundee.ac.uk>
Mon, 15 May 2023 13:54:24 +0000 (14:54 +0100)
src/jalview/analysis/AlignmentUtils.java

index 403991a..0fdabc8 100644 (file)
@@ -1539,8 +1539,9 @@ public class AlignmentUtils
         int endRes = ann.annotations.length;
         if (selectionGroup != null)
         {
-          startRes = selectionGroup.getStartRes();
-          endRes = selectionGroup.getEndRes();
+          startRes = -1+Math.min(seq.getEnd(), Math.max(seq.getStart(),seq.findPosition(selectionGroup.getStartRes())));
+          endRes = -1+Math.min(seq.getEnd(),seq.findPosition(selectionGroup.getEndRes()));
+          
         }
         copyAnn.restrict(startRes, endRes + 0);