}\r
\r
/**\r
- * DOCUMENT ME!\r
+ * Column number at position i in selection\r
*\r
- * @param i DOCUMENT ME!\r
+ * @param i index into selected columns\r
*\r
- * @return DOCUMENT ME!\r
+ * @return column number in alignment\r
*/\r
public int columnAt(int i)\r
{\r
}\r
\r
/**\r
- * DOCUMENT ME!\r
+ * rightmost selected column\r
*\r
- * @return DOCUMENT ME!\r
+ * @return rightmost column in alignment that is selected\r
*/\r
public int getMax()\r
{\r
}\r
\r
/**\r
- * DOCUMENT ME!\r
+ * Leftmost column in selection\r
*\r
- * @return DOCUMENT ME!\r
+ * @return column index of leftmost column in selection\r
*/\r
public int getMin()\r
{\r
start, end - 1};\r
}\r
}\r
+\r
+ /**\r
+ * delete any columns in alignmentAnnotation that are hidden (including sequence associated annotation).\r
+ * @param alignmentAnnotation\r
+ */\r
+ public void makeVisibleAnnotation(AlignmentAnnotation alignmentAnnotation)\r
+ {\r
+ makeVisibleAnnotation(-1,-1,alignmentAnnotation);\r
+ }\r
+ /**\r
+ * delete any columns in alignmentAnnotation that are hidden (including sequence associated annotation).\r
+ * @param start remove any annotation to the right of this column\r
+ * @param end remove any annotation to the left of this column\r
+ * @param alignmentAnnotation the annotation to operate on\r
+ */\r
+ public void makeVisibleAnnotation(int start, int end, AlignmentAnnotation alignmentAnnotation)\r
+ {\r
+ if (alignmentAnnotation.annotations==null)\r
+ {\r
+ return;\r
+ }\r
+ if (start==end && end==-1)\r
+ {\r
+ start = 0;\r
+ end = alignmentAnnotation.annotations.length;\r
+ }\r
+ if (hiddenColumns != null && hiddenColumns.size() > 0)\r
+ {\r
+ // then mangle the alignmentAnnotation annotation array\r
+ Vector annels = new Vector();\r
+ Annotation[] els = null;\r
+ Vector regions = getHiddenColumns();\r
+ int blockStart = start, blockEnd = end;\r
+ int[] region;\r
+ int hideStart, hideEnd,w=0;\r
+\r
+ for (int j = 0; j < regions.size(); j++)\r
+ {\r
+ region = (int[]) regions.elementAt(j);\r
+ hideStart = region[0];\r
+ hideEnd = region[1];\r
+\r
+ if (hideStart < start)\r
+ {\r
+ continue;\r
+ }\r
+\r
+ blockStart = Math.min(blockStart, hideEnd + 1);\r
+ blockEnd = Math.min(blockEnd, hideStart);\r
+\r
+ if (blockStart > blockEnd)\r
+ {\r
+ break;\r
+ }\r
+\r
+ annels.addElement(els = new Annotation[blockEnd-blockStart]);\r
+ System.arraycopy(alignmentAnnotation.annotations, blockStart, els, 0, els.length);\r
+ w+=els.length;\r
+ blockStart = hideEnd + 1;\r
+ blockEnd = end;\r
+ }\r
+\r
+ if (end > blockStart)\r
+ {\r
+ annels.addElement(els = new Annotation[end-blockStart]);\r
+ System.arraycopy(alignmentAnnotation.annotations, blockStart, els, 0, els.length);\r
+ w+=els.length;\r
+ }\r
+ if (w==0)\r
+ return;\r
+ Enumeration e = annels.elements();\r
+ alignmentAnnotation.annotations = new Annotation[w];\r
+ w=0;\r
+ while (e.hasMoreElements())\r
+ {\r
+ Annotation[] chnk = (Annotation[]) e.nextElement();\r
+ System.arraycopy(chnk, 0, alignmentAnnotation.annotations, w, chnk.length);\r
+ w+=chnk.length;\r
+ }\r
+ }\r
+ }\r
}\r