SequenceI [] seqs = new SequenceI[iSize];\r
SequenceI [] inorder = getSequencesInOrder(align);\r
\r
- char ch;\r
- int sres, eres;\r
-\r
for (int i = 0; i < iSize; i++)\r
{\r
SequenceI seq = inorder[i];\r
\r
- //FIND START RES\r
- //Returns residue following index if gap\r
- sres = seq.findPosition(startRes);\r
-\r
- //FIND END RES\r
- //Need to find the residue preceeding index if gap\r
- eres = 0;\r
-\r
- for (int j = 0; j < endRes + 1 && j < seq.getLength(); j++)\r
- {\r
- ch = seq.getCharAt(j);\r
- if (!jalview.util.Comparison.isGap( (ch)))\r
- {\r
- eres++;\r
- }\r
- }\r
-\r
- if (eres > 0)\r
- {\r
- eres += seq.getStart() - 1;\r
- }\r
-\r
seqs[i] = new Sequence(seq.getName(),\r
seq.getSequence(startRes, endRes + 1),\r
- sres,\r
- eres);\r
+ seq.findPosition(startRes),\r
+ findEndRes(seq));\r
+\r
seqs[i].setDescription(seq.getDescription());\r
seqs[i].setDBRef(seq.getDBRef());\r
seqs[i].setSequenceFeatures(seq.getSequenceFeatures());\r
\r
}\r
\r
+ /**\r
+ * If sequence ends in gaps, the end residue can\r
+ * be correctly calculated here\r
+ * @param seq SequenceI\r
+ * @return int\r
+ */\r
+ public int findEndRes(SequenceI seq)\r
+ {\r
+ int eres = 0;\r
+ char ch;\r
+\r
+ for (int j = 0; j < endRes + 1 && j < seq.getLength(); j++)\r
+ {\r
+ ch = seq.getCharAt(j);\r
+ if (!jalview.util.Comparison.isGap( (ch)))\r
+ {\r
+ eres++;\r
+ }\r
+ }\r
+\r
+ if (eres > 0)\r
+ {\r
+ eres += seq.getStart() - 1;\r
+ }\r
+\r
+ return eres;\r
+ }\r
+\r
public Vector getSequences(boolean includeHidden)\r
{\r
if(!includeHidden)\r