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.Arrays;
34 import java.util.List;
38 * Collects a set contiguous ranges on a set of sequences
43 public class SequenceGroup implements AnnotatedCollectionI
45 // TODO ideally this event notification functionality should be separated into
47 // subclass of ViewportProperties similarly to ViewportRanges. Done here as
48 // quick fix for JAL-2665
49 public static final String SEQ_GROUP_CHANGED = "Sequence group changed";
51 protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(
54 public void addPropertyChangeListener(PropertyChangeListener listener)
56 changeSupport.addPropertyChangeListener(listener);
59 public void removePropertyChangeListener(PropertyChangeListener listener)
61 changeSupport.removePropertyChangeListener(listener);
63 // end of event notification functionality initialisation
69 Conservation conserve;
71 boolean displayBoxes = true;
73 boolean displayText = true;
75 boolean colourText = false;
78 * True if the group is defined as a group on the alignment, false if it is
81 boolean isDefined = false;
84 * after Olivier's non-conserved only character display
86 boolean showNonconserved = false;
91 private List<SequenceI> sequences;
94 * representative sequence for this group (if any)
96 private SequenceI seqrep = null;
101 * Colourscheme applied to group if any
103 public ResidueShaderI cs;
106 * start column (base 0)
108 private int startRes = 0;
111 * end column (base 0)
113 private int endRes = 0;
115 public Color outlineColour = Color.black;
117 public Color idColour = null;
119 public int thresholdTextColour = 0;
121 public Color textColour = Color.black;
123 public Color textColour2 = Color.white;
126 * consensus calculation property
128 private boolean ignoreGapsInConsensus = true;
131 * consensus calculation property
133 private boolean showSequenceLogo = false;
136 * flag indicating if logo should be rendered normalised
138 private boolean normaliseSequenceLogo;
141 * visibility of rows or represented rows covered by group
143 private boolean hidereps = false;
146 * visibility of columns intersecting this group
148 private boolean hidecols = false;
150 AlignmentAnnotation consensus = null;
152 AlignmentAnnotation conservation = null;
154 private boolean showConsensusHistogram;
156 private AnnotatedCollectionI context;
159 * Creates a new SequenceGroup object.
161 public SequenceGroup()
163 groupName = "JGroup:" + this.hashCode();
164 cs = new ResidueShader();
165 sequences = new ArrayList<>();
169 * Creates a new SequenceGroup object.
174 * @param displayBoxes
178 * first column of group
180 * last column of group
182 public SequenceGroup(List<SequenceI> sequences, String groupName,
183 ColourSchemeI scheme, boolean displayBoxes, boolean displayText,
184 boolean colourText, int start, int end)
187 this.sequences = sequences;
188 this.groupName = groupName;
189 this.displayBoxes = displayBoxes;
190 this.displayText = displayText;
191 this.colourText = colourText;
192 this.cs = new ResidueShader(scheme);
195 recalcConservation();
203 public SequenceGroup(SequenceGroup seqsel)
208 sequences = new ArrayList<>();
209 sequences.addAll(seqsel.sequences);
210 if (seqsel.groupName != null)
212 groupName = new String(seqsel.groupName);
214 displayBoxes = seqsel.displayBoxes;
215 displayText = seqsel.displayText;
216 colourText = seqsel.colourText;
218 startRes = seqsel.startRes;
219 endRes = seqsel.endRes;
220 cs = new ResidueShader((ResidueShader) seqsel.cs);
221 if (seqsel.description != null)
223 description = new String(seqsel.description);
225 hidecols = seqsel.hidecols;
226 hidereps = seqsel.hidereps;
227 showNonconserved = seqsel.showNonconserved;
228 showSequenceLogo = seqsel.showSequenceLogo;
229 normaliseSequenceLogo = seqsel.normaliseSequenceLogo;
230 showConsensusHistogram = seqsel.showConsensusHistogram;
231 idColour = seqsel.idColour;
232 outlineColour = seqsel.outlineColour;
233 seqrep = seqsel.seqrep;
234 textColour = seqsel.textColour;
235 textColour2 = seqsel.textColour2;
236 thresholdTextColour = seqsel.thresholdTextColour;
237 width = seqsel.width;
238 ignoreGapsInConsensus = seqsel.ignoreGapsInConsensus;
239 if (seqsel.conserve != null)
241 recalcConservation(); // safer than
242 // aaFrequency = (Vector) seqsel.aaFrequency.clone(); // ??
248 * Constructor that copies the given list of sequences
252 public SequenceGroup(List<SequenceI> seqs)
255 this.sequences.addAll(seqs);
258 public boolean isShowSequenceLogo()
260 return showSequenceLogo;
263 public SequenceI[] getSelectionAsNewSequences(AlignmentI align)
265 int iSize = sequences.size();
266 SequenceI[] seqs = new SequenceI[iSize];
267 SequenceI[] inorder = getSequencesInOrder(align);
269 for (int i = 0, ipos = 0; i < inorder.length; i++)
271 SequenceI seq = inorder[i];
273 seqs[ipos] = seq.getSubSequence(startRes, endRes + 1);
274 if (seqs[ipos] != null)
276 seqs[ipos].setDescription(seq.getDescription());
277 seqs[ipos].setDBRefs(seq.getDBRefs());
278 seqs[ipos].setSequenceFeatures(seq.getSequenceFeatures());
279 if (seq.getDatasetSequence() != null)
281 seqs[ipos].setDatasetSequence(seq.getDatasetSequence());
284 if (seq.getAnnotation() != null)
286 AlignmentAnnotation[] alann = align.getAlignmentAnnotation();
287 // Only copy annotation that is either a score or referenced by the
288 // alignment's annotation vector
289 for (int a = 0; a < seq.getAnnotation().length; a++)
291 AlignmentAnnotation tocopy = seq.getAnnotation()[a];
294 boolean found = false;
295 for (int pos = 0; pos < alann.length; pos++)
297 if (alann[pos] == tocopy)
308 AlignmentAnnotation newannot = new AlignmentAnnotation(
309 seq.getAnnotation()[a]);
310 newannot.restrict(startRes, endRes);
311 newannot.setSequenceRef(seqs[ipos]);
312 newannot.adjustForAlignment();
313 seqs[ipos].addAlignmentAnnotation(newannot);
323 if (iSize != inorder.length)
325 SequenceI[] nseqs = new SequenceI[iSize];
326 System.arraycopy(seqs, 0, nseqs, 0, iSize);
334 * If sequence ends in gaps, the end residue can be correctly calculated here
340 public int findEndRes(SequenceI seq)
345 for (int j = 0; j < endRes + 1 && j < seq.getLength(); j++)
347 ch = seq.getCharAt(j);
348 if (!jalview.util.Comparison.isGap((ch)))
356 eres += seq.getStart() - 1;
363 public List<SequenceI> getSequences()
369 public List<SequenceI> getSequences(
370 Map<SequenceI, SequenceCollectionI> hiddenReps)
372 if (hiddenReps == null)
374 // TODO: need a synchronizedCollection here ?
379 List<SequenceI> allSequences = new ArrayList<>();
380 for (SequenceI seq : sequences)
382 allSequences.add(seq);
383 if (hiddenReps.containsKey(seq))
385 SequenceCollectionI hsg = hiddenReps.get(seq);
386 for (SequenceI seq2 : hsg.getSequences())
388 if (seq2 != seq && !allSequences.contains(seq2))
390 allSequences.add(seq2);
400 public SequenceI[] getSequencesAsArray(
401 Map<SequenceI, SequenceCollectionI> map)
403 List<SequenceI> tmp = getSequences(map);
408 return tmp.toArray(new SequenceI[tmp.size()]);
417 * @return DOCUMENT ME!
419 public boolean adjustForRemoveLeft(int col)
421 // return value is true if the group still exists
424 startRes = startRes - col;
429 endRes = endRes - col;
431 if (startRes > endRes)
438 // must delete this group!!
451 * @return DOCUMENT ME!
453 public boolean adjustForRemoveRight(int col)
472 * @return DOCUMENT ME!
474 public String getName()
479 public String getDescription()
490 public void setName(String name)
493 // TODO: URGENT: update dependent objects (annotation row)
496 public void setDescription(String desc)
504 * @return DOCUMENT ME!
506 public Conservation getConservation()
517 public void setConservation(Conservation c)
523 * Add s to this sequence group. If aligment sequence is already contained in
524 * group, it will not be added again, but recalculation may happen if the flag
528 * alignment sequence to be added
530 * true means Group's conservation should be recalculated
532 public void addSequence(SequenceI s, boolean recalc)
534 synchronized (sequences)
536 if (s != null && !sequences.contains(s))
539 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED,
540 sequences.size() - 1, sequences.size());
545 recalcConservation();
551 * Max Gaps Threshold (percent) for performing a conservation calculation
553 private int consPercGaps = 25;
556 * @return Max Gaps Threshold for performing a conservation calculation
558 public int getConsPercGaps()
564 * set Max Gaps Threshold (percent) for performing a conservation calculation
566 * @param consPercGaps
568 public void setConsPercGaps(int consPercGaps)
570 this.consPercGaps = consPercGaps;
574 * calculate residue conservation and colourschemes for group - but only if
575 * necessary. returns true if the calculation resulted in a visible change to
578 public boolean recalcConservation()
580 return recalcConservation(false);
584 * calculate residue conservation for group - but only if necessary. returns
585 * true if the calculation resulted in a visible change to group
588 * when set, colourschemes for this group are not refreshed after
591 public boolean recalcConservation(boolean defer)
593 if (cs == null && consensus == null && conservation == null)
597 // TODO: try harder to detect changes in state in order to minimise
598 // recalculation effort
602 ProfilesI cnsns = AAFrequency.calculate(sequences, startRes,
603 endRes + 1, showSequenceLogo);
604 if (consensus != null)
606 _updateConsensusRow(cnsns, sequences.size());
611 cs.setConsensus(cnsns);
615 if ((conservation != null)
616 || (cs != null && cs.conservationApplied()))
618 Conservation c = new Conservation(groupName, sequences, startRes,
621 c.verdict(false, consPercGaps);
622 if (conservation != null)
624 _updateConservationRow(c);
628 if (cs.conservationApplied())
630 cs.setConservation(c);
633 // eager update - will cause a refresh of overview regardless
636 if (cs != null && !defer)
638 // TODO: JAL-2034 should cs.alignmentChanged modify return state
639 cs.alignmentChanged(context != null ? context : this, null);
646 } catch (java.lang.OutOfMemoryError err)
649 System.out.println("Out of memory loading groups: " + err);
654 private void _updateConservationRow(Conservation c)
656 if (conservation == null)
661 conservation.label = "Conservation for " + getName();
662 conservation.description = "Conservation for group " + getName()
663 + " less than " + consPercGaps + "% gaps";
664 // preserve width if already set
665 int aWidth = (conservation.annotations != null)
666 ? (endRes < conservation.annotations.length
667 ? conservation.annotations.length
670 conservation.annotations = null;
671 conservation.annotations = new Annotation[aWidth]; // should be alignment
673 c.completeAnnotations(conservation, null, startRes, endRes + 1);
676 public ProfilesI consensusData = null;
678 private void _updateConsensusRow(ProfilesI cnsns, long nseq)
680 if (consensus == null)
684 consensus.label = "Consensus for " + getName();
685 consensus.description = "Percent Identity";
686 consensusData = cnsns;
687 // preserve width if already set
688 int aWidth = (consensus.annotations != null)
689 ? (endRes < consensus.annotations.length
690 ? consensus.annotations.length
693 consensus.annotations = null;
694 consensus.annotations = new Annotation[aWidth]; // should be alignment width
696 AAFrequency.completeConsensus(consensus, cnsns, startRes, endRes + 1,
697 ignoreGapsInConsensus, showSequenceLogo, nseq); // TODO: setting
700 // ignoreGapsInConsensusCalculation);
705 * sequence to either add or remove from group
707 * flag passed to delete/addSequence to indicate if group properties
708 * should be recalculated
710 public void addOrRemove(SequenceI s, boolean recalc)
712 synchronized (sequences)
714 if (sequences.contains(s))
716 deleteSequence(s, recalc);
720 addSequence(s, recalc);
731 * true means recalculate conservation
733 public void deleteSequence(SequenceI s, boolean recalc)
735 synchronized (sequences)
738 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED,
739 sequences.size() + 1, sequences.size());
743 recalcConservation();
751 * @return the first column selected by this group. Runs from 0<=i<N_cols
754 public int getStartRes()
761 * @return the groups last selected column. Runs from 0<=i<N_cols
764 public int getEndRes()
770 * Set the first column selected by this group. Runs from 0<=i<N_cols
774 public void setStartRes(int newStart)
776 int before = startRes;
777 startRes= Math.max(0,newStart); // sanity check for negative start column positions
778 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, startRes);
785 * Set the groups last selected column. Runs from 0<=i<N_cols
789 public void setEndRes(int i)
793 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, endRes);
797 * @return number of sequences in group
801 return sequences.size();
806 * @return the ith sequence
808 public SequenceI getSequenceAt(int i)
810 return sequences.get(i);
817 public void setColourText(boolean state)
825 * @return DOCUMENT ME!
827 public boolean getColourText()
838 public void setDisplayText(boolean state)
846 * @return DOCUMENT ME!
848 public boolean getDisplayText()
859 public void setDisplayBoxes(boolean state)
861 displayBoxes = state;
867 * @return DOCUMENT ME!
869 public boolean getDisplayBoxes()
875 * computes the width of current set of sequences and returns it
877 * @return DOCUMENT ME!
880 public int getWidth()
882 synchronized (sequences)
884 // MC This needs to get reset when characters are inserted and deleted
885 boolean first = true;
886 for (SequenceI seq : sequences)
888 if (first || seq.getLength() > width)
890 width = seq.getLength();
904 public void setOutlineColour(Color c)
912 * @return DOCUMENT ME!
914 public Color getOutlineColour()
916 return outlineColour;
921 * returns the sequences in the group ordered by the ordering given by al.
922 * this used to return an array with null entries regardless, new behaviour is
923 * below. TODO: verify that this does not affect use in applet or application
927 * @return SequenceI[] intersection of sequences in group with al, ordered by
928 * al, or null if group does not intersect with al
930 public SequenceI[] getSequencesInOrder(AlignmentI al)
932 return getSequencesInOrder(al, true);
936 * return an array representing the intersection of the group with al,
937 * optionally returning an array the size of al.getHeight() where nulls mark
938 * the non-intersected sequences
942 * @return null or array
944 public SequenceI[] getSequencesInOrder(AlignmentI al, boolean trim)
946 synchronized (sequences)
948 int sSize = sequences.size();
949 int alHeight = al.getHeight();
951 SequenceI[] seqs = new SequenceI[(trim) ? sSize : alHeight];
954 for (int i = 0; i < alHeight && index < sSize; i++)
956 if (sequences.contains(al.getSequenceAt(i)))
958 seqs[(trim) ? index : i] = al.getSequenceAt(i);
970 if (index < seqs.length)
972 SequenceI[] dummy = seqs;
973 seqs = new SequenceI[index];
976 seqs[index] = dummy[index];
985 * @return the idColour
987 public Color getIdColour()
994 * the idColour to set
996 public void setIdColour(Color idColour)
998 this.idColour = idColour;
1002 * @return the representative sequence for this group
1005 public SequenceI getSeqrep()
1011 * set the representative sequence for this group. Note - this affects the
1012 * interpretation of the Hidereps attribute.
1015 * the seqrep to set (null means no sequence representative)
1018 public void setSeqrep(SequenceI seqrep)
1020 this.seqrep = seqrep;
1025 * @return true if group has a sequence representative
1028 public boolean hasSeqrep()
1030 return seqrep != null;
1034 * set visibility of sequences covered by (if no sequence representative is
1035 * defined) or represented by this group.
1039 public void setHidereps(boolean visibility)
1041 hidereps = visibility;
1046 * @return true if sequences represented (or covered) by this group should be
1049 public boolean isHidereps()
1055 * set intended visibility of columns covered by this group
1059 public void setHideCols(boolean visibility)
1061 hidecols = visibility;
1066 * @return true if columns covered by group should be hidden
1068 public boolean isHideCols()
1074 * create a new sequence group from the intersection of this group with an
1075 * alignment Hashtable of hidden representatives
1081 * @return new group containing sequences common to this group and alignment
1083 public SequenceGroup intersect(AlignmentI alignment,
1084 Map<SequenceI, SequenceCollectionI> map)
1086 SequenceGroup sgroup = new SequenceGroup(this);
1087 SequenceI[] insect = getSequencesInOrder(alignment);
1088 sgroup.sequences = new ArrayList<>();
1089 for (int s = 0; insect != null && s < insect.length; s++)
1091 if (map == null || map.containsKey(insect[s]))
1093 sgroup.sequences.add(insect[s]);
1100 * @return the showUnconserved
1102 public boolean getShowNonconserved()
1104 return showNonconserved;
1108 * @param showNonconserved
1109 * the showUnconserved to set
1111 public void setShowNonconserved(boolean displayNonconserved)
1113 this.showNonconserved = displayNonconserved;
1117 * set this alignmentAnnotation object as the one used to render consensus
1122 public void setConsensus(AlignmentAnnotation aan)
1124 if (consensus == null)
1132 * @return automatically calculated consensus row note: the row is a stub if a
1133 * consensus calculation has not yet been performed on the group
1135 public AlignmentAnnotation getConsensus()
1137 // TODO get or calculate and get consensus annotation row for this group
1138 int aWidth = this.getWidth();
1146 if (consensus == null)
1148 consensus = new AlignmentAnnotation("", "", new Annotation[1], 0f,
1149 100f, AlignmentAnnotation.BAR_GRAPH);
1150 consensus.hasText = true;
1151 consensus.autoCalculated = true;
1152 consensus.groupRef = this;
1153 consensus.label = "Consensus for " + getName();
1154 consensus.description = "Percent Identity";
1160 * set this alignmentAnnotation object as the one used to render consensus
1165 public void setConservationRow(AlignmentAnnotation aan)
1167 if (conservation == null)
1174 * get the conservation annotation row for this group
1176 * @return autoCalculated annotation row
1178 public AlignmentAnnotation getConservationRow()
1180 if (conservation == null)
1182 conservation = new AlignmentAnnotation("", "", new Annotation[1], 0f,
1183 11f, AlignmentAnnotation.BAR_GRAPH);
1186 conservation.hasText = true;
1187 conservation.autoCalculated = true;
1188 conservation.groupRef = this;
1189 conservation.label = "Conservation for " + getName();
1190 conservation.description = "Conservation for group " + getName()
1191 + " less than " + consPercGaps + "% gaps";
1192 return conservation;
1197 * @return true if annotation rows have been instantiated for this group
1199 public boolean hasAnnotationRows()
1201 return consensus != null || conservation != null;
1204 public SequenceI getConsensusSeq()
1207 StringBuffer seqs = new StringBuffer();
1208 for (int i = 0; i < consensus.annotations.length; i++)
1210 if (consensus.annotations[i] != null)
1212 String desc = consensus.annotations[i].description;
1213 if (desc.length() > 1 && desc.charAt(0) == '[')
1215 seqs.append(desc.charAt(1));
1219 seqs.append(consensus.annotations[i].displayCharacter);
1224 SequenceI sq = new Sequence("Group" + getName() + " Consensus",
1226 sq.setDescription("Percentage Identity Consensus "
1227 + ((ignoreGapsInConsensus) ? " without gaps" : ""));
1231 public void setIgnoreGapsConsensus(boolean state)
1233 if (this.ignoreGapsInConsensus != state && consensus != null)
1235 ignoreGapsInConsensus = state;
1236 recalcConservation();
1238 ignoreGapsInConsensus = state;
1241 public boolean getIgnoreGapsConsensus()
1243 return ignoreGapsInConsensus;
1247 * @param showSequenceLogo
1248 * indicates if a sequence logo is shown for consensus annotation
1250 public void setshowSequenceLogo(boolean showSequenceLogo)
1252 // TODO: decouple calculation from settings update
1253 if (this.showSequenceLogo != showSequenceLogo && consensus != null)
1255 this.showSequenceLogo = showSequenceLogo;
1256 recalcConservation();
1258 this.showSequenceLogo = showSequenceLogo;
1263 * @param showConsHist
1264 * flag indicating if the consensus histogram for this group should
1267 public void setShowConsensusHistogram(boolean showConsHist)
1270 if (showConsensusHistogram != showConsHist && consensus != null)
1272 this.showConsensusHistogram = showConsHist;
1273 recalcConservation();
1275 this.showConsensusHistogram = showConsHist;
1279 * @return the showConsensusHistogram
1281 public boolean isShowConsensusHistogram()
1283 return showConsensusHistogram;
1287 * set flag indicating if logo should be normalised when rendered
1291 public void setNormaliseSequenceLogo(boolean norm)
1293 normaliseSequenceLogo = norm;
1296 public boolean isNormaliseSequenceLogo()
1298 return normaliseSequenceLogo;
1303 * returns a new array with all annotation involving this group
1305 public AlignmentAnnotation[] getAlignmentAnnotation()
1307 // TODO add in other methods like 'getAlignmentAnnotation(String label),
1309 ArrayList<AlignmentAnnotation> annot = new ArrayList<>();
1310 synchronized (sequences)
1312 for (SequenceI seq : sequences)
1314 AlignmentAnnotation[] aa = seq.getAnnotation();
1317 for (AlignmentAnnotation al : aa)
1319 if (al.groupRef == this)
1326 if (consensus != null)
1328 annot.add(consensus);
1330 if (conservation != null)
1332 annot.add(conservation);
1335 return annot.toArray(new AlignmentAnnotation[0]);
1339 public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
1341 return AlignmentAnnotation.findAnnotation(
1342 Arrays.asList(getAlignmentAnnotation()), calcId);
1346 public Iterable<AlignmentAnnotation> findAnnotations(SequenceI seq,
1347 String calcId, String label)
1349 return AlignmentAnnotation.findAnnotations(
1350 Arrays.asList(getAlignmentAnnotation()), seq, calcId, label);
1354 * Answer true if any annotation matches the calcId passed in (if not null).
1359 public boolean hasAnnotation(String calcId)
1361 return AlignmentAnnotation
1362 .hasAnnotation(Arrays.asList(getAlignmentAnnotation()), calcId);
1366 * Remove all sequences from the group (leaving other properties unchanged).
1370 synchronized (sequences)
1372 int before = sequences.size();
1374 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before,
1380 * Sets the alignment or group context for this group, and whether it is
1381 * defined as a group
1384 * the context for the group
1386 * whether the group is defined on the alignment or is just a
1388 * @throws IllegalArgumentException
1389 * if setting the context would result in a circular reference chain
1391 public void setContext(AnnotatedCollectionI ctx, boolean defined)
1394 this.isDefined = defined;
1398 * Sets the alignment or group context for this group
1401 * the context for the group
1402 * @throws IllegalArgumentException
1403 * if setting the context would result in a circular reference chain
1405 public void setContext(AnnotatedCollectionI ctx)
1407 AnnotatedCollectionI ref = ctx;
1410 if (ref == this || ref.getContext() == ctx)
1412 throw new IllegalArgumentException(
1413 "Circular reference in SequenceGroup.context");
1415 ref = ref.getContext();
1423 * @see jalview.datamodel.AnnotatedCollectionI#getContext()
1426 public AnnotatedCollectionI getContext()
1431 public boolean isDefined()
1436 public void setColourScheme(ColourSchemeI scheme)
1440 cs = new ResidueShader();
1442 cs.setColourScheme(scheme);
1445 public void setGroupColourScheme(ResidueShaderI scheme)
1450 public ColourSchemeI getColourScheme()
1452 return cs == null ? null : cs.getColourScheme();
1455 public ResidueShaderI getGroupColourScheme()
1461 public boolean isNucleotide()
1463 if (context != null)
1465 return context.isNucleotide();
1472 * @return true if seq is a member of the group
1475 public boolean contains(SequenceI seq1)
1477 return sequences.contains(seq1);
1483 * @return true if startRes<=apos and endRes>=apos and seq is in the group
1485 public boolean contains(SequenceI seq, int apos)
1487 return (startRes <= apos && endRes >= apos) && sequences.contains(seq);