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;
28 * Data structure to hold and manipulate a multiple sequence alignment
34 public class Alignment implements AlignmentI
36 protected Alignment dataset;
38 protected List<SequenceI> sequences;
40 protected List<SequenceGroup> groups = java.util.Collections
41 .synchronizedList(new ArrayList<SequenceGroup>());
43 protected char gapCharacter = '-';
45 protected int type = NUCLEOTIDE;
47 public static final int PROTEIN = 0;
49 public static final int NUCLEOTIDE = 1;
51 public boolean hasRNAStructure = false;
54 public AlignmentAnnotation[] annotations;
56 HiddenSequences hiddenSequences = new HiddenSequences(this);
58 public Hashtable alignmentProperties;
60 private void initAlignment(SequenceI[] seqs)
64 if (jalview.util.Comparison.isNucleotide(seqs))
73 sequences = java.util.Collections
74 .synchronizedList(new ArrayList<SequenceI>());
76 for (i = 0; i < seqs.length; i++)
78 sequences.add(seqs[i]);
84 * Make an alignment from an array of Sequences.
88 public Alignment(SequenceI[] seqs)
94 * Make a new alignment from an array of SeqCigars
99 public Alignment(SeqCigar[] alseqs)
101 SequenceI[] seqs = SeqCigar.createAlignmentSequences(alseqs,
102 gapCharacter, new ColumnSelection(), null);
107 * Make a new alignment from an CigarArray JBPNote - can only do this when
108 * compactAlignment does not contain hidden regions. JBPNote - must also check
109 * that compactAlignment resolves to a set of SeqCigars - or construct them
112 * @param compactAlignment
115 public static AlignmentI createAlignment(CigarArray compactAlignment)
117 throw new Error(MessageManager.getString("error.alignment_cigararray_not_implemented"));
118 // this(compactAlignment.refCigars);
124 * @return DOCUMENT ME!
127 public List<SequenceI> getSequences()
133 public List<SequenceI> getSequences(
134 Map<SequenceI, SequenceCollectionI> hiddenReps)
136 // TODO: in jalview 2.8 we don't do anything with hiddenreps - fix design to
142 public SequenceI[] getSequencesArray()
144 if (sequences == null)
146 synchronized (sequences)
148 return sequences.toArray(new SequenceI[sequences.size()]);
158 * @return DOCUMENT ME!
161 public SequenceI getSequenceAt(int i)
163 synchronized (sequences)
165 if (i > -1 && i < sequences.size())
167 return sequences.get(i);
174 * Adds a sequence to the alignment. Recalculates maxLength and size.
179 public void addSequence(SequenceI snew)
183 // maintain dataset integrity
184 if (snew.getDatasetSequence() != null)
186 getDataset().addSequence(snew.getDatasetSequence());
190 // derive new sequence
191 SequenceI adding = snew.deriveSequence();
192 getDataset().addSequence(adding.getDatasetSequence());
196 if (sequences == null)
198 initAlignment(new SequenceI[]
203 synchronized (sequences)
208 if (hiddenSequences != null)
209 hiddenSequences.adjustHeightSequenceAdded();
213 * Adds a sequence to the alignment. Recalculates maxLength and size.
218 public void setSequenceAt(int i, SequenceI snew)
220 SequenceI oldseq = getSequenceAt(i);
222 synchronized (sequences)
224 sequences.set(i, snew);
231 * @return DOCUMENT ME!
234 public List<SequenceGroup> getGroups()
240 public void finalize()
242 if (getDataset() != null)
243 getDataset().removeAlignmentRef();
249 hiddenSequences = null;
253 * decrement the alignmentRefs counter by one and call finalize if it goes to
256 private void removeAlignmentRef()
258 if (--alignmentRefs == 0)
271 public void deleteSequence(SequenceI s)
273 deleteSequence(findIndex(s));
283 public void deleteSequence(int i)
285 if (i > -1 && i < getHeight())
287 synchronized (sequences)
291 hiddenSequences.adjustHeightSequenceDeleted(i);
298 * @see jalview.datamodel.AlignmentI#findGroup(jalview.datamodel.SequenceI)
301 public SequenceGroup findGroup(SequenceI s)
303 synchronized (groups)
305 for (int i = 0; i < this.groups.size(); i++)
307 SequenceGroup sg = groups.get(i);
309 if (sg.getSequences(null).contains(s))
322 * jalview.datamodel.AlignmentI#findAllGroups(jalview.datamodel.SequenceI)
325 public SequenceGroup[] findAllGroups(SequenceI s)
327 ArrayList<SequenceGroup> temp = new ArrayList<SequenceGroup>();
329 synchronized (groups)
331 int gSize = groups.size();
332 for (int i = 0; i < gSize; i++)
334 SequenceGroup sg = groups.get(i);
335 if (sg == null || sg.getSequences(null) == null)
337 this.deleteGroup(sg);
342 if (sg.getSequences(null).contains(s))
348 SequenceGroup[] ret = new SequenceGroup[temp.size()];
349 return temp.toArray(ret);
354 public void addGroup(SequenceGroup sg)
356 synchronized (groups)
358 if (!groups.contains(sg))
360 if (hiddenSequences.getSize() > 0)
362 int i, iSize = sg.getSize();
363 for (i = 0; i < iSize; i++)
365 if (!sequences.contains(sg.getSequenceAt(i)))
367 sg.deleteSequence(sg.getSequenceAt(i), false);
373 if (sg.getSize() < 1)
385 * remove any annotation that references gp
388 * (if null, removes all group associated annotation)
390 private void removeAnnotationForGroup(SequenceGroup gp)
392 if (annotations == null || annotations.length == 0)
396 // remove annotation very quickly
397 AlignmentAnnotation[] t, todelete = new AlignmentAnnotation[annotations.length], tokeep = new AlignmentAnnotation[annotations.length];
401 for (i = 0, p = 0, k = 0; i < annotations.length; i++)
403 if (annotations[i].groupRef != null)
405 todelete[p++] = annotations[i];
409 tokeep[k++] = annotations[i];
415 for (i = 0, p = 0, k = 0; i < annotations.length; i++)
417 if (annotations[i].groupRef == gp)
419 todelete[p++] = annotations[i];
423 tokeep[k++] = annotations[i];
429 // clear out the group associated annotation.
430 for (i = 0; i < p; i++)
432 unhookAnnotation(todelete[i]);
435 t = new AlignmentAnnotation[k];
436 for (i = 0; i < k; i++)
445 public void deleteAllGroups()
447 synchronized (groups)
449 if (annotations != null)
451 removeAnnotationForGroup(null);
453 for (SequenceGroup sg : groups)
463 public void deleteGroup(SequenceGroup g)
465 synchronized (groups)
467 if (groups.contains(g))
469 removeAnnotationForGroup(g);
478 public SequenceI findName(String name)
480 return findName(name, false);
486 * @see jalview.datamodel.AlignmentI#findName(java.lang.String, boolean)
489 public SequenceI findName(String token, boolean b)
491 return findName(null, token, b);
497 * @see jalview.datamodel.AlignmentI#findName(SequenceI, java.lang.String,
501 public SequenceI findName(SequenceI startAfter, String token, boolean b)
506 String sqname = null;
507 if (startAfter != null)
509 // try to find the sequence in the alignment
510 boolean matched = false;
511 while (i < sequences.size())
513 if (getSequenceAt(i++) == startAfter)
524 while (i < sequences.size())
526 sq = getSequenceAt(i);
527 sqname = sq.getName();
528 if (sqname.equals(token) // exact match
529 || (b && // allow imperfect matches - case varies
530 (sqname.equalsIgnoreCase(token))))
532 return getSequenceAt(i);
542 public SequenceI[] findSequenceMatch(String name)
544 Vector matches = new Vector();
547 while (i < sequences.size())
549 if (getSequenceAt(i).getName().equals(name))
551 matches.addElement(getSequenceAt(i));
556 SequenceI[] result = new SequenceI[matches.size()];
557 for (i = 0; i < result.length; i++)
559 result[i] = (SequenceI) matches.elementAt(i);
569 * @see jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SequenceI)
572 public int findIndex(SequenceI s)
576 while (i < sequences.size())
578 if (s == getSequenceAt(i))
593 * jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SearchResults)
596 public int findIndex(SearchResults results)
600 while (i < sequences.size())
602 if (results.involvesSequence(getSequenceAt(i)))
614 * @return DOCUMENT ME!
617 public int getHeight()
619 return sequences.size();
625 * @return DOCUMENT ME!
628 public int getWidth()
632 for (int i = 0; i < sequences.size(); i++)
634 if (getSequenceAt(i).getLength() > maxLength)
636 maxLength = getSequenceAt(i).getLength();
650 public void setGapCharacter(char gc)
653 synchronized (sequences)
655 for (SequenceI seq : sequences)
657 seq.setSequence(seq.getSequenceAsString().replace('.', gc)
658 .replace('-', gc).replace(' ', gc));
666 * @return DOCUMENT ME!
669 public char getGapCharacter()
677 * @see jalview.datamodel.AlignmentI#isAligned()
680 public boolean isAligned()
682 return isAligned(false);
688 * @see jalview.datamodel.AlignmentI#isAligned(boolean)
691 public boolean isAligned(boolean includeHidden)
693 int width = getWidth();
694 if (hiddenSequences == null || hiddenSequences.getSize() == 0)
696 includeHidden = true; // no hidden sequences to check against.
698 for (int i = 0; i < sequences.size(); i++)
700 if (includeHidden || !hiddenSequences.isHidden(getSequenceAt(i)))
702 if (getSequenceAt(i).getLength() != width)
715 * @seejalview.datamodel.AlignmentI#deleteAnnotation(jalview.datamodel.
716 * AlignmentAnnotation)
719 public boolean deleteAnnotation(AlignmentAnnotation aa)
721 return deleteAnnotation(aa, true);
725 public boolean deleteAnnotation(AlignmentAnnotation aa, boolean unhook)
729 if (annotations != null)
731 aSize = annotations.length;
739 AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize - 1];
741 boolean swap = false;
744 for (int i = 0; i < aSize; i++)
746 if (annotations[i] == aa)
751 if (tIndex < temp.length)
752 temp[tIndex++] = annotations[i];
760 unhookAnnotation(aa);
767 * remove any object references associated with this annotation
771 private void unhookAnnotation(AlignmentAnnotation aa)
773 if (aa.sequenceRef != null)
775 aa.sequenceRef.removeAlignmentAnnotation(aa);
777 if (aa.groupRef != null)
779 // probably need to do more here in the future (post 2.5.0)
787 * @seejalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.
788 * AlignmentAnnotation)
791 public void addAnnotation(AlignmentAnnotation aa)
793 addAnnotation(aa, -1);
799 * @seejalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.
800 * AlignmentAnnotation, int)
803 public void addAnnotation(AlignmentAnnotation aa, int pos)
805 if (aa.getRNAStruc() != null)
807 hasRNAStructure = true;
811 if (annotations != null)
813 aSize = annotations.length + 1;
816 AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize];
818 if (pos == -1 || pos >= aSize)
820 temp[aSize - 1] = aa;
829 for (i = 0; i < (aSize - 1); i++, p++)
837 temp[p] = annotations[i];
846 public void setAnnotationIndex(AlignmentAnnotation aa, int index)
848 if (aa == null || annotations == null || annotations.length - 1 < index)
853 int aSize = annotations.length;
854 AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize];
858 for (int i = 0; i < aSize; i++)
867 temp[i] = annotations[i];
871 temp[i] = annotations[i - 1];
880 * returns all annotation on the alignment
882 public AlignmentAnnotation[] getAlignmentAnnotation()
888 public void setNucleotide(boolean b)
901 public boolean isNucleotide()
903 if (type == NUCLEOTIDE)
914 public boolean hasRNAStructure()
916 // TODO can it happen that structure is removed from alignment?
917 return hasRNAStructure;
921 public void setDataset(Alignment data)
923 if (dataset == null && data == null)
925 // Create a new dataset for this alignment.
926 // Can only be done once, if dataset is not null
927 // This will not be performed
928 SequenceI[] seqs = new SequenceI[getHeight()];
929 SequenceI currentSeq;
930 for (int i = 0; i < getHeight(); i++)
932 currentSeq = getSequenceAt(i);
933 if (currentSeq.getDatasetSequence() != null)
935 seqs[i] = currentSeq.getDatasetSequence();
939 seqs[i] = currentSeq.createDatasetSequence();
943 dataset = new Alignment(seqs);
945 else if (dataset == null && data != null)
949 dataset.addAlignmentRef();
953 * reference count for number of alignments referencing this one.
955 int alignmentRefs = 0;
958 * increase reference count to this alignment.
960 private void addAlignmentRef()
966 public Alignment getDataset()
972 public boolean padGaps()
974 boolean modified = false;
976 // Remove excess gaps from the end of alignment
980 for (int i = 0; i < sequences.size(); i++)
982 current = getSequenceAt(i);
983 for (int j = current.getLength(); j > maxLength; j--)
986 && !jalview.util.Comparison.isGap(current.getCharAt(j)))
997 for (int i = 0; i < sequences.size(); i++)
999 current = getSequenceAt(i);
1000 cLength = current.getLength();
1002 if (cLength < maxLength)
1004 current.insertCharAt(cLength, maxLength - cLength, gapCharacter);
1007 else if (current.getLength() > maxLength)
1009 current.deleteChars(maxLength, current.getLength());
1016 * Justify the sequences to the left or right by deleting and inserting gaps
1017 * before the initial residue or after the terminal residue
1020 * true if alignment padded to right, false to justify to left
1021 * @return true if alignment was changed
1024 public boolean justify(boolean right)
1026 boolean modified = false;
1028 // Remove excess gaps from the end of alignment
1030 int ends[] = new int[sequences.size() * 2];
1032 for (int i = 0; i < sequences.size(); i++)
1034 current = getSequenceAt(i);
1035 // This should really be a sequence method
1036 ends[i * 2] = current.findIndex(current.getStart());
1037 ends[i * 2 + 1] = current.findIndex(current.getStart()
1038 + current.getLength());
1039 boolean hitres = false;
1040 for (int j = 0, rs = 0, ssiz = current.getLength(); j < ssiz; j++)
1042 if (!jalview.util.Comparison.isGap(current.getCharAt(j)))
1051 ends[i * 2 + 1] = j;
1052 if (j - ends[i * 2] > maxLength)
1054 maxLength = j - ends[i * 2];
1062 // now edit the flanking gaps to justify to either left or right
1063 int cLength, extent, diff;
1064 for (int i = 0; i < sequences.size(); i++)
1066 current = getSequenceAt(i);
1068 cLength = 1 + ends[i * 2 + 1] - ends[i * 2];
1069 diff = maxLength - cLength; // number of gaps to indent
1070 extent = current.getLength();
1074 if (extent > ends[i * 2 + 1])
1076 current.deleteChars(ends[i * 2 + 1] + 1, extent);
1079 if (ends[i * 2] > diff)
1081 current.deleteChars(0, ends[i * 2] - diff);
1086 if (ends[i * 2] < diff)
1088 current.insertCharAt(0, diff - ends[i * 2], gapCharacter);
1096 if (ends[i * 2] > 0)
1098 current.deleteChars(0, ends[i * 2]);
1100 ends[i * 2 + 1] -= ends[i * 2];
1101 extent -= ends[i * 2];
1103 if (extent > maxLength)
1105 current.deleteChars(maxLength + 1, extent);
1110 if (extent < maxLength)
1112 current.insertCharAt(extent, maxLength - extent, gapCharacter);
1122 public HiddenSequences getHiddenSequences()
1124 return hiddenSequences;
1128 public CigarArray getCompactAlignment()
1130 synchronized (sequences)
1132 SeqCigar alseqs[] = new SeqCigar[sequences.size()];
1134 for (SequenceI seq : sequences)
1136 alseqs[i++] = new SeqCigar(seq);
1138 CigarArray cal = new CigarArray(alseqs);
1139 cal.addOperation(CigarArray.M, getWidth());
1145 public void setProperty(Object key, Object value)
1147 if (alignmentProperties == null)
1148 alignmentProperties = new Hashtable();
1150 alignmentProperties.put(key, value);
1154 public Object getProperty(Object key)
1156 if (alignmentProperties != null)
1157 return alignmentProperties.get(key);
1163 public Hashtable getProperties()
1165 return alignmentProperties;
1168 AlignedCodonFrame[] codonFrameList = null;
1174 * jalview.datamodel.AlignmentI#addCodonFrame(jalview.datamodel.AlignedCodonFrame
1178 public void addCodonFrame(AlignedCodonFrame codons)
1182 if (codonFrameList == null)
1184 codonFrameList = new AlignedCodonFrame[]
1188 AlignedCodonFrame[] t = new AlignedCodonFrame[codonFrameList.length + 1];
1189 System.arraycopy(codonFrameList, 0, t, 0, codonFrameList.length);
1190 t[codonFrameList.length] = codons;
1197 * @see jalview.datamodel.AlignmentI#getCodonFrame(int)
1200 public AlignedCodonFrame getCodonFrame(int index)
1202 return codonFrameList[index];
1209 * jalview.datamodel.AlignmentI#getCodonFrame(jalview.datamodel.SequenceI)
1212 public AlignedCodonFrame[] getCodonFrame(SequenceI seq)
1214 if (seq == null || codonFrameList == null)
1216 Vector cframes = new Vector();
1217 for (int f = 0; f < codonFrameList.length; f++)
1219 if (codonFrameList[f].involvesSequence(seq))
1220 cframes.addElement(codonFrameList[f]);
1222 if (cframes.size() == 0)
1224 AlignedCodonFrame[] cfr = new AlignedCodonFrame[cframes.size()];
1225 cframes.copyInto(cfr);
1232 * @see jalview.datamodel.AlignmentI#getCodonFrames()
1235 public AlignedCodonFrame[] getCodonFrames()
1237 return codonFrameList;
1243 * @seejalview.datamodel.AlignmentI#removeCodonFrame(jalview.datamodel.
1244 * AlignedCodonFrame)
1247 public boolean removeCodonFrame(AlignedCodonFrame codons)
1249 if (codons == null || codonFrameList == null)
1251 boolean removed = false;
1252 int i = 0, iSize = codonFrameList.length;
1255 if (codonFrameList[i] == codons)
1260 System.arraycopy(codonFrameList, i + 1, codonFrameList, i, iSize
1274 public void append(AlignmentI toappend)
1276 if (toappend == this)
1278 System.err.println("Self append may cause a deadlock.");
1280 // TODO test this method for a future 2.5 release
1281 // currently tested for use in jalview.gui.SequenceFetcher
1282 boolean samegap = toappend.getGapCharacter() == getGapCharacter();
1283 char oldc = toappend.getGapCharacter();
1284 boolean hashidden = toappend.getHiddenSequences() != null
1285 && toappend.getHiddenSequences().hiddenSequences != null;
1286 // get all sequences including any hidden ones
1287 List<SequenceI> sqs = (hashidden) ? toappend.getHiddenSequences()
1288 .getFullAlignment().getSequences() : toappend.getSequences();
1293 for (SequenceI addedsq : sqs)
1297 char[] oldseq = addedsq.getSequence();
1298 for (int c = 0; c < oldseq.length; c++)
1300 if (oldseq[c] == oldc)
1302 oldseq[c] = gapCharacter;
1306 addSequence(addedsq);
1310 AlignmentAnnotation[] alan = toappend.getAlignmentAnnotation();
1311 for (int a = 0; alan != null && a < alan.length; a++)
1313 addAnnotation(alan[a]);
1315 AlignedCodonFrame[] acod = toappend.getCodonFrames();
1316 for (int a = 0; acod != null && a < acod.length; a++)
1318 this.addCodonFrame(acod[a]);
1320 List<SequenceGroup> sg = toappend.getGroups();
1323 for (SequenceGroup _sg : sg)
1328 if (toappend.getHiddenSequences() != null)
1330 HiddenSequences hs = toappend.getHiddenSequences();
1331 if (hiddenSequences == null)
1333 hiddenSequences = new HiddenSequences(this);
1335 if (hs.hiddenSequences != null)
1337 for (int s = 0; s < hs.hiddenSequences.length; s++)
1339 // hide the newly appended sequence in the alignment
1340 if (hs.hiddenSequences[s] != null)
1342 hiddenSequences.hideSequence(hs.hiddenSequences[s]);
1347 if (toappend.getProperties() != null)
1349 // we really can't do very much here - just try to concatenate strings
1350 // where property collisions occur.
1351 Enumeration key = toappend.getProperties().keys();
1352 while (key.hasMoreElements())
1354 Object k = key.nextElement();
1355 Object ourval = this.getProperty(k);
1356 Object toapprop = toappend.getProperty(k);
1359 if (ourval.getClass().equals(toapprop.getClass())
1360 && !ourval.equals(toapprop))
1362 if (ourval instanceof String)
1365 this.setProperty(k, ((String) ourval) + "; "
1366 + ((String) toapprop));
1370 if (ourval instanceof Vector)
1373 Enumeration theirv = ((Vector) toapprop).elements();
1374 while (theirv.hasMoreElements())
1376 ((Vector) ourval).addElement(theirv);
1384 // just add new property directly
1385 setProperty(k, toapprop);
1393 public AlignmentAnnotation findOrCreateAnnotation(String name,
1394 String calcId, boolean autoCalc, SequenceI seqRef,
1395 SequenceGroup groupRef)
1397 assert (name != null);
1398 if (annotations != null)
1400 for (AlignmentAnnotation annot : getAlignmentAnnotation())
1402 if (annot.autoCalculated == autoCalc && (name.equals(annot.label))
1403 && (calcId == null || annot.getCalcId().equals(calcId))
1404 && annot.sequenceRef == seqRef
1405 && annot.groupRef == groupRef)
1411 AlignmentAnnotation annot = new AlignmentAnnotation(name, name,
1412 new Annotation[1], 0f, 0f, AlignmentAnnotation.BAR_GRAPH);
1413 annot.hasText = false;
1414 annot.setCalcId(new String(calcId));
1415 annot.autoCalculated = autoCalc;
1418 annot.setSequenceRef(seqRef);
1420 annot.groupRef = groupRef;
1421 addAnnotation(annot);
1427 public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
1429 ArrayList<AlignmentAnnotation> aa = new ArrayList<AlignmentAnnotation>();
1430 for (AlignmentAnnotation a : getAlignmentAnnotation())
1432 if (a.getCalcId() == calcId
1433 || (a.getCalcId() != null && calcId != null && a.getCalcId()
1443 public void moveSelectedSequencesByOne(SequenceGroup sg,
1444 Map<SequenceI, SequenceCollectionI> map, boolean up)
1446 synchronized (sequences)
1451 for (int i = 1, iSize = sequences.size(); i < iSize; i++)
1453 SequenceI seq = sequences.get(i);
1454 if (!sg.getSequences(map).contains(seq))
1459 SequenceI temp = sequences.get(i - 1);
1460 if (sg.getSequences(null).contains(temp))
1465 sequences.set(i, temp);
1466 sequences.set(i - 1, seq);
1471 for (int i = sequences.size() - 2; i > -1; i--)
1473 SequenceI seq = sequences.get(i);
1474 if (!sg.getSequences(map).contains(seq))
1479 SequenceI temp = sequences.get(i + 1);
1480 if (sg.getSequences(map).contains(temp))
1485 sequences.set(i, temp);
1486 sequences.set(i + 1, seq);
1494 public void validateAnnotation(AlignmentAnnotation alignmentAnnotation)
1496 alignmentAnnotation.validateRangeAndDisplay();
1497 if (isNucleotide() && alignmentAnnotation.isValidStruc())
1499 hasRNAStructure = true;
1504 public int getEndRes()
1506 return getWidth() - 1;
1510 public int getStartRes()
1516 * In the case of AlignmentI - returns the dataset for the alignment, if set
1519 * @see jalview.datamodel.AnnotatedCollectionI#getContext()
1522 public AnnotatedCollectionI getContext()