+ startRes = seqs[i].getStart();
+ endRes = seqs[i].getEnd();
+
+ startIndex = startEnd[0];
+ endIndex = startEnd[1];
+
+ if (startEnd != null)
+ {
+ // get first non-gaped residue start position
+ while (jalview.util.Comparison.isGap(seqs[i]
+ .getCharAt(startIndex)) && startIndex < endIndex)
+ {
+ startIndex++;
+ }
+
+ // get last non-gaped residue end position
+ while (jalview.util.Comparison.isGap(seqs[i].getCharAt(endIndex))
+ && endIndex > startIndex)
+ {
+ endIndex--;
+ }
+
+ startRes = seqs[i].findPosition(startIndex);
+ startRes = seqs[i].getStart() > 1 ? startRes - seqs[i].getStart()
+ : startRes;
+ endRes = seqs[i].findPosition(endIndex) - seqs[i].getStart();
+ }
+