2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
3 * Copyright (C) 2008 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
49 public void setStart(int start);
52 * get start position of first non-gapped residue in sequence
56 public int getStart();
59 * get the displayed id of the sequence
61 * @return true means the id will be returned in the form
62 * DisplayName/Start-End
64 public String getDisplayId(boolean jvsuffix);
67 * set end position for last residue in sequence
71 public void setEnd(int end);
74 * get end position for last residue in sequence getEnd()>getStart() unless
75 * sequence only consists of gap characters
82 * @return length of sequence including gaps
85 public int getLength();
88 * Replace the sequence with the given string
93 public void setSequence(String sequence);
96 * @return sequence as string
98 public String getSequenceAsString();
101 * get a range on the seuqence as a string
108 * @return DOCUMENT ME!
110 public String getSequenceAsString(int start, int end);
115 * @return DOCUMENT ME!
117 public char[] getSequence();
120 * get stretch of sequence characters in an array
123 * absolute index into getSequence()
125 * exclusive index of last position in segment to be returned.
127 * @return char[max(0,end-start)];
129 public char[] getSequence(int start, int end);
132 * create a new sequence object from start to end of this sequence
140 public SequenceI getSubSequence(int start, int end);
148 * @return DOCUMENT ME!
150 public char getCharAt(int i);
158 public void setDescription(String desc);
163 * @return DOCUMENT ME!
165 public String getDescription();
173 * @return DOCUMENT ME!
175 public int findIndex(int pos);
178 * Returns the sequence position for an alignment position
181 * column index in alignment (from 1)
183 * @return residue number for residue (left of and) nearest ith column
185 public int findPosition(int i);
188 * Returns an int array where indices correspond to each residue in the
189 * sequence and the element value gives its position in the alignment
191 * @return int[SequenceI.getEnd()-SequenceI.getStart()+1] or null if no
192 * residues in SequenceI object
194 public int[] gapMap();
197 * Returns an int array where indices correspond to each position in sequence
198 * char array and the element value gives the result of findPosition for that
199 * index in the sequence.
201 * @return int[SequenceI.getLength()]
203 public int[] findPositionMap();
206 * Delete a range of aligned sequence columns, creating a new dataset sequence
207 * if necessary and adjusting start and end positions accordingly.
210 * first column in range to delete
212 * last column in range to delete
214 public void deleteChars(int i, int j);
224 public void insertCharAt(int i, char c);
234 public void insertCharAt(int i, int length, char c);
239 * @return DOCUMENT ME!
241 public SequenceFeature[] getSequenceFeatures();
249 public void setSequenceFeatures(SequenceFeature[] features);
257 public void setPDBId(Vector ids);
262 * @return DOCUMENT ME!
264 public Vector getPDBId();
267 * add entry to the vector of PDBIds, if it isn't in the list already
271 public void addPDBId(PDBEntry entry);
274 * update the list of PDBEntrys to include any DBRefEntrys citing structural
277 * @return true if PDBEntry list was modified
279 public boolean updatePDBIds();
281 public String getVamsasId();
283 public void setVamsasId(String id);
285 public void setDBRef(DBRefEntry[] dbs);
287 public DBRefEntry[] getDBRef();
290 * add the given entry to the list of DBRefs for this sequence, or replace a
291 * similar one if entry contains a map object and the existing one doesnt.
295 public void addDBRef(DBRefEntry entry);
297 public void addSequenceFeature(SequenceFeature sf);
299 public void deleteFeature(SequenceFeature sf);
301 public void setDatasetSequence(SequenceI seq);
303 public SequenceI getDatasetSequence();
305 public AlignmentAnnotation[] getAnnotation();
307 public void addAlignmentAnnotation(AlignmentAnnotation annotation);
309 public void removeAlignmentAnnotation(AlignmentAnnotation annotation);
312 * Derive a sequence (using this one's dataset or as the dataset)
314 * @return duplicate sequence with valid dataset sequence
316 public SequenceI deriveSequence();
319 * set the array of associated AlignmentAnnotation for this sequenceI
323 public void setAlignmentAnnotation(AlignmentAnnotation[] annotation);
326 * Get one or more alignment annotations with a particular label.
329 * string which each returned annotation must have as a label.
330 * @return null or array of annotations.
332 public AlignmentAnnotation[] getAnnotation(String label);
335 * create a new dataset sequence (if necessary) for this sequence and sets
336 * this sequence to refer to it. This call will move any features or
337 * references on the sequence onto the dataset.
339 * @return dataset sequence for this sequence
341 public SequenceI createDatasetSequence();
344 * Transfer any database references or annotation from entry under a sequence
349 * null or mapping from entry's numbering to local start/end
351 public void transferAnnotation(SequenceI entry, Mapping mp);