2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
19 package jalview.datamodel;
\r
24 /** Data structure to hold and manipulate a multiple sequence alignment
\r
26 public interface AlignmentI
\r
29 * Calculates the number of sequences in an alignment
\r
31 * @return Number of sequences in alignment
\r
33 public int getHeight();
\r
36 * Calculates the maximum width of the alignment, including gaps.
\r
38 * @return Greatest sequence length within alignment.
\r
40 public int getWidth();
\r
43 * Calculates the longest sequence Id of the alignment
\r
45 * @return Number of characters in longest sequence Id.
\r
47 public int getMaxIdLength();
\r
50 * Calculates if this set of sequences is all the same length
\r
52 * @return true if all sequences in alignment are the same length
\r
54 public boolean isAligned();
\r
57 * Gets sequences as a Vector
\r
59 * @return All sequences in alignment.
\r
61 public Vector getSequences();
\r
64 * Find a specific sequence in this alignment.
\r
66 * @param i Index of required sequence.
\r
68 * @return SequenceI at given index.
\r
70 public SequenceI getSequenceAt(int i);
\r
73 * Add a new sequence to this alignment.
\r
75 * @param seq New sequence will be added at end of alignment.
\r
77 public void addSequence(SequenceI seq);
\r
80 * Used to set a particular index of the alignment with the given sequence.
\r
82 * @param i Index of sequence to be updated.
\r
83 * @param seq New sequence to be inserted.
\r
85 public void setSequenceAt(int i, SequenceI seq);
\r
88 * Deletes a sequence from the alignment.
\r
90 * @param s Sequence to be deleted.
\r
92 public void deleteSequence(SequenceI s);
\r
95 * Deletes a sequence from the alignment.
\r
97 * @param i Index of sequence to be deleted.
\r
99 public void deleteSequence(int i);
\r
102 * Deletes all residues in every sequence of alignment within given columns.
\r
104 * @param start Start index of columns to delete.
\r
105 * @param end End index to columns to delete.
\r
107 public void deleteColumns(int start, int end);
\r
110 * Deletes all residues in every sequence of alignment within given columns.
\r
112 * @param seq1 Index of first sequence to delete columns from.
\r
113 * @param seq2 Index of last sequence to delete columns from.
\r
114 * @param start Start index of columns to delete.
\r
115 * @param end End index of columns to delete.
\r
117 public void deleteColumns(int seq1, int seq2, int start, int end);
\r
120 * Finds sequence in alignment using sequence name as query.
\r
122 * @param name Id of sequence to search for.
\r
124 * @return Sequence matching query, if found. If not found returns null.
\r
126 public SequenceI findName(String name);
\r
129 * Finds sequence in alignment using full displayId as query.
\r
131 * @param name displayId, ie <em>NAME/25-100</em>
\r
133 * @return Sequence matching query, if found. If not found returns null.
\r
135 public SequenceI findbyDisplayId(String name);
\r
138 * Finds index of a given sequence in the alignment.
\r
140 * @param s Sequence to look for.
\r
142 * @return Index of sequence within the alignment.
\r
144 public int findIndex(SequenceI s);
\r
147 * All sequences will be cut from beginning to given index.
\r
149 * @param i Remove all residues in sequences up to this column.
\r
151 public void trimLeft(int i);
\r
154 * All sequences will be cut from given index.
\r
156 * @param i Remove all residues in sequences beyond this column.
\r
158 public void trimRight(int i);
\r
161 * Removes all columns containing entirely gap characters.
\r
163 public void removeGaps();
\r
166 * Removes redundant sequences from alignment.
\r
168 * @param threshold Remove all sequences above the given threshold.
\r
169 * @param sel Set of sequences which will have redundant sequences removed from.
\r
171 * @return All sequences below redundancy threshold.
\r
173 public Vector removeRedundancy(float threshold, Vector sel);
\r
176 * Finds group that sequence at index i in alignment is part of.
\r
178 * @param i Index in alignment.
\r
180 * @return First group found for sequence at position i. WARNING :
\r
181 * Sequences may be members of several groups. This method is incomplete.
\r
183 public SequenceGroup findGroup(int i);
\r
186 * Finds group that given sequence is part of.
\r
188 * @param s Sequence in alignment.
\r
190 * @return First group found for sequence. WARNING :
\r
191 * Sequences may be members of several groups. This method is incomplete.
\r
193 public SequenceGroup findGroup(SequenceI s);
\r
196 * Finds all groups that a given sequence is part of.
\r
198 * @param s Sequence in alignment.
\r
200 * @return All groups containing given sequence.
\r
202 public SequenceGroup[] findAllGroups(SequenceI s);
\r
205 * Adds a new SequenceGroup to this alignment.
\r
207 * @param sg New group to be added.
\r
209 public void addGroup(SequenceGroup sg);
\r
212 * Deletes a specific SequenceGroup
\r
214 * @param g Group will be deleted from alignment.
\r
216 public void deleteGroup(SequenceGroup g);
\r
219 * Get all the groups associated with this alignment.
\r
221 * @return All groups as a Vector.
\r
223 public Vector getGroups();
\r
226 * Deletes all groups from this alignment.
\r
228 public void deleteAllGroups();
\r
231 * Adds a super group. A SuperGroup is a group of groups.
\r
233 * @param sg Adds a new SuperGroup to alignment
\r
235 public void addSuperGroup(SuperGroup sg);
\r
238 * Removes SuperGroup from alignment.
\r
240 * @param sg This SuperGroup will be deleted from alignment.
\r
242 public void removeSuperGroup(SuperGroup sg);
\r
245 * Finds any SuperGroup that a given SequenceGroup may be part of.
\r
247 * @param sg SequenceGroup to search for.
\r
249 * @return SuperGroup that contains the given SequenceGroup.
\r
251 public SuperGroup getSuperGroup(SequenceGroup sg);
\r
254 * Adds a new AlignmentAnnotation to this alignment
\r
256 public void addAnnotation(AlignmentAnnotation aa);
\r
259 * Deletes a specific AlignmentAnnotation from the alignment.
\r
261 * @param aa DOCUMENT ME!
\r
263 public void deleteAnnotation(AlignmentAnnotation aa);
\r
268 * @return DOCUMENT ME!
\r
270 public AlignmentAnnotation[] getAlignmentAnnotation();
\r
275 * @param gc DOCUMENT ME!
\r
277 public void setGapCharacter(char gc);
\r
282 * @return DOCUMENT ME!
\r
284 public char getGapCharacter();
\r
289 * @return DOCUMENT ME!
\r
291 public Vector getAAFrequency();
\r