2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.datamodel;
23 import java.util.Vector;
25 import fr.orsay.lri.varna.models.rna.RNA;
33 public interface SequenceI
36 * Set the display name for the sequence
40 public void setName(String name);
43 * Get the display name
45 public String getName();
48 * Set start position of first non-gapped symbol in sequence
53 public void setStart(int start);
56 * get start position of first non-gapped residue in sequence
60 public int getStart();
63 * get the displayed id of the sequence
65 * @return true means the id will be returned in the form
66 * DisplayName/Start-End
68 public String getDisplayId(boolean jvsuffix);
71 * set end position for last residue in sequence
75 public void setEnd(int end);
78 * get end position for last residue in sequence getEnd()>getStart() unless
79 * sequence only consists of gap characters
86 * @return length of sequence including gaps
89 public int getLength();
92 * Replace the sequence with the given string
97 public void setSequence(String sequence);
100 * @return sequence as string
102 public String getSequenceAsString();
105 * get a range on the sequence as a string
108 * position relative to start of sequence including gaps (from 0)
110 * position relative to start of sequence including gaps (from 0)
112 * @return String containing all gap and symbols in specified range
114 public String getSequenceAsString(int start, int end);
117 * Get the sequence as a character array
119 * @return seqeunce and any gaps
121 public char[] getSequence();
124 * get stretch of sequence characters in an array
127 * absolute index into getSequence()
129 * exclusive index of last position in segment to be returned.
131 * @return char[max(0,end-start)];
133 public char[] getSequence(int start, int end);
136 * create a new sequence object from start to end of this sequence
144 public SequenceI getSubSequence(int start, int end);
152 * @return DOCUMENT ME!
154 public char getCharAt(int i);
162 public void setDescription(String desc);
167 * @return DOCUMENT ME!
169 public String getDescription();
172 * Return the alignment column for a sequence position * Return the alignment
173 * position for a sequence position
176 * lying from start to end
178 * @return aligned column for residue (0 if residue is upstream from
179 * alignment, -1 if residue is downstream from alignment) note.
180 * Sequence object returns sequence.getEnd() for positions upstream
181 * currently. TODO: change sequence for
182 * assert(findIndex(seq.getEnd()+1)==-1) and fix incremental bugs
185 public int findIndex(int pos);
188 * Returns the sequence position for an alignment position
191 * column index in alignment (from 1)
193 * @return residue number for residue (left of and) nearest ith column
195 public int findPosition(int i);
198 * Returns an int array where indices correspond to each residue in the
199 * sequence and the element value gives its position in the alignment
201 * @return int[SequenceI.getEnd()-SequenceI.getStart()+1] or null if no
202 * residues in SequenceI object
204 public int[] gapMap();
207 * Returns an int array where indices correspond to each position in sequence
208 * char array and the element value gives the result of findPosition for that
209 * index in the sequence.
211 * @return int[SequenceI.getLength()]
213 public int[] findPositionMap();
216 * Delete a range of aligned sequence columns, creating a new dataset sequence
217 * if necessary and adjusting start and end positions accordingly.
220 * first column in range to delete
222 * last column in range to delete
224 public void deleteChars(int i, int j);
234 public void insertCharAt(int i, char c);
244 public void insertCharAt(int i, int length, char c);
249 * @return DOCUMENT ME!
251 public SequenceFeature[] getSequenceFeatures();
259 public void setSequenceFeatures(SequenceFeature[] features);
267 public void setPDBId(Vector ids);
272 * @return DOCUMENT ME!
274 public Vector getPDBId();
277 * add entry to the vector of PDBIds, if it isn't in the list already
281 public void addPDBId(PDBEntry entry);
284 * update the list of PDBEntrys to include any DBRefEntrys citing structural
287 * @return true if PDBEntry list was modified
289 public boolean updatePDBIds();
291 public String getVamsasId();
293 public void setVamsasId(String id);
295 public void setDBRef(DBRefEntry[] dbs);
297 public DBRefEntry[] getDBRef();
300 * add the given entry to the list of DBRefs for this sequence, or replace a
301 * similar one if entry contains a map object and the existing one doesnt.
305 public void addDBRef(DBRefEntry entry);
307 public void addSequenceFeature(SequenceFeature sf);
309 public void deleteFeature(SequenceFeature sf);
311 public void setDatasetSequence(SequenceI seq);
313 public SequenceI getDatasetSequence();
315 public AlignmentAnnotation[] getAnnotation();
317 public void addAlignmentAnnotation(AlignmentAnnotation annotation);
319 public void removeAlignmentAnnotation(AlignmentAnnotation annotation);
322 * Derive a sequence (using this one's dataset or as the dataset)
324 * @return duplicate sequence with valid dataset sequence
326 public SequenceI deriveSequence();
329 * set the array of associated AlignmentAnnotation for this sequenceI
333 public void setAlignmentAnnotation(AlignmentAnnotation[] annotation);
336 * Get one or more alignment annotations with a particular label.
339 * string which each returned annotation must have as a label.
340 * @return null or array of annotations.
342 public AlignmentAnnotation[] getAnnotation(String label);
345 * create a new dataset sequence (if necessary) for this sequence and sets
346 * this sequence to refer to it. This call will move any features or
347 * references on the sequence onto the dataset.
349 * @return dataset sequence for this sequence
351 public SequenceI createDatasetSequence();
354 * Transfer any database references or annotation from entry under a sequence
359 * null or mapping from entry's numbering to local start/end
361 public void transferAnnotation(SequenceI entry, Mapping mp);
365 * The sequence index in the MSA
367 public void setIndex(int index);
370 * @return The index of the sequence in the alignment
372 public int getIndex();
375 * @return The RNA of the sequence in the alignment
384 public void setRNA(RNA rna);