/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)\r
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
* AlignmentView\r
* \r
* @param profileseq\r
- * @param al - alignment to have gaps inserted into it\r
- * @param input - alignment view where sequence corresponding to profileseq is first entry\r
- * @return new Column selection for new alignment view, with insertions into profileseq marked as hidden.\r
+ * @param al\r
+ * - alignment to have gaps inserted into it\r
+ * @param input\r
+ * - alignment view where sequence corresponding to profileseq is\r
+ * first entry\r
+ * @return new Column selection for new alignment view, with insertions into\r
+ * profileseq marked as hidden.\r
*/\r
public static ColumnSelection propagateInsertions(SequenceI profileseq,\r
Alignment al, AlignmentView input)\r
{\r
- int profsqpos=0;\r
- \r
-// return propagateInsertions(profileseq, al, )\r
+ int profsqpos = 0;\r
+\r
+ // return propagateInsertions(profileseq, al, )\r
char gc = al.getGapCharacter();\r
Object[] alandcolsel = input.getAlignmentAndColumnSelection(gc);\r
ColumnSelection nview = (ColumnSelection) alandcolsel[1];\r
SequenceI origseq = ((SequenceI[]) alandcolsel[0])[profsqpos];\r
- nview.propagateInsertions(profileseq,\r
- al, origseq);\r
+ nview.propagateInsertions(profileseq, al, origseq);\r
return nview;\r
}\r
+\r
/**\r
* \r
- * @param profileseq - sequence in al which corresponds to origseq \r
- * @param al - alignment which is to have gaps inserted into it\r
- * @param origseq - sequence corresponding to profileseq which defines gap map for modifying al\r
+ * @param profileseq\r
+ * - sequence in al which corresponds to origseq\r
+ * @param al\r
+ * - alignment which is to have gaps inserted into it\r
+ * @param origseq\r
+ * - sequence corresponding to profileseq which defines gap map for\r
+ * modifying al\r
*/\r
- public void propagateInsertions(SequenceI profileseq, AlignmentI al, SequenceI origseq)\r
+ public void propagateInsertions(SequenceI profileseq, AlignmentI al,\r
+ SequenceI origseq)\r
{\r
char gc = al.getGapCharacter();\r
- // recover mapping between sequence's non-gap positions and positions \r
+ // recover mapping between sequence's non-gap positions and positions\r
// mapping to view.\r
- pruneDeletions(ShiftList\r
- .parseMap(origseq\r
- .gapMap())); \r
+ pruneDeletions(ShiftList.parseMap(origseq.gapMap()));\r
int[] viscontigs = getVisibleContigs(0, profileseq.getLength());\r
int spos = 0;\r
int offset = 0;\r
sq = sq + sb;\r
while ((diff = spos + offset - sq.length() - 1) > 0)\r
{\r
- //sq = sq\r
- // + ((diff >= sb.length()) ? sb.toString() : sb\r
- // .substring(0, diff));\r
- if (diff>=sb.length()) {\r
- sq+=sb.toString();\r
- } else {\r
+ // sq = sq\r
+ // + ((diff >= sb.length()) ? sb.toString() : sb\r
+ // .substring(0, diff));\r
+ if (diff >= sb.length())\r
+ {\r
+ sq += sb.toString();\r
+ }\r
+ else\r
+ {\r
char[] buf = new char[diff];\r
sb.getChars(0, diff, buf, 0);\r
- sq+=buf.toString();\r
+ sq += buf.toString();\r
}\r
}\r
}\r
for (int s = 0, ns = al.getHeight(); s < ns; s++)\r
{\r
SequenceI sqobj = al.getSequenceAt(s);\r
- if (sqobj==profileseq)\r
+ if (sqobj == profileseq)\r
{\r
continue;\r
}\r
int diff = origseq.getLength() - sq.length();\r
while (diff > 0)\r
{\r
- //sq = sq\r
- // + ((diff >= sb.length()) ? sb.toString() : sb\r
- // .substring(0, diff));\r
- if (diff>=sb.length()) {\r
- sq+=sb.toString();\r
- } else {\r
+ // sq = sq\r
+ // + ((diff >= sb.length()) ? sb.toString() : sb\r
+ // .substring(0, diff));\r
+ if (diff >= sb.length())\r
+ {\r
+ sq += sb.toString();\r
+ }\r
+ else\r
+ {\r
char[] buf = new char[diff];\r
sb.getChars(0, diff, buf, 0);\r
- sq+=buf.toString();\r
+ sq += buf.toString();\r
}\r
diff = origseq.getLength() - sq.length();\r
}\r