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 * Delete a range of aligned sequence columns, creating a new dataset sequence if necessary
178 * and adjusting start and end positions accordingly.
180 * @param i first column in range to delete
181 * @param j last column in range to delete
183 public void deleteChars(int i, int j);
188 * @param i DOCUMENT ME!
189 * @param c DOCUMENT ME!
191 public void insertCharAt(int i, char c);
196 * @param i DOCUMENT ME!
197 * @param c DOCUMENT ME!
199 public void insertCharAt(int i, int length, char c);
204 * @return DOCUMENT ME!
206 public SequenceFeature[] getSequenceFeatures();
211 * @param v DOCUMENT ME!
213 public void setSequenceFeatures(SequenceFeature[] features);
218 * @param id DOCUMENT ME!
220 public void setPDBId(Vector ids);
225 * @return DOCUMENT ME!
227 public Vector getPDBId();
229 public void addPDBId(PDBEntry entry);
231 * update the list of PDBEntrys to include any DBRefEntrys citing structural databases
232 * @return true if PDBEntry list was modified
234 public boolean updatePDBIds();
236 public String getVamsasId();
238 public void setVamsasId(String id);
240 public void setDBRef(DBRefEntry[] dbs);
242 public DBRefEntry[] getDBRef();
245 * add the given entry to the list of DBRefs for this sequence,
246 * or replace a similar one if entry contains a map object
247 * and the existing one doesnt.
250 public void addDBRef(DBRefEntry entry);
252 public void addSequenceFeature(SequenceFeature sf);
254 public void deleteFeature(SequenceFeature sf);
256 public void setDatasetSequence(SequenceI seq);
258 public SequenceI getDatasetSequence();
260 public AlignmentAnnotation[] getAnnotation();
262 public void addAlignmentAnnotation(AlignmentAnnotation annotation);
264 public void removeAlignmentAnnotation(AlignmentAnnotation annotation);
267 * Derive a sequence (using this one's dataset or as the dataset)
268 * @return duplicate sequence with valid dataset sequence
270 public SequenceI deriveSequence();
272 * set the array of associated AlignmentAnnotation for this sequenceI
275 public void setAlignmentAnnotation(AlignmentAnnotation[] annotation);
277 * Get one or more alignment annotations with a particular label.
278 * @param label string which each returned annotation must have as a label.
279 * @return null or array of annotations.
281 public AlignmentAnnotation[] getAnnotation(String label);
283 * create a new dataset sequence (if necessary)
284 * for this sequence and sets this sequence to refer to it.
285 * This call will move any features or references on the sequence onto the dataset.
286 * @return dataset sequence for this sequence
288 public SequenceI createDatasetSequence();