JAL-2544 only include features in selected columns for sort
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 19 May 2017 10:48:11 +0000 (11:48 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 19 May 2017 10:48:11 +0000 (11:48 +0100)
src/jalview/analysis/AlignmentSorter.java

index 681d3b7..f228350 100755 (executable)
@@ -771,6 +771,18 @@ public class AlignmentSorter
       {
         SequenceFeature sf = it.next();
 
+        /*
+         * double-check feature overlaps columns (JAL-2544)
+         * (could avoid this with a findPositions(fromCol, toCol) method)
+         * findIndex returns base 1 column values, startCol/endCol are base 0
+         */
+        if (seqs[i].findIndex(sf.getBegin()) > endCol + 1
+                || seqs[i].findIndex(sf.getEnd()) < startCol + 1)
+        {
+          it.remove();
+          continue;
+        }
+
         String featureGroup = sf.getFeatureGroup();
         if (groups != null && featureGroup != null
                 && !groups.contains(featureGroup))