2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 package jalview.datamodel;
21 import jalview.util.ShiftList;
26 /** Data structure to hold and manipulate a multiple sequence alignment
28 public interface AlignmentI
31 * Calculates the number of sequences in an alignment
33 * @return Number of sequences in alignment
35 public int getHeight();
38 * Calculates the maximum width of the alignment, including gaps.
40 * @return Greatest sequence length within alignment.
42 public int getWidth();
45 * Calculates the longest sequence Id of the alignment
47 * @return Number of characters in longest sequence Id.
49 public int getMaxIdLength();
52 * Calculates if this set of sequences is all the same length
54 * @return true if all sequences in alignment are the same length
56 public boolean isAligned();
59 * Gets sequences as a Vector
61 * @return All sequences in alignment.
63 public Vector getSequences();
66 * Gets sequences as a SequenceI[]
68 * @return All sequences in alignment.
70 public SequenceI [] getSequencesArray();
73 * Find a specific sequence in this alignment.
75 * @param i Index of required sequence.
77 * @return SequenceI at given index.
79 public SequenceI getSequenceAt(int i);
82 * Add a new sequence to this alignment.
84 * @param seq New sequence will be added at end of alignment.
86 public void addSequence(SequenceI seq);
89 * Used to set a particular index of the alignment with the given sequence.
91 * @param i Index of sequence to be updated.
92 * @param seq New sequence to be inserted.
94 public void setSequenceAt(int i, SequenceI seq);
97 * Deletes a sequence from the alignment.
99 * @param s Sequence to be deleted.
101 public void deleteSequence(SequenceI s);
104 * Deletes a sequence from the alignment.
106 * @param i Index of sequence to be deleted.
108 public void deleteSequence(int i);
111 * Deletes all residues in every sequence of alignment within given columns.
113 * @param start Start index of columns to delete.
114 * @param end End index to columns to delete.
116 public void deleteColumns(SequenceI seqs [], int start, int end);
120 * Finds sequence in alignment using sequence name as query.
122 * @param name Id of sequence to search for.
124 * @return Sequence matching query, if found. If not found returns null.
126 public SequenceI findName(String name);
128 public SequenceI [] findSequenceMatch(String name);
131 * Finds index of a given sequence in the alignment.
133 * @param s Sequence to look for.
135 * @return Index of sequence within the alignment.
137 public int findIndex(SequenceI s);
140 * All sequences will be cut from beginning to given index.
142 * @param i Remove all residues in sequences up to this column.
144 public void trimLeft(int i);
147 * All sequences will be cut from given index.
149 * @param i Remove all residues in sequences beyond this column.
151 public void trimRight(int i);
154 * Removes all columns containing entirely gap characters.
156 public void removeGaps();
158 * remove gaps in alignment - recording any frame shifts in shiftrecord
161 public void removeGaps(ShiftList shiftrecord);
164 * Finds group that given sequence is part of.
166 * @param s Sequence in alignment.
168 * @return First group found for sequence. WARNING :
169 * Sequences may be members of several groups. This method is incomplete.
171 public SequenceGroup findGroup(SequenceI s);
174 * Finds all groups that a given sequence is part of.
176 * @param s Sequence in alignment.
178 * @return All groups containing given sequence.
180 public SequenceGroup[] findAllGroups(SequenceI s);
183 * Adds a new SequenceGroup to this alignment.
185 * @param sg New group to be added.
187 public void addGroup(SequenceGroup sg);
190 * Deletes a specific SequenceGroup
192 * @param g Group will be deleted from alignment.
194 public void deleteGroup(SequenceGroup g);
197 * Get all the groups associated with this alignment.
199 * @return All groups as a Vector.
201 public Vector getGroups();
204 * Deletes all groups from this alignment.
206 public void deleteAllGroups();
210 * Adds a new AlignmentAnnotation to this alignment
212 public void addAnnotation(AlignmentAnnotation aa);
215 public void setAnnotationIndex(AlignmentAnnotation aa, int index);
218 * Deletes a specific AlignmentAnnotation from the alignment.
220 * @param aa DOCUMENT ME!
222 public void deleteAnnotation(AlignmentAnnotation aa);
227 * @return DOCUMENT ME!
229 public AlignmentAnnotation[] getAlignmentAnnotation();
234 * @param gc DOCUMENT ME!
236 public void setGapCharacter(char gc);
241 * @return DOCUMENT ME!
243 public char getGapCharacter();
247 * Returns true if alignment is nucleotide sequence
249 * @return DOCUMENT ME!
251 public boolean isNucleotide();
254 * Set true if the alignment is a nucleotide sequence
258 public void setNucleotide(boolean b);
261 public Alignment getDataset();
263 public void setDataset(Alignment dataset);
265 * pads sequences with gaps (to ensure the set looks like an alignment)
266 * @return boolean true if alignment was modified
268 public boolean padGaps();
270 public void adjustSequenceAnnotations();
272 public HiddenSequences getHiddenSequences();
274 * Compact representation of alignment
277 public CigarArray getCompactAlignment();