create dataset sequence method
[jalview.git] / src / jalview / datamodel / SequenceI.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 /**
24  * DOCUMENT ME!
25  *
26  * @author $author$
27  * @version $Revision$
28  */
29 public interface SequenceI
30 {
31   /**
32    * DOCUMENT ME!
33    *
34    * @param name DOCUMENT ME!
35    */
36   public void setName(String name);
37
38   /**
39    * DOCUMENT ME!
40    *
41    * @return DOCUMENT ME!
42    */
43   public String getName();
44
45   /**
46    * DOCUMENT ME!
47    *
48    * @param start DOCUMENT ME!
49    */
50   public void setStart(int start);
51
52   /**
53    * DOCUMENT ME!
54    *
55    * @return DOCUMENT ME!
56    */
57   public int getStart();
58
59   /**
60    * DOCUMENT ME!
61    *
62    * @return DOCUMENT ME!
63    */
64   public String getDisplayId(boolean jvsuffix);
65
66   /**
67    * DOCUMENT ME!
68    *
69    * @param end DOCUMENT ME!
70    */
71   public void setEnd(int end);
72
73   /**
74    * DOCUMENT ME!
75    *
76    * @return DOCUMENT ME!
77    */
78   public int getEnd();
79
80   /**
81    * DOCUMENT ME!
82    *
83    * @return DOCUMENT ME!
84    */
85   public int getLength();
86
87   /**
88    * DOCUMENT ME!
89    *
90    * @param sequence DOCUMENT ME!
91    */
92   public void setSequence(String sequence);
93
94   /**
95    * DOCUMENT ME!
96    *
97    * @return DOCUMENT ME!
98    */
99   public String getSequenceAsString();
100
101   /**
102    * DOCUMENT ME!
103    *
104    * @param start DOCUMENT ME!
105    * @param end DOCUMENT ME!
106    *
107    * @return DOCUMENT ME!
108    */
109   public String getSequenceAsString(int start, int end);
110
111   /**
112    * DOCUMENT ME!
113    *
114    * @return DOCUMENT ME!
115    */
116   public char[] getSequence();
117
118   /**
119    * DOCUMENT ME!
120    *
121    * @param start DOCUMENT ME!
122    * @param end DOCUMENT ME!
123    *
124    * @return DOCUMENT ME!
125    */
126   public char[] getSequence(int start, int end);
127
128   /**
129    * create a new sequence object from start to end of this sequence
130    * @param start int
131    * @param end int
132    * @return SequenceI
133    */
134   public SequenceI getSubSequence(int start, int end);
135
136   /**
137    * DOCUMENT ME!
138    *
139    * @param i DOCUMENT ME!
140    *
141    * @return DOCUMENT ME!
142    */
143   public char getCharAt(int i);
144
145   /**
146    * DOCUMENT ME!
147    *
148    * @param desc DOCUMENT ME!
149    */
150   public void setDescription(String desc);
151
152   /**
153    * DOCUMENT ME!
154    *
155    * @return DOCUMENT ME!
156    */
157   public String getDescription();
158
159   /**
160    * DOCUMENT ME!
161    *
162    * @param pos DOCUMENT ME!
163    *
164    * @return DOCUMENT ME!
165    */
166   public int findIndex(int pos);
167
168   /**
169    * Returns the sequence position for an alignment position
170    *
171    * @param i column index in alignment (from 1)
172    *
173    * @return residue number for residue (left of and) nearest ith column
174    */
175   public int findPosition(int i);
176
177   /**
178    * Returns an int array where indices correspond to each residue in the sequence and the element value gives its position in the alignment
179    *
180    * @return int[SequenceI.getEnd()-SequenceI.getStart()+1] or null if no residues in SequenceI object
181    */
182   public int[] gapMap();
183
184   /**
185    * Delete a range of aligned sequence columns, creating a new dataset sequence if necessary
186    * and adjusting start and end positions accordingly.
187    *
188    * @param i first column in range to delete
189    * @param j last column in range to delete
190    */
191   public void deleteChars(int i, int j);
192
193   /**
194    * DOCUMENT ME!
195    *
196    * @param i DOCUMENT ME!
197    * @param c DOCUMENT ME!
198    */
199   public void insertCharAt(int i, char c);
200
201   /**
202    * DOCUMENT ME!
203    *
204    * @param i DOCUMENT ME!
205    * @param c DOCUMENT ME!
206    */
207   public void insertCharAt(int i, int length, char c);
208
209   /**
210    * DOCUMENT ME!
211    *
212    * @return DOCUMENT ME!
213    */
214   public SequenceFeature[] getSequenceFeatures();
215
216   /**
217    * DOCUMENT ME!
218    *
219    * @param v DOCUMENT ME!
220    */
221   public void setSequenceFeatures(SequenceFeature[] features);
222
223   /**
224    * DOCUMENT ME!
225    *
226    * @param id DOCUMENT ME!
227    */
228   public void setPDBId(Vector ids);
229
230   /**
231    * DOCUMENT ME!
232    *
233    * @return DOCUMENT ME!
234    */
235   public Vector getPDBId();
236
237   public void addPDBId(PDBEntry entry);
238
239   public String getVamsasId();
240
241   public void setVamsasId(String id);
242
243   public void setDBRef(DBRefEntry[] dbs);
244
245   public DBRefEntry[] getDBRef();
246
247   /**
248    * add the given entry to the list of DBRefs for this sequence, 
249    * or replace a similar one if entry contains a map object 
250    * and the existing one doesnt. 
251    * @param entry
252    */
253   public void addDBRef(DBRefEntry entry);
254
255   public void addSequenceFeature(SequenceFeature sf);
256
257   public void deleteFeature(SequenceFeature sf);
258
259   public void setDatasetSequence(SequenceI seq);
260
261   public SequenceI getDatasetSequence();
262
263   public AlignmentAnnotation[] getAnnotation();
264
265   public void addAlignmentAnnotation(AlignmentAnnotation annotation);
266
267   public void removeAlignmentAnnotation(AlignmentAnnotation annotation);
268
269   /**
270    * Derive a sequence (using this one's dataset or as the dataset)
271    * @return duplicate sequence with valid dataset sequence
272    */
273   public SequenceI deriveSequence();
274   /**
275    * set the array of associated AlignmentAnnotation for this sequenceI
276    * @param revealed
277    */
278   public void setAlignmentAnnotation(AlignmentAnnotation[] annotation);
279   /**
280    * Get one or more alignment annotations with a particular label.  
281    * @param label string which each returned annotation must have as a label.
282    * @return null or array of annotations.
283    */
284   public AlignmentAnnotation[] getAnnotation(String label);
285   /**
286    * create a new dataset sequence (if necessary) 
287    * for this sequence and sets this sequence to refer to it.
288    * This call will move any features or references on the sequence onto the dataset.
289    * @return dataset sequence for this sequence
290    */
291   public SequenceI createDatasetSequence();
292
293 }