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) {
460 public void deleteGroup(SequenceGroup g)
462 synchronized (groups)
464 if (groups.contains(g))
466 removeAnnotationForGroup(g);
475 public SequenceI findName(String name)
477 return findName(name, false);
483 * @see jalview.datamodel.AlignmentI#findName(java.lang.String, boolean)
486 public SequenceI findName(String token, boolean b)
488 return findName(null, token, b);
494 * @see jalview.datamodel.AlignmentI#findName(SequenceI, java.lang.String,
498 public SequenceI findName(SequenceI startAfter, String token, boolean b)
503 String sqname = null;
504 if (startAfter != null)
506 // try to find the sequence in the alignment
507 boolean matched = false;
508 while (i < sequences.size())
510 if (getSequenceAt(i++) == startAfter)
521 while (i < sequences.size())
523 sq = getSequenceAt(i);
524 sqname = sq.getName();
525 if (sqname.equals(token) // exact match
526 || (b && // allow imperfect matches - case varies
527 (sqname.equalsIgnoreCase(token))))
529 return getSequenceAt(i);
539 public SequenceI[] findSequenceMatch(String name)
541 Vector matches = new Vector();
544 while (i < sequences.size())
546 if (getSequenceAt(i).getName().equals(name))
548 matches.addElement(getSequenceAt(i));
553 SequenceI[] result = new SequenceI[matches.size()];
554 for (i = 0; i < result.length; i++)
556 result[i] = (SequenceI) matches.elementAt(i);
566 * @see jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SequenceI)
569 public int findIndex(SequenceI s)
573 while (i < sequences.size())
575 if (s == getSequenceAt(i))
590 * jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SearchResults)
593 public int findIndex(SearchResults results)
597 while (i < sequences.size())
599 if (results.involvesSequence(getSequenceAt(i)))
611 * @return DOCUMENT ME!
614 public int getHeight()
616 return sequences.size();
622 * @return DOCUMENT ME!
625 public int getWidth()
629 for (int i = 0; i < sequences.size(); i++)
631 if (getSequenceAt(i).getLength() > maxLength)
633 maxLength = getSequenceAt(i).getLength();
647 public void setGapCharacter(char gc)
650 synchronized (sequences)
652 for (SequenceI seq : sequences)
654 seq.setSequence(seq.getSequenceAsString().replace('.', gc)
655 .replace('-', gc).replace(' ', gc));
663 * @return DOCUMENT ME!
666 public char getGapCharacter()
674 * @see jalview.datamodel.AlignmentI#isAligned()
677 public boolean isAligned()
679 return isAligned(false);
685 * @see jalview.datamodel.AlignmentI#isAligned(boolean)
688 public boolean isAligned(boolean includeHidden)
690 int width = getWidth();
691 if (hiddenSequences == null || hiddenSequences.getSize() == 0)
693 includeHidden = true; // no hidden sequences to check against.
695 for (int i = 0; i < sequences.size(); i++)
697 if (includeHidden || !hiddenSequences.isHidden(getSequenceAt(i)))
699 if (getSequenceAt(i).getLength() != width)
712 * @seejalview.datamodel.AlignmentI#deleteAnnotation(jalview.datamodel.
713 * AlignmentAnnotation)
716 public boolean deleteAnnotation(AlignmentAnnotation aa)
718 return deleteAnnotation(aa, true);
722 public boolean deleteAnnotation(AlignmentAnnotation aa, boolean unhook)
726 if (annotations != null)
728 aSize = annotations.length;
736 AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize - 1];
738 boolean swap = false;
741 for (int i = 0; i < aSize; i++)
743 if (annotations[i] == aa)
748 if (tIndex < temp.length)
749 temp[tIndex++] = annotations[i];
757 unhookAnnotation(aa);
764 * remove any object references associated with this annotation
768 private void unhookAnnotation(AlignmentAnnotation aa)
770 if (aa.sequenceRef != null)
772 aa.sequenceRef.removeAlignmentAnnotation(aa);
774 if (aa.groupRef != null)
776 // probably need to do more here in the future (post 2.5.0)
784 * @seejalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.
785 * AlignmentAnnotation)
788 public void addAnnotation(AlignmentAnnotation aa)
790 addAnnotation(aa, -1);
796 * @seejalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.
797 * AlignmentAnnotation, int)
800 public void addAnnotation(AlignmentAnnotation aa, int pos)
802 if (aa.getRNAStruc() != null)
804 hasRNAStructure = true;
808 if (annotations != null)
810 aSize = annotations.length + 1;
813 AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize];
815 if (pos == -1 || pos >= aSize)
817 temp[aSize - 1] = aa;
826 for (i = 0; i < (aSize - 1); i++, p++)
834 temp[p] = annotations[i];
843 public void setAnnotationIndex(AlignmentAnnotation aa, int index)
845 if (aa == null || annotations == null || annotations.length - 1 < index)
850 int aSize = annotations.length;
851 AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize];
855 for (int i = 0; i < aSize; i++)
864 temp[i] = annotations[i];
868 temp[i] = annotations[i - 1];
877 * returns all annotation on the alignment
879 public AlignmentAnnotation[] getAlignmentAnnotation()
885 public void setNucleotide(boolean b)
898 public boolean isNucleotide()
900 if (type == NUCLEOTIDE)
911 public boolean hasRNAStructure()
913 // TODO can it happen that structure is removed from alignment?
914 return hasRNAStructure;
918 public void setDataset(Alignment data)
920 if (dataset == null && data == null)
922 // Create a new dataset for this alignment.
923 // Can only be done once, if dataset is not null
924 // This will not be performed
925 SequenceI[] seqs = new SequenceI[getHeight()];
926 SequenceI currentSeq;
927 for (int i = 0; i < getHeight(); i++)
929 currentSeq = getSequenceAt(i);
930 if (currentSeq.getDatasetSequence() != null)
932 seqs[i] = currentSeq.getDatasetSequence();
936 seqs[i] = currentSeq.createDatasetSequence();
940 dataset = new Alignment(seqs);
942 else if (dataset == null && data != null)
946 dataset.addAlignmentRef();
950 * reference count for number of alignments referencing this one.
952 int alignmentRefs = 0;
955 * increase reference count to this alignment.
957 private void addAlignmentRef()
963 public Alignment getDataset()
969 public boolean padGaps()
971 boolean modified = false;
973 // Remove excess gaps from the end of alignment
977 for (int i = 0; i < sequences.size(); i++)
979 current = getSequenceAt(i);
980 for (int j = current.getLength(); j > maxLength; j--)
983 && !jalview.util.Comparison.isGap(current.getCharAt(j)))
994 for (int i = 0; i < sequences.size(); i++)
996 current = getSequenceAt(i);
997 cLength = current.getLength();
999 if (cLength < maxLength)
1001 current.insertCharAt(cLength, maxLength - cLength, gapCharacter);
1004 else if (current.getLength() > maxLength)
1006 current.deleteChars(maxLength, current.getLength());
1013 * Justify the sequences to the left or right by deleting and inserting gaps
1014 * before the initial residue or after the terminal residue
1017 * true if alignment padded to right, false to justify to left
1018 * @return true if alignment was changed
1021 public boolean justify(boolean right)
1023 boolean modified = false;
1025 // Remove excess gaps from the end of alignment
1027 int ends[] = new int[sequences.size() * 2];
1029 for (int i = 0; i < sequences.size(); i++)
1031 current = getSequenceAt(i);
1032 // This should really be a sequence method
1033 ends[i * 2] = current.findIndex(current.getStart());
1034 ends[i * 2 + 1] = current.findIndex(current.getStart()
1035 + current.getLength());
1036 boolean hitres = false;
1037 for (int j = 0, rs = 0, ssiz = current.getLength(); j < ssiz; j++)
1039 if (!jalview.util.Comparison.isGap(current.getCharAt(j)))
1048 ends[i * 2 + 1] = j;
1049 if (j - ends[i * 2] > maxLength)
1051 maxLength = j - ends[i * 2];
1059 // now edit the flanking gaps to justify to either left or right
1060 int cLength, extent, diff;
1061 for (int i = 0; i < sequences.size(); i++)
1063 current = getSequenceAt(i);
1065 cLength = 1 + ends[i * 2 + 1] - ends[i * 2];
1066 diff = maxLength - cLength; // number of gaps to indent
1067 extent = current.getLength();
1071 if (extent > ends[i * 2 + 1])
1073 current.deleteChars(ends[i * 2 + 1] + 1, extent);
1076 if (ends[i * 2] > diff)
1078 current.deleteChars(0, ends[i * 2] - diff);
1083 if (ends[i * 2] < diff)
1085 current.insertCharAt(0, diff - ends[i * 2], gapCharacter);
1093 if (ends[i * 2] > 0)
1095 current.deleteChars(0, ends[i * 2]);
1097 ends[i * 2 + 1] -= ends[i * 2];
1098 extent -= ends[i * 2];
1100 if (extent > maxLength)
1102 current.deleteChars(maxLength + 1, extent);
1107 if (extent < maxLength)
1109 current.insertCharAt(extent, maxLength - extent, gapCharacter);
1119 public HiddenSequences getHiddenSequences()
1121 return hiddenSequences;
1125 public CigarArray getCompactAlignment()
1127 synchronized (sequences)
1129 SeqCigar alseqs[] = new SeqCigar[sequences.size()];
1131 for (SequenceI seq : sequences)
1133 alseqs[i++] = new SeqCigar(seq);
1135 CigarArray cal = new CigarArray(alseqs);
1136 cal.addOperation(CigarArray.M, getWidth());
1142 public void setProperty(Object key, Object value)
1144 if (alignmentProperties == null)
1145 alignmentProperties = new Hashtable();
1147 alignmentProperties.put(key, value);
1151 public Object getProperty(Object key)
1153 if (alignmentProperties != null)
1154 return alignmentProperties.get(key);
1160 public Hashtable getProperties()
1162 return alignmentProperties;
1165 AlignedCodonFrame[] codonFrameList = null;
1171 * jalview.datamodel.AlignmentI#addCodonFrame(jalview.datamodel.AlignedCodonFrame
1175 public void addCodonFrame(AlignedCodonFrame codons)
1179 if (codonFrameList == null)
1181 codonFrameList = new AlignedCodonFrame[]
1185 AlignedCodonFrame[] t = new AlignedCodonFrame[codonFrameList.length + 1];
1186 System.arraycopy(codonFrameList, 0, t, 0, codonFrameList.length);
1187 t[codonFrameList.length] = codons;
1194 * @see jalview.datamodel.AlignmentI#getCodonFrame(int)
1197 public AlignedCodonFrame getCodonFrame(int index)
1199 return codonFrameList[index];
1206 * jalview.datamodel.AlignmentI#getCodonFrame(jalview.datamodel.SequenceI)
1209 public AlignedCodonFrame[] getCodonFrame(SequenceI seq)
1211 if (seq == null || codonFrameList == null)
1213 Vector cframes = new Vector();
1214 for (int f = 0; f < codonFrameList.length; f++)
1216 if (codonFrameList[f].involvesSequence(seq))
1217 cframes.addElement(codonFrameList[f]);
1219 if (cframes.size() == 0)
1221 AlignedCodonFrame[] cfr = new AlignedCodonFrame[cframes.size()];
1222 cframes.copyInto(cfr);
1229 * @see jalview.datamodel.AlignmentI#getCodonFrames()
1232 public AlignedCodonFrame[] getCodonFrames()
1234 return codonFrameList;
1240 * @seejalview.datamodel.AlignmentI#removeCodonFrame(jalview.datamodel.
1241 * AlignedCodonFrame)
1244 public boolean removeCodonFrame(AlignedCodonFrame codons)
1246 if (codons == null || codonFrameList == null)
1248 boolean removed = false;
1249 int i = 0, iSize = codonFrameList.length;
1252 if (codonFrameList[i] == codons)
1257 System.arraycopy(codonFrameList, i + 1, codonFrameList, i, iSize
1271 public void append(AlignmentI toappend)
1273 if (toappend == this)
1275 System.err.println("Self append may cause a deadlock.");
1277 // TODO test this method for a future 2.5 release
1278 // currently tested for use in jalview.gui.SequenceFetcher
1279 boolean samegap = toappend.getGapCharacter() == getGapCharacter();
1280 char oldc = toappend.getGapCharacter();
1281 boolean hashidden = toappend.getHiddenSequences() != null
1282 && toappend.getHiddenSequences().hiddenSequences != null;
1283 // get all sequences including any hidden ones
1284 List<SequenceI> sqs = (hashidden) ? toappend.getHiddenSequences()
1285 .getFullAlignment().getSequences() : toappend.getSequences();
1290 for (SequenceI addedsq : sqs)
1294 char[] oldseq = addedsq.getSequence();
1295 for (int c = 0; c < oldseq.length; c++)
1297 if (oldseq[c] == oldc)
1299 oldseq[c] = gapCharacter;
1303 addSequence(addedsq);
1307 AlignmentAnnotation[] alan = toappend.getAlignmentAnnotation();
1308 for (int a = 0; alan != null && a < alan.length; a++)
1310 addAnnotation(alan[a]);
1312 AlignedCodonFrame[] acod = toappend.getCodonFrames();
1313 for (int a = 0; acod != null && a < acod.length; a++)
1315 this.addCodonFrame(acod[a]);
1317 List<SequenceGroup> sg = toappend.getGroups();
1320 for (SequenceGroup _sg : sg)
1325 if (toappend.getHiddenSequences() != null)
1327 HiddenSequences hs = toappend.getHiddenSequences();
1328 if (hiddenSequences == null)
1330 hiddenSequences = new HiddenSequences(this);
1332 if (hs.hiddenSequences != null)
1334 for (int s = 0; s < hs.hiddenSequences.length; s++)
1336 // hide the newly appended sequence in the alignment
1337 if (hs.hiddenSequences[s] != null)
1339 hiddenSequences.hideSequence(hs.hiddenSequences[s]);
1344 if (toappend.getProperties() != null)
1346 // we really can't do very much here - just try to concatenate strings
1347 // where property collisions occur.
1348 Enumeration key = toappend.getProperties().keys();
1349 while (key.hasMoreElements())
1351 Object k = key.nextElement();
1352 Object ourval = this.getProperty(k);
1353 Object toapprop = toappend.getProperty(k);
1356 if (ourval.getClass().equals(toapprop.getClass())
1357 && !ourval.equals(toapprop))
1359 if (ourval instanceof String)
1362 this.setProperty(k, ((String) ourval) + "; "
1363 + ((String) toapprop));
1367 if (ourval instanceof Vector)
1370 Enumeration theirv = ((Vector) toapprop).elements();
1371 while (theirv.hasMoreElements())
1373 ((Vector) ourval).addElement(theirv);
1381 // just add new property directly
1382 setProperty(k, toapprop);
1390 public AlignmentAnnotation findOrCreateAnnotation(String name,
1391 String calcId, boolean autoCalc, SequenceI seqRef,
1392 SequenceGroup groupRef)
1394 assert (name != null);
1395 if (annotations != null)
1397 for (AlignmentAnnotation annot : getAlignmentAnnotation())
1399 if (annot.autoCalculated == autoCalc && (name.equals(annot.label))
1400 && (calcId == null || annot.getCalcId().equals(calcId))
1401 && annot.sequenceRef == seqRef
1402 && annot.groupRef == groupRef)
1408 AlignmentAnnotation annot = new AlignmentAnnotation(name, name,
1409 new Annotation[1], 0f, 0f, AlignmentAnnotation.BAR_GRAPH);
1410 annot.hasText = false;
1411 annot.setCalcId(new String(calcId));
1412 annot.autoCalculated = autoCalc;
1415 annot.setSequenceRef(seqRef);
1417 annot.groupRef = groupRef;
1418 addAnnotation(annot);
1424 public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
1426 ArrayList<AlignmentAnnotation> aa = new ArrayList<AlignmentAnnotation>();
1427 for (AlignmentAnnotation a : getAlignmentAnnotation())
1429 if (a.getCalcId() == calcId
1430 || (a.getCalcId() != null && calcId != null && a.getCalcId()
1440 public void moveSelectedSequencesByOne(SequenceGroup sg,
1441 Map<SequenceI, SequenceCollectionI> map, boolean up)
1443 synchronized (sequences)
1448 for (int i = 1, iSize = sequences.size(); i < iSize; i++)
1450 SequenceI seq = sequences.get(i);
1451 if (!sg.getSequences(map).contains(seq))
1456 SequenceI temp = sequences.get(i - 1);
1457 if (sg.getSequences(null).contains(temp))
1462 sequences.set(i, temp);
1463 sequences.set(i - 1, seq);
1468 for (int i = sequences.size() - 2; i > -1; i--)
1470 SequenceI seq = sequences.get(i);
1471 if (!sg.getSequences(map).contains(seq))
1476 SequenceI temp = sequences.get(i + 1);
1477 if (sg.getSequences(map).contains(temp))
1482 sequences.set(i, temp);
1483 sequences.set(i + 1, seq);
1490 public void validateAnnotation(AlignmentAnnotation alignmentAnnotation)
1492 alignmentAnnotation.validateRangeAndDisplay();
1493 if (isNucleotide() && alignmentAnnotation.isValidStruc())
1495 hasRNAStructure = true;
1499 public int getEndRes()
1501 return getWidth()-1;
1503 public int getStartRes()
1508 /* In the case of AlignmentI - returns the dataset for the alignment, if set
1510 * @see jalview.datamodel.AnnotatedCollectionI#getContext()
1513 public AnnotatedCollectionI getContext()