firstUngappedPos++;
}
- /*
- * If this sequence is only gaps in the selected range, skip it
- */
- if (firstUngappedPos > selectionEndRes)
- {
- continue;
- }
+ boolean allGapped = (firstUngappedPos > selectionEndRes);
int lastUngappedPos = selectionEndRes;
- while (lastUngappedPos >= selectionStartRes
- && Comparison.isGap(selected.getCharAt(lastUngappedPos)))
+ if (!allGapped)
{
- lastUngappedPos--;
+ while (lastUngappedPos >= selectionStartRes
+ && Comparison.isGap(selected.getCharAt(lastUngappedPos)))
+ {
+ lastUngappedPos--;
+ }
}
/*
* Find the selected start/end residue positions in sequence
*/
- int startResiduePos = selected.findPosition(firstUngappedPos);
- int endResiduePos = selected.findPosition(lastUngappedPos);
+ int startResiduePos = allGapped ? 0 : selected.findPosition(firstUngappedPos);
+ int endResiduePos = allGapped ? 0 : selected.findPosition(lastUngappedPos);
for (AlignedCodonFrame acf : codonFrames)
{
{
continue;
}
+ mappedGroup.addSequence(seq, false);
+ if (allGapped)
+ {
+ /*
+ * sequence is mapped but includes no mapped residues
+ */
+ continue;
+ }
int mappedStartResidue = 0;
int mappedEndResidue = 0;
List<AlignedCodonFrame> mapping = Arrays.asList(acf);
int mappedEndCol = seq.findIndex(mappedEndResidue) - 1;
maxEndCol = maxEndCol == -1 ? mappedEndCol
: Math.max(maxEndCol, mappedEndCol);
- mappedGroup.addSequence(seq, false);
- break;
}
}
}