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