+
+ @Override
+ public void updateGroupAnnotationSettings(boolean applyGlobalSettings,
+ boolean preserveNewGroupSettings)
+ {
+ boolean updateCalcs = false;
+ boolean conv = isShowGroupConservation();
+ boolean cons = isShowGroupConsensus();
+ boolean showprf = isShowSequenceLogo();
+ boolean showConsHist = isShowConsensusHistogram();
+ boolean normLogo = isNormaliseSequenceLogo();
+
+ /**
+ * TODO reorder the annotation rows according to group/sequence ordering on alignment
+ */
+ boolean sortg = true;
+
+ // remove old automatic annotation
+ // add any new annotation
+
+ // intersect alignment annotation with alignment groups
+
+ AlignmentAnnotation[] aan = alignment.getAlignmentAnnotation();
+ List<SequenceGroup> oldrfs = new ArrayList<SequenceGroup>();
+ if (aan != null)
+ {
+ for (int an = 0; an < aan.length; an++)
+ {
+ if (aan[an].autoCalculated && aan[an].groupRef != null)
+ {
+ oldrfs.add(aan[an].groupRef);
+ alignment.deleteAnnotation(aan[an]);
+ aan[an] = null;
+ }
+ }
+ }
+ if (alignment.getGroups() != null)
+ {
+ for (SequenceGroup sg : alignment.getGroups())
+ {
+ updateCalcs = false;
+ if (applyGlobalSettings
+ || (!preserveNewGroupSettings && !oldrfs.contains(sg)))
+ {
+ // set defaults for this group's conservation/consensus
+ sg.setshowSequenceLogo(showprf);
+ sg.setShowConsensusHistogram(showConsHist);
+ sg.setNormaliseSequenceLogo(normLogo);
+ }
+ if (conv)
+ {
+ updateCalcs = true;
+ alignment.addAnnotation(sg.getConservationRow(), 0);
+ }
+ if (cons)
+ {
+ updateCalcs = true;
+ alignment.addAnnotation(sg.getConsensus(), 0);
+ }
+ // refresh the annotation rows
+ if (updateCalcs)
+ {
+ sg.recalcConservation();
+ }
+ }
+ }
+ oldrfs.clear();
+ }
+