/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)\r
- * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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
* \r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
+ * This file is part of Jalview.\r
* \r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
+ * Jalview is free software: you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License \r
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
* \r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ * Jalview is distributed in the hope that it will be useful, but \r
+ * WITHOUT ANY WARRANTY; without even the implied warranty \r
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
+ * PURPOSE. See the GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
package jalview.datamodel;\r
\r
* regions\r
* \r
* @param gapCharacter\r
- * char\r
+ * char\r
* @return Object[] { SequenceI[], ColumnSelection}\r
*/\r
public Object[] getAlignmentAndColumnSelection(char gapCharacter)\r
* getSequenceStrings\r
* \r
* @param c\r
- * char\r
+ * char\r
* @return String[]\r
*/\r
public String[] getSequenceStrings(char c)\r
* get the contiguous subalignments in an alignment view.\r
* \r
* @param gapCharacter\r
- * char\r
+ * char\r
* @return SequenceI[][]\r
*/\r
public SequenceI[][] getVisibleContigs(char gapCharacter)\r
njobs++;\r
}\r
fwidth += contigs[contig + 2]; // end up with full region width\r
- // (including hidden regions)\r
+ // (including hidden regions)\r
start = contigs[contig + 1] + contigs[contig + 2];\r
}\r
if (start < fwidth)\r
* sub alignments\r
* \r
* @param nvismsa\r
- * SequenceI[][]\r
+ * SequenceI[][]\r
* @param orders\r
- * AlignmentOrder[] corresponding to each SequenceI[] block.\r
+ * AlignmentOrder[] corresponding to each SequenceI[] block.\r
* @return Object[]\r
*/\r
public Object[] getUpdatedView(SequenceI[][] nvismsa,\r
+ sequences.length + ")");\r
}\r
swidth = mseq[0].getLength(); // JBPNote: could ensure padded\r
- // here.\r
+ // here.\r
for (int s = 0; s < mseq.length; s++)\r
{\r
if (alignment[s] == null)\r
nvis++;\r
}\r
fwidth += contigs[contig + 2]; // end up with full region width\r
- // (including hidden regions)\r
+ // (including hidden regions)\r
start = contigs[contig + 1] + contigs[contig + 2];\r
}\r
if (start < fwidth)\r
// TODO Auto-generated method stub\r
return firstCol;\r
}\r
+\r
+ /**\r
+ * compute a deletion map for the current view according to the given\r
+ * gap/match map\r
+ * \r
+ * @param gapMap (as returned from SequenceI.gapMap())\r
+ * @return int[] {intersection of visible regions with gapMap)\r
+ */\r
+ public int[] getVisibleContigMapFor(int[] gapMap)\r
+ {\r
+ int[] delMap = null;\r
+ int[] viscontigs = getVisibleContigs();\r
+ int spos = 0;\r
+ int i = 0;\r
+ if (viscontigs != null)\r
+ {\r
+ // viscontigs maps from a subset of the gapMap to the gapMap, so it will\r
+ // always be equal to or shorter than gapMap\r
+ delMap = new int[gapMap.length];\r
+ for (int contig = 0; contig < viscontigs.length; contig += 2)\r
+ {\r
+\r
+ while (spos < gapMap.length && gapMap[spos] < viscontigs[contig])\r
+ {\r
+ spos++;\r
+ }\r
+ while (spos < gapMap.length\r
+ && gapMap[spos] <= viscontigs[contig + 1])\r
+ {\r
+ delMap[i++] = spos++;\r
+ }\r
+ }\r
+ int tmap[] = new int[i];\r
+ System.arraycopy(delMap, 0, tmap, 0, i);\r
+ delMap = tmap;\r
+ }\r
+ return delMap;\r
+ }\r
}\r