2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ 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.analysis.AAFrequency;
24 import jalview.analysis.Conservation;
25 import jalview.renderer.ResidueShader;
26 import jalview.renderer.ResidueShaderI;
27 import jalview.schemes.ColourSchemeI;
29 import java.awt.Color;
30 import java.beans.PropertyChangeListener;
31 import java.beans.PropertyChangeSupport;
32 import java.util.ArrayList;
33 import java.util.List;
37 * Collects a set contiguous ranges on a set of sequences
42 public class SequenceGroup implements AnnotatedCollectionI
44 // TODO ideally this event notification functionality should be separated into
46 // subclass of ViewportProperties similarly to ViewportRanges. Done here as
47 // quick fix for JAL-2665
48 public static final String SEQ_GROUP_CHANGED = "Sequence group changed";
50 protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(
53 public void addPropertyChangeListener(PropertyChangeListener listener)
55 changeSupport.addPropertyChangeListener(listener);
58 public void removePropertyChangeListener(PropertyChangeListener listener)
60 changeSupport.removePropertyChangeListener(listener);
62 // end of event notification functionality initialisation
68 Conservation conserve;
70 boolean displayBoxes = true;
72 boolean displayText = true;
74 boolean colourText = false;
77 * True if the group is defined as a group on the alignment, false if it is
80 boolean isDefined = false;
83 * after Olivier's non-conserved only character display
85 boolean showNonconserved = false;
90 private List<SequenceI> sequences = new ArrayList<>();
93 * representative sequence for this group (if any)
95 private SequenceI seqrep = null;
100 * Colourscheme applied to group if any
102 public ResidueShaderI cs;
104 // start column (base 0)
107 // end column (base 0)
110 public Color outlineColour = Color.black;
112 public Color idColour = null;
114 public int thresholdTextColour = 0;
116 public Color textColour = Color.black;
118 public Color textColour2 = Color.white;
121 * consensus calculation property
123 private boolean ignoreGapsInConsensus = true;
126 * consensus calculation property
128 private boolean showSequenceLogo = false;
131 * flag indicating if logo should be rendered normalised
133 private boolean normaliseSequenceLogo;
136 * visibility of rows or represented rows covered by group
138 private boolean hidereps = false;
141 * visibility of columns intersecting this group
143 private boolean hidecols = false;
145 AlignmentAnnotation consensus = null;
147 AlignmentAnnotation conservation = null;
149 private boolean showConsensusHistogram;
151 private AnnotatedCollectionI context;
154 * Creates a new SequenceGroup object.
156 public SequenceGroup()
158 groupName = "JGroup:" + this.hashCode();
159 cs = new ResidueShader();
163 * Creates a new SequenceGroup object.
168 * @param displayBoxes
172 * first column of group
174 * last column of group
176 public SequenceGroup(List<SequenceI> sequences, String groupName,
177 ColourSchemeI scheme, boolean displayBoxes, boolean displayText,
178 boolean colourText, int start, int end)
181 this.sequences = sequences;
182 this.groupName = groupName;
183 this.displayBoxes = displayBoxes;
184 this.displayText = displayText;
185 this.colourText = colourText;
186 this.cs = new ResidueShader(scheme);
189 recalcConservation();
197 public SequenceGroup(SequenceGroup seqsel)
202 sequences = new ArrayList<>();
203 sequences.addAll(seqsel.sequences);
204 if (seqsel.groupName != null)
206 groupName = new String(seqsel.groupName);
208 displayBoxes = seqsel.displayBoxes;
209 displayText = seqsel.displayText;
210 colourText = seqsel.colourText;
211 startRes = seqsel.startRes;
212 endRes = seqsel.endRes;
213 cs = new ResidueShader((ResidueShader) seqsel.cs);
214 if (seqsel.description != null)
216 description = new String(seqsel.description);
218 hidecols = seqsel.hidecols;
219 hidereps = seqsel.hidereps;
220 showNonconserved = seqsel.showNonconserved;
221 showSequenceLogo = seqsel.showSequenceLogo;
222 normaliseSequenceLogo = seqsel.normaliseSequenceLogo;
223 showConsensusHistogram = seqsel.showConsensusHistogram;
224 idColour = seqsel.idColour;
225 outlineColour = seqsel.outlineColour;
226 seqrep = seqsel.seqrep;
227 textColour = seqsel.textColour;
228 textColour2 = seqsel.textColour2;
229 thresholdTextColour = seqsel.thresholdTextColour;
230 width = seqsel.width;
231 ignoreGapsInConsensus = seqsel.ignoreGapsInConsensus;
232 if (seqsel.conserve != null)
234 recalcConservation(); // safer than
235 // aaFrequency = (Vector) seqsel.aaFrequency.clone(); // ??
240 public boolean isShowSequenceLogo()
242 return showSequenceLogo;
245 public SequenceI[] getSelectionAsNewSequences(AlignmentI align)
247 int iSize = sequences.size();
248 SequenceI[] seqs = new SequenceI[iSize];
249 SequenceI[] inorder = getSequencesInOrder(align);
251 for (int i = 0, ipos = 0; i < inorder.length; i++)
253 SequenceI seq = inorder[i];
255 seqs[ipos] = seq.getSubSequence(startRes, endRes + 1);
256 if (seqs[ipos] != null)
258 seqs[ipos].setDescription(seq.getDescription());
259 seqs[ipos].setDBRefs(seq.getDBRefs());
260 seqs[ipos].setSequenceFeatures(seq.getSequenceFeatures());
261 if (seq.getDatasetSequence() != null)
263 seqs[ipos].setDatasetSequence(seq.getDatasetSequence());
266 if (seq.getAnnotation() != null)
268 AlignmentAnnotation[] alann = align.getAlignmentAnnotation();
269 // Only copy annotation that is either a score or referenced by the
270 // alignment's annotation vector
271 for (int a = 0; a < seq.getAnnotation().length; a++)
273 AlignmentAnnotation tocopy = seq.getAnnotation()[a];
276 boolean found = false;
277 for (int pos = 0; pos < alann.length; pos++)
279 if (alann[pos] == tocopy)
290 AlignmentAnnotation newannot = new AlignmentAnnotation(
291 seq.getAnnotation()[a]);
292 newannot.restrict(startRes, endRes);
293 newannot.setSequenceRef(seqs[ipos]);
294 newannot.adjustForAlignment();
295 seqs[ipos].addAlignmentAnnotation(newannot);
305 if (iSize != inorder.length)
307 SequenceI[] nseqs = new SequenceI[iSize];
308 System.arraycopy(seqs, 0, nseqs, 0, iSize);
316 * If sequence ends in gaps, the end residue can be correctly calculated here
322 public int findEndRes(SequenceI seq)
327 for (int j = 0; j < endRes + 1 && j < seq.getLength(); j++)
329 ch = seq.getCharAt(j);
330 if (!jalview.util.Comparison.isGap((ch)))
338 eres += seq.getStart() - 1;
345 public List<SequenceI> getSequences()
351 public List<SequenceI> getSequences(
352 Map<SequenceI, SequenceCollectionI> hiddenReps)
354 if (hiddenReps == null)
356 // TODO: need a synchronizedCollection here ?
361 List<SequenceI> allSequences = new ArrayList<>();
362 for (SequenceI seq : sequences)
364 allSequences.add(seq);
365 if (hiddenReps.containsKey(seq))
367 SequenceCollectionI hsg = hiddenReps.get(seq);
368 for (SequenceI seq2 : hsg.getSequences())
370 if (seq2 != seq && !allSequences.contains(seq2))
372 allSequences.add(seq2);
382 public SequenceI[] getSequencesAsArray(
383 Map<SequenceI, SequenceCollectionI> map)
385 List<SequenceI> tmp = getSequences(map);
390 return tmp.toArray(new SequenceI[tmp.size()]);
399 * @return DOCUMENT ME!
401 public boolean adjustForRemoveLeft(int col)
403 // return value is true if the group still exists
406 startRes = startRes - col;
411 endRes = endRes - col;
413 if (startRes > endRes)
420 // must delete this group!!
433 * @return DOCUMENT ME!
435 public boolean adjustForRemoveRight(int col)
454 * @return DOCUMENT ME!
456 public String getName()
461 public String getDescription()
472 public void setName(String name)
475 // TODO: URGENT: update dependent objects (annotation row)
478 public void setDescription(String desc)
486 * @return DOCUMENT ME!
488 public Conservation getConservation()
499 public void setConservation(Conservation c)
505 * Add s to this sequence group. If aligment sequence is already contained in
506 * group, it will not be added again, but recalculation may happen if the flag
510 * alignment sequence to be added
512 * true means Group's conservation should be recalculated
514 public void addSequence(SequenceI s, boolean recalc)
516 synchronized (sequences)
518 if (s != null && !sequences.contains(s))
520 List<SequenceI> before = sequences;
522 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before,
528 recalcConservation();
534 * Max Gaps Threshold (percent) for performing a conservation calculation
536 private int consPercGaps = 25;
539 * @return Max Gaps Threshold for performing a conservation calculation
541 public int getConsPercGaps()
547 * set Max Gaps Threshold (percent) for performing a conservation calculation
549 * @param consPercGaps
551 public void setConsPercGaps(int consPercGaps)
553 this.consPercGaps = consPercGaps;
557 * calculate residue conservation and colourschemes for group - but only if
558 * necessary. returns true if the calculation resulted in a visible change to
561 public boolean recalcConservation()
563 return recalcConservation(false);
567 * calculate residue conservation for group - but only if necessary. returns
568 * true if the calculation resulted in a visible change to group
571 * when set, colourschemes for this group are not refreshed after
574 public boolean recalcConservation(boolean defer)
576 if (cs == null && consensus == null && conservation == null)
580 // TODO: try harder to detect changes in state in order to minimise
581 // recalculation effort
585 ProfilesI cnsns = AAFrequency.calculate(sequences, startRes,
586 endRes + 1, showSequenceLogo);
587 if (consensus != null)
589 _updateConsensusRow(cnsns, sequences.size());
594 cs.setConsensus(cnsns);
598 if ((conservation != null)
599 || (cs != null && cs.conservationApplied()))
601 Conservation c = new Conservation(groupName, sequences, startRes,
604 c.verdict(false, consPercGaps);
605 if (conservation != null)
607 _updateConservationRow(c);
611 if (cs.conservationApplied())
613 cs.setConservation(c);
616 // eager update - will cause a refresh of overview regardless
619 if (cs != null && !defer)
621 // TODO: JAL-2034 should cs.alignmentChanged modify return state
622 cs.alignmentChanged(context != null ? context : this, null);
629 } catch (java.lang.OutOfMemoryError err)
632 System.out.println("Out of memory loading groups: " + err);
637 private void _updateConservationRow(Conservation c)
639 if (conservation == null)
644 conservation.label = "Conservation for " + getName();
645 conservation.description = "Conservation for group " + getName()
646 + " less than " + consPercGaps + "% gaps";
647 // preserve width if already set
648 int aWidth = (conservation.annotations != null) ? (endRes < conservation.annotations.length ? conservation.annotations.length
651 conservation.annotations = null;
652 conservation.annotations = new Annotation[aWidth]; // should be alignment
654 c.completeAnnotations(conservation, null, startRes, endRes + 1);
657 public ProfilesI consensusData = null;
659 private void _updateConsensusRow(ProfilesI cnsns, long nseq)
661 if (consensus == null)
665 consensus.label = "Consensus for " + getName();
666 consensus.description = "Percent Identity";
667 consensusData = cnsns;
668 // preserve width if already set
669 int aWidth = (consensus.annotations != null) ? (endRes < consensus.annotations.length ? consensus.annotations.length
672 consensus.annotations = null;
673 consensus.annotations = new Annotation[aWidth]; // should be alignment width
675 AAFrequency.completeConsensus(consensus, cnsns, startRes, endRes + 1,
676 ignoreGapsInConsensus, showSequenceLogo, nseq); // TODO: setting
679 // ignoreGapsInConsensusCalculation);
684 * sequence to either add or remove from group
686 * flag passed to delete/addSequence to indicate if group properties
687 * should be recalculated
689 public void addOrRemove(SequenceI s, boolean recalc)
691 synchronized (sequences)
693 if (sequences.contains(s))
695 deleteSequence(s, recalc);
699 addSequence(s, recalc);
710 * true means recalculate conservation
712 public void deleteSequence(SequenceI s, boolean recalc)
714 synchronized (sequences)
716 List<SequenceI> before = sequences;
718 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before,
723 recalcConservation();
731 * @return the first column selected by this group. Runs from 0<=i<N_cols
734 public int getStartRes()
741 * @return the groups last selected column. Runs from 0<=i<N_cols
744 public int getEndRes()
750 * Set the first column selected by this group. Runs from 0<=i<N_cols
754 public void setStartRes(int i)
756 int before = startRes;
758 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, startRes);
762 * Set the groups last selected column. Runs from 0<=i<N_cols
766 public void setEndRes(int i)
770 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, endRes);
774 * @return number of sequences in group
778 return sequences.size();
783 * @return the ith sequence
785 public SequenceI getSequenceAt(int i)
787 return sequences.get(i);
794 public void setColourText(boolean state)
802 * @return DOCUMENT ME!
804 public boolean getColourText()
815 public void setDisplayText(boolean state)
823 * @return DOCUMENT ME!
825 public boolean getDisplayText()
836 public void setDisplayBoxes(boolean state)
838 displayBoxes = state;
844 * @return DOCUMENT ME!
846 public boolean getDisplayBoxes()
852 * computes the width of current set of sequences and returns it
854 * @return DOCUMENT ME!
857 public int getWidth()
859 synchronized (sequences)
861 // MC This needs to get reset when characters are inserted and deleted
862 boolean first = true;
863 for (SequenceI seq : sequences)
865 if (first || seq.getLength() > width)
867 width = seq.getLength();
881 public void setOutlineColour(Color c)
889 * @return DOCUMENT ME!
891 public Color getOutlineColour()
893 return outlineColour;
898 * returns the sequences in the group ordered by the ordering given by al.
899 * this used to return an array with null entries regardless, new behaviour is
900 * below. TODO: verify that this does not affect use in applet or application
904 * @return SequenceI[] intersection of sequences in group with al, ordered by
905 * al, or null if group does not intersect with al
907 public SequenceI[] getSequencesInOrder(AlignmentI al)
909 return getSequencesInOrder(al, true);
913 * return an array representing the intersection of the group with al,
914 * optionally returning an array the size of al.getHeight() where nulls mark
915 * the non-intersected sequences
919 * @return null or array
921 public SequenceI[] getSequencesInOrder(AlignmentI al, boolean trim)
923 synchronized (sequences)
925 int sSize = sequences.size();
926 int alHeight = al.getHeight();
928 SequenceI[] seqs = new SequenceI[(trim) ? sSize : alHeight];
931 for (int i = 0; i < alHeight && index < sSize; i++)
933 if (sequences.contains(al.getSequenceAt(i)))
935 seqs[(trim) ? index : i] = al.getSequenceAt(i);
947 if (index < seqs.length)
949 SequenceI[] dummy = seqs;
950 seqs = new SequenceI[index];
953 seqs[index] = dummy[index];
962 * @return the idColour
964 public Color getIdColour()
971 * the idColour to set
973 public void setIdColour(Color idColour)
975 this.idColour = idColour;
979 * @return the representative sequence for this group
982 public SequenceI getSeqrep()
988 * set the representative sequence for this group. Note - this affects the
989 * interpretation of the Hidereps attribute.
992 * the seqrep to set (null means no sequence representative)
995 public void setSeqrep(SequenceI seqrep)
997 this.seqrep = seqrep;
1002 * @return true if group has a sequence representative
1005 public boolean hasSeqrep()
1007 return seqrep != null;
1011 * set visibility of sequences covered by (if no sequence representative is
1012 * defined) or represented by this group.
1016 public void setHidereps(boolean visibility)
1018 hidereps = visibility;
1023 * @return true if sequences represented (or covered) by this group should be
1026 public boolean isHidereps()
1032 * set intended visibility of columns covered by this group
1036 public void setHideCols(boolean visibility)
1038 hidecols = visibility;
1043 * @return true if columns covered by group should be hidden
1045 public boolean isHideCols()
1051 * create a new sequence group from the intersection of this group with an
1052 * alignment Hashtable of hidden representatives
1058 * @return new group containing sequences common to this group and alignment
1060 public SequenceGroup intersect(AlignmentI alignment,
1061 Map<SequenceI, SequenceCollectionI> map)
1063 SequenceGroup sgroup = new SequenceGroup(this);
1064 SequenceI[] insect = getSequencesInOrder(alignment);
1065 sgroup.sequences = new ArrayList<>();
1066 for (int s = 0; insect != null && s < insect.length; s++)
1068 if (map == null || map.containsKey(insect[s]))
1070 sgroup.sequences.add(insect[s]);
1077 * @return the showUnconserved
1079 public boolean getShowNonconserved()
1081 return showNonconserved;
1085 * @param showNonconserved
1086 * the showUnconserved to set
1088 public void setShowNonconserved(boolean displayNonconserved)
1090 this.showNonconserved = displayNonconserved;
1094 * set this alignmentAnnotation object as the one used to render consensus
1099 public void setConsensus(AlignmentAnnotation aan)
1101 if (consensus == null)
1109 * @return automatically calculated consensus row note: the row is a stub if a
1110 * consensus calculation has not yet been performed on the group
1112 public AlignmentAnnotation getConsensus()
1114 // TODO get or calculate and get consensus annotation row for this group
1115 int aWidth = this.getWidth();
1123 if (consensus == null)
1125 consensus = new AlignmentAnnotation("", "", new Annotation[1], 0f,
1126 100f, AlignmentAnnotation.BAR_GRAPH);
1127 consensus.hasText = true;
1128 consensus.autoCalculated = true;
1129 consensus.groupRef = this;
1130 consensus.label = "Consensus for " + getName();
1131 consensus.description = "Percent Identity";
1137 * set this alignmentAnnotation object as the one used to render consensus
1142 public void setConservationRow(AlignmentAnnotation aan)
1144 if (conservation == null)
1151 * get the conservation annotation row for this group
1153 * @return autoCalculated annotation row
1155 public AlignmentAnnotation getConservationRow()
1157 if (conservation == null)
1159 conservation = new AlignmentAnnotation("", "", new Annotation[1], 0f,
1160 11f, AlignmentAnnotation.BAR_GRAPH);
1163 conservation.hasText = true;
1164 conservation.autoCalculated = true;
1165 conservation.groupRef = this;
1166 conservation.label = "Conservation for " + getName();
1167 conservation.description = "Conservation for group " + getName()
1168 + " less than " + consPercGaps + "% gaps";
1169 return conservation;
1174 * @return true if annotation rows have been instantiated for this group
1176 public boolean hasAnnotationRows()
1178 return consensus != null || conservation != null;
1181 public SequenceI getConsensusSeq()
1184 StringBuffer seqs = new StringBuffer();
1185 for (int i = 0; i < consensus.annotations.length; i++)
1187 if (consensus.annotations[i] != null)
1189 if (consensus.annotations[i].description.charAt(0) == '[')
1191 seqs.append(consensus.annotations[i].description.charAt(1));
1195 seqs.append(consensus.annotations[i].displayCharacter);
1200 SequenceI sq = new Sequence("Group" + getName() + " Consensus",
1202 sq.setDescription("Percentage Identity Consensus "
1203 + ((ignoreGapsInConsensus) ? " without gaps" : ""));
1207 public void setIgnoreGapsConsensus(boolean state)
1209 if (this.ignoreGapsInConsensus != state && consensus != null)
1211 ignoreGapsInConsensus = state;
1212 recalcConservation();
1214 ignoreGapsInConsensus = state;
1217 public boolean getIgnoreGapsConsensus()
1219 return ignoreGapsInConsensus;
1223 * @param showSequenceLogo
1224 * indicates if a sequence logo is shown for consensus annotation
1226 public void setshowSequenceLogo(boolean showSequenceLogo)
1228 // TODO: decouple calculation from settings update
1229 if (this.showSequenceLogo != showSequenceLogo && consensus != null)
1231 this.showSequenceLogo = showSequenceLogo;
1232 recalcConservation();
1234 this.showSequenceLogo = showSequenceLogo;
1239 * @param showConsHist
1240 * flag indicating if the consensus histogram for this group should
1243 public void setShowConsensusHistogram(boolean showConsHist)
1246 if (showConsensusHistogram != showConsHist && consensus != null)
1248 this.showConsensusHistogram = showConsHist;
1249 recalcConservation();
1251 this.showConsensusHistogram = showConsHist;
1255 * @return the showConsensusHistogram
1257 public boolean isShowConsensusHistogram()
1259 return showConsensusHistogram;
1263 * set flag indicating if logo should be normalised when rendered
1267 public void setNormaliseSequenceLogo(boolean norm)
1269 normaliseSequenceLogo = norm;
1272 public boolean isNormaliseSequenceLogo()
1274 return normaliseSequenceLogo;
1279 * returns a new array with all annotation involving this group
1281 public AlignmentAnnotation[] getAlignmentAnnotation()
1283 // TODO add in other methods like 'getAlignmentAnnotation(String label),
1285 ArrayList<AlignmentAnnotation> annot = new ArrayList<>();
1286 synchronized (sequences)
1288 for (SequenceI seq : sequences)
1290 AlignmentAnnotation[] aa = seq.getAnnotation();
1293 for (AlignmentAnnotation al : aa)
1295 if (al.groupRef == this)
1302 if (consensus != null)
1304 annot.add(consensus);
1306 if (conservation != null)
1308 annot.add(conservation);
1311 return annot.toArray(new AlignmentAnnotation[0]);
1315 public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
1317 List<AlignmentAnnotation> aa = new ArrayList<>();
1322 for (AlignmentAnnotation a : getAlignmentAnnotation())
1324 if (calcId.equals(a.getCalcId()))
1333 public Iterable<AlignmentAnnotation> findAnnotations(SequenceI seq,
1334 String calcId, String label)
1336 ArrayList<AlignmentAnnotation> aa = new ArrayList<>();
1337 for (AlignmentAnnotation ann : getAlignmentAnnotation())
1339 if ((calcId == null || (ann.getCalcId() != null && ann.getCalcId()
1341 && (seq == null || (ann.sequenceRef != null && ann.sequenceRef == seq))
1342 && (label == null || (ann.label != null && ann.label
1352 * Answer true if any annotation matches the calcId passed in (if not null).
1357 public boolean hasAnnotation(String calcId)
1359 if (calcId != null && !"".equals(calcId))
1361 for (AlignmentAnnotation a : getAlignmentAnnotation())
1363 if (a.getCalcId() == calcId)
1373 * Remove all sequences from the group (leaving other properties unchanged).
1377 synchronized (sequences)
1379 List<SequenceI> before = sequences;
1381 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before,
1387 * Sets the alignment or group context for this group, and whether it is
1388 * defined as a group
1391 * the context for the group
1393 * whether the group is defined on the alignment or is just a
1395 * @throws IllegalArgumentException
1396 * if setting the context would result in a circular reference chain
1398 public void setContext(AnnotatedCollectionI ctx, boolean defined)
1401 this.isDefined = defined;
1405 * Sets the alignment or group context for this group
1408 * the context for the group
1409 * @throws IllegalArgumentException
1410 * if setting the context would result in a circular reference chain
1412 public void setContext(AnnotatedCollectionI ctx)
1414 AnnotatedCollectionI ref = ctx;
1417 if (ref == this || ref.getContext() == ctx)
1419 throw new IllegalArgumentException(
1420 "Circular reference in SequenceGroup.context");
1422 ref = ref.getContext();
1430 * @see jalview.datamodel.AnnotatedCollectionI#getContext()
1433 public AnnotatedCollectionI getContext()
1438 public boolean isDefined()
1443 public void setColourScheme(ColourSchemeI scheme)
1447 cs = new ResidueShader();
1449 cs.setColourScheme(scheme);
1452 public void setGroupColourScheme(ResidueShaderI scheme)
1457 public ColourSchemeI getColourScheme()
1459 return cs == null ? null : cs.getColourScheme();
1462 public ResidueShaderI getGroupColourScheme()
1468 public boolean isNucleotide()
1470 if (context != null) {
1471 return context.isNucleotide();
1478 * @return true if seq is a member of the group
1481 public boolean contains(SequenceI seq1)
1483 return sequences.contains(seq1);
1489 * @return true if startRes<=apos and endRes>=apos and seq is in the group
1491 public boolean contains(SequenceI seq, int apos)
1493 return (startRes <= apos && endRes >= apos) && sequences.contains(seq);