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 jalview.util.MessageManager;
25 import java.util.ArrayList;
26 import java.util.Enumeration;
27 import java.util.Hashtable;
28 import java.util.List;
30 import java.util.Vector;
33 * Data structure to hold and manipulate a multiple sequence alignment
39 public class Alignment implements AlignmentI
41 protected Alignment dataset;
43 protected List<SequenceI> sequences;
45 protected List<SequenceGroup> groups = java.util.Collections
46 .synchronizedList(new ArrayList<SequenceGroup>());
48 protected char gapCharacter = '-';
50 protected int type = NUCLEOTIDE;
52 public static final int PROTEIN = 0;
54 public static final int NUCLEOTIDE = 1;
56 public boolean hasRNAStructure = false;
59 public AlignmentAnnotation[] annotations;
61 HiddenSequences hiddenSequences = new HiddenSequences(this);
63 public Hashtable alignmentProperties;
65 private void initAlignment(SequenceI[] seqs)
69 if (jalview.util.Comparison.isNucleotide(seqs))
78 sequences = java.util.Collections
79 .synchronizedList(new ArrayList<SequenceI>());
81 for (i = 0; i < seqs.length; i++)
83 sequences.add(seqs[i]);
89 * Make an alignment from an array of Sequences.
93 public Alignment(SequenceI[] seqs)
99 * Make a new alignment from an array of SeqCigars
104 public Alignment(SeqCigar[] alseqs)
106 SequenceI[] seqs = SeqCigar.createAlignmentSequences(alseqs,
107 gapCharacter, new ColumnSelection(), null);
112 * Make a new alignment from an CigarArray JBPNote - can only do this when
113 * compactAlignment does not contain hidden regions. JBPNote - must also check
114 * that compactAlignment resolves to a set of SeqCigars - or construct them
117 * @param compactAlignment
120 public static AlignmentI createAlignment(CigarArray compactAlignment)
122 throw new Error(MessageManager.getString("error.alignment_cigararray_not_implemented"));
123 // this(compactAlignment.refCigars);
129 * @return DOCUMENT ME!
132 public List<SequenceI> getSequences()
138 public List<SequenceI> getSequences(
139 Map<SequenceI, SequenceCollectionI> hiddenReps)
141 // TODO: in jalview 2.8 we don't do anything with hiddenreps - fix design to
147 public SequenceI[] getSequencesArray()
149 if (sequences == null)
151 synchronized (sequences)
153 return sequences.toArray(new SequenceI[sequences.size()]);
163 * @return DOCUMENT ME!
166 public SequenceI getSequenceAt(int i)
168 synchronized (sequences)
170 if (i > -1 && i < sequences.size())
172 return sequences.get(i);
179 * Adds a sequence to the alignment. Recalculates maxLength and size.
184 public void addSequence(SequenceI snew)
188 // maintain dataset integrity
189 if (snew.getDatasetSequence() != null)
191 getDataset().addSequence(snew.getDatasetSequence());
195 // derive new sequence
196 SequenceI adding = snew.deriveSequence();
197 getDataset().addSequence(adding.getDatasetSequence());
201 if (sequences == null)
203 initAlignment(new SequenceI[]
208 synchronized (sequences)
213 if (hiddenSequences != null)
214 hiddenSequences.adjustHeightSequenceAdded();
218 * Adds a sequence to the alignment. Recalculates maxLength and size.
223 public void setSequenceAt(int i, SequenceI snew)
225 SequenceI oldseq = getSequenceAt(i);
227 synchronized (sequences)
229 sequences.set(i, snew);
236 * @return DOCUMENT ME!
239 public List<SequenceGroup> getGroups()
245 public void finalize()
247 if (getDataset() != null)
248 getDataset().removeAlignmentRef();
254 hiddenSequences = null;
258 * decrement the alignmentRefs counter by one and call finalize if it goes to
261 private void removeAlignmentRef()
263 if (--alignmentRefs == 0)
276 public void deleteSequence(SequenceI s)
278 deleteSequence(findIndex(s));
288 public void deleteSequence(int i)
290 if (i > -1 && i < getHeight())
292 synchronized (sequences)
296 hiddenSequences.adjustHeightSequenceDeleted(i);
303 * @see jalview.datamodel.AlignmentI#findGroup(jalview.datamodel.SequenceI)
306 public SequenceGroup findGroup(SequenceI s)
308 synchronized (groups)
310 for (int i = 0; i < this.groups.size(); i++)
312 SequenceGroup sg = groups.get(i);
314 if (sg.getSequences(null).contains(s))
327 * jalview.datamodel.AlignmentI#findAllGroups(jalview.datamodel.SequenceI)
330 public SequenceGroup[] findAllGroups(SequenceI s)
332 ArrayList<SequenceGroup> temp = new ArrayList<SequenceGroup>();
334 synchronized (groups)
336 int gSize = groups.size();
337 for (int i = 0; i < gSize; i++)
339 SequenceGroup sg = groups.get(i);
340 if (sg == null || sg.getSequences(null) == null)
342 this.deleteGroup(sg);
347 if (sg.getSequences(null).contains(s))
353 SequenceGroup[] ret = new SequenceGroup[temp.size()];
354 return temp.toArray(ret);
359 public void addGroup(SequenceGroup sg)
361 synchronized (groups)
363 if (!groups.contains(sg))
365 if (hiddenSequences.getSize() > 0)
367 int i, iSize = sg.getSize();
368 for (i = 0; i < iSize; i++)
370 if (!sequences.contains(sg.getSequenceAt(i)))
372 sg.deleteSequence(sg.getSequenceAt(i), false);
378 if (sg.getSize() < 1)
390 * remove any annotation that references gp
393 * (if null, removes all group associated annotation)
395 private void removeAnnotationForGroup(SequenceGroup gp)
397 if (annotations == null || annotations.length == 0)
401 // remove annotation very quickly
402 AlignmentAnnotation[] t, todelete = new AlignmentAnnotation[annotations.length], tokeep = new AlignmentAnnotation[annotations.length];
406 for (i = 0, p = 0, k = 0; i < annotations.length; i++)
408 if (annotations[i].groupRef != null)
410 todelete[p++] = annotations[i];
414 tokeep[k++] = annotations[i];
420 for (i = 0, p = 0, k = 0; i < annotations.length; i++)
422 if (annotations[i].groupRef == gp)
424 todelete[p++] = annotations[i];
428 tokeep[k++] = annotations[i];
434 // clear out the group associated annotation.
435 for (i = 0; i < p; i++)
437 unhookAnnotation(todelete[i]);
440 t = new AlignmentAnnotation[k];
441 for (i = 0; i < k; i++)
450 public void deleteAllGroups()
452 synchronized (groups)
454 if (annotations != null)
456 removeAnnotationForGroup(null);
458 for (SequenceGroup sg : groups)
468 public void deleteGroup(SequenceGroup g)
470 synchronized (groups)
472 if (groups.contains(g))
474 removeAnnotationForGroup(g);
483 public SequenceI findName(String name)
485 return findName(name, false);
491 * @see jalview.datamodel.AlignmentI#findName(java.lang.String, boolean)
494 public SequenceI findName(String token, boolean b)
496 return findName(null, token, b);
502 * @see jalview.datamodel.AlignmentI#findName(SequenceI, java.lang.String,
506 public SequenceI findName(SequenceI startAfter, String token, boolean b)
511 String sqname = null;
512 if (startAfter != null)
514 // try to find the sequence in the alignment
515 boolean matched = false;
516 while (i < sequences.size())
518 if (getSequenceAt(i++) == startAfter)
529 while (i < sequences.size())
531 sq = getSequenceAt(i);
532 sqname = sq.getName();
533 if (sqname.equals(token) // exact match
534 || (b && // allow imperfect matches - case varies
535 (sqname.equalsIgnoreCase(token))))
537 return getSequenceAt(i);
547 public SequenceI[] findSequenceMatch(String name)
549 Vector matches = new Vector();
552 while (i < sequences.size())
554 if (getSequenceAt(i).getName().equals(name))
556 matches.addElement(getSequenceAt(i));
561 SequenceI[] result = new SequenceI[matches.size()];
562 for (i = 0; i < result.length; i++)
564 result[i] = (SequenceI) matches.elementAt(i);
574 * @see jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SequenceI)
577 public int findIndex(SequenceI s)
581 while (i < sequences.size())
583 if (s == getSequenceAt(i))
598 * jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SearchResults)
601 public int findIndex(SearchResults results)
605 while (i < sequences.size())
607 if (results.involvesSequence(getSequenceAt(i)))
619 * @return DOCUMENT ME!
622 public int getHeight()
624 return sequences.size();
630 * @return DOCUMENT ME!
633 public int getWidth()
637 for (int i = 0; i < sequences.size(); i++)
639 if (getSequenceAt(i).getLength() > maxLength)
641 maxLength = getSequenceAt(i).getLength();
655 public void setGapCharacter(char gc)
658 synchronized (sequences)
660 for (SequenceI seq : sequences)
662 seq.setSequence(seq.getSequenceAsString().replace('.', gc)
663 .replace('-', gc).replace(' ', gc));
671 * @return DOCUMENT ME!
674 public char getGapCharacter()
682 * @see jalview.datamodel.AlignmentI#isAligned()
685 public boolean isAligned()
687 return isAligned(false);
693 * @see jalview.datamodel.AlignmentI#isAligned(boolean)
696 public boolean isAligned(boolean includeHidden)
698 int width = getWidth();
699 if (hiddenSequences == null || hiddenSequences.getSize() == 0)
701 includeHidden = true; // no hidden sequences to check against.
703 for (int i = 0; i < sequences.size(); i++)
705 if (includeHidden || !hiddenSequences.isHidden(getSequenceAt(i)))
707 if (getSequenceAt(i).getLength() != width)
720 * @seejalview.datamodel.AlignmentI#deleteAnnotation(jalview.datamodel.
721 * AlignmentAnnotation)
724 public boolean deleteAnnotation(AlignmentAnnotation aa)
726 return deleteAnnotation(aa, true);
730 public boolean deleteAnnotation(AlignmentAnnotation aa, boolean unhook)
734 if (annotations != null)
736 aSize = annotations.length;
744 AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize - 1];
746 boolean swap = false;
749 for (int i = 0; i < aSize; i++)
751 if (annotations[i] == aa)
756 if (tIndex < temp.length)
757 temp[tIndex++] = annotations[i];
765 unhookAnnotation(aa);
772 * remove any object references associated with this annotation
776 private void unhookAnnotation(AlignmentAnnotation aa)
778 if (aa.sequenceRef != null)
780 aa.sequenceRef.removeAlignmentAnnotation(aa);
782 if (aa.groupRef != null)
784 // probably need to do more here in the future (post 2.5.0)
792 * @seejalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.
793 * AlignmentAnnotation)
796 public void addAnnotation(AlignmentAnnotation aa)
798 addAnnotation(aa, -1);
804 * @seejalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.
805 * AlignmentAnnotation, int)
808 public void addAnnotation(AlignmentAnnotation aa, int pos)
810 if (aa.getRNAStruc() != null)
812 hasRNAStructure = true;
816 if (annotations != null)
818 aSize = annotations.length + 1;
821 AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize];
823 if (pos == -1 || pos >= aSize)
825 temp[aSize - 1] = aa;
834 for (i = 0; i < (aSize - 1); i++, p++)
842 temp[p] = annotations[i];
851 public void setAnnotationIndex(AlignmentAnnotation aa, int index)
853 if (aa == null || annotations == null || annotations.length - 1 < index)
858 int aSize = annotations.length;
859 AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize];
863 for (int i = 0; i < aSize; i++)
872 temp[i] = annotations[i];
876 temp[i] = annotations[i - 1];
885 * returns all annotation on the alignment
887 public AlignmentAnnotation[] getAlignmentAnnotation()
893 public void setNucleotide(boolean b)
906 public boolean isNucleotide()
908 if (type == NUCLEOTIDE)
919 public boolean hasRNAStructure()
921 // TODO can it happen that structure is removed from alignment?
922 return hasRNAStructure;
926 public void setDataset(Alignment data)
928 if (dataset == null && data == null)
930 // Create a new dataset for this alignment.
931 // Can only be done once, if dataset is not null
932 // This will not be performed
933 SequenceI[] seqs = new SequenceI[getHeight()];
934 SequenceI currentSeq;
935 for (int i = 0; i < getHeight(); i++)
937 currentSeq = getSequenceAt(i);
938 if (currentSeq.getDatasetSequence() != null)
940 seqs[i] = currentSeq.getDatasetSequence();
944 seqs[i] = currentSeq.createDatasetSequence();
948 dataset = new Alignment(seqs);
950 else if (dataset == null && data != null)
954 dataset.addAlignmentRef();
958 * reference count for number of alignments referencing this one.
960 int alignmentRefs = 0;
963 * increase reference count to this alignment.
965 private void addAlignmentRef()
971 public Alignment getDataset()
977 public boolean padGaps()
979 boolean modified = false;
981 // Remove excess gaps from the end of alignment
985 for (int i = 0; i < sequences.size(); i++)
987 current = getSequenceAt(i);
988 for (int j = current.getLength(); j > maxLength; j--)
991 && !jalview.util.Comparison.isGap(current.getCharAt(j)))
1002 for (int i = 0; i < sequences.size(); i++)
1004 current = getSequenceAt(i);
1005 cLength = current.getLength();
1007 if (cLength < maxLength)
1009 current.insertCharAt(cLength, maxLength - cLength, gapCharacter);
1012 else if (current.getLength() > maxLength)
1014 current.deleteChars(maxLength, current.getLength());
1021 * Justify the sequences to the left or right by deleting and inserting gaps
1022 * before the initial residue or after the terminal residue
1025 * true if alignment padded to right, false to justify to left
1026 * @return true if alignment was changed
1029 public boolean justify(boolean right)
1031 boolean modified = false;
1033 // Remove excess gaps from the end of alignment
1035 int ends[] = new int[sequences.size() * 2];
1037 for (int i = 0; i < sequences.size(); i++)
1039 current = getSequenceAt(i);
1040 // This should really be a sequence method
1041 ends[i * 2] = current.findIndex(current.getStart());
1042 ends[i * 2 + 1] = current.findIndex(current.getStart()
1043 + current.getLength());
1044 boolean hitres = false;
1045 for (int j = 0, rs = 0, ssiz = current.getLength(); j < ssiz; j++)
1047 if (!jalview.util.Comparison.isGap(current.getCharAt(j)))
1056 ends[i * 2 + 1] = j;
1057 if (j - ends[i * 2] > maxLength)
1059 maxLength = j - ends[i * 2];
1067 // now edit the flanking gaps to justify to either left or right
1068 int cLength, extent, diff;
1069 for (int i = 0; i < sequences.size(); i++)
1071 current = getSequenceAt(i);
1073 cLength = 1 + ends[i * 2 + 1] - ends[i * 2];
1074 diff = maxLength - cLength; // number of gaps to indent
1075 extent = current.getLength();
1079 if (extent > ends[i * 2 + 1])
1081 current.deleteChars(ends[i * 2 + 1] + 1, extent);
1084 if (ends[i * 2] > diff)
1086 current.deleteChars(0, ends[i * 2] - diff);
1091 if (ends[i * 2] < diff)
1093 current.insertCharAt(0, diff - ends[i * 2], gapCharacter);
1101 if (ends[i * 2] > 0)
1103 current.deleteChars(0, ends[i * 2]);
1105 ends[i * 2 + 1] -= ends[i * 2];
1106 extent -= ends[i * 2];
1108 if (extent > maxLength)
1110 current.deleteChars(maxLength + 1, extent);
1115 if (extent < maxLength)
1117 current.insertCharAt(extent, maxLength - extent, gapCharacter);
1127 public HiddenSequences getHiddenSequences()
1129 return hiddenSequences;
1133 public CigarArray getCompactAlignment()
1135 synchronized (sequences)
1137 SeqCigar alseqs[] = new SeqCigar[sequences.size()];
1139 for (SequenceI seq : sequences)
1141 alseqs[i++] = new SeqCigar(seq);
1143 CigarArray cal = new CigarArray(alseqs);
1144 cal.addOperation(CigarArray.M, getWidth());
1150 public void setProperty(Object key, Object value)
1152 if (alignmentProperties == null)
1153 alignmentProperties = new Hashtable();
1155 alignmentProperties.put(key, value);
1159 public Object getProperty(Object key)
1161 if (alignmentProperties != null)
1162 return alignmentProperties.get(key);
1168 public Hashtable getProperties()
1170 return alignmentProperties;
1173 AlignedCodonFrame[] codonFrameList = null;
1179 * jalview.datamodel.AlignmentI#addCodonFrame(jalview.datamodel.AlignedCodonFrame
1183 public void addCodonFrame(AlignedCodonFrame codons)
1187 if (codonFrameList == null)
1189 codonFrameList = new AlignedCodonFrame[]
1193 AlignedCodonFrame[] t = new AlignedCodonFrame[codonFrameList.length + 1];
1194 System.arraycopy(codonFrameList, 0, t, 0, codonFrameList.length);
1195 t[codonFrameList.length] = codons;
1202 * @see jalview.datamodel.AlignmentI#getCodonFrame(int)
1205 public AlignedCodonFrame getCodonFrame(int index)
1207 return codonFrameList[index];
1214 * jalview.datamodel.AlignmentI#getCodonFrame(jalview.datamodel.SequenceI)
1217 public AlignedCodonFrame[] getCodonFrame(SequenceI seq)
1219 if (seq == null || codonFrameList == null)
1221 Vector cframes = new Vector();
1222 for (int f = 0; f < codonFrameList.length; f++)
1224 if (codonFrameList[f].involvesSequence(seq))
1225 cframes.addElement(codonFrameList[f]);
1227 if (cframes.size() == 0)
1229 AlignedCodonFrame[] cfr = new AlignedCodonFrame[cframes.size()];
1230 cframes.copyInto(cfr);
1237 * @see jalview.datamodel.AlignmentI#getCodonFrames()
1240 public AlignedCodonFrame[] getCodonFrames()
1242 return codonFrameList;
1248 * @seejalview.datamodel.AlignmentI#removeCodonFrame(jalview.datamodel.
1249 * AlignedCodonFrame)
1252 public boolean removeCodonFrame(AlignedCodonFrame codons)
1254 if (codons == null || codonFrameList == null)
1256 boolean removed = false;
1257 int i = 0, iSize = codonFrameList.length;
1260 if (codonFrameList[i] == codons)
1265 System.arraycopy(codonFrameList, i + 1, codonFrameList, i, iSize
1279 public void append(AlignmentI toappend)
1281 if (toappend == this)
1283 System.err.println("Self append may cause a deadlock.");
1285 // TODO test this method for a future 2.5 release
1286 // currently tested for use in jalview.gui.SequenceFetcher
1287 boolean samegap = toappend.getGapCharacter() == getGapCharacter();
1288 char oldc = toappend.getGapCharacter();
1289 boolean hashidden = toappend.getHiddenSequences() != null
1290 && toappend.getHiddenSequences().hiddenSequences != null;
1291 // get all sequences including any hidden ones
1292 List<SequenceI> sqs = (hashidden) ? toappend.getHiddenSequences()
1293 .getFullAlignment().getSequences() : toappend.getSequences();
1298 for (SequenceI addedsq : sqs)
1302 char[] oldseq = addedsq.getSequence();
1303 for (int c = 0; c < oldseq.length; c++)
1305 if (oldseq[c] == oldc)
1307 oldseq[c] = gapCharacter;
1311 addSequence(addedsq);
1315 AlignmentAnnotation[] alan = toappend.getAlignmentAnnotation();
1316 for (int a = 0; alan != null && a < alan.length; a++)
1318 addAnnotation(alan[a]);
1320 AlignedCodonFrame[] acod = toappend.getCodonFrames();
1321 for (int a = 0; acod != null && a < acod.length; a++)
1323 this.addCodonFrame(acod[a]);
1325 List<SequenceGroup> sg = toappend.getGroups();
1328 for (SequenceGroup _sg : sg)
1333 if (toappend.getHiddenSequences() != null)
1335 HiddenSequences hs = toappend.getHiddenSequences();
1336 if (hiddenSequences == null)
1338 hiddenSequences = new HiddenSequences(this);
1340 if (hs.hiddenSequences != null)
1342 for (int s = 0; s < hs.hiddenSequences.length; s++)
1344 // hide the newly appended sequence in the alignment
1345 if (hs.hiddenSequences[s] != null)
1347 hiddenSequences.hideSequence(hs.hiddenSequences[s]);
1352 if (toappend.getProperties() != null)
1354 // we really can't do very much here - just try to concatenate strings
1355 // where property collisions occur.
1356 Enumeration key = toappend.getProperties().keys();
1357 while (key.hasMoreElements())
1359 Object k = key.nextElement();
1360 Object ourval = this.getProperty(k);
1361 Object toapprop = toappend.getProperty(k);
1364 if (ourval.getClass().equals(toapprop.getClass())
1365 && !ourval.equals(toapprop))
1367 if (ourval instanceof String)
1370 this.setProperty(k, ((String) ourval) + "; "
1371 + ((String) toapprop));
1375 if (ourval instanceof Vector)
1378 Enumeration theirv = ((Vector) toapprop).elements();
1379 while (theirv.hasMoreElements())
1381 ((Vector) ourval).addElement(theirv);
1389 // just add new property directly
1390 setProperty(k, toapprop);
1398 public AlignmentAnnotation findOrCreateAnnotation(String name,
1399 String calcId, boolean autoCalc, SequenceI seqRef,
1400 SequenceGroup groupRef)
1402 assert (name != null);
1403 if (annotations != null)
1405 for (AlignmentAnnotation annot : getAlignmentAnnotation())
1407 if (annot.autoCalculated == autoCalc && (name.equals(annot.label))
1408 && (calcId == null || annot.getCalcId().equals(calcId))
1409 && annot.sequenceRef == seqRef
1410 && annot.groupRef == groupRef)
1416 AlignmentAnnotation annot = new AlignmentAnnotation(name, name,
1417 new Annotation[1], 0f, 0f, AlignmentAnnotation.BAR_GRAPH);
1418 annot.hasText = false;
1419 annot.setCalcId(new String(calcId));
1420 annot.autoCalculated = autoCalc;
1423 annot.setSequenceRef(seqRef);
1425 annot.groupRef = groupRef;
1426 addAnnotation(annot);
1432 public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
1434 ArrayList<AlignmentAnnotation> aa = new ArrayList<AlignmentAnnotation>();
1435 for (AlignmentAnnotation a : getAlignmentAnnotation())
1437 if (a.getCalcId() == calcId
1438 || (a.getCalcId() != null && calcId != null && a.getCalcId()
1448 public void moveSelectedSequencesByOne(SequenceGroup sg,
1449 Map<SequenceI, SequenceCollectionI> map, boolean up)
1451 synchronized (sequences)
1456 for (int i = 1, iSize = sequences.size(); i < iSize; i++)
1458 SequenceI seq = sequences.get(i);
1459 if (!sg.getSequences(map).contains(seq))
1464 SequenceI temp = sequences.get(i - 1);
1465 if (sg.getSequences(null).contains(temp))
1470 sequences.set(i, temp);
1471 sequences.set(i - 1, seq);
1476 for (int i = sequences.size() - 2; i > -1; i--)
1478 SequenceI seq = sequences.get(i);
1479 if (!sg.getSequences(map).contains(seq))
1484 SequenceI temp = sequences.get(i + 1);
1485 if (sg.getSequences(map).contains(temp))
1490 sequences.set(i, temp);
1491 sequences.set(i + 1, seq);
1499 public void validateAnnotation(AlignmentAnnotation alignmentAnnotation)
1501 alignmentAnnotation.validateRangeAndDisplay();
1502 if (isNucleotide() && alignmentAnnotation.isValidStruc())
1504 hasRNAStructure = true;
1509 public int getEndRes()
1511 return getWidth() - 1;
1515 public int getStartRes()
1521 * In the case of AlignmentI - returns the dataset for the alignment, if set
1524 * @see jalview.datamodel.AnnotatedCollectionI#getContext()
1527 public AnnotatedCollectionI getContext()