2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
3 * Copyright (C) 2014 The Jalview Authors
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/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.datamodel;
21 import java.util.Vector;
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 sequence as a string
104 * position relative to start of sequence including gaps (from 0)
106 * position relative to start of sequence including gaps (from 0)
108 * @return String containing all gap and symbols in specified range
110 public String getSequenceAsString(int start, int end);
113 * Get the sequence as a character array
115 * @return seqeunce and any gaps
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();
168 * Return the alignment column for a sequence position * Return the alignment
169 * position for a sequence position
172 * lying from start to end
174 * @return aligned column for residue (0 if residue is upstream from
175 * alignment, -1 if residue is downstream from alignment) note.
176 * Sequence object returns sequence.getEnd() for positions upstream
177 * currently. TODO: change sequence for
178 * assert(findIndex(seq.getEnd()+1)==-1) and fix incremental bugs
181 public int findIndex(int pos);
184 * Returns the sequence position for an alignment position
187 * column index in alignment (from 1)
189 * @return residue number for residue (left of and) nearest ith column
191 public int findPosition(int i);
194 * Returns an int array where indices correspond to each residue in the
195 * sequence and the element value gives its position in the alignment
197 * @return int[SequenceI.getEnd()-SequenceI.getStart()+1] or null if no
198 * residues in SequenceI object
200 public int[] gapMap();
203 * Returns an int array where indices correspond to each position in sequence
204 * char array and the element value gives the result of findPosition for that
205 * index in the sequence.
207 * @return int[SequenceI.getLength()]
209 public int[] findPositionMap();
212 * Delete a range of aligned sequence columns, creating a new dataset sequence
213 * if necessary and adjusting start and end positions accordingly.
216 * first column in range to delete
218 * last column in range to delete
220 public void deleteChars(int i, int j);
230 public void insertCharAt(int i, char c);
240 public void insertCharAt(int i, int length, char c);
245 * @return DOCUMENT ME!
247 public SequenceFeature[] getSequenceFeatures();
255 public void setSequenceFeatures(SequenceFeature[] features);
263 public void setPDBId(Vector ids);
268 * @return DOCUMENT ME!
270 public Vector getPDBId();
273 * add entry to the vector of PDBIds, if it isn't in the list already
277 public void addPDBId(PDBEntry entry);
280 * update the list of PDBEntrys to include any DBRefEntrys citing structural
283 * @return true if PDBEntry list was modified
285 public boolean updatePDBIds();
287 public String getVamsasId();
289 public void setVamsasId(String id);
291 public void setDBRef(DBRefEntry[] dbs);
293 public DBRefEntry[] getDBRef();
296 * add the given entry to the list of DBRefs for this sequence, or replace a
297 * similar one if entry contains a map object and the existing one doesnt.
301 public void addDBRef(DBRefEntry entry);
303 public void addSequenceFeature(SequenceFeature sf);
305 public void deleteFeature(SequenceFeature sf);
307 public void setDatasetSequence(SequenceI seq);
309 public SequenceI getDatasetSequence();
311 public AlignmentAnnotation[] getAnnotation();
313 public void addAlignmentAnnotation(AlignmentAnnotation annotation);
315 public void removeAlignmentAnnotation(AlignmentAnnotation annotation);
318 * Derive a sequence (using this one's dataset or as the dataset)
320 * @return duplicate sequence with valid dataset sequence
322 public SequenceI deriveSequence();
325 * set the array of associated AlignmentAnnotation for this sequenceI
329 public void setAlignmentAnnotation(AlignmentAnnotation[] annotation);
332 * Get one or more alignment annotations with a particular label.
335 * string which each returned annotation must have as a label.
336 * @return null or array of annotations.
338 public AlignmentAnnotation[] getAnnotation(String label);
341 * create a new dataset sequence (if necessary) for this sequence and sets
342 * this sequence to refer to it. This call will move any features or
343 * references on the sequence onto the dataset.
345 * @return dataset sequence for this sequence
347 public SequenceI createDatasetSequence();
350 * Transfer any database references or annotation from entry under a sequence
355 * null or mapping from entry's numbering to local start/end
357 public void transferAnnotation(SequenceI entry, Mapping mp);
361 * The sequence index in the MSA
363 public void setIndex(int index);
366 * @return The index of the sequence in the alignment
368 public int getIndex();