1 package jalview.commands;
\r
4 * Jalview - A Sequence Alignment Editor and Viewer
\r
5 * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
7 * This program is free software; you can redistribute it and/or
\r
8 * modify it under the terms of the GNU General Public License
\r
9 * as published by the Free Software Foundation; either version 2
\r
10 * of the License, or (at your option) any later version.
\r
12 * This program is distributed in the hope that it will be useful,
\r
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 * GNU General Public License for more details.
\r
17 * You should have received a copy of the GNU General Public License
\r
18 * along with this program; if not, write to the Free Software
\r
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
22 import jalview.datamodel.*;
\r
24 public class RemoveGapColCommand
\r
28 public RemoveGapColCommand(String description,
\r
30 int start, int end, AlignmentI al)
\r
32 this.description = description;
\r
34 int j, jSize = seqs.length;
\r
36 int startCol = -1, endCol = -1;
\r
39 edits = new Edit[0];
\r
41 boolean delete = true;
\r
42 for (int i = start; i <= end; i++)
\r
46 for (j = 0; j < jSize; j++)
\r
48 if (seqs[j].getLength() > i)
\r
50 if (!jalview.util.Comparison.isGap(seqs[j].getCharAt(i)))
\r
63 if (delete && startCol == -1)
\r
68 if (!delete && startCol > -1)
\r
70 this.appendEdit(DELETE_GAP, seqs,
\r
71 startCol - columnsDeleted,
\r
76 columnsDeleted += (endCol - startCol);
\r
82 if (delete && startCol > -1)
\r
84 //This is for empty columns at the
\r
85 //end of the alignment
\r
87 this.appendEdit(DELETE_GAP, seqs,
\r
88 startCol - columnsDeleted,
\r
93 columnsDeleted += (end - startCol + 1);
\r
99 public int getSize()
\r
101 //We're interested in the number of columns deleted,
\r
102 //Not the number of sequence edits.
\r
103 return columnsDeleted;
\r