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;
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();
168 * Creates a new SequenceGroup object.
173 * @param displayBoxes
177 * first column of group
179 * last column of group
181 public SequenceGroup(List<SequenceI> sequences, String groupName,
182 ColourSchemeI scheme, boolean displayBoxes, boolean displayText,
183 boolean colourText, int start, int end)
186 this.sequences = sequences;
187 this.groupName = groupName;
188 this.displayBoxes = displayBoxes;
189 this.displayText = displayText;
190 this.colourText = colourText;
191 this.cs = new ResidueShader(scheme);
194 recalcConservation();
202 public SequenceGroup(SequenceGroup seqsel)
207 sequences = new ArrayList<>();
208 sequences.addAll(seqsel.sequences);
209 if (seqsel.groupName != null)
211 groupName = new String(seqsel.groupName);
213 displayBoxes = seqsel.displayBoxes;
214 displayText = seqsel.displayText;
215 colourText = seqsel.colourText;
217 startRes = seqsel.startRes;
218 endRes = seqsel.endRes;
219 cs = new ResidueShader((ResidueShader) seqsel.cs);
220 if (seqsel.description != null)
222 description = new String(seqsel.description);
224 hidecols = seqsel.hidecols;
225 hidereps = seqsel.hidereps;
226 showNonconserved = seqsel.showNonconserved;
227 showSequenceLogo = seqsel.showSequenceLogo;
228 normaliseSequenceLogo = seqsel.normaliseSequenceLogo;
229 showConsensusHistogram = seqsel.showConsensusHistogram;
230 idColour = seqsel.idColour;
231 outlineColour = seqsel.outlineColour;
232 seqrep = seqsel.seqrep;
233 textColour = seqsel.textColour;
234 textColour2 = seqsel.textColour2;
235 thresholdTextColour = seqsel.thresholdTextColour;
236 width = seqsel.width;
237 ignoreGapsInConsensus = seqsel.ignoreGapsInConsensus;
238 if (seqsel.conserve != null)
240 recalcConservation(); // safer than
241 // aaFrequency = (Vector) seqsel.aaFrequency.clone(); // ??
246 public boolean isShowSequenceLogo()
248 return showSequenceLogo;
251 public SequenceI[] getSelectionAsNewSequences(AlignmentI align)
253 int iSize = sequences.size();
254 SequenceI[] seqs = new SequenceI[iSize];
255 SequenceI[] inorder = getSequencesInOrder(align);
257 for (int i = 0, ipos = 0; i < inorder.length; i++)
259 SequenceI seq = inorder[i];
261 seqs[ipos] = seq.getSubSequence(startRes, endRes + 1);
262 if (seqs[ipos] != null)
264 seqs[ipos].setDescription(seq.getDescription());
265 seqs[ipos].setDBRefs(seq.getDBRefs());
266 seqs[ipos].setSequenceFeatures(seq.getSequenceFeatures());
267 if (seq.getDatasetSequence() != null)
269 seqs[ipos].setDatasetSequence(seq.getDatasetSequence());
272 if (seq.getAnnotation() != null)
274 AlignmentAnnotation[] alann = align.getAlignmentAnnotation();
275 // Only copy annotation that is either a score or referenced by the
276 // alignment's annotation vector
277 for (int a = 0; a < seq.getAnnotation().length; a++)
279 AlignmentAnnotation tocopy = seq.getAnnotation()[a];
282 boolean found = false;
283 for (int pos = 0; pos < alann.length; pos++)
285 if (alann[pos] == tocopy)
296 AlignmentAnnotation newannot = new AlignmentAnnotation(
297 seq.getAnnotation()[a]);
298 newannot.restrict(startRes, endRes);
299 newannot.setSequenceRef(seqs[ipos]);
300 newannot.adjustForAlignment();
301 seqs[ipos].addAlignmentAnnotation(newannot);
311 if (iSize != inorder.length)
313 SequenceI[] nseqs = new SequenceI[iSize];
314 System.arraycopy(seqs, 0, nseqs, 0, iSize);
322 * If sequence ends in gaps, the end residue can be correctly calculated here
328 public int findEndRes(SequenceI seq)
333 for (int j = 0; j < endRes + 1 && j < seq.getLength(); j++)
335 ch = seq.getCharAt(j);
336 if (!jalview.util.Comparison.isGap((ch)))
344 eres += seq.getStart() - 1;
351 public List<SequenceI> getSequences()
357 public List<SequenceI> getSequences(
358 Map<SequenceI, SequenceCollectionI> hiddenReps)
360 if (hiddenReps == null)
362 // TODO: need a synchronizedCollection here ?
367 List<SequenceI> allSequences = new ArrayList<>();
368 for (SequenceI seq : sequences)
370 allSequences.add(seq);
371 if (hiddenReps.containsKey(seq))
373 SequenceCollectionI hsg = hiddenReps.get(seq);
374 for (SequenceI seq2 : hsg.getSequences())
376 if (seq2 != seq && !allSequences.contains(seq2))
378 allSequences.add(seq2);
388 public SequenceI[] getSequencesAsArray(
389 Map<SequenceI, SequenceCollectionI> map)
391 List<SequenceI> tmp = getSequences(map);
396 return tmp.toArray(new SequenceI[tmp.size()]);
405 * @return DOCUMENT ME!
407 public boolean adjustForRemoveLeft(int col)
409 // return value is true if the group still exists
412 startRes = startRes - col;
417 endRes = endRes - col;
419 if (startRes > endRes)
426 // must delete this group!!
439 * @return DOCUMENT ME!
441 public boolean adjustForRemoveRight(int col)
460 * @return DOCUMENT ME!
462 public String getName()
467 public String getDescription()
478 public void setName(String name)
481 // TODO: URGENT: update dependent objects (annotation row)
484 public void setDescription(String desc)
492 * @return DOCUMENT ME!
494 public Conservation getConservation()
505 public void setConservation(Conservation c)
511 * Add s to this sequence group. If aligment sequence is already contained in
512 * group, it will not be added again, but recalculation may happen if the flag
516 * alignment sequence to be added
518 * true means Group's conservation should be recalculated
520 public void addSequence(SequenceI s, boolean recalc)
522 synchronized (sequences)
524 if (s != null && !sequences.contains(s))
527 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED,
528 sequences.size() - 1, sequences.size());
533 recalcConservation();
539 * Max Gaps Threshold (percent) for performing a conservation calculation
541 private int consPercGaps = 25;
544 * @return Max Gaps Threshold for performing a conservation calculation
546 public int getConsPercGaps()
552 * set Max Gaps Threshold (percent) for performing a conservation calculation
554 * @param consPercGaps
556 public void setConsPercGaps(int consPercGaps)
558 this.consPercGaps = consPercGaps;
562 * calculate residue conservation and colourschemes for group - but only if
563 * necessary. returns true if the calculation resulted in a visible change to
566 public boolean recalcConservation()
568 return recalcConservation(false);
572 * calculate residue conservation for group - but only if necessary. returns
573 * true if the calculation resulted in a visible change to group
576 * when set, colourschemes for this group are not refreshed after
579 public boolean recalcConservation(boolean defer)
581 if (cs == null && consensus == null && conservation == null)
585 // TODO: try harder to detect changes in state in order to minimise
586 // recalculation effort
590 ProfilesI cnsns = AAFrequency.calculate(sequences, startRes,
591 endRes + 1, showSequenceLogo);
592 if (consensus != null)
594 _updateConsensusRow(cnsns, sequences.size());
599 cs.setConsensus(cnsns);
603 if ((conservation != null)
604 || (cs != null && cs.conservationApplied()))
606 Conservation c = new Conservation(groupName, sequences, startRes,
609 c.verdict(false, consPercGaps);
610 if (conservation != null)
612 _updateConservationRow(c);
616 if (cs.conservationApplied())
618 cs.setConservation(c);
621 // eager update - will cause a refresh of overview regardless
624 if (cs != null && !defer)
626 // TODO: JAL-2034 should cs.alignmentChanged modify return state
627 cs.alignmentChanged(context != null ? context : this, null);
634 } catch (java.lang.OutOfMemoryError err)
637 System.out.println("Out of memory loading groups: " + err);
642 private void _updateConservationRow(Conservation c)
644 if (conservation == null)
649 conservation.label = "Conservation for " + getName();
650 conservation.description = "Conservation for group " + getName()
651 + " less than " + consPercGaps + "% gaps";
652 // preserve width if already set
653 int aWidth = (conservation.annotations != null)
654 ? (endRes < conservation.annotations.length
655 ? conservation.annotations.length
658 conservation.annotations = null;
659 conservation.annotations = new Annotation[aWidth]; // should be alignment
661 c.completeAnnotations(conservation, null, startRes, endRes + 1);
664 public ProfilesI consensusData = null;
666 private void _updateConsensusRow(ProfilesI cnsns, long nseq)
668 if (consensus == null)
672 consensus.label = "Consensus for " + getName();
673 consensus.description = "Percent Identity";
674 consensusData = cnsns;
675 // preserve width if already set
676 int aWidth = (consensus.annotations != null)
677 ? (endRes < consensus.annotations.length
678 ? consensus.annotations.length
681 consensus.annotations = null;
682 consensus.annotations = new Annotation[aWidth]; // should be alignment width
684 AAFrequency.completeConsensus(consensus, cnsns, startRes, endRes + 1,
685 ignoreGapsInConsensus, showSequenceLogo, nseq); // TODO: setting
688 // ignoreGapsInConsensusCalculation);
693 * sequence to either add or remove from group
695 * flag passed to delete/addSequence to indicate if group properties
696 * should be recalculated
698 public void addOrRemove(SequenceI s, boolean recalc)
700 synchronized (sequences)
702 if (sequences.contains(s))
704 deleteSequence(s, recalc);
708 addSequence(s, recalc);
719 * true means recalculate conservation
721 public void deleteSequence(SequenceI s, boolean recalc)
723 synchronized (sequences)
726 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED,
727 sequences.size() + 1, sequences.size());
731 recalcConservation();
739 * @return the first column selected by this group. Runs from 0<=i<N_cols
742 public int getStartRes()
749 * @return the groups last selected column. Runs from 0<=i<N_cols
752 public int getEndRes()
758 * Set the first column selected by this group. Runs from 0<=i<N_cols
762 public void setStartRes(int newStart)
764 int before = startRes;
765 startRes= Math.max(0,newStart); // sanity check for negative start column positions
766 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, startRes);
773 * Set the groups last selected column. Runs from 0<=i<N_cols
777 public void setEndRes(int i)
781 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, endRes);
785 * @return number of sequences in group
789 return sequences.size();
794 * @return the ith sequence
796 public SequenceI getSequenceAt(int i)
798 return sequences.get(i);
805 public void setColourText(boolean state)
813 * @return DOCUMENT ME!
815 public boolean getColourText()
826 public void setDisplayText(boolean state)
834 * @return DOCUMENT ME!
836 public boolean getDisplayText()
847 public void setDisplayBoxes(boolean state)
849 displayBoxes = state;
855 * @return DOCUMENT ME!
857 public boolean getDisplayBoxes()
863 * computes the width of current set of sequences and returns it
865 * @return DOCUMENT ME!
868 public int getWidth()
870 synchronized (sequences)
872 // MC This needs to get reset when characters are inserted and deleted
873 boolean first = true;
874 for (SequenceI seq : sequences)
876 if (first || seq.getLength() > width)
878 width = seq.getLength();
892 public void setOutlineColour(Color c)
900 * @return DOCUMENT ME!
902 public Color getOutlineColour()
904 return outlineColour;
909 * returns the sequences in the group ordered by the ordering given by al.
910 * this used to return an array with null entries regardless, new behaviour is
911 * below. TODO: verify that this does not affect use in applet or application
915 * @return SequenceI[] intersection of sequences in group with al, ordered by
916 * al, or null if group does not intersect with al
918 public SequenceI[] getSequencesInOrder(AlignmentI al)
920 return getSequencesInOrder(al, true);
924 * return an array representing the intersection of the group with al,
925 * optionally returning an array the size of al.getHeight() where nulls mark
926 * the non-intersected sequences
930 * @return null or array
932 public SequenceI[] getSequencesInOrder(AlignmentI al, boolean trim)
934 synchronized (sequences)
936 int sSize = sequences.size();
937 int alHeight = al.getHeight();
939 SequenceI[] seqs = new SequenceI[(trim) ? sSize : alHeight];
942 for (int i = 0; i < alHeight && index < sSize; i++)
944 if (sequences.contains(al.getSequenceAt(i)))
946 seqs[(trim) ? index : i] = al.getSequenceAt(i);
958 if (index < seqs.length)
960 SequenceI[] dummy = seqs;
961 seqs = new SequenceI[index];
964 seqs[index] = dummy[index];
973 * @return the idColour
975 public Color getIdColour()
982 * the idColour to set
984 public void setIdColour(Color idColour)
986 this.idColour = idColour;
990 * @return the representative sequence for this group
993 public SequenceI getSeqrep()
999 * set the representative sequence for this group. Note - this affects the
1000 * interpretation of the Hidereps attribute.
1003 * the seqrep to set (null means no sequence representative)
1006 public void setSeqrep(SequenceI seqrep)
1008 this.seqrep = seqrep;
1013 * @return true if group has a sequence representative
1016 public boolean hasSeqrep()
1018 return seqrep != null;
1022 * set visibility of sequences covered by (if no sequence representative is
1023 * defined) or represented by this group.
1027 public void setHidereps(boolean visibility)
1029 hidereps = visibility;
1034 * @return true if sequences represented (or covered) by this group should be
1037 public boolean isHidereps()
1043 * set intended visibility of columns covered by this group
1047 public void setHideCols(boolean visibility)
1049 hidecols = visibility;
1054 * @return true if columns covered by group should be hidden
1056 public boolean isHideCols()
1062 * create a new sequence group from the intersection of this group with an
1063 * alignment Hashtable of hidden representatives
1069 * @return new group containing sequences common to this group and alignment
1071 public SequenceGroup intersect(AlignmentI alignment,
1072 Map<SequenceI, SequenceCollectionI> map)
1074 SequenceGroup sgroup = new SequenceGroup(this);
1075 SequenceI[] insect = getSequencesInOrder(alignment);
1076 sgroup.sequences = new ArrayList<>();
1077 for (int s = 0; insect != null && s < insect.length; s++)
1079 if (map == null || map.containsKey(insect[s]))
1081 sgroup.sequences.add(insect[s]);
1088 * @return the showUnconserved
1090 public boolean getShowNonconserved()
1092 return showNonconserved;
1096 * @param showNonconserved
1097 * the showUnconserved to set
1099 public void setShowNonconserved(boolean displayNonconserved)
1101 this.showNonconserved = displayNonconserved;
1105 * set this alignmentAnnotation object as the one used to render consensus
1110 public void setConsensus(AlignmentAnnotation aan)
1112 if (consensus == null)
1120 * @return automatically calculated consensus row note: the row is a stub if a
1121 * consensus calculation has not yet been performed on the group
1123 public AlignmentAnnotation getConsensus()
1125 // TODO get or calculate and get consensus annotation row for this group
1126 int aWidth = this.getWidth();
1134 if (consensus == null)
1136 consensus = new AlignmentAnnotation("", "", new Annotation[1], 0f,
1137 100f, AlignmentAnnotation.BAR_GRAPH);
1138 consensus.hasText = true;
1139 consensus.autoCalculated = true;
1140 consensus.groupRef = this;
1141 consensus.label = "Consensus for " + getName();
1142 consensus.description = "Percent Identity";
1148 * set this alignmentAnnotation object as the one used to render consensus
1153 public void setConservationRow(AlignmentAnnotation aan)
1155 if (conservation == null)
1162 * get the conservation annotation row for this group
1164 * @return autoCalculated annotation row
1166 public AlignmentAnnotation getConservationRow()
1168 if (conservation == null)
1170 conservation = new AlignmentAnnotation("", "", new Annotation[1], 0f,
1171 11f, AlignmentAnnotation.BAR_GRAPH);
1174 conservation.hasText = true;
1175 conservation.autoCalculated = true;
1176 conservation.groupRef = this;
1177 conservation.label = "Conservation for " + getName();
1178 conservation.description = "Conservation for group " + getName()
1179 + " less than " + consPercGaps + "% gaps";
1180 return conservation;
1185 * @return true if annotation rows have been instantiated for this group
1187 public boolean hasAnnotationRows()
1189 return consensus != null || conservation != null;
1192 public SequenceI getConsensusSeq()
1195 StringBuffer seqs = new StringBuffer();
1196 for (int i = 0; i < consensus.annotations.length; i++)
1198 if (consensus.annotations[i] != null)
1200 String desc = consensus.annotations[i].description;
1201 if (desc.length() > 1 && desc.charAt(0) == '[')
1203 seqs.append(desc.charAt(1));
1207 seqs.append(consensus.annotations[i].displayCharacter);
1212 SequenceI sq = new Sequence("Group" + getName() + " Consensus",
1214 sq.setDescription("Percentage Identity Consensus "
1215 + ((ignoreGapsInConsensus) ? " without gaps" : ""));
1219 public void setIgnoreGapsConsensus(boolean state)
1221 if (this.ignoreGapsInConsensus != state && consensus != null)
1223 ignoreGapsInConsensus = state;
1224 recalcConservation();
1226 ignoreGapsInConsensus = state;
1229 public boolean getIgnoreGapsConsensus()
1231 return ignoreGapsInConsensus;
1235 * @param showSequenceLogo
1236 * indicates if a sequence logo is shown for consensus annotation
1238 public void setshowSequenceLogo(boolean showSequenceLogo)
1240 // TODO: decouple calculation from settings update
1241 if (this.showSequenceLogo != showSequenceLogo && consensus != null)
1243 this.showSequenceLogo = showSequenceLogo;
1244 recalcConservation();
1246 this.showSequenceLogo = showSequenceLogo;
1251 * @param showConsHist
1252 * flag indicating if the consensus histogram for this group should
1255 public void setShowConsensusHistogram(boolean showConsHist)
1258 if (showConsensusHistogram != showConsHist && consensus != null)
1260 this.showConsensusHistogram = showConsHist;
1261 recalcConservation();
1263 this.showConsensusHistogram = showConsHist;
1267 * @return the showConsensusHistogram
1269 public boolean isShowConsensusHistogram()
1271 return showConsensusHistogram;
1275 * set flag indicating if logo should be normalised when rendered
1279 public void setNormaliseSequenceLogo(boolean norm)
1281 normaliseSequenceLogo = norm;
1284 public boolean isNormaliseSequenceLogo()
1286 return normaliseSequenceLogo;
1291 * returns a new array with all annotation involving this group
1293 public AlignmentAnnotation[] getAlignmentAnnotation()
1295 // TODO add in other methods like 'getAlignmentAnnotation(String label),
1297 ArrayList<AlignmentAnnotation> annot = new ArrayList<>();
1298 synchronized (sequences)
1300 for (SequenceI seq : sequences)
1302 AlignmentAnnotation[] aa = seq.getAnnotation();
1305 for (AlignmentAnnotation al : aa)
1307 if (al.groupRef == this)
1314 if (consensus != null)
1316 annot.add(consensus);
1318 if (conservation != null)
1320 annot.add(conservation);
1323 return annot.toArray(new AlignmentAnnotation[0]);
1327 public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
1329 return AlignmentAnnotation.findAnnotation(
1330 Arrays.asList(getAlignmentAnnotation()), calcId);
1334 public Iterable<AlignmentAnnotation> findAnnotations(SequenceI seq,
1335 String calcId, String label)
1337 return AlignmentAnnotation.findAnnotations(
1338 Arrays.asList(getAlignmentAnnotation()), seq, calcId, label);
1342 * Answer true if any annotation matches the calcId passed in (if not null).
1347 public boolean hasAnnotation(String calcId)
1349 return AlignmentAnnotation
1350 .hasAnnotation(Arrays.asList(getAlignmentAnnotation()), calcId);
1354 * Remove all sequences from the group (leaving other properties unchanged).
1358 synchronized (sequences)
1360 int before = sequences.size();
1362 changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before,
1368 * Sets the alignment or group context for this group, and whether it is
1369 * defined as a group
1372 * the context for the group
1374 * whether the group is defined on the alignment or is just a
1376 * @throws IllegalArgumentException
1377 * if setting the context would result in a circular reference chain
1379 public void setContext(AnnotatedCollectionI ctx, boolean defined)
1382 this.isDefined = defined;
1386 * Sets the alignment or group context for this group
1389 * the context for the group
1390 * @throws IllegalArgumentException
1391 * if setting the context would result in a circular reference chain
1393 public void setContext(AnnotatedCollectionI ctx)
1395 AnnotatedCollectionI ref = ctx;
1398 if (ref == this || ref.getContext() == ctx)
1400 throw new IllegalArgumentException(
1401 "Circular reference in SequenceGroup.context");
1403 ref = ref.getContext();
1411 * @see jalview.datamodel.AnnotatedCollectionI#getContext()
1414 public AnnotatedCollectionI getContext()
1419 public boolean isDefined()
1424 public void setColourScheme(ColourSchemeI scheme)
1428 cs = new ResidueShader();
1430 cs.setColourScheme(scheme);
1433 public void setGroupColourScheme(ResidueShaderI scheme)
1438 public ColourSchemeI getColourScheme()
1440 return cs == null ? null : cs.getColourScheme();
1443 public ResidueShaderI getGroupColourScheme()
1449 public boolean isNucleotide()
1451 if (context != null)
1453 return context.isNucleotide();
1460 * @return true if seq is a member of the group
1463 public boolean contains(SequenceI seq1)
1465 return sequences.contains(seq1);
1471 * @return true if startRes<=apos and endRes>=apos and seq is in the group
1473 public boolean contains(SequenceI seq, int apos)
1475 return (startRes <= apos && endRes >= apos) && sequences.contains(seq);