2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.datamodel;
28 public interface SequenceI
31 * Set the display name for the sequence
35 public void setName(String name);
38 * Get the display name
40 public String getName();
43 * Set start position of first non-gapped symbol in sequence
48 public void setStart(int start);
51 * get start position of first non-gapped residue in sequence
55 public int getStart();
58 * get the displayed id of the sequence
60 * @return true means the id will be returned in the form
61 * DisplayName/Start-End
63 public String getDisplayId(boolean jvsuffix);
66 * set end position for last residue in sequence
70 public void setEnd(int end);
73 * get end position for last residue in sequence getEnd()>getStart() unless
74 * sequence only consists of gap characters
81 * @return length of sequence including gaps
84 public int getLength();
87 * Replace the sequence with the given string
92 public void setSequence(String sequence);
95 * @return sequence as string
97 public String getSequenceAsString();
100 * get a range on the seuqence as a string
107 * @return DOCUMENT ME!
109 public String getSequenceAsString(int start, int end);
114 * @return DOCUMENT ME!
116 public char[] getSequence();
119 * get stretch of sequence characters in an array
122 * absolute index into getSequence()
124 * exclusive index of last position in segment to be returned.
126 * @return char[max(0,end-start)];
128 public char[] getSequence(int start, int end);
131 * create a new sequence object from start to end of this sequence
139 public SequenceI getSubSequence(int start, int end);
147 * @return DOCUMENT ME!
149 public char getCharAt(int i);
157 public void setDescription(String desc);
162 * @return DOCUMENT ME!
164 public String getDescription();
172 * @return DOCUMENT ME!
174 public int findIndex(int pos);
177 * Returns the sequence position for an alignment position
180 * column index in alignment (from 1)
182 * @return residue number for residue (left of and) nearest ith column
184 public int findPosition(int i);
187 * Returns an int array where indices correspond to each residue in the
188 * sequence and the element value gives its position in the alignment
190 * @return int[SequenceI.getEnd()-SequenceI.getStart()+1] or null if no
191 * residues in SequenceI object
193 public int[] gapMap();
196 * Returns an int array where indices correspond to each position in sequence
197 * char array and the element value gives the result of findPosition for that
198 * index in the sequence.
200 * @return int[SequenceI.getLength()]
202 public int[] findPositionMap();
205 * Delete a range of aligned sequence columns, creating a new dataset sequence
206 * if necessary and adjusting start and end positions accordingly.
209 * first column in range to delete
211 * last column in range to delete
213 public void deleteChars(int i, int j);
223 public void insertCharAt(int i, char c);
233 public void insertCharAt(int i, int length, char c);
238 * @return DOCUMENT ME!
240 public SequenceFeature[] getSequenceFeatures();
248 public void setSequenceFeatures(SequenceFeature[] features);
256 public void setPDBId(Vector ids);
261 * @return DOCUMENT ME!
263 public Vector getPDBId();
266 * add entry to the vector of PDBIds, if it isn't in the list already
270 public void addPDBId(PDBEntry entry);
273 * update the list of PDBEntrys to include any DBRefEntrys citing structural
276 * @return true if PDBEntry list was modified
278 public boolean updatePDBIds();
280 public String getVamsasId();
282 public void setVamsasId(String id);
284 public void setDBRef(DBRefEntry[] dbs);
286 public DBRefEntry[] getDBRef();
289 * add the given entry to the list of DBRefs for this sequence, or replace a
290 * similar one if entry contains a map object and the existing one doesnt.
294 public void addDBRef(DBRefEntry entry);
296 public void addSequenceFeature(SequenceFeature sf);
298 public void deleteFeature(SequenceFeature sf);
300 public void setDatasetSequence(SequenceI seq);
302 public SequenceI getDatasetSequence();
304 public AlignmentAnnotation[] getAnnotation();
306 public void addAlignmentAnnotation(AlignmentAnnotation annotation);
308 public void removeAlignmentAnnotation(AlignmentAnnotation annotation);
311 * Derive a sequence (using this one's dataset or as the dataset)
313 * @return duplicate sequence with valid dataset sequence
315 public SequenceI deriveSequence();
318 * set the array of associated AlignmentAnnotation for this sequenceI
322 public void setAlignmentAnnotation(AlignmentAnnotation[] annotation);
325 * Get one or more alignment annotations with a particular label.
328 * string which each returned annotation must have as a label.
329 * @return null or array of annotations.
331 public AlignmentAnnotation[] getAnnotation(String label);
334 * create a new dataset sequence (if necessary) for this sequence and sets
335 * this sequence to refer to it. This call will move any features or
336 * references on the sequence onto the dataset.
338 * @return dataset sequence for this sequence
340 public SequenceI createDatasetSequence();
343 * Transfer any database references or annotation from entry under a sequence
348 * null or mapping from entry's numbering to local start/end
350 public void transferAnnotation(SequenceI entry, Mapping mp);