- // optimisation - could consider 'spos,apos' like cursor argument
- // - findIndex wastes time by starting from first character and
- // counting
-
- int sfStartCol = sq.findIndex(sf.getBegin());
- int sfEndCol = sq.findIndex(sf.getEnd());
-
- if (sf.isContactFeature())
- {
- /*
- * 'contact' feature - check for 'start' or 'end'
- * position within the selected region
- */
- if (sfStartCol >= startPosition
- && sfStartCol <= endPosition)
- {
- bs.set(sfStartCol - 1);
- sequenceHasFeature = true;
- }
- if (sfEndCol >= startPosition && sfEndCol <= endPosition)
- {
- bs.set(sfEndCol - 1);
- sequenceHasFeature = true;
- }
- continue;
- }
-
- /*
- * contiguous feature - select feature positions (if any)
- * within the selected region
- */
- if (sfStartCol > endPosition || sfEndCol < startPosition)
- {
- // feature is outside selected region
- continue;
- }
- sequenceHasFeature = true;
- if (sfStartCol < startPosition)
- {
- sfStartCol = startPosition;
- }
- if (sfStartCol < ist)
- {
- sfStartCol = ist;
- }
- if (sfEndCol > endPosition)
- {
- sfEndCol = endPosition;
- }
- for (; sfStartCol <= sfEndCol; sfStartCol++)
- {
- bs.set(sfStartCol - 1); // convert to base 0
- }