Destroy aligment method added
[jalview.git] / src / jalview / datamodel / AlignmentI.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer
3  * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
4  *
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.
9  *
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.
14  *
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
18  */
19 package jalview.datamodel;
20
21 import java.util.*;
22
23 /** Data structure to hold and manipulate a multiple sequence alignment
24  */
25 public interface AlignmentI
26 {
27   /**
28    *  Calculates the number of sequences in an alignment
29    *
30    * @return Number of sequences in alignment
31    */
32   public int getHeight();
33
34   /**
35    * Calculates the maximum width of the alignment, including gaps.
36    *
37    * @return Greatest sequence length within alignment.
38    */
39   public int getWidth();
40
41   /**
42    * Calculates if this set of sequences is all the same length
43    *
44    * @return true if all sequences in alignment are the same length
45    */
46   public boolean isAligned();
47
48   /**
49    * Gets sequences as a Vector
50    *
51    * @return All sequences in alignment.
52    */
53   public Vector getSequences();
54
55   /**
56    * Gets sequences as a SequenceI[]
57    *
58    * @return All sequences in alignment.
59    */
60   public SequenceI[] getSequencesArray();
61
62   /**
63    * Find a specific sequence in this alignment.
64    *
65    * @param i Index of required sequence.
66    *
67    * @return SequenceI at given index.
68    */
69   public SequenceI getSequenceAt(int i);
70
71   /**
72    * Add a new sequence to this alignment.
73    *
74    * @param seq New sequence will be added at end of alignment.
75    */
76   public void addSequence(SequenceI seq);
77
78   /**
79    * Used to set a particular index of the alignment with the given sequence.
80    *
81    * @param i Index of sequence to be updated.
82    * @param seq New sequence to be inserted.
83    */
84   public void setSequenceAt(int i, SequenceI seq);
85
86   /**
87    * Deletes a sequence from the alignment
88    *
89    * @param s Sequence to be deleted.
90    */
91   public void deleteSequence(SequenceI s);
92
93   /**
94    * Deletes a sequence from the alignment.
95    *
96    * @param i Index of sequence to be deleted.
97    */
98   public void deleteSequence(int i);
99
100   /**
101    * Finds sequence in alignment using sequence name as query.
102    *
103    * @param name Id of sequence to search for.
104    *
105    * @return Sequence matching query, if found. If not found returns null.
106    */
107   public SequenceI findName(String name);
108
109   public SequenceI[] findSequenceMatch(String name);
110
111   /**
112    * Finds index of a given sequence in the alignment.
113    *
114    * @param s Sequence to look for.
115    *
116    * @return Index of sequence within the alignment.
117    */
118   public int findIndex(SequenceI s);
119
120   /**
121    * Finds group that given sequence is part of.
122    *
123    * @param s Sequence in alignment.
124    *
125    * @return First group found for sequence. WARNING :
126    * Sequences may be members of several groups. This method is incomplete.
127    */
128   public SequenceGroup findGroup(SequenceI s);
129
130   /**
131    * Finds all groups that a given sequence is part of.
132    *
133    * @param s Sequence in alignment.
134    *
135    * @return All groups containing given sequence.
136    */
137   public SequenceGroup[] findAllGroups(SequenceI s);
138
139   /**
140    * Adds a new SequenceGroup to this alignment.
141    *
142    * @param sg New group to be added.
143    */
144   public void addGroup(SequenceGroup sg);
145
146   /**
147    * Deletes a specific SequenceGroup
148    *
149    * @param g Group will be deleted from alignment.
150    */
151   public void deleteGroup(SequenceGroup g);
152
153   /**
154    * Get all the groups associated with this alignment.
155    *
156    * @return All groups as a Vector.
157    */
158   public Vector getGroups();
159
160   public void destroyAlignment();
161
162   /**
163    * Deletes all groups from this alignment.
164    */
165   public void deleteAllGroups();
166
167   /**
168    * Adds a new AlignmentAnnotation to this alignment
169    */
170   public void addAnnotation(AlignmentAnnotation aa);
171
172   public void setAnnotationIndex(AlignmentAnnotation aa, int index);
173
174   /**
175    * Deletes a specific AlignmentAnnotation from the alignment.
176    *
177    * @param aa DOCUMENT ME!
178    */
179   public void deleteAnnotation(AlignmentAnnotation aa);
180
181   /**
182    * DOCUMENT ME!
183    *
184    * @return DOCUMENT ME!
185    */
186   public AlignmentAnnotation[] getAlignmentAnnotation();
187
188   /**
189    * DOCUMENT ME!
190    *
191    * @param gc DOCUMENT ME!
192    */
193   public void setGapCharacter(char gc);
194
195   /**
196    * DOCUMENT ME!
197    *
198    * @return DOCUMENT ME!
199    */
200   public char getGapCharacter();
201
202   /**
203    * Returns true if alignment is nucleotide sequence
204    *
205    * @return DOCUMENT ME!
206    */
207   public boolean isNucleotide();
208
209   /**
210    * Set true if the alignment is a nucleotide sequence
211    *
212    * @return
213    */
214   public void setNucleotide(boolean b);
215
216   public Alignment getDataset();
217
218   public void setDataset(Alignment dataset);
219
220   /**
221    * pads sequences with gaps (to ensure the set looks like an alignment)
222    * @return boolean true if alignment was modified
223    */
224   public boolean padGaps();
225
226   public HiddenSequences getHiddenSequences();
227
228   /**
229    * Compact representation of alignment
230    * @return CigarArray
231    */
232   public CigarArray getCompactAlignment();
233 }