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;
26 * Data structure to hold and manipulate a multiple sequence alignment
32 public class Alignment implements AlignmentI
34 protected Alignment dataset;
36 protected List<SequenceI> sequences;
38 protected List<SequenceGroup> groups = java.util.Collections
39 .synchronizedList(new ArrayList<SequenceGroup>());
41 protected char gapCharacter = '-';
43 protected int type = NUCLEOTIDE;
45 public static final int PROTEIN = 0;
47 public static final int NUCLEOTIDE = 1;
49 public boolean hasRNAStructure = false;
52 public AlignmentAnnotation[] annotations;
54 HiddenSequences hiddenSequences = new HiddenSequences(this);
56 public Hashtable alignmentProperties;
58 private void initAlignment(SequenceI[] seqs)
62 if (jalview.util.Comparison.isNucleotide(seqs))
71 sequences = java.util.Collections
72 .synchronizedList(new ArrayList<SequenceI>());
74 for (i = 0; i < seqs.length; i++)
76 sequences.add(seqs[i]);
82 * Make an alignment from an array of Sequences.
86 public Alignment(SequenceI[] seqs)
92 * Make a new alignment from an array of SeqCigars
97 public Alignment(SeqCigar[] alseqs)
99 SequenceI[] seqs = SeqCigar.createAlignmentSequences(alseqs,
100 gapCharacter, new ColumnSelection(), null);
105 * Make a new alignment from an CigarArray JBPNote - can only do this when
106 * compactAlignment does not contain hidden regions. JBPNote - must also check
107 * that compactAlignment resolves to a set of SeqCigars - or construct them
110 * @param compactAlignment
113 public static AlignmentI createAlignment(CigarArray compactAlignment)
115 throw new Error("Alignment(CigarArray) not yet implemented");
116 // this(compactAlignment.refCigars);
122 * @return DOCUMENT ME!
125 public List<SequenceI> getSequences()
131 public List<SequenceI> getSequences(
132 Map<SequenceI, SequenceCollectionI> hiddenReps)
134 // TODO: in jalview 2.8 we don't do anything with hiddenreps - fix design to
140 public SequenceI[] getSequencesArray()
142 if (sequences == null)
144 synchronized (sequences)
146 return sequences.toArray(new SequenceI[sequences.size()]);
156 * @return DOCUMENT ME!
159 public SequenceI getSequenceAt(int i)
161 synchronized (sequences)
163 if (i > -1 && i < sequences.size())
165 return sequences.get(i);
172 * Adds a sequence to the alignment. Recalculates maxLength and size.
177 public void addSequence(SequenceI snew)
181 // maintain dataset integrity
182 if (snew.getDatasetSequence() != null)
184 getDataset().addSequence(snew.getDatasetSequence());
188 // derive new sequence
189 SequenceI adding = snew.deriveSequence();
190 getDataset().addSequence(adding.getDatasetSequence());
194 if (sequences == null)
196 initAlignment(new SequenceI[]
201 synchronized (sequences)
206 if (hiddenSequences != null)
207 hiddenSequences.adjustHeightSequenceAdded();
211 * Adds a sequence to the alignment. Recalculates maxLength and size.
216 public void setSequenceAt(int i, SequenceI snew)
218 SequenceI oldseq = getSequenceAt(i);
220 synchronized (sequences)
222 sequences.set(i, snew);
229 * @return DOCUMENT ME!
232 public List<SequenceGroup> getGroups()
238 public void finalize()
240 if (getDataset() != null)
241 getDataset().removeAlignmentRef();
247 hiddenSequences = null;
251 * decrement the alignmentRefs counter by one and call finalize if it goes to
254 private void removeAlignmentRef()
256 if (--alignmentRefs == 0)
269 public void deleteSequence(SequenceI s)
271 deleteSequence(findIndex(s));
281 public void deleteSequence(int i)
283 if (i > -1 && i < getHeight())
285 synchronized (sequences)
289 hiddenSequences.adjustHeightSequenceDeleted(i);
296 * @see jalview.datamodel.AlignmentI#findGroup(jalview.datamodel.SequenceI)
299 public SequenceGroup findGroup(SequenceI s)
301 synchronized (groups)
303 for (int i = 0; i < this.groups.size(); i++)
305 SequenceGroup sg = groups.get(i);
307 if (sg.getSequences(null).contains(s))
320 * jalview.datamodel.AlignmentI#findAllGroups(jalview.datamodel.SequenceI)
323 public SequenceGroup[] findAllGroups(SequenceI s)
325 ArrayList<SequenceGroup> temp = new ArrayList<SequenceGroup>();
327 synchronized (groups)
329 int gSize = groups.size();
330 for (int i = 0; i < gSize; i++)
332 SequenceGroup sg = groups.get(i);
333 if (sg == null || sg.getSequences(null) == null)
335 this.deleteGroup(sg);
340 if (sg.getSequences(null).contains(s))
346 SequenceGroup[] ret = new SequenceGroup[temp.size()];
347 return temp.toArray(ret);
352 public void addGroup(SequenceGroup sg)
354 synchronized (groups)
356 if (!groups.contains(sg))
358 if (hiddenSequences.getSize() > 0)
360 int i, iSize = sg.getSize();
361 for (i = 0; i < iSize; i++)
363 if (!sequences.contains(sg.getSequenceAt(i)))
365 sg.deleteSequence(sg.getSequenceAt(i), false);
371 if (sg.getSize() < 1)
383 * remove any annotation that references gp
386 * (if null, removes all group associated annotation)
388 private void removeAnnotationForGroup(SequenceGroup gp)
390 if (annotations == null || annotations.length == 0)
394 // remove annotation very quickly
395 AlignmentAnnotation[] t, todelete = new AlignmentAnnotation[annotations.length], tokeep = new AlignmentAnnotation[annotations.length];
399 for (i = 0, p = 0, k = 0; i < annotations.length; i++)
401 if (annotations[i].groupRef != null)
403 todelete[p++] = annotations[i];
407 tokeep[k++] = annotations[i];
413 for (i = 0, p = 0, k = 0; i < annotations.length; i++)
415 if (annotations[i].groupRef == gp)
417 todelete[p++] = annotations[i];
421 tokeep[k++] = annotations[i];
427 // clear out the group associated annotation.
428 for (i = 0; i < p; i++)
430 unhookAnnotation(todelete[i]);
433 t = new AlignmentAnnotation[k];
434 for (i = 0; i < k; i++)
443 public void deleteAllGroups()
445 synchronized (groups)
447 if (annotations != null)
449 removeAnnotationForGroup(null);
451 for (SequenceGroup sg : groups)
461 public void deleteGroup(SequenceGroup g)
463 synchronized (groups)
465 if (groups.contains(g))
467 removeAnnotationForGroup(g);
476 public SequenceI findName(String name)
478 return findName(name, false);
484 * @see jalview.datamodel.AlignmentI#findName(java.lang.String, boolean)
487 public SequenceI findName(String token, boolean b)
489 return findName(null, token, b);
495 * @see jalview.datamodel.AlignmentI#findName(SequenceI, java.lang.String,
499 public SequenceI findName(SequenceI startAfter, String token, boolean b)
504 String sqname = null;
505 if (startAfter != null)
507 // try to find the sequence in the alignment
508 boolean matched = false;
509 while (i < sequences.size())
511 if (getSequenceAt(i++) == startAfter)
522 while (i < sequences.size())
524 sq = getSequenceAt(i);
525 sqname = sq.getName();
526 if (sqname.equals(token) // exact match
527 || (b && // allow imperfect matches - case varies
528 (sqname.equalsIgnoreCase(token))))
530 return getSequenceAt(i);
540 public SequenceI[] findSequenceMatch(String name)
542 Vector matches = new Vector();
545 while (i < sequences.size())
547 if (getSequenceAt(i).getName().equals(name))
549 matches.addElement(getSequenceAt(i));
554 SequenceI[] result = new SequenceI[matches.size()];
555 for (i = 0; i < result.length; i++)
557 result[i] = (SequenceI) matches.elementAt(i);
567 * @see jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SequenceI)
570 public int findIndex(SequenceI s)
574 while (i < sequences.size())
576 if (s == getSequenceAt(i))
591 * jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SearchResults)
594 public int findIndex(SearchResults results)
598 while (i < sequences.size())
600 if (results.involvesSequence(getSequenceAt(i)))
612 * @return DOCUMENT ME!
615 public int getHeight()
617 return sequences.size();
623 * @return DOCUMENT ME!
626 public int getWidth()
630 for (int i = 0; i < sequences.size(); i++)
632 if (getSequenceAt(i).getLength() > maxLength)
634 maxLength = getSequenceAt(i).getLength();
648 public void setGapCharacter(char gc)
651 synchronized (sequences)
653 for (SequenceI seq : sequences)
655 seq.setSequence(seq.getSequenceAsString().replace('.', gc)
656 .replace('-', gc).replace(' ', gc));
664 * @return DOCUMENT ME!
667 public char getGapCharacter()
675 * @see jalview.datamodel.AlignmentI#isAligned()
678 public boolean isAligned()
680 return isAligned(false);
686 * @see jalview.datamodel.AlignmentI#isAligned(boolean)
689 public boolean isAligned(boolean includeHidden)
691 int width = getWidth();
692 if (hiddenSequences == null || hiddenSequences.getSize() == 0)
694 includeHidden = true; // no hidden sequences to check against.
696 for (int i = 0; i < sequences.size(); i++)
698 if (includeHidden || !hiddenSequences.isHidden(getSequenceAt(i)))
700 if (getSequenceAt(i).getLength() != width)
713 * @seejalview.datamodel.AlignmentI#deleteAnnotation(jalview.datamodel.
714 * AlignmentAnnotation)
717 public boolean deleteAnnotation(AlignmentAnnotation aa)
719 return deleteAnnotation(aa, true);
723 public boolean deleteAnnotation(AlignmentAnnotation aa, boolean unhook)
727 if (annotations != null)
729 aSize = annotations.length;
737 AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize - 1];
739 boolean swap = false;
742 for (int i = 0; i < aSize; i++)
744 if (annotations[i] == aa)
749 if (tIndex < temp.length)
750 temp[tIndex++] = annotations[i];
758 unhookAnnotation(aa);
765 * remove any object references associated with this annotation
769 private void unhookAnnotation(AlignmentAnnotation aa)
771 if (aa.sequenceRef != null)
773 aa.sequenceRef.removeAlignmentAnnotation(aa);
775 if (aa.groupRef != null)
777 // probably need to do more here in the future (post 2.5.0)
785 * @seejalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.
786 * AlignmentAnnotation)
789 public void addAnnotation(AlignmentAnnotation aa)
791 addAnnotation(aa, -1);
797 * @seejalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.
798 * AlignmentAnnotation, int)
801 public void addAnnotation(AlignmentAnnotation aa, int pos)
803 if (aa.getRNAStruc() != null)
805 hasRNAStructure = true;
809 if (annotations != null)
811 aSize = annotations.length + 1;
814 AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize];
816 if (pos == -1 || pos >= aSize)
818 temp[aSize - 1] = aa;
827 for (i = 0; i < (aSize - 1); i++, p++)
835 temp[p] = annotations[i];
844 public void setAnnotationIndex(AlignmentAnnotation aa, int index)
846 if (aa == null || annotations == null || annotations.length - 1 < index)
851 int aSize = annotations.length;
852 AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize];
856 for (int i = 0; i < aSize; i++)
865 temp[i] = annotations[i];
869 temp[i] = annotations[i - 1];
878 * returns all annotation on the alignment
880 public AlignmentAnnotation[] getAlignmentAnnotation()
886 public void setNucleotide(boolean b)
899 public boolean isNucleotide()
901 if (type == NUCLEOTIDE)
912 public boolean hasRNAStructure()
914 // TODO can it happen that structure is removed from alignment?
915 return hasRNAStructure;
919 public void setDataset(Alignment data)
921 if (dataset == null && data == null)
923 // Create a new dataset for this alignment.
924 // Can only be done once, if dataset is not null
925 // This will not be performed
926 SequenceI[] seqs = new SequenceI[getHeight()];
927 SequenceI currentSeq;
928 for (int i = 0; i < getHeight(); i++)
930 currentSeq = getSequenceAt(i);
931 if (currentSeq.getDatasetSequence() != null)
933 seqs[i] = currentSeq.getDatasetSequence();
937 seqs[i] = currentSeq.createDatasetSequence();
941 dataset = new Alignment(seqs);
943 else if (dataset == null && data != null)
947 dataset.addAlignmentRef();
951 * reference count for number of alignments referencing this one.
953 int alignmentRefs = 0;
956 * increase reference count to this alignment.
958 private void addAlignmentRef()
964 public Alignment getDataset()
970 public boolean padGaps()
972 boolean modified = false;
974 // Remove excess gaps from the end of alignment
978 for (int i = 0; i < sequences.size(); i++)
980 current = getSequenceAt(i);
981 for (int j = current.getLength(); j > maxLength; j--)
984 && !jalview.util.Comparison.isGap(current.getCharAt(j)))
995 for (int i = 0; i < sequences.size(); i++)
997 current = getSequenceAt(i);
998 cLength = current.getLength();
1000 if (cLength < maxLength)
1002 current.insertCharAt(cLength, maxLength - cLength, gapCharacter);
1005 else if (current.getLength() > maxLength)
1007 current.deleteChars(maxLength, current.getLength());
1014 * Justify the sequences to the left or right by deleting and inserting gaps
1015 * before the initial residue or after the terminal residue
1018 * true if alignment padded to right, false to justify to left
1019 * @return true if alignment was changed
1022 public boolean justify(boolean right)
1024 boolean modified = false;
1026 // Remove excess gaps from the end of alignment
1028 int ends[] = new int[sequences.size() * 2];
1030 for (int i = 0; i < sequences.size(); i++)
1032 current = getSequenceAt(i);
1033 // This should really be a sequence method
1034 ends[i * 2] = current.findIndex(current.getStart());
1035 ends[i * 2 + 1] = current.findIndex(current.getStart()
1036 + current.getLength());
1037 boolean hitres = false;
1038 for (int j = 0, rs = 0, ssiz = current.getLength(); j < ssiz; j++)
1040 if (!jalview.util.Comparison.isGap(current.getCharAt(j)))
1049 ends[i * 2 + 1] = j;
1050 if (j - ends[i * 2] > maxLength)
1052 maxLength = j - ends[i * 2];
1060 // now edit the flanking gaps to justify to either left or right
1061 int cLength, extent, diff;
1062 for (int i = 0; i < sequences.size(); i++)
1064 current = getSequenceAt(i);
1066 cLength = 1 + ends[i * 2 + 1] - ends[i * 2];
1067 diff = maxLength - cLength; // number of gaps to indent
1068 extent = current.getLength();
1072 if (extent > ends[i * 2 + 1])
1074 current.deleteChars(ends[i * 2 + 1] + 1, extent);
1077 if (ends[i * 2] > diff)
1079 current.deleteChars(0, ends[i * 2] - diff);
1084 if (ends[i * 2] < diff)
1086 current.insertCharAt(0, diff - ends[i * 2], gapCharacter);
1094 if (ends[i * 2] > 0)
1096 current.deleteChars(0, ends[i * 2]);
1098 ends[i * 2 + 1] -= ends[i * 2];
1099 extent -= ends[i * 2];
1101 if (extent > maxLength)
1103 current.deleteChars(maxLength + 1, extent);
1108 if (extent < maxLength)
1110 current.insertCharAt(extent, maxLength - extent, gapCharacter);
1120 public HiddenSequences getHiddenSequences()
1122 return hiddenSequences;
1126 public CigarArray getCompactAlignment()
1128 synchronized (sequences)
1130 SeqCigar alseqs[] = new SeqCigar[sequences.size()];
1132 for (SequenceI seq : sequences)
1134 alseqs[i++] = new SeqCigar(seq);
1136 CigarArray cal = new CigarArray(alseqs);
1137 cal.addOperation(CigarArray.M, getWidth());
1143 public void setProperty(Object key, Object value)
1145 if (alignmentProperties == null)
1146 alignmentProperties = new Hashtable();
1148 alignmentProperties.put(key, value);
1152 public Object getProperty(Object key)
1154 if (alignmentProperties != null)
1155 return alignmentProperties.get(key);
1161 public Hashtable getProperties()
1163 return alignmentProperties;
1166 AlignedCodonFrame[] codonFrameList = null;
1172 * jalview.datamodel.AlignmentI#addCodonFrame(jalview.datamodel.AlignedCodonFrame
1176 public void addCodonFrame(AlignedCodonFrame codons)
1180 if (codonFrameList == null)
1182 codonFrameList = new AlignedCodonFrame[]
1186 AlignedCodonFrame[] t = new AlignedCodonFrame[codonFrameList.length + 1];
1187 System.arraycopy(codonFrameList, 0, t, 0, codonFrameList.length);
1188 t[codonFrameList.length] = codons;
1195 * @see jalview.datamodel.AlignmentI#getCodonFrame(int)
1198 public AlignedCodonFrame getCodonFrame(int index)
1200 return codonFrameList[index];
1207 * jalview.datamodel.AlignmentI#getCodonFrame(jalview.datamodel.SequenceI)
1210 public AlignedCodonFrame[] getCodonFrame(SequenceI seq)
1212 if (seq == null || codonFrameList == null)
1214 Vector cframes = new Vector();
1215 for (int f = 0; f < codonFrameList.length; f++)
1217 if (codonFrameList[f].involvesSequence(seq))
1218 cframes.addElement(codonFrameList[f]);
1220 if (cframes.size() == 0)
1222 AlignedCodonFrame[] cfr = new AlignedCodonFrame[cframes.size()];
1223 cframes.copyInto(cfr);
1230 * @see jalview.datamodel.AlignmentI#getCodonFrames()
1233 public AlignedCodonFrame[] getCodonFrames()
1235 return codonFrameList;
1241 * @seejalview.datamodel.AlignmentI#removeCodonFrame(jalview.datamodel.
1242 * AlignedCodonFrame)
1245 public boolean removeCodonFrame(AlignedCodonFrame codons)
1247 if (codons == null || codonFrameList == null)
1249 boolean removed = false;
1250 int i = 0, iSize = codonFrameList.length;
1253 if (codonFrameList[i] == codons)
1258 System.arraycopy(codonFrameList, i + 1, codonFrameList, i, iSize
1272 public void append(AlignmentI toappend)
1274 if (toappend == this)
1276 System.err.println("Self append may cause a deadlock.");
1278 // TODO test this method for a future 2.5 release
1279 // currently tested for use in jalview.gui.SequenceFetcher
1280 boolean samegap = toappend.getGapCharacter() == getGapCharacter();
1281 char oldc = toappend.getGapCharacter();
1282 boolean hashidden = toappend.getHiddenSequences() != null
1283 && toappend.getHiddenSequences().hiddenSequences != null;
1284 // get all sequences including any hidden ones
1285 List<SequenceI> sqs = (hashidden) ? toappend.getHiddenSequences()
1286 .getFullAlignment().getSequences() : toappend.getSequences();
1291 for (SequenceI addedsq : sqs)
1295 char[] oldseq = addedsq.getSequence();
1296 for (int c = 0; c < oldseq.length; c++)
1298 if (oldseq[c] == oldc)
1300 oldseq[c] = gapCharacter;
1304 addSequence(addedsq);
1308 AlignmentAnnotation[] alan = toappend.getAlignmentAnnotation();
1309 for (int a = 0; alan != null && a < alan.length; a++)
1311 addAnnotation(alan[a]);
1313 AlignedCodonFrame[] acod = toappend.getCodonFrames();
1314 for (int a = 0; acod != null && a < acod.length; a++)
1316 this.addCodonFrame(acod[a]);
1318 List<SequenceGroup> sg = toappend.getGroups();
1321 for (SequenceGroup _sg : sg)
1326 if (toappend.getHiddenSequences() != null)
1328 HiddenSequences hs = toappend.getHiddenSequences();
1329 if (hiddenSequences == null)
1331 hiddenSequences = new HiddenSequences(this);
1333 if (hs.hiddenSequences != null)
1335 for (int s = 0; s < hs.hiddenSequences.length; s++)
1337 // hide the newly appended sequence in the alignment
1338 if (hs.hiddenSequences[s] != null)
1340 hiddenSequences.hideSequence(hs.hiddenSequences[s]);
1345 if (toappend.getProperties() != null)
1347 // we really can't do very much here - just try to concatenate strings
1348 // where property collisions occur.
1349 Enumeration key = toappend.getProperties().keys();
1350 while (key.hasMoreElements())
1352 Object k = key.nextElement();
1353 Object ourval = this.getProperty(k);
1354 Object toapprop = toappend.getProperty(k);
1357 if (ourval.getClass().equals(toapprop.getClass())
1358 && !ourval.equals(toapprop))
1360 if (ourval instanceof String)
1363 this.setProperty(k, ((String) ourval) + "; "
1364 + ((String) toapprop));
1368 if (ourval instanceof Vector)
1371 Enumeration theirv = ((Vector) toapprop).elements();
1372 while (theirv.hasMoreElements())
1374 ((Vector) ourval).addElement(theirv);
1382 // just add new property directly
1383 setProperty(k, toapprop);
1391 public AlignmentAnnotation findOrCreateAnnotation(String name,
1392 String calcId, boolean autoCalc, SequenceI seqRef,
1393 SequenceGroup groupRef)
1395 assert (name != null);
1396 if (annotations != null)
1398 for (AlignmentAnnotation annot : getAlignmentAnnotation())
1400 if (annot.autoCalculated == autoCalc && (name.equals(annot.label))
1401 && (calcId == null || annot.getCalcId().equals(calcId))
1402 && annot.sequenceRef == seqRef
1403 && annot.groupRef == groupRef)
1409 AlignmentAnnotation annot = new AlignmentAnnotation(name, name,
1410 new Annotation[1], 0f, 0f, AlignmentAnnotation.BAR_GRAPH);
1411 annot.hasText = false;
1412 annot.setCalcId(new String(calcId));
1413 annot.autoCalculated = autoCalc;
1416 annot.setSequenceRef(seqRef);
1418 annot.groupRef = groupRef;
1419 addAnnotation(annot);
1425 public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
1427 ArrayList<AlignmentAnnotation> aa = new ArrayList<AlignmentAnnotation>();
1428 for (AlignmentAnnotation a : getAlignmentAnnotation())
1430 if (a.getCalcId() == calcId
1431 || (a.getCalcId() != null && calcId != null && a.getCalcId()
1441 public void moveSelectedSequencesByOne(SequenceGroup sg,
1442 Map<SequenceI, SequenceCollectionI> map, boolean up)
1444 synchronized (sequences)
1449 for (int i = 1, iSize = sequences.size(); i < iSize; i++)
1451 SequenceI seq = sequences.get(i);
1452 if (!sg.getSequences(map).contains(seq))
1457 SequenceI temp = sequences.get(i - 1);
1458 if (sg.getSequences(null).contains(temp))
1463 sequences.set(i, temp);
1464 sequences.set(i - 1, seq);
1469 for (int i = sequences.size() - 2; i > -1; i--)
1471 SequenceI seq = sequences.get(i);
1472 if (!sg.getSequences(map).contains(seq))
1477 SequenceI temp = sequences.get(i + 1);
1478 if (sg.getSequences(map).contains(temp))
1483 sequences.set(i, temp);
1484 sequences.set(i + 1, seq);
1492 public void validateAnnotation(AlignmentAnnotation alignmentAnnotation)
1494 alignmentAnnotation.validateRangeAndDisplay();
1495 if (isNucleotide() && alignmentAnnotation.isValidStruc())
1497 hasRNAStructure = true;
1502 public int getEndRes()
1504 return getWidth() - 1;
1508 public int getStartRes()
1514 * In the case of AlignmentI - returns the dataset for the alignment, if set
1517 * @see jalview.datamodel.AnnotatedCollectionI#getContext()
1520 public AnnotatedCollectionI getContext()