2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2007 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;
29 public interface SequenceI
32 * Set the display name for the sequence
36 public void setName(String name);
39 * Get the display name
41 public String getName();
44 * Set start position of first non-gapped symbol in sequence
46 * @param start new start position
48 public void setStart(int start);
51 * get start position of first non-gapped residue in sequence
54 public int getStart();
57 * get the displayed id of the sequence
58 * @return true means the id will be returned in the form DisplayName/Start-End
60 public String getDisplayId(boolean jvsuffix);
63 * set end position for last residue in sequence
66 public void setEnd(int end);
69 * get end position for last residue in sequence
70 * getEnd()>getStart() unless sequence only consists of gap characters
77 * @return length of sequence including gaps
80 public int getLength();
83 * Replace the sequence with the given string
85 * @param sequence new sequence string
87 public void setSequence(String sequence);
90 * @return sequence as string
92 public String getSequenceAsString();
95 * get a range on the seuqence as a string
96 * @param start DOCUMENT ME!
97 * @param end DOCUMENT ME!
99 * @return DOCUMENT ME!
101 public String getSequenceAsString(int start, int end);
106 * @return DOCUMENT ME!
108 public char[] getSequence();
111 * get stretch of sequence characters in an array
113 * @param start absolute index into getSequence()
114 * @param end exclusive index of last position in segment to be returned.
116 * @return char[max(0,end-start)];
118 public char[] getSequence(int start, int end);
121 * create a new sequence object from start to end of this sequence
126 public SequenceI getSubSequence(int start, int end);
131 * @param i DOCUMENT ME!
133 * @return DOCUMENT ME!
135 public char getCharAt(int i);
140 * @param desc DOCUMENT ME!
142 public void setDescription(String desc);
147 * @return DOCUMENT ME!
149 public String getDescription();
154 * @param pos DOCUMENT ME!
156 * @return DOCUMENT ME!
158 public int findIndex(int pos);
161 * Returns the sequence position for an alignment position
163 * @param i column index in alignment (from 1)
165 * @return residue number for residue (left of and) nearest ith column
167 public int findPosition(int i);
170 * Returns an int array where indices correspond to each residue in the sequence and the element value gives its position in the alignment
172 * @return int[SequenceI.getEnd()-SequenceI.getStart()+1] or null if no residues in SequenceI object
174 public int[] gapMap();
177 * Returns an int array where indices correspond to each position in
178 * sequence char array and the element value gives the result of findPosition
179 * for that index in the sequence.
181 * @return int[SequenceI.getLength()]
183 public int[] findPositionMap();
185 * Delete a range of aligned sequence columns, creating a new dataset sequence if necessary
186 * and adjusting start and end positions accordingly.
188 * @param i first column in range to delete
189 * @param j last column in range to delete
191 public void deleteChars(int i, int j);
196 * @param i DOCUMENT ME!
197 * @param c DOCUMENT ME!
199 public void insertCharAt(int i, char c);
204 * @param i DOCUMENT ME!
205 * @param c DOCUMENT ME!
207 public void insertCharAt(int i, int length, char c);
212 * @return DOCUMENT ME!
214 public SequenceFeature[] getSequenceFeatures();
219 * @param v DOCUMENT ME!
221 public void setSequenceFeatures(SequenceFeature[] features);
226 * @param id DOCUMENT ME!
228 public void setPDBId(Vector ids);
233 * @return DOCUMENT ME!
235 public Vector getPDBId();
238 * add entry to the vector of PDBIds, if it isn't in the list already
241 public void addPDBId(PDBEntry entry);
243 * update the list of PDBEntrys to include any DBRefEntrys citing structural databases
244 * @return true if PDBEntry list was modified
246 public boolean updatePDBIds();
248 public String getVamsasId();
250 public void setVamsasId(String id);
252 public void setDBRef(DBRefEntry[] dbs);
254 public DBRefEntry[] getDBRef();
257 * add the given entry to the list of DBRefs for this sequence,
258 * or replace a similar one if entry contains a map object
259 * and the existing one doesnt.
262 public void addDBRef(DBRefEntry entry);
264 public void addSequenceFeature(SequenceFeature sf);
266 public void deleteFeature(SequenceFeature sf);
268 public void setDatasetSequence(SequenceI seq);
270 public SequenceI getDatasetSequence();
272 public AlignmentAnnotation[] getAnnotation();
274 public void addAlignmentAnnotation(AlignmentAnnotation annotation);
276 public void removeAlignmentAnnotation(AlignmentAnnotation annotation);
279 * Derive a sequence (using this one's dataset or as the dataset)
280 * @return duplicate sequence with valid dataset sequence
282 public SequenceI deriveSequence();
284 * set the array of associated AlignmentAnnotation for this sequenceI
287 public void setAlignmentAnnotation(AlignmentAnnotation[] annotation);
289 * Get one or more alignment annotations with a particular label.
290 * @param label string which each returned annotation must have as a label.
291 * @return null or array of annotations.
293 public AlignmentAnnotation[] getAnnotation(String label);
295 * create a new dataset sequence (if necessary)
296 * for this sequence and sets this sequence to refer to it.
297 * This call will move any features or references on the sequence onto the dataset.
298 * @return dataset sequence for this sequence
300 public SequenceI createDatasetSequence();
303 * Transfer any database references or annotation from entry
304 * under a sequence mapping.
306 * @param mp null or mapping from entry's numbering to local start/end
308 public void transferAnnotation(SequenceI entry, Mapping mp);