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 = new ArrayList<>();
94 * representative sequence for this group (if any)
96 private SequenceI seqrep = null;
101 * Colourscheme applied to group if any
103 public ResidueShaderI cs;
105 // start column (base 0)
108 // end column (base 0)
111 public Color outlineColour = Color.black;
113 public Color idColour = null;
115 public int thresholdTextColour = 0;
117 public Color textColour = Color.black;
119 public Color textColour2 = Color.white;
122 * consensus calculation property
124 private boolean ignoreGapsInConsensus = true;
127 * consensus calculation property
129 private boolean showSequenceLogo = false;
132 * flag indicating if logo should be rendered normalised
134 private boolean normaliseSequenceLogo;
137 * visibility of rows or represented rows covered by group
139 private boolean hidereps = false;
142 * visibility of columns intersecting this group
144 private boolean hidecols = false;
146 AlignmentAnnotation consensus = null;
148 AlignmentAnnotation conservation = null;
150 private boolean showConsensusHistogram;
152 private AnnotatedCollectionI context;
155 * Creates a new SequenceGroup object.
157 public SequenceGroup()
159 groupName = "JGroup:" + this.hashCode();
160 cs = new ResidueShader();
164 * Creates a new SequenceGroup object.
169 * @param displayBoxes
173 * first column of group
175 * last column of group
177 public SequenceGroup(List<SequenceI> sequences, String groupName,
178 ColourSchemeI scheme, boolean displayBoxes, boolean displayText,
179 boolean colourText, int start, int end)
182 this.sequences = sequences;
183 this.groupName = groupName;
184 this.displayBoxes = displayBoxes;
185 this.displayText = displayText;
186 this.colourText = colourText;
187 this.cs = new ResidueShader(scheme);
190 recalcConservation();
198 public SequenceGroup(SequenceGroup seqsel)
203 sequences = new ArrayList<>();
204 sequences.addAll(seqsel.sequences);
205 if (seqsel.groupName != null)
207 groupName = new String(seqsel.groupName);
209 displayBoxes = seqsel.displayBoxes;
210 displayText = seqsel.displayText;
211 colourText = seqsel.colourText;
212 startRes = seqsel.startRes;
213 endRes = seqsel.endRes;
214 cs = new ResidueShader((ResidueShader) seqsel.cs);
215 if (seqsel.description != null)
217 description = new String(seqsel.description);
219 hidecols = seqsel.hidecols;
220 hidereps = seqsel.hidereps;
221 showNonconserved = seqsel.showNonconserved;
222 showSequenceLogo = seqsel.showSequenceLogo;
223 normaliseSequenceLogo = seqsel.normaliseSequenceLogo;
224 showConsensusHistogram = seqsel.showConsensusHistogram;
225 idColour = seqsel.idColour;
226 outlineColour = seqsel.outlineColour;
227 seqrep = seqsel.seqrep;
228 textColour = seqsel.textColour;
229 textColour2 = seqsel.textColour2;
230 thresholdTextColour = seqsel.thresholdTextColour;
231 width = seqsel.width;
232 ignoreGapsInConsensus = seqsel.ignoreGapsInConsensus;
233 if (seqsel.conserve != null)
235 recalcConservation(); // safer than
236 // aaFrequency = (Vector) seqsel.aaFrequency.clone(); // ??
241 public boolean isShowSequenceLogo()
243 return showSequenceLogo;
246 public SequenceI[] getSelectionAsNewSequences(AlignmentI align)
248 int iSize = sequences.size();
249 SequenceI[] seqs = new SequenceI[iSize];
250 SequenceI[] inorder = getSequencesInOrder(align);
252 for (int i = 0, ipos = 0; i < inorder.length; i++)
254 SequenceI seq = inorder[i];
256 seqs[ipos] = seq.getSubSequence(startRes, endRes + 1);
257 if (seqs[ipos] != null)
259 seqs[ipos].setDescription(seq.getDescription());
260 seqs[ipos].setDBRefs(seq.getDBRefs());
261 seqs[ipos].setSequenceFeatures(seq.getSequenceFeatures());
262 if (seq.getDatasetSequence() != null)
264 seqs[ipos].setDatasetSequence(seq.getDatasetSequence());
267 if (seq.getAnnotation() != null)
269 AlignmentAnnotation[] alann = align.getAlignmentAnnotation();
270 // Only copy annotation that is either a score or referenced by the
271 // alignment's annotation vector
272 for (int a = 0; a < seq.getAnnotation().length; a++)
274 AlignmentAnnotation tocopy = seq.getAnnotation()[a];
277 boolean found = false;
278 for (int pos = 0; pos < alann.length; pos++)
280 if (alann[pos] == tocopy)
291 AlignmentAnnotation newannot = new AlignmentAnnotation(
292 seq.getAnnotation()[a]);
293 newannot.restrict(startRes, endRes);
294 newannot.setSequenceRef(seqs[ipos]);
295 newannot.adjustForAlignment();
296 seqs[ipos].addAlignmentAnnotation(newannot);
306 if (iSize != inorder.length)
308 SequenceI[] nseqs = new SequenceI[iSize];
309 System.arraycopy(seqs, 0, nseqs, 0, iSize);
317 * If sequence ends in gaps, the end residue can be correctly calculated here
323 public int findEndRes(SequenceI seq)
328 for (int j = 0; j < endRes + 1 && j < seq.getLength(); j++)
330 ch = seq.getCharAt(j);
331 if (!jalview.util.Comparison.isGap((ch)))
339 eres += seq.getStart() - 1;
346 public List<SequenceI> getSequences()
352 public List<SequenceI> getSequences(
353 Map<SequenceI, SequenceCollectionI> hiddenReps)
355 if (hiddenReps == null)
357 // TODO: need a synchronizedCollection here ?
362 List<SequenceI> allSequences = new ArrayList<>();
363 for (SequenceI seq : sequences)
365 allSequences.add(seq);
366 if (hiddenReps.containsKey(seq))
368 SequenceCollectionI hsg = hiddenReps.get(seq);
369 for (SequenceI seq2 : hsg.getSequences())
371 if (seq2 != seq && !allSequences.contains(seq2))
373 allSequences.add(seq2);
383 public SequenceI[] getSequencesAsArray(
384 Map<SequenceI, SequenceCollectionI> map)
386 List<SequenceI> tmp = getSequences(map);
391 return tmp.toArray(new SequenceI[tmp.size()]);
400 * @return DOCUMENT ME!
402 public boolean adjustForRemoveLeft(int col)
404 // return value is true if the group still exists
407 startRes = startRes - col;
412 endRes = endRes - col;
414 if (startRes > endRes)
421 // must delete this group!!
434 * @return DOCUMENT ME!
436 public boolean adjustForRemoveRight(int col)
455 * @return DOCUMENT ME!
457 public String getName()
462 public String getDescription()
473 public void setName(String name)
476 // TODO: URGENT: update dependent objects (annotation row)
479 public void setDescription(String desc)
487 * @return DOCUMENT ME!
489 public Conservation getConservation()
500 public void setConservation(Conservation c)
506 * Add s to this sequence group. If aligment sequence is already contained in
507 * group, it will not be added again, but recalculation may happen if the flag
511 * alignment sequence to be added
513 * true means Group's conservation should be recalculated
515 public void addSequence(SequenceI s, boolean recalc)
517 synchronized (sequences)
519 if (s != null && !sequences.contains(s))
522 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED,
523 sequences.size() - 1, sequences.size());
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)
649 ? (endRes < conservation.annotations.length
650 ? conservation.annotations.length
653 conservation.annotations = null;
654 conservation.annotations = new Annotation[aWidth]; // should be alignment
656 c.completeAnnotations(conservation, null, startRes, endRes + 1);
659 public ProfilesI consensusData = null;
661 private void _updateConsensusRow(ProfilesI cnsns, long nseq)
663 if (consensus == null)
667 consensus.label = "Consensus for " + getName();
668 consensus.description = "Percent Identity";
669 consensusData = cnsns;
670 // preserve width if already set
671 int aWidth = (consensus.annotations != null)
672 ? (endRes < consensus.annotations.length
673 ? consensus.annotations.length
676 consensus.annotations = null;
677 consensus.annotations = new Annotation[aWidth]; // should be alignment width
679 AAFrequency.completeConsensus(consensus, cnsns, startRes, endRes + 1,
680 ignoreGapsInConsensus, showSequenceLogo, nseq); // TODO: setting
683 // ignoreGapsInConsensusCalculation);
688 * sequence to either add or remove from group
690 * flag passed to delete/addSequence to indicate if group properties
691 * should be recalculated
693 public void addOrRemove(SequenceI s, boolean recalc)
695 synchronized (sequences)
697 if (sequences.contains(s))
699 deleteSequence(s, recalc);
703 addSequence(s, recalc);
714 * true means recalculate conservation
716 public void deleteSequence(SequenceI s, boolean recalc)
718 synchronized (sequences)
721 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED,
722 sequences.size() + 1, sequences.size());
726 recalcConservation();
734 * @return the first column selected by this group. Runs from 0<=i<N_cols
737 public int getStartRes()
744 * @return the groups last selected column. Runs from 0<=i<N_cols
747 public int getEndRes()
753 * Set the first column selected by this group. Runs from 0<=i<N_cols
757 public void setStartRes(int i)
759 int before = startRes;
761 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, startRes);
765 * Set the groups last selected column. Runs from 0<=i<N_cols
769 public void setEndRes(int i)
773 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, endRes);
777 * @return number of sequences in group
781 return sequences.size();
786 * @return the ith sequence
788 public SequenceI getSequenceAt(int i)
790 return sequences.get(i);
797 public void setColourText(boolean state)
805 * @return DOCUMENT ME!
807 public boolean getColourText()
818 public void setDisplayText(boolean state)
826 * @return DOCUMENT ME!
828 public boolean getDisplayText()
839 public void setDisplayBoxes(boolean state)
841 displayBoxes = state;
847 * @return DOCUMENT ME!
849 public boolean getDisplayBoxes()
855 * computes the width of current set of sequences and returns it
857 * @return DOCUMENT ME!
860 public int getWidth()
862 synchronized (sequences)
864 // MC This needs to get reset when characters are inserted and deleted
865 boolean first = true;
866 for (SequenceI seq : sequences)
868 if (first || seq.getLength() > width)
870 width = seq.getLength();
884 public void setOutlineColour(Color c)
892 * @return DOCUMENT ME!
894 public Color getOutlineColour()
896 return outlineColour;
901 * returns the sequences in the group ordered by the ordering given by al.
902 * this used to return an array with null entries regardless, new behaviour is
903 * below. TODO: verify that this does not affect use in applet or application
907 * @return SequenceI[] intersection of sequences in group with al, ordered by
908 * al, or null if group does not intersect with al
910 public SequenceI[] getSequencesInOrder(AlignmentI al)
912 return getSequencesInOrder(al, true);
916 * return an array representing the intersection of the group with al,
917 * optionally returning an array the size of al.getHeight() where nulls mark
918 * the non-intersected sequences
922 * @return null or array
924 public SequenceI[] getSequencesInOrder(AlignmentI al, boolean trim)
926 synchronized (sequences)
928 int sSize = sequences.size();
929 int alHeight = al.getHeight();
931 SequenceI[] seqs = new SequenceI[(trim) ? sSize : alHeight];
934 for (int i = 0; i < alHeight && index < sSize; i++)
936 if (sequences.contains(al.getSequenceAt(i)))
938 seqs[(trim) ? index : i] = al.getSequenceAt(i);
950 if (index < seqs.length)
952 SequenceI[] dummy = seqs;
953 seqs = new SequenceI[index];
956 seqs[index] = dummy[index];
965 * @return the idColour
967 public Color getIdColour()
974 * the idColour to set
976 public void setIdColour(Color idColour)
978 this.idColour = idColour;
982 * @return the representative sequence for this group
985 public SequenceI getSeqrep()
991 * set the representative sequence for this group. Note - this affects the
992 * interpretation of the Hidereps attribute.
995 * the seqrep to set (null means no sequence representative)
998 public void setSeqrep(SequenceI seqrep)
1000 this.seqrep = seqrep;
1005 * @return true if group has a sequence representative
1008 public boolean hasSeqrep()
1010 return seqrep != null;
1014 * set visibility of sequences covered by (if no sequence representative is
1015 * defined) or represented by this group.
1019 public void setHidereps(boolean visibility)
1021 hidereps = visibility;
1026 * @return true if sequences represented (or covered) by this group should be
1029 public boolean isHidereps()
1035 * set intended visibility of columns covered by this group
1039 public void setHideCols(boolean visibility)
1041 hidecols = visibility;
1046 * @return true if columns covered by group should be hidden
1048 public boolean isHideCols()
1054 * create a new sequence group from the intersection of this group with an
1055 * alignment Hashtable of hidden representatives
1061 * @return new group containing sequences common to this group and alignment
1063 public SequenceGroup intersect(AlignmentI alignment,
1064 Map<SequenceI, SequenceCollectionI> map)
1066 SequenceGroup sgroup = new SequenceGroup(this);
1067 SequenceI[] insect = getSequencesInOrder(alignment);
1068 sgroup.sequences = new ArrayList<>();
1069 for (int s = 0; insect != null && s < insect.length; s++)
1071 if (map == null || map.containsKey(insect[s]))
1073 sgroup.sequences.add(insect[s]);
1080 * @return the showUnconserved
1082 public boolean getShowNonconserved()
1084 return showNonconserved;
1088 * @param showNonconserved
1089 * the showUnconserved to set
1091 public void setShowNonconserved(boolean displayNonconserved)
1093 this.showNonconserved = displayNonconserved;
1097 * set this alignmentAnnotation object as the one used to render consensus
1102 public void setConsensus(AlignmentAnnotation aan)
1104 if (consensus == null)
1112 * @return automatically calculated consensus row note: the row is a stub if a
1113 * consensus calculation has not yet been performed on the group
1115 public AlignmentAnnotation getConsensus()
1117 // TODO get or calculate and get consensus annotation row for this group
1118 int aWidth = this.getWidth();
1126 if (consensus == null)
1128 consensus = new AlignmentAnnotation("", "", new Annotation[1], 0f,
1129 100f, AlignmentAnnotation.BAR_GRAPH);
1130 consensus.hasText = true;
1131 consensus.autoCalculated = true;
1132 consensus.groupRef = this;
1133 consensus.label = "Consensus for " + getName();
1134 consensus.description = "Percent Identity";
1140 * set this alignmentAnnotation object as the one used to render consensus
1145 public void setConservationRow(AlignmentAnnotation aan)
1147 if (conservation == null)
1154 * get the conservation annotation row for this group
1156 * @return autoCalculated annotation row
1158 public AlignmentAnnotation getConservationRow()
1160 if (conservation == null)
1162 conservation = new AlignmentAnnotation("", "", new Annotation[1], 0f,
1163 11f, AlignmentAnnotation.BAR_GRAPH);
1166 conservation.hasText = true;
1167 conservation.autoCalculated = true;
1168 conservation.groupRef = this;
1169 conservation.label = "Conservation for " + getName();
1170 conservation.description = "Conservation for group " + getName()
1171 + " less than " + consPercGaps + "% gaps";
1172 return conservation;
1177 * @return true if annotation rows have been instantiated for this group
1179 public boolean hasAnnotationRows()
1181 return consensus != null || conservation != null;
1184 public SequenceI getConsensusSeq()
1187 StringBuffer seqs = new StringBuffer();
1188 for (int i = 0; i < consensus.annotations.length; i++)
1190 if (consensus.annotations[i] != null)
1192 String desc = consensus.annotations[i].description;
1193 if (desc.length() > 1 && desc.charAt(0) == '[')
1195 seqs.append(desc.charAt(1));
1199 seqs.append(consensus.annotations[i].displayCharacter);
1204 SequenceI sq = new Sequence("Group" + getName() + " Consensus",
1206 sq.setDescription("Percentage Identity Consensus "
1207 + ((ignoreGapsInConsensus) ? " without gaps" : ""));
1211 public void setIgnoreGapsConsensus(boolean state)
1213 if (this.ignoreGapsInConsensus != state && consensus != null)
1215 ignoreGapsInConsensus = state;
1216 recalcConservation();
1218 ignoreGapsInConsensus = state;
1221 public boolean getIgnoreGapsConsensus()
1223 return ignoreGapsInConsensus;
1227 * @param showSequenceLogo
1228 * indicates if a sequence logo is shown for consensus annotation
1230 public void setshowSequenceLogo(boolean showSequenceLogo)
1232 // TODO: decouple calculation from settings update
1233 if (this.showSequenceLogo != showSequenceLogo && consensus != null)
1235 this.showSequenceLogo = showSequenceLogo;
1236 recalcConservation();
1238 this.showSequenceLogo = showSequenceLogo;
1243 * @param showConsHist
1244 * flag indicating if the consensus histogram for this group should
1247 public void setShowConsensusHistogram(boolean showConsHist)
1250 if (showConsensusHistogram != showConsHist && consensus != null)
1252 this.showConsensusHistogram = showConsHist;
1253 recalcConservation();
1255 this.showConsensusHistogram = showConsHist;
1259 * @return the showConsensusHistogram
1261 public boolean isShowConsensusHistogram()
1263 return showConsensusHistogram;
1267 * set flag indicating if logo should be normalised when rendered
1271 public void setNormaliseSequenceLogo(boolean norm)
1273 normaliseSequenceLogo = norm;
1276 public boolean isNormaliseSequenceLogo()
1278 return normaliseSequenceLogo;
1283 * returns a new array with all annotation involving this group
1285 public AlignmentAnnotation[] getAlignmentAnnotation()
1287 // TODO add in other methods like 'getAlignmentAnnotation(String label),
1289 ArrayList<AlignmentAnnotation> annot = new ArrayList<>();
1290 synchronized (sequences)
1292 for (SequenceI seq : sequences)
1294 AlignmentAnnotation[] aa = seq.getAnnotation();
1297 for (AlignmentAnnotation al : aa)
1299 if (al.groupRef == this)
1306 if (consensus != null)
1308 annot.add(consensus);
1310 if (conservation != null)
1312 annot.add(conservation);
1315 return annot.toArray(new AlignmentAnnotation[0]);
1319 public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
1321 return AlignmentAnnotation.findAnnotation(
1322 Arrays.asList(getAlignmentAnnotation()), calcId);
1326 public Iterable<AlignmentAnnotation> findAnnotations(SequenceI seq,
1327 String calcId, String label)
1329 return AlignmentAnnotation.findAnnotations(
1330 Arrays.asList(getAlignmentAnnotation()), seq, calcId, label);
1334 * Answer true if any annotation matches the calcId passed in (if not null).
1339 public boolean hasAnnotation(String calcId)
1341 return AlignmentAnnotation
1342 .hasAnnotation(Arrays.asList(getAlignmentAnnotation()), calcId);
1346 * Remove all sequences from the group (leaving other properties unchanged).
1350 synchronized (sequences)
1352 int before = sequences.size();
1354 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before,
1360 * Sets the alignment or group context for this group, and whether it is
1361 * defined as a group
1364 * the context for the group
1366 * whether the group is defined on the alignment or is just a
1368 * @throws IllegalArgumentException
1369 * if setting the context would result in a circular reference chain
1371 public void setContext(AnnotatedCollectionI ctx, boolean defined)
1374 this.isDefined = defined;
1378 * Sets the alignment or group context for this group
1381 * the context for the group
1382 * @throws IllegalArgumentException
1383 * if setting the context would result in a circular reference chain
1385 public void setContext(AnnotatedCollectionI ctx)
1387 AnnotatedCollectionI ref = ctx;
1390 if (ref == this || ref.getContext() == ctx)
1392 throw new IllegalArgumentException(
1393 "Circular reference in SequenceGroup.context");
1395 ref = ref.getContext();
1403 * @see jalview.datamodel.AnnotatedCollectionI#getContext()
1406 public AnnotatedCollectionI getContext()
1411 public boolean isDefined()
1416 public void setColourScheme(ColourSchemeI scheme)
1420 cs = new ResidueShader();
1422 cs.setColourScheme(scheme);
1425 public void setGroupColourScheme(ResidueShaderI scheme)
1430 public ColourSchemeI getColourScheme()
1432 return cs == null ? null : cs.getColourScheme();
1435 public ResidueShaderI getGroupColourScheme()
1441 public boolean isNucleotide()
1443 if (context != null)
1445 return context.isNucleotide();
1452 * @return true if seq is a member of the group
1455 public boolean contains(SequenceI seq1)
1457 return sequences.contains(seq1);
1463 * @return true if startRes<=apos and endRes>=apos and seq is in the group
1465 public boolean contains(SequenceI seq, int apos)
1467 return (startRes <= apos && endRes >= apos) && sequences.contains(seq);