*/
protected void updateCursor(int residuePos, int column, int startColumn)
{
- int endColumn = cursor == null ? 0 : cursor.lastResidueColumn;
+ /*
+ * preserve end residue column provided cursor was valid
+ */
+ int endColumn = isValidCursor(cursor) ? cursor.lastResidueColumn : 0;
if (residuePos == this.end)
{
endColumn = column;
// the very large sequence case
int eindex = -1, sindex = -1;
boolean ecalc = false, scalc = false;
- for (int s = i; s < j; s++)
+ for (int s = i; s < j && s < sequence.length; s++)
{
- if (jalview.schemes.ResidueProperties.aaIndex[sequence[s]] != 23)
+ if (!Comparison.isGap(sequence[s]))
{
if (createNewDs)
{
/*
* if the start or end column is gapped, startPos or endPos may be to the
* left or right, and we may have included adjacent or enclosing features;
- * remove any that are not enclosing, non-contact features
+ * remove any that are not enclosing features
*/
if (endPos > this.end || Comparison.isGap(sequence[fromColumn - 1])
|| Comparison.isGap(sequence[toColumn - 1]))
SequenceFeature sf = it.next();
int featureStartColumn = findIndex(sf.getBegin());
int featureEndColumn = findIndex(sf.getEnd());
- boolean noOverlap = featureStartColumn > toColumn
- || featureEndColumn < fromColumn;
-
- /*
- * reject an 'enclosing' feature if it is actually a contact feature
- */
- if (sf.isContactFeature() && featureStartColumn < fromColumn
- && featureEndColumn > toColumn)
- {
- noOverlap = true;
- }
- if (noOverlap)
+ if (featureStartColumn > toColumn
+ || featureEndColumn < fromColumn)
{
it.remove();
}