- if (
- // ignore features outwith alignment start-stop positions.
- (sf[f].end < sstart || sf[f].begin > sstop)
- ||
- // or ignore based on selection criteria
- (featureLabels != null && !AlignmentSorter
- .containsIgnoreCase(sf[f].type, featureLabels))
- || (groupLabels != null
- // problem here: we cannot eliminate null feature group features
- && (sf[f].getFeatureGroup() != null && !AlignmentSorter
- .containsIgnoreCase(sf[f].getFeatureGroup(),
- groupLabels))))
+ SequenceFeature feature = sf[f];
+
+ /*
+ * 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
+ */
+ boolean noOverlap = seqs[i].findIndex(feature.getBegin()) > stop + 1
+ || seqs[i].findIndex(feature.getEnd()) < start + 1;
+ boolean skipFeatureType = featureLabels != null && !AlignmentSorter
+ .containsIgnoreCase(feature.type, featureLabels);
+ boolean skipFeatureGroup = groupLabels != null
+ && (feature.getFeatureGroup() != null
+ && !AlignmentSorter.containsIgnoreCase(
+ feature.getFeatureGroup(), groupLabels));
+ if (noOverlap || skipFeatureType || skipFeatureGroup)