void setHiddenRepSequences(
Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
+ /**
+ * hides or shows dynamic annotation rows based on groups and group and alignment associated auto-annotation state flags
+ * apply the current group/autoannotation settings to the alignment view.
+ * Usually you should call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to ensure the annotation panel bounds are set correctly.
+ * @param applyGlobalSettings - apply to all autoannotation rows or just the ones associated with the current visible region
+ * @param preserveNewGroupSettings - don't apply global settings to groups which don't already have group associated annotation
+ */
+ void updateGroupAnnotationSettings(boolean applyGlobalSettings,
+ boolean preserveNewGroupSettings);
+
}
public void updateAnnotation(boolean applyGlobalSettings)
{
- // TODO: this should be merged with other annotation update stuff - that
- // sits on AlignViewport
- boolean updateCalcs = false;
- boolean conv = av.isShowGroupConservation();
- boolean cons = av.isShowGroupConsensus();
- boolean showprf = av.isShowSequenceLogo();
- boolean showConsHist = av.isShowConsensusHistogram();
-
- boolean sortg = true;
-
- // remove old automatic annotation
- // add any new annotation
-
- ; // OrderedBy(av.alignment.getSequencesArray());
- // intersect alignment annotation with alignment groups
-
- AlignmentAnnotation[] aan = av.getAlignment().getAlignmentAnnotation();
- Hashtable oldrfs = new Hashtable();
- if (aan != null)
- {
- for (int an = 0; an < aan.length; an++)
- {
- if (aan[an].autoCalculated && aan[an].groupRef != null)
- {
- oldrfs.put(aan[an].groupRef, aan[an].groupRef);
- av.getAlignment().deleteAnnotation(aan[an]);
- aan[an] = null;
- }
- }
- }
- if (av.getAlignment().getGroups()!= null)
- {
- for (SequenceGroup sg:av.getAlignment().getGroups())
- {
- updateCalcs = false;
- if (applyGlobalSettings || !oldrfs.containsKey(sg))
- {
- // set defaults for this group's conservation/consensus
- sg.setshowSequenceLogo(showprf);
- sg.setShowConsensusHistogram(showConsHist);
- }
- if (conv)
- {
- updateCalcs = true;
- av.getAlignment().addAnnotation(sg.getConservationRow(), 0);
- }
- if (cons)
- {
- updateCalcs = true;
- av.getAlignment().addAnnotation(sg.getConsensus(), 0);
- }
- // refresh the annotation rows
- if (updateCalcs)
- {
- sg.recalcConservation();
- }
- }
- }
- oldrfs.clear();
+ updateAnnotation(applyGlobalSettings, false);
+ }
+ public void updateAnnotation(boolean applyGlobalSettings, boolean preserveNewGroupSettings)
+ {
+ av.updateGroupAnnotationSettings(applyGlobalSettings, preserveNewGroupSettings);
adjustAnnotationHeight();
}
}
public void updateAnnotation(boolean applyGlobalSettings, boolean preserveNewGroupSettings)
{
- // TODO: this should be merged with other annotation update stuff - that
- // sits on AlignViewport
- boolean updateCalcs = false;
- boolean conv = av.isShowGroupConservation();
- boolean cons = av.isShowGroupConsensus();
- boolean showprf = av.isShowSequenceLogo();
- boolean showConsHist = av.isShowConsensusHistogram();
- boolean normLogo = av.isNormaliseSequenceLogo();
-
- boolean sortg = true;
-
- // remove old automatic annotation
- // add any new annotation
-
- // intersect alignment annotation with alignment groups
-
- AlignmentAnnotation[] aan = av.getAlignment().getAlignmentAnnotation();
- Hashtable oldrfs = new Hashtable();
- if (aan != null)
- {
- for (int an = 0; an < aan.length; an++)
- {
- if (aan[an].autoCalculated && aan[an].groupRef != null)
- {
- oldrfs.put(aan[an].groupRef, aan[an].groupRef);
- av.getAlignment().deleteAnnotation(aan[an]);
- aan[an] = null;
- }
- }
- }
- if (av.getAlignment().getGroups()!=null)
- {
- for (SequenceGroup sg:av.getAlignment().getGroups())
- {
- updateCalcs = false;
- if (applyGlobalSettings || (!preserveNewGroupSettings && !oldrfs.containsKey(sg)))
- {
- // set defaults for this group's conservation/consensus
- sg.setshowSequenceLogo(showprf);
- sg.setShowConsensusHistogram(showConsHist);
- sg.setNormaliseSequenceLogo(normLogo);
- }
- if (conv)
- {
- updateCalcs = true;
- av.getAlignment().addAnnotation(sg.getConservationRow(), 0);
- }
- if (cons)
- {
- updateCalcs = true;
- av.getAlignment().addAnnotation(sg.getConsensus(), 0);
- }
- // refresh the annotation rows
- if (updateCalcs)
- {
- sg.recalcConservation();
- }
- }
- }
- oldrfs.clear();
+ av.updateGroupAnnotationSettings(applyGlobalSettings, preserveNewGroupSettings);
adjustAnnotationHeight();
}
import jalview.workers.ConsensusThread;
import jalview.workers.StrucConsensusThread;
+import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
}
return height;
}
+
+ @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();
+ }
+
}