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.util.ArrayList;
31 import java.util.List;
35 * Collects a set contiguous ranges on a set of sequences
40 public class SequenceGroup implements AnnotatedCollectionI
46 Conservation conserve;
48 boolean displayBoxes = true;
50 boolean displayText = true;
52 boolean colourText = false;
55 * True if the group is defined as a group on the alignment, false if it is
58 boolean isDefined = false;
61 * after Olivier's non-conserved only character display
63 boolean showNonconserved = false;
68 private List<SequenceI> sequences = new ArrayList<>();
71 * representative sequence for this group (if any)
73 private SequenceI seqrep = null;
78 * Colourscheme applied to group if any
80 public ResidueShaderI cs;
82 // start column (base 0)
85 // end column (base 0)
88 public Color outlineColour = Color.black;
90 public Color idColour = null;
92 public int thresholdTextColour = 0;
94 public Color textColour = Color.black;
96 public Color textColour2 = Color.white;
99 * consensus calculation property
101 private boolean ignoreGapsInConsensus = true;
103 private boolean ignoreBelowBackground = true;
106 * consensus calculation property
108 private boolean showSequenceLogo = false;
111 * flag indicating if logo should be rendered normalised
113 private boolean normaliseSequenceLogo;
116 * visibility of rows or represented rows covered by group
118 private boolean hidereps = false;
121 * visibility of columns intersecting this group
123 private boolean hidecols = false;
125 AlignmentAnnotation consensus = null;
127 AlignmentAnnotation conservation = null;
129 AlignmentAnnotation information = null;
131 private boolean showConsensusHistogram;
133 private AnnotatedCollectionI context;
135 private boolean showHMMSequenceLogo;
137 private boolean normaliseHMMSequenceLogo;
139 private boolean showInformationHistogram;
142 * Creates a new SequenceGroup object.
144 public SequenceGroup()
146 groupName = "JGroup:" + this.hashCode();
147 cs = new ResidueShader();
151 * Creates a new SequenceGroup object.
156 * @param displayBoxes
160 * first column of group
162 * last column of group
164 public SequenceGroup(List<SequenceI> sequences, String groupName,
165 ColourSchemeI scheme, boolean displayBoxes, boolean displayText,
166 boolean colourText, int start, int end)
169 this.sequences = sequences;
170 this.groupName = groupName;
171 this.displayBoxes = displayBoxes;
172 this.displayText = displayText;
173 this.colourText = colourText;
174 this.cs = new ResidueShader(scheme);
177 recalcConservation();
185 public SequenceGroup(SequenceGroup seqsel)
190 sequences = new ArrayList<>();
191 sequences.addAll(seqsel.sequences);
192 if (seqsel.groupName != null)
194 groupName = new String(seqsel.groupName);
196 displayBoxes = seqsel.displayBoxes;
197 displayText = seqsel.displayText;
198 colourText = seqsel.colourText;
199 startRes = seqsel.startRes;
200 endRes = seqsel.endRes;
201 cs = new ResidueShader(seqsel.getColourScheme());
202 if (seqsel.description != null)
204 description = new String(seqsel.description);
206 hidecols = seqsel.hidecols;
207 hidereps = seqsel.hidereps;
208 showNonconserved = seqsel.showNonconserved;
209 showSequenceLogo = seqsel.showSequenceLogo;
210 normaliseSequenceLogo = seqsel.normaliseSequenceLogo;
211 showConsensusHistogram = seqsel.showConsensusHistogram;
212 showHMMSequenceLogo = seqsel.showHMMSequenceLogo;
213 normaliseHMMSequenceLogo = seqsel.normaliseHMMSequenceLogo;
214 showInformationHistogram = seqsel.showInformationHistogram;
215 idColour = seqsel.idColour;
216 outlineColour = seqsel.outlineColour;
217 seqrep = seqsel.seqrep;
218 textColour = seqsel.textColour;
219 textColour2 = seqsel.textColour2;
220 thresholdTextColour = seqsel.thresholdTextColour;
221 width = seqsel.width;
222 ignoreGapsInConsensus = seqsel.ignoreGapsInConsensus;
223 ignoreBelowBackground = seqsel.ignoreBelowBackground;
224 if (seqsel.conserve != null)
226 recalcConservation(); // safer than
227 // aaFrequency = (Vector) seqsel.aaFrequency.clone(); // ??
232 public boolean isShowSequenceLogo()
234 return showSequenceLogo;
237 public SequenceI[] getSelectionAsNewSequences(AlignmentI align)
239 int iSize = sequences.size();
240 SequenceI[] seqs = new SequenceI[iSize];
241 SequenceI[] inorder = getSequencesInOrder(align);
243 for (int i = 0, ipos = 0; i < inorder.length; i++)
245 SequenceI seq = inorder[i];
247 seqs[ipos] = seq.getSubSequence(startRes, endRes + 1);
248 if (seqs[ipos] != null)
250 seqs[ipos].setDescription(seq.getDescription());
251 seqs[ipos].setDBRefs(seq.getDBRefs());
252 seqs[ipos].setSequenceFeatures(seq.getSequenceFeatures());
253 if (seq.getDatasetSequence() != null)
255 seqs[ipos].setDatasetSequence(seq.getDatasetSequence());
258 if (seq.getAnnotation() != null)
260 AlignmentAnnotation[] alann = align.getAlignmentAnnotation();
261 // Only copy annotation that is either a score or referenced by the
262 // alignment's annotation vector
263 for (int a = 0; a < seq.getAnnotation().length; a++)
265 AlignmentAnnotation tocopy = seq.getAnnotation()[a];
268 boolean found = false;
269 for (int pos = 0; pos < alann.length; pos++)
271 if (alann[pos] == tocopy)
282 AlignmentAnnotation newannot = new AlignmentAnnotation(
283 seq.getAnnotation()[a]);
284 newannot.restrict(startRes, endRes);
285 newannot.setSequenceRef(seqs[ipos]);
286 newannot.adjustForAlignment();
287 seqs[ipos].addAlignmentAnnotation(newannot);
297 if (iSize != inorder.length)
299 SequenceI[] nseqs = new SequenceI[iSize];
300 System.arraycopy(seqs, 0, nseqs, 0, iSize);
308 * If sequence ends in gaps, the end residue can be correctly calculated here
314 public int findEndRes(SequenceI seq)
319 for (int j = 0; j < endRes + 1 && j < seq.getLength(); j++)
321 ch = seq.getCharAt(j);
322 if (!jalview.util.Comparison.isGap((ch)))
330 eres += seq.getStart() - 1;
337 public List<SequenceI> getSequences()
343 public List<SequenceI> getSequences(
344 Map<SequenceI, SequenceCollectionI> hiddenReps)
346 if (hiddenReps == null)
348 // TODO: need a synchronizedCollection here ?
353 List<SequenceI> allSequences = new ArrayList<>();
354 for (SequenceI seq : sequences)
356 allSequences.add(seq);
357 if (hiddenReps.containsKey(seq))
359 SequenceCollectionI hsg = hiddenReps.get(seq);
360 for (SequenceI seq2 : hsg.getSequences())
362 if (seq2 != seq && !allSequences.contains(seq2))
364 allSequences.add(seq2);
374 public SequenceI[] getSequencesAsArray(
375 Map<SequenceI, SequenceCollectionI> map)
377 List<SequenceI> tmp = getSequences(map);
382 return tmp.toArray(new SequenceI[tmp.size()]);
391 * @return DOCUMENT ME!
393 public boolean adjustForRemoveLeft(int col)
395 // return value is true if the group still exists
398 startRes = startRes - col;
403 endRes = endRes - col;
405 if (startRes > endRes)
412 // must delete this group!!
425 * @return DOCUMENT ME!
427 public boolean adjustForRemoveRight(int col)
446 * @return DOCUMENT ME!
448 public String getName()
453 public String getDescription()
464 public void setName(String name)
467 // TODO: URGENT: update dependent objects (annotation row)
470 public void setDescription(String desc)
478 * @return DOCUMENT ME!
480 public Conservation getConservation()
491 public void setConservation(Conservation c)
497 * Add s to this sequence group. If aligment sequence is already contained in
498 * group, it will not be added again, but recalculation may happen if the flag
502 * alignment sequence to be added
504 * true means Group's conservation should be recalculated
506 public void addSequence(SequenceI s, boolean recalc)
508 synchronized (sequences)
510 if (s != null && !sequences.contains(s))
517 recalcConservation();
523 * Max Gaps Threshold (percent) for performing a conservation calculation
525 private int consPercGaps = 25;
528 * @return Max Gaps Threshold for performing a conservation calculation
530 public int getConsPercGaps()
536 * set Max Gaps Threshold (percent) for performing a conservation calculation
538 * @param consPercGaps
540 public void setConsPercGaps(int consPercGaps)
542 this.consPercGaps = consPercGaps;
546 * calculate residue conservation and colourschemes for group - but only if
547 * necessary. returns true if the calculation resulted in a visible change to
550 public boolean recalcConservation()
552 return recalcConservation(false);
556 * calculate residue conservation for group - but only if necessary. returns
557 * true if the calculation resulted in a visible change to group
560 * when set, colourschemes for this group are not refreshed after
563 public boolean recalcConservation(boolean defer)
565 if (cs == null && consensus == null && conservation == null
566 && information == null)
570 // TODO: try harder to detect changes in state in order to minimise
571 // recalculation effort
575 ProfilesI cnsns = AAFrequency.calculate(sequences, startRes,
576 endRes + 1, showSequenceLogo);
577 if (information != null)
579 HiddenMarkovModel hmm = information.sequenceRef.getHMM();
581 ProfilesI info = AAFrequency.calculateInformation(hmm,
582 (endRes + 1) - startRes, startRes, endRes + 1,
583 showHMMSequenceLogo, ignoreBelowBackground);
584 _updateInformationRow(info, sequences.size());
587 if (consensus != null)
589 _updateConsensusRow(cnsns, sequences.size());
594 cs.setConsensus(cnsns);
598 if ((conservation != null)
599 || (cs != null && cs.conservationApplied()))
601 Conservation c = new Conservation(groupName, sequences, startRes,
604 c.verdict(false, consPercGaps);
605 if (conservation != null)
607 _updateConservationRow(c);
611 if (cs.conservationApplied())
613 cs.setConservation(c);
616 // eager update - will cause a refresh of overview regardless
619 if (cs != null && !defer)
621 // TODO: JAL-2034 should cs.alignmentChanged modify return state
622 cs.alignmentChanged(context != null ? context : this, null);
629 } catch (java.lang.OutOfMemoryError err)
632 System.out.println("Out of memory loading groups: " + err);
637 private void _updateConservationRow(Conservation c)
639 if (conservation == null)
644 conservation.label = "Conservation for " + getName();
645 conservation.description = "Conservation for group " + getName()
646 + " less than " + consPercGaps + "% gaps";
647 // preserve width if already set
648 int aWidth = (conservation.annotations != null) ? (endRes < conservation.annotations.length ? conservation.annotations.length
651 conservation.annotations = null;
652 conservation.annotations = new Annotation[aWidth]; // should be alignment
654 c.completeAnnotations(conservation, null, startRes, endRes + 1);
657 public ProfilesI consensusData = null;
659 public ProfilesI informationData = 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) ? (endRes < consensus.annotations.length ? consensus.annotations.length
674 consensus.annotations = null;
675 consensus.annotations = new Annotation[aWidth]; // should be alignment width
677 AAFrequency.completeConsensus(consensus, cnsns, startRes, endRes + 1,
678 ignoreGapsInConsensus, showSequenceLogo, nseq); // TODO: setting
681 // ignoreGapsInConsensusCalculation);
684 private void _updateInformationRow(ProfilesI cnsns, long nseq)
686 if (information == null)
690 information.label = "Information for " + getName();
691 information.description = "Percent Identity";
692 informationData = cnsns;
693 // preserve width if already set
694 int aWidth = (information.annotations != null)
695 ? (endRes < information.annotations.length
696 ? information.annotations.length : endRes + 1)
698 information.annotations = null;
699 information.annotations = new Annotation[aWidth]; // should be alignment
702 AAFrequency.completeInformation(information, cnsns, startRes,
703 endRes + 1, ignoreBelowBackground, showSequenceLogo, nseq); // TODO:
707 // ignoreGapsInInformationCalculation);
712 * sequence to either add or remove from group
714 * flag passed to delete/addSequence to indicate if group properties
715 * should be recalculated
717 public void addOrRemove(SequenceI s, boolean recalc)
719 synchronized (sequences)
721 if (sequences.contains(s))
723 deleteSequence(s, recalc);
727 addSequence(s, recalc);
738 * true means recalculate conservation
740 public void deleteSequence(SequenceI s, boolean recalc)
742 synchronized (sequences)
748 recalcConservation();
756 * @return the first column selected by this group. Runs from 0<=i<N_cols
759 public int getStartRes()
766 * @return the groups last selected column. Runs from 0<=i<N_cols
769 public int getEndRes()
775 * Set the first column selected by this group. Runs from 0<=i<N_cols
779 public void setStartRes(int i)
785 * Set the groups last selected column. Runs from 0<=i<N_cols
789 public void setEndRes(int i)
795 * @return number of sequences in group
799 return sequences.size();
804 * @return the ith sequence
806 public SequenceI getSequenceAt(int i)
808 return sequences.get(i);
815 public void setColourText(boolean state)
823 * @return DOCUMENT ME!
825 public boolean getColourText()
836 public void setDisplayText(boolean state)
844 * @return DOCUMENT ME!
846 public boolean getDisplayText()
857 public void setDisplayBoxes(boolean state)
859 displayBoxes = state;
865 * @return DOCUMENT ME!
867 public boolean getDisplayBoxes()
873 * computes the width of current set of sequences and returns it
875 * @return DOCUMENT ME!
878 public int getWidth()
880 synchronized (sequences)
882 // MC This needs to get reset when characters are inserted and deleted
883 boolean first = true;
884 for (SequenceI seq : sequences)
886 if (first || seq.getLength() > width)
888 width = seq.getLength();
902 public void setOutlineColour(Color c)
910 * @return DOCUMENT ME!
912 public Color getOutlineColour()
914 return outlineColour;
919 * returns the sequences in the group ordered by the ordering given by al.
920 * this used to return an array with null entries regardless, new behaviour is
921 * below. TODO: verify that this does not affect use in applet or application
925 * @return SequenceI[] intersection of sequences in group with al, ordered by
926 * al, or null if group does not intersect with al
928 public SequenceI[] getSequencesInOrder(AlignmentI al)
930 return getSequencesInOrder(al, true);
934 * return an array representing the intersection of the group with al,
935 * optionally returning an array the size of al.getHeight() where nulls mark
936 * the non-intersected sequences
940 * @return null or array
942 public SequenceI[] getSequencesInOrder(AlignmentI al, boolean trim)
944 synchronized (sequences)
946 int sSize = sequences.size();
947 int alHeight = al.getHeight();
949 SequenceI[] seqs = new SequenceI[(trim) ? sSize : alHeight];
952 for (int i = 0; i < alHeight && index < sSize; i++)
954 if (sequences.contains(al.getSequenceAt(i)))
956 seqs[(trim) ? index : i] = al.getSequenceAt(i);
968 if (index < seqs.length)
970 SequenceI[] dummy = seqs;
971 seqs = new SequenceI[index];
974 seqs[index] = dummy[index];
983 * @return the idColour
985 public Color getIdColour()
992 * the idColour to set
994 public void setIdColour(Color idColour)
996 this.idColour = idColour;
1000 * @return the representative sequence for this group
1003 public SequenceI getSeqrep()
1009 * set the representative sequence for this group. Note - this affects the
1010 * interpretation of the Hidereps attribute.
1013 * the seqrep to set (null means no sequence representative)
1016 public void setSeqrep(SequenceI seqrep)
1018 this.seqrep = seqrep;
1023 * @return true if group has a sequence representative
1026 public boolean hasSeqrep()
1028 return seqrep != null;
1032 * set visibility of sequences covered by (if no sequence representative is
1033 * defined) or represented by this group.
1037 public void setHidereps(boolean visibility)
1039 hidereps = visibility;
1044 * @return true if sequences represented (or covered) by this group should be
1047 public boolean isHidereps()
1053 * set intended visibility of columns covered by this group
1057 public void setHideCols(boolean visibility)
1059 hidecols = visibility;
1064 * @return true if columns covered by group should be hidden
1066 public boolean isHideCols()
1072 * create a new sequence group from the intersection of this group with an
1073 * alignment Hashtable of hidden representatives
1079 * @return new group containing sequences common to this group and alignment
1081 public SequenceGroup intersect(AlignmentI alignment,
1082 Map<SequenceI, SequenceCollectionI> map)
1084 SequenceGroup sgroup = new SequenceGroup(this);
1085 SequenceI[] insect = getSequencesInOrder(alignment);
1086 sgroup.sequences = new ArrayList<>();
1087 for (int s = 0; insect != null && s < insect.length; s++)
1089 if (map == null || map.containsKey(insect[s]))
1091 sgroup.sequences.add(insect[s]);
1098 * @return the showUnconserved
1100 public boolean getShowNonconserved()
1102 return showNonconserved;
1106 * @param showNonconserved
1107 * the showUnconserved to set
1109 public void setShowNonconserved(boolean displayNonconserved)
1111 this.showNonconserved = displayNonconserved;
1115 * set this alignmentAnnotation object as the one used to render consensus
1120 public void setConsensus(AlignmentAnnotation aan)
1122 if (consensus == null)
1130 * @return automatically calculated consensus row note: the row is a stub if a
1131 * consensus calculation has not yet been performed on the group
1133 public AlignmentAnnotation getConsensus()
1135 // TODO get or calculate and get consensus annotation row for this group
1136 int aWidth = this.getWidth();
1144 if (consensus == null)
1146 consensus = new AlignmentAnnotation("", "", new Annotation[1], 0f,
1147 100f, AlignmentAnnotation.BAR_GRAPH);
1148 consensus.hasText = true;
1149 consensus.autoCalculated = true;
1150 consensus.groupRef = this;
1151 consensus.label = "Consensus for " + getName();
1152 consensus.description = "Percent Identity";
1159 * @return information content annotation.
1161 public AlignmentAnnotation getInformation()
1163 // TODO get or calculate and get information annotation row for this group
1164 int aWidth = this.getWidth();
1172 if (information == null)
1174 information = new AlignmentAnnotation("", "", new Annotation[1], 0f,
1175 6.25f, AlignmentAnnotation.BAR_GRAPH);
1176 information.hasText = true;
1177 information.autoCalculated = false;
1178 information.groupRef = this;
1179 information.label = getName() + "_HMM";
1180 information.description = "Information content, measured in bits";
1186 * set this alignmentAnnotation object as the one used to render consensus
1191 public void setConservationRow(AlignmentAnnotation aan)
1193 if (conservation == null)
1200 * get the conservation annotation row for this group
1202 * @return autoCalculated annotation row
1204 public AlignmentAnnotation getConservationRow()
1206 if (conservation == null)
1208 conservation = new AlignmentAnnotation("", "", new Annotation[1], 0f,
1209 11f, AlignmentAnnotation.BAR_GRAPH);
1212 conservation.hasText = true;
1213 conservation.autoCalculated = true;
1214 conservation.groupRef = this;
1215 conservation.label = "Conservation for " + getName();
1216 conservation.description = "Conservation for group " + getName()
1217 + " less than " + consPercGaps + "% gaps";
1218 return conservation;
1223 * @return true if annotation rows have been instantiated for this group
1225 public boolean hasAnnotationRows()
1227 return consensus != null || conservation != null;
1230 public SequenceI getConsensusSeq()
1233 StringBuffer seqs = new StringBuffer();
1234 for (int i = 0; i < consensus.annotations.length; i++)
1236 if (consensus.annotations[i] != null)
1238 if (consensus.annotations[i].description.charAt(0) == '[')
1240 seqs.append(consensus.annotations[i].description.charAt(1));
1244 seqs.append(consensus.annotations[i].displayCharacter);
1249 SequenceI sq = new Sequence("Group" + getName() + " Consensus",
1251 sq.setDescription("Percentage Identity Consensus "
1252 + ((ignoreGapsInConsensus) ? " without gaps" : ""));
1256 public void setIgnoreGapsConsensus(boolean state)
1258 if (this.ignoreGapsInConsensus != state && consensus != null)
1260 ignoreGapsInConsensus = state;
1261 recalcConservation();
1263 ignoreGapsInConsensus = state;
1266 public boolean getIgnoreGapsConsensus()
1268 return ignoreGapsInConsensus;
1271 public void setIgnoreBelowBackground(boolean state)
1273 if (this.ignoreBelowBackground != state)
1275 ignoreBelowBackground = state;
1277 ignoreBelowBackground = state;
1280 public boolean getIgnoreBelowBackground()
1286 * @param showSequenceLogo
1287 * indicates if a sequence logo is shown for consensus annotation
1289 public void setshowSequenceLogo(boolean showSequenceLogo)
1291 // TODO: decouple calculation from settings update
1292 if (this.showSequenceLogo != showSequenceLogo && consensus != null)
1294 this.showSequenceLogo = showSequenceLogo;
1295 recalcConservation();
1297 this.showSequenceLogo = showSequenceLogo;
1302 * @param showConsHist
1303 * flag indicating if the consensus histogram for this group should
1306 public void setShowConsensusHistogram(boolean showConsHist)
1309 if (showConsensusHistogram != showConsHist && consensus != null)
1311 this.showConsensusHistogram = showConsHist;
1312 recalcConservation();
1314 this.showConsensusHistogram = showConsHist;
1318 * @return the showConsensusHistogram
1320 public boolean isShowConsensusHistogram()
1322 return showConsensusHistogram;
1326 * set flag indicating if logo should be normalised when rendered
1330 public void setNormaliseSequenceLogo(boolean norm)
1332 normaliseSequenceLogo = norm;
1335 public boolean isNormaliseSequenceLogo()
1337 return normaliseSequenceLogo;
1342 * returns a new array with all annotation involving this group
1344 public AlignmentAnnotation[] getAlignmentAnnotation()
1346 // TODO add in other methods like 'getAlignmentAnnotation(String label),
1348 ArrayList<AlignmentAnnotation> annot = new ArrayList<>();
1349 synchronized (sequences)
1351 for (SequenceI seq : sequences)
1353 AlignmentAnnotation[] aa = seq.getAnnotation();
1356 for (AlignmentAnnotation al : aa)
1358 if (al.groupRef == this)
1365 if (consensus != null)
1367 annot.add(consensus);
1369 if (conservation != null)
1371 annot.add(conservation);
1374 return annot.toArray(new AlignmentAnnotation[0]);
1378 public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
1380 List<AlignmentAnnotation> aa = new ArrayList<>();
1385 for (AlignmentAnnotation a : getAlignmentAnnotation())
1387 if (calcId.equals(a.getCalcId()))
1396 public Iterable<AlignmentAnnotation> findAnnotations(SequenceI seq,
1397 String calcId, String label)
1399 ArrayList<AlignmentAnnotation> aa = new ArrayList<>();
1400 for (AlignmentAnnotation ann : getAlignmentAnnotation())
1402 if ((calcId == null || (ann.getCalcId() != null && ann.getCalcId()
1404 && (seq == null || (ann.sequenceRef != null && ann.sequenceRef == seq))
1405 && (label == null || (ann.label != null && ann.label
1415 * Answer true if any annotation matches the calcId passed in (if not null).
1420 public boolean hasAnnotation(String calcId)
1422 if (calcId != null && !"".equals(calcId))
1424 for (AlignmentAnnotation a : getAlignmentAnnotation())
1426 if (a.getCalcId() == calcId)
1436 * Remove all sequences from the group (leaving other properties unchanged).
1440 synchronized (sequences)
1447 * Sets the alignment or group context for this group, and whether it is
1448 * defined as a group
1451 * the context for the group
1453 * whether the group is defined on the alignment or is just a
1455 * @throws IllegalArgumentException
1456 * if setting the context would result in a circular reference chain
1458 public void setContext(AnnotatedCollectionI ctx, boolean defined)
1461 this.isDefined = defined;
1465 * Sets the alignment or group context for this group
1468 * the context for the group
1469 * @throws IllegalArgumentException
1470 * if setting the context would result in a circular reference chain
1472 public void setContext(AnnotatedCollectionI ctx)
1474 AnnotatedCollectionI ref = ctx;
1477 if (ref == this || ref.getContext() == ctx)
1479 throw new IllegalArgumentException(
1480 "Circular reference in SequenceGroup.context");
1482 ref = ref.getContext();
1490 * @see jalview.datamodel.AnnotatedCollectionI#getContext()
1493 public AnnotatedCollectionI getContext()
1498 public boolean isDefined()
1503 public void setColourScheme(ColourSchemeI scheme)
1507 cs = new ResidueShader();
1509 cs.setColourScheme(scheme);
1512 public void setGroupColourScheme(ResidueShaderI scheme)
1517 public ColourSchemeI getColourScheme()
1519 return cs == null ? null : cs.getColourScheme();
1522 public ResidueShaderI getGroupColourScheme()
1528 public boolean isNucleotide()
1530 if (context != null) {
1531 return context.isNucleotide();
1538 * @return true if seq is a member of the group
1541 public boolean contains(SequenceI seq1)
1543 return sequences.contains(seq1);
1549 * @return true if startRes<=apos and endRes>=apos and seq is in the group
1551 public boolean contains(SequenceI seq, int apos)
1553 return (startRes <= apos && endRes >= apos) && sequences.contains(seq);
1556 public boolean isShowInformationHistogram()
1558 return showInformationHistogram;
1561 public void setShowInformationHistogram(boolean state)
1563 if (showInformationHistogram != state && information != null)
1565 this.showInformationHistogram = state;
1566 // recalcConservation(); TODO don't know what to do here next
1568 this.showInformationHistogram = state;
1572 public boolean isShowHMMSequenceLogo()
1574 // TODO Auto-generated method stub
1575 return showHMMSequenceLogo;
1578 public void setshowHMMSequenceLogo(boolean state)
1580 showHMMSequenceLogo = state;
1584 public boolean isNormaliseHMMSequenceLogo()
1586 // TODO Auto-generated method stub
1587 return normaliseHMMSequenceLogo;
1590 public void setNormaliseHMMSequenceLogo(boolean state)
1592 normaliseSequenceLogo = state;