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];
272 SequenceI seqipos = seqs[ipos] = seq.getSubSequence(startRes, endRes + 1);
275 seqipos.setDescription(seq.getDescription());
276 seqipos.setDBRefs(seq.getDBRefs());
277 seqipos.setSequenceFeatures(seq.getSequenceFeatures());
278 if (seq.getDatasetSequence() != null)
280 seqipos.setDatasetSequence(seq.getDatasetSequence());
283 if (seq.getAnnotation() != null)
285 AlignmentAnnotation[] alann = align.getAlignmentAnnotation();
286 // Only copy annotation that is either a score or referenced by the
287 // alignment's annotation vector
288 for (int a = 0; a < seq.getAnnotation().length; a++)
290 AlignmentAnnotation tocopy = seq.getAnnotation()[a];
293 boolean found = false;
294 for (int pos = 0, np = alann.length; pos < np; pos++)
296 if (alann[pos] == tocopy)
307 AlignmentAnnotation newannot = new AlignmentAnnotation(
308 seq.getAnnotation()[a]);
309 newannot.restrict(startRes, endRes);
310 newannot.setSequenceRef(seqs[ipos]);
311 newannot.adjustForAlignment();
312 seqipos.addAlignmentAnnotation(newannot);
322 if (iSize != inorder.length)
324 SequenceI[] nseqs = new SequenceI[iSize];
325 System.arraycopy(seqs, 0, nseqs, 0, iSize);
333 * If sequence ends in gaps, the end residue can be correctly calculated here
339 public int findEndRes(SequenceI seq)
344 for (int j = 0; j < endRes + 1 && j < seq.getLength(); j++)
346 ch = seq.getCharAt(j);
347 if (!jalview.util.Comparison.isGap((ch)))
355 eres += seq.getStart() - 1;
362 public List<SequenceI> getSequences()
368 public List<SequenceI> getSequences(
369 Map<SequenceI, SequenceCollectionI> hiddenReps)
371 if (hiddenReps == null)
373 // TODO: need a synchronizedCollection here ?
378 List<SequenceI> allSequences = new ArrayList<>();
379 for (SequenceI seq : sequences)
381 allSequences.add(seq);
382 if (hiddenReps.containsKey(seq))
384 SequenceCollectionI hsg = hiddenReps.get(seq);
385 for (SequenceI seq2 : hsg.getSequences())
387 if (seq2 != seq && !allSequences.contains(seq2))
389 allSequences.add(seq2);
399 public SequenceI[] getSequencesAsArray(
400 Map<SequenceI, SequenceCollectionI> map)
402 List<SequenceI> tmp = getSequences(map);
407 return tmp.toArray(new SequenceI[tmp.size()]);
416 * @return DOCUMENT ME!
418 public boolean adjustForRemoveLeft(int col)
420 // return value is true if the group still exists
423 startRes = startRes - col;
428 endRes = endRes - col;
430 if (startRes > endRes)
437 // must delete this group!!
450 * @return DOCUMENT ME!
452 public boolean adjustForRemoveRight(int col)
471 * @return DOCUMENT ME!
473 public String getName()
478 public String getDescription()
489 public void setName(String name)
492 // TODO: URGENT: update dependent objects (annotation row)
495 public void setDescription(String desc)
503 * @return DOCUMENT ME!
505 public Conservation getConservation()
516 public void setConservation(Conservation c)
522 * Add s to this sequence group. If aligment sequence is already contained in
523 * group, it will not be added again, but recalculation may happen if the flag
527 * alignment sequence to be added
529 * true means Group's conservation should be recalculated
531 public void addSequence(SequenceI s, boolean recalc)
533 synchronized (sequences)
535 if (s != null && !sequences.contains(s))
538 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED,
539 sequences.size() - 1, sequences.size());
544 recalcConservation();
550 * Max Gaps Threshold (percent) for performing a conservation calculation
552 private int consPercGaps = 25;
555 * @return Max Gaps Threshold for performing a conservation calculation
557 public int getConsPercGaps()
563 * set Max Gaps Threshold (percent) for performing a conservation calculation
565 * @param consPercGaps
567 public void setConsPercGaps(int consPercGaps)
569 this.consPercGaps = consPercGaps;
573 * calculate residue conservation and colourschemes for group - but only if
574 * necessary. returns true if the calculation resulted in a visible change to
577 public boolean recalcConservation()
579 return recalcConservation(false);
583 * calculate residue conservation for group - but only if necessary. returns
584 * true if the calculation resulted in a visible change to group
587 * when set, colourschemes for this group are not refreshed after
590 public boolean recalcConservation(boolean defer)
592 if (cs == null && consensus == null && conservation == null)
596 // TODO: try harder to detect changes in state in order to minimise
597 // recalculation effort
601 ProfilesI cnsns = AAFrequency.calculate(sequences, startRes,
602 endRes + 1, showSequenceLogo);
603 if (consensus != null)
605 _updateConsensusRow(cnsns, sequences.size());
610 cs.setConsensus(cnsns);
614 if ((conservation != null)
615 || (cs != null && cs.conservationApplied()))
617 Conservation c = new Conservation(groupName, sequences, startRes,
620 c.verdict(false, consPercGaps);
621 if (conservation != null)
623 _updateConservationRow(c);
627 if (cs.conservationApplied())
629 cs.setConservation(c);
632 // eager update - will cause a refresh of overview regardless
635 if (cs != null && !defer)
637 // TODO: JAL-2034 should cs.alignmentChanged modify return state
638 cs.alignmentChanged(context != null ? context : this, null);
645 } catch (java.lang.OutOfMemoryError err)
648 System.out.println("Out of memory loading groups: " + err);
653 private void _updateConservationRow(Conservation c)
655 if (conservation == null)
660 conservation.label = "Conservation for " + getName();
661 conservation.description = "Conservation for group " + getName()
662 + " less than " + consPercGaps + "% gaps";
663 // preserve width if already set
664 int aWidth = (conservation.annotations != null)
665 ? (endRes < conservation.annotations.length
666 ? conservation.annotations.length
669 conservation.annotations = null;
670 conservation.annotations = new Annotation[aWidth]; // should be alignment
672 c.completeAnnotations(conservation, null, startRes, endRes + 1);
675 public ProfilesI consensusData = null;
677 private void _updateConsensusRow(ProfilesI cnsns, long nseq)
679 if (consensus == null)
683 consensus.label = "Consensus for " + getName();
684 consensus.description = "Percent Identity";
685 consensusData = cnsns;
686 // preserve width if already set
687 int aWidth = (consensus.annotations != null)
688 ? (endRes < consensus.annotations.length
689 ? consensus.annotations.length
692 consensus.annotations = null;
693 consensus.annotations = new Annotation[aWidth]; // should be alignment width
695 AAFrequency.completeConsensus(consensus, cnsns, startRes, endRes + 1,
696 ignoreGapsInConsensus, showSequenceLogo, nseq); // TODO: setting
699 // ignoreGapsInConsensusCalculation);
704 * sequence to either add or remove from group
706 * flag passed to delete/addSequence to indicate if group properties
707 * should be recalculated
709 public void addOrRemove(SequenceI s, boolean recalc)
711 synchronized (sequences)
713 if (sequences.contains(s))
715 deleteSequence(s, recalc);
719 addSequence(s, recalc);
730 * true means recalculate conservation
732 public void deleteSequence(SequenceI s, boolean recalc)
734 synchronized (sequences)
737 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED,
738 sequences.size() + 1, sequences.size());
742 recalcConservation();
750 * @return the first column selected by this group. Runs from 0<=i<N_cols
753 public int getStartRes()
760 * @return the groups last selected column. Runs from 0<=i<N_cols
763 public int getEndRes()
769 * Set the first column selected by this group. Runs from 0<=i<N_cols
773 public void setStartRes(int newStart)
775 int before = startRes;
776 startRes= Math.max(0,newStart); // sanity check for negative start column positions
777 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, startRes);
784 * Set the groups last selected column. Runs from 0<=i<N_cols
788 public void setEndRes(int i)
792 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, endRes);
796 * @return number of sequences in group
800 return sequences.size();
805 * @return the ith sequence
807 public SequenceI getSequenceAt(int i)
809 return sequences.get(i);
816 public void setColourText(boolean state)
824 * @return DOCUMENT ME!
826 public boolean getColourText()
837 public void setDisplayText(boolean state)
845 * @return DOCUMENT ME!
847 public boolean getDisplayText()
858 public void setDisplayBoxes(boolean state)
860 displayBoxes = state;
866 * @return DOCUMENT ME!
868 public boolean getDisplayBoxes()
874 * computes the width of current set of sequences and returns it
876 * @return DOCUMENT ME!
879 public int getWidth()
881 synchronized (sequences)
883 // MC This needs to get reset when characters are inserted and deleted
884 boolean first = true;
885 for (SequenceI seq : sequences)
887 if (first || seq.getLength() > width)
889 width = seq.getLength();
903 public void setOutlineColour(Color c)
911 * @return DOCUMENT ME!
913 public Color getOutlineColour()
915 return outlineColour;
920 * returns the sequences in the group ordered by the ordering given by al.
921 * this used to return an array with null entries regardless, new behaviour is
922 * below. TODO: verify that this does not affect use in applet or application
926 * @return SequenceI[] intersection of sequences in group with al, ordered by
927 * al, or null if group does not intersect with al
929 public SequenceI[] getSequencesInOrder(AlignmentI al)
931 return getSequencesInOrder(al, true);
935 * return an array representing the intersection of the group with al,
936 * optionally returning an array the size of al.getHeight() where nulls mark
937 * the non-intersected sequences
941 * @return null or array
943 public SequenceI[] getSequencesInOrder(AlignmentI al, boolean trim)
945 synchronized (sequences)
947 int sSize = sequences.size();
948 int alHeight = al.getHeight();
950 SequenceI[] seqs = new SequenceI[(trim) ? sSize : alHeight];
953 for (int i = 0; i < alHeight && index < sSize; i++)
955 if (sequences.contains(al.getSequenceAt(i)))
957 seqs[(trim) ? index : i] = al.getSequenceAt(i);
969 if (index < seqs.length)
971 SequenceI[] dummy = seqs;
972 seqs = new SequenceI[index];
975 seqs[index] = dummy[index];
984 * @return the idColour
986 public Color getIdColour()
993 * the idColour to set
995 public void setIdColour(Color idColour)
997 this.idColour = idColour;
1001 * @return the representative sequence for this group
1004 public SequenceI getSeqrep()
1010 * set the representative sequence for this group. Note - this affects the
1011 * interpretation of the Hidereps attribute.
1014 * the seqrep to set (null means no sequence representative)
1017 public void setSeqrep(SequenceI seqrep)
1019 this.seqrep = seqrep;
1024 * @return true if group has a sequence representative
1027 public boolean hasSeqrep()
1029 return seqrep != null;
1033 * set visibility of sequences covered by (if no sequence representative is
1034 * defined) or represented by this group.
1038 public void setHidereps(boolean visibility)
1040 hidereps = visibility;
1045 * @return true if sequences represented (or covered) by this group should be
1048 public boolean isHidereps()
1054 * set intended visibility of columns covered by this group
1058 public void setHideCols(boolean visibility)
1060 hidecols = visibility;
1065 * @return true if columns covered by group should be hidden
1067 public boolean isHideCols()
1073 * create a new sequence group from the intersection of this group with an
1074 * alignment Hashtable of hidden representatives
1080 * @return new group containing sequences common to this group and alignment
1082 public SequenceGroup intersect(AlignmentI alignment,
1083 Map<SequenceI, SequenceCollectionI> map)
1085 SequenceGroup sgroup = new SequenceGroup(this);
1086 SequenceI[] insect = getSequencesInOrder(alignment);
1087 sgroup.sequences = new ArrayList<>();
1088 for (int s = 0; insect != null && s < insect.length; s++)
1090 if (map == null || map.containsKey(insect[s]))
1092 sgroup.sequences.add(insect[s]);
1099 * @return the showUnconserved
1101 public boolean getShowNonconserved()
1103 return showNonconserved;
1107 * @param showNonconserved
1108 * the showUnconserved to set
1110 public void setShowNonconserved(boolean displayNonconserved)
1112 this.showNonconserved = displayNonconserved;
1116 * set this alignmentAnnotation object as the one used to render consensus
1121 public void setConsensus(AlignmentAnnotation aan)
1123 if (consensus == null)
1131 * @return automatically calculated consensus row note: the row is a stub if a
1132 * consensus calculation has not yet been performed on the group
1134 public AlignmentAnnotation getConsensus()
1136 // TODO get or calculate and get consensus annotation row for this group
1137 int aWidth = this.getWidth();
1145 if (consensus == null)
1147 consensus = new AlignmentAnnotation("", "", new Annotation[1], 0f,
1148 100f, AlignmentAnnotation.BAR_GRAPH);
1149 consensus.hasText = true;
1150 consensus.autoCalculated = true;
1151 consensus.groupRef = this;
1152 consensus.label = "Consensus for " + getName();
1153 consensus.description = "Percent Identity";
1159 * set this alignmentAnnotation object as the one used to render consensus
1164 public void setConservationRow(AlignmentAnnotation aan)
1166 if (conservation == null)
1173 * get the conservation annotation row for this group
1175 * @return autoCalculated annotation row
1177 public AlignmentAnnotation getConservationRow()
1179 if (conservation == null)
1181 conservation = new AlignmentAnnotation("", "", new Annotation[1], 0f,
1182 11f, AlignmentAnnotation.BAR_GRAPH);
1185 conservation.hasText = true;
1186 conservation.autoCalculated = true;
1187 conservation.groupRef = this;
1188 conservation.label = "Conservation for " + getName();
1189 conservation.description = "Conservation for group " + getName()
1190 + " less than " + consPercGaps + "% gaps";
1191 return conservation;
1196 * @return true if annotation rows have been instantiated for this group
1198 public boolean hasAnnotationRows()
1200 return consensus != null || conservation != null;
1203 public SequenceI getConsensusSeq()
1206 StringBuffer seqs = new StringBuffer();
1207 for (int i = 0; i < consensus.annotations.length; i++)
1209 if (consensus.annotations[i] != null)
1211 String desc = consensus.annotations[i].description;
1212 if (desc.length() > 1 && desc.charAt(0) == '[')
1214 seqs.append(desc.charAt(1));
1218 seqs.append(consensus.annotations[i].displayCharacter);
1223 SequenceI sq = new Sequence("Group" + getName() + " Consensus",
1225 sq.setDescription("Percentage Identity Consensus "
1226 + ((ignoreGapsInConsensus) ? " without gaps" : ""));
1230 public void setIgnoreGapsConsensus(boolean state)
1232 if (this.ignoreGapsInConsensus != state && consensus != null)
1234 ignoreGapsInConsensus = state;
1235 recalcConservation();
1237 ignoreGapsInConsensus = state;
1240 public boolean getIgnoreGapsConsensus()
1242 return ignoreGapsInConsensus;
1246 * @param showSequenceLogo
1247 * indicates if a sequence logo is shown for consensus annotation
1249 public void setshowSequenceLogo(boolean showSequenceLogo)
1251 // TODO: decouple calculation from settings update
1252 if (this.showSequenceLogo != showSequenceLogo && consensus != null)
1254 this.showSequenceLogo = showSequenceLogo;
1255 recalcConservation();
1257 this.showSequenceLogo = showSequenceLogo;
1262 * @param showConsHist
1263 * flag indicating if the consensus histogram for this group should
1266 public void setShowConsensusHistogram(boolean showConsHist)
1269 if (showConsensusHistogram != showConsHist && consensus != null)
1271 this.showConsensusHistogram = showConsHist;
1272 recalcConservation();
1274 this.showConsensusHistogram = showConsHist;
1278 * @return the showConsensusHistogram
1280 public boolean isShowConsensusHistogram()
1282 return showConsensusHistogram;
1286 * set flag indicating if logo should be normalised when rendered
1290 public void setNormaliseSequenceLogo(boolean norm)
1292 normaliseSequenceLogo = norm;
1295 public boolean isNormaliseSequenceLogo()
1297 return normaliseSequenceLogo;
1302 * returns a new array with all annotation involving this group
1304 public AlignmentAnnotation[] getAlignmentAnnotation()
1306 // TODO add in other methods like 'getAlignmentAnnotation(String label),
1308 ArrayList<AlignmentAnnotation> annot = new ArrayList<>();
1309 synchronized (sequences)
1311 for (SequenceI seq : sequences)
1313 AlignmentAnnotation[] aa = seq.getAnnotation();
1316 for (AlignmentAnnotation al : aa)
1318 if (al.groupRef == this)
1325 if (consensus != null)
1327 annot.add(consensus);
1329 if (conservation != null)
1331 annot.add(conservation);
1334 return annot.toArray(new AlignmentAnnotation[0]);
1338 public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
1340 return AlignmentAnnotation.findAnnotation(
1341 Arrays.asList(getAlignmentAnnotation()), calcId);
1345 public Iterable<AlignmentAnnotation> findAnnotations(SequenceI seq,
1346 String calcId, String label)
1348 return AlignmentAnnotation.findAnnotations(
1349 Arrays.asList(getAlignmentAnnotation()), seq, calcId, label);
1353 * Answer true if any annotation matches the calcId passed in (if not null).
1358 public boolean hasAnnotation(String calcId)
1360 return AlignmentAnnotation
1361 .hasAnnotation(Arrays.asList(getAlignmentAnnotation()), calcId);
1365 * Remove all sequences from the group (leaving other properties unchanged).
1369 synchronized (sequences)
1371 int before = sequences.size();
1373 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before,
1379 * Sets the alignment or group context for this group, and whether it is
1380 * defined as a group
1383 * the context for the group
1385 * whether the group is defined on the alignment or is just a
1387 * @throws IllegalArgumentException
1388 * if setting the context would result in a circular reference chain
1390 public void setContext(AnnotatedCollectionI ctx, boolean defined)
1393 this.isDefined = defined;
1397 * Sets the alignment or group context for this group
1400 * the context for the group
1401 * @throws IllegalArgumentException
1402 * if setting the context would result in a circular reference chain
1404 public void setContext(AnnotatedCollectionI ctx)
1406 AnnotatedCollectionI ref = ctx;
1409 if (ref == this || ref.getContext() == ctx)
1411 throw new IllegalArgumentException(
1412 "Circular reference in SequenceGroup.context");
1414 ref = ref.getContext();
1422 * @see jalview.datamodel.AnnotatedCollectionI#getContext()
1425 public AnnotatedCollectionI getContext()
1430 public boolean isDefined()
1435 public void setColourScheme(ColourSchemeI scheme)
1439 cs = new ResidueShader();
1441 cs.setColourScheme(scheme);
1444 public void setGroupColourScheme(ResidueShaderI scheme)
1449 public ColourSchemeI getColourScheme()
1451 return cs == null ? null : cs.getColourScheme();
1454 public ResidueShaderI getGroupColourScheme()
1460 public boolean isNucleotide()
1462 if (context != null)
1464 return context.isNucleotide();
1471 * @return true if seq is a member of the group
1474 public boolean contains(SequenceI seq1)
1476 return sequences.contains(seq1);
1482 * @return true if startRes<=apos and endRes>=apos and seq is in the group
1484 public boolean contains(SequenceI seq, int apos)
1486 return (startRes <= apos && endRes >= apos) && sequences.contains(seq);