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.List;
\r
24 import java.util.Vector;
\r
26 import fr.orsay.lri.varna.models.rna.RNA;
\r
32 * @version $Revision$
\r
34 public interface SequenceI
\r
37 * Set the display name for the sequence
\r
41 public void setName(String name);
\r
44 * Get the display name
\r
46 public String getName();
\r
49 * Set start position of first non-gapped symbol in sequence
\r
52 * new start position
\r
54 public void setStart(int start);
\r
57 * get start position of first non-gapped residue in sequence
\r
61 public int getStart();
\r
64 * get the displayed id of the sequence
\r
66 * @return true means the id will be returned in the form
\r
67 * DisplayName/Start-End
\r
69 public String getDisplayId(boolean jvsuffix);
\r
72 * set end position for last residue in sequence
\r
76 public void setEnd(int end);
\r
79 * get end position for last residue in sequence getEnd()>getStart() unless
\r
80 * sequence only consists of gap characters
\r
84 public int getEnd();
\r
87 * @return length of sequence including gaps
\r
90 public int getLength();
\r
93 * Replace the sequence with the given string
\r
96 * new sequence string
\r
98 public void setSequence(String sequence);
\r
101 * @return sequence as string
\r
103 public String getSequenceAsString();
\r
106 * get a range on the sequence as a string
\r
109 * position relative to start of sequence including gaps (from 0)
\r
111 * position relative to start of sequence including gaps (from 0)
\r
113 * @return String containing all gap and symbols in specified range
\r
115 public String getSequenceAsString(int start, int end);
\r
118 * Get the sequence as a character array
\r
120 * @return seqeunce and any gaps
\r
122 public char[] getSequence();
\r
125 * get stretch of sequence characters in an array
\r
128 * absolute index into getSequence()
\r
130 * exclusive index of last position in segment to be returned.
\r
132 * @return char[max(0,end-start)];
\r
134 public char[] getSequence(int start, int end);
\r
137 * create a new sequence object from start to end of this sequence
\r
143 * @return SequenceI
\r
145 public SequenceI getSubSequence(int start, int end);
\r
153 * @return DOCUMENT ME!
\r
155 public char getCharAt(int i);
\r
163 public void setDescription(String desc);
\r
168 * @return DOCUMENT ME!
\r
170 public String getDescription();
\r
173 * Return the alignment column for a sequence position * Return the alignment
\r
174 * position for a sequence position
\r
177 * lying from start to end
\r
179 * @return aligned column for residue (0 if residue is upstream from
\r
180 * alignment, -1 if residue is downstream from alignment) note.
\r
181 * Sequence object returns sequence.getEnd() for positions upstream
\r
182 * currently. TODO: change sequence for
\r
183 * assert(findIndex(seq.getEnd()+1)==-1) and fix incremental bugs
\r
186 public int findIndex(int pos);
\r
189 * Returns the sequence position for an alignment position
\r
192 * column index in alignment (from 1)
\r
194 * @return residue number for residue (left of and) nearest ith column
\r
196 public int findPosition(int i);
\r
199 * Returns an int array where indices correspond to each residue in the
\r
200 * sequence and the element value gives its position in the alignment
\r
202 * @return int[SequenceI.getEnd()-SequenceI.getStart()+1] or null if no
\r
203 * residues in SequenceI object
\r
205 public int[] gapMap();
\r
208 * Returns an int array where indices correspond to each position in sequence
\r
209 * char array and the element value gives the result of findPosition for that
\r
210 * index in the sequence.
\r
212 * @return int[SequenceI.getLength()]
\r
214 public int[] findPositionMap();
\r
217 * Delete a range of aligned sequence columns, creating a new dataset sequence
\r
218 * if necessary and adjusting start and end positions accordingly.
\r
221 * first column in range to delete
\r
223 * last column in range to delete
\r
225 public void deleteChars(int i, int j);
\r
235 public void insertCharAt(int i, char c);
\r
245 public void insertCharAt(int i, int length, char c);
\r
250 * @return DOCUMENT ME!
\r
252 public SequenceFeature[] getSequenceFeatures();
\r
260 public void setSequenceFeatures(SequenceFeature[] features);
\r
268 public void setPDBId(Vector ids);
\r
273 * @return DOCUMENT ME!
\r
275 public Vector getPDBId();
\r
278 * add entry to the vector of PDBIds, if it isn't in the list already
\r
282 public void addPDBId(PDBEntry entry);
\r
285 * update the list of PDBEntrys to include any DBRefEntrys citing structural
\r
288 * @return true if PDBEntry list was modified
\r
290 public boolean updatePDBIds();
\r
292 public String getVamsasId();
\r
294 public void setVamsasId(String id);
\r
296 public void setDBRef(DBRefEntry[] dbs);
\r
298 public DBRefEntry[] getDBRef();
\r
301 * add the given entry to the list of DBRefs for this sequence, or replace a
\r
302 * similar one if entry contains a map object and the existing one doesnt.
\r
306 public void addDBRef(DBRefEntry entry);
\r
308 public void addSequenceFeature(SequenceFeature sf);
\r
310 public void deleteFeature(SequenceFeature sf);
\r
312 public void setDatasetSequence(SequenceI seq);
\r
314 public SequenceI getDatasetSequence();
\r
316 public AlignmentAnnotation[] getAnnotation();
\r
318 public void addAlignmentAnnotation(AlignmentAnnotation annotation);
\r
320 public void removeAlignmentAnnotation(AlignmentAnnotation annotation);
\r
323 * Derive a sequence (using this one's dataset or as the dataset)
\r
325 * @return duplicate sequence with valid dataset sequence
\r
327 public SequenceI deriveSequence();
\r
330 * set the array of associated AlignmentAnnotation for this sequenceI
\r
334 public void setAlignmentAnnotation(AlignmentAnnotation[] annotation);
\r
337 * Get one or more alignment annotations with a particular label.
\r
340 * string which each returned annotation must have as a label.
\r
341 * @return null or array of annotations.
\r
343 public AlignmentAnnotation[] getAnnotation(String label);
\r
346 * Return a list of any annotations which match the given calcId (source) and
\r
347 * label (type). Null values do not match.
\r
353 public List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
\r
357 * create a new dataset sequence (if necessary) for this sequence and sets
\r
358 * this sequence to refer to it. This call will move any features or
\r
359 * references on the sequence onto the dataset. It will also make a duplicate
\r
360 * of existing annotation rows for the dataset sequence, rather than relocate
\r
361 * them in order to preserve external references (since 2.8.2).
\r
363 * @return dataset sequence for this sequence
\r
365 public SequenceI createDatasetSequence();
\r
368 * Transfer any database references or annotation from entry under a sequence
\r
370 * <strong>Note: DOES NOT transfer sequence associated alignment
\r
371 * annotation </strong><br/>
\r
375 * null or mapping from entry's numbering to local start/end
\r
377 public void transferAnnotation(SequenceI entry, Mapping mp);
\r
381 * The sequence index in the MSA
\r
383 public void setIndex(int index);
\r
386 * @return The index of the sequence in the alignment
\r
388 public int getIndex();
\r
391 * @return The RNA of the sequence in the alignment
\r
394 public RNA getRNA();
\r
400 public void setRNA(RNA rna);
\r