for (int g = 0; g < gps.length; g++)
{
// gps[g].setShowunconserved(viewport.getShowUnconserved());
- gps[g].setIncludeAllConsSymbols(viewport
- .isIncludeAllConsensusSymbols());
+ gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());
viewport.alignment.addGroup(gps[g]);
Color col = new Color((int) (Math.random() * 255), (int) (Math
.random() * 255), (int) (Math.random() * 255));
hconsensus = new Hashtable[aWidth];
AAFrequency.calculate(alignment.getSequencesArray(), 0, alignment
- .getWidth(), hconsensus, includeAllConsensusSymbols);
+ .getWidth(), hconsensus, true); // always calculate the full profile
AAFrequency.completeConsensus(consensus, hconsensus, 0, aWidth,
ignoreGapsInConsensusCalculation,
includeAllConsensusSymbols);
}
/**
- * @param includeAllConsSymbols
- * the includeAllConsSymbols to set
+ * @param showSequenceLogo
+ * indicates if a sequence logo is shown for consensus annotation
*/
- public void setIncludeAllConsSymbols(boolean includeAllConsSymbols)
+ public void setshowSequenceLogo(boolean showSequenceLogo)
{
- if (this.showSequenceLogo != includeAllConsSymbols && consensus != null)
+ // TODO: decouple calculation from settings update
+ if (this.showSequenceLogo != showSequenceLogo && consensus != null)
{
- this.showSequenceLogo = includeAllConsSymbols;
+ this.showSequenceLogo = showSequenceLogo;
recalcConservation();
}
- this.showSequenceLogo = includeAllConsSymbols;
+ this.showSequenceLogo = showSequenceLogo;
}
/**
for (int g = 0; g < gps.length; g++)
{
gps[g].setShowNonconserved(viewport.getShowUnconserved());
- gps[g].setIncludeAllConsSymbols(viewport
- .isIncludeAllConsensusSymbols());
+ gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());
viewport.alignment.addGroup(gps[g]);
Color col = new Color((int) (Math.random() * 255), (int) (Math
.random() * 255), (int) (Math.random() * 255));
showUnconserved = jalview.bin.Cache.getDefault("SHOW_UNCONSERVED",
false);
sortByTree = jalview.bin.Cache.getDefault("SORT_BY_TREE", false);
- followSelection = jalview.bin.Cache.getDefault("FOLLOW_SELECTIONS", true);
+ followSelection = jalview.bin.Cache.getDefault("FOLLOW_SELECTIONS",
+ true);
}
/**
private boolean shownpfeats;
/**
- * consensus annotation includes all percentage for all symbols in column
- */
- private boolean includeAllConsensusSymbols = true;
-
- /**
* trigger update of conservation annotation
*/
public void updateConservation(final AlignmentPanel ap)
hconsensus = new Hashtable[aWidth];
AAFrequency.calculate(alignment.getSequencesArray(), 0, alignment
- .getWidth(), hconsensus, includeAllConsensusSymbols);
- AAFrequency.completeConsensus(consensus, hconsensus, 0, aWidth,
- ignoreGapsInConsensusCalculation,
- includeAllConsensusSymbols);
+ .getWidth(), hconsensus, true);
+ updateAnnotation(true);
if (globalColourScheme != null)
{
ap.paintAlignment(true);
}
}
+
+ /**
+ * update the consensus annotation from the sequence profile data using
+ * current visualization settings.
+ */
+ public void updateAnnotation()
+ {
+ updateAnnotation(false);
+ }
+
+ protected void updateAnnotation(boolean immediate)
+ {
+ if (immediate
+ || (!updatingConsensus && consensus != null && hconsensus != null))
+ {
+ AAFrequency.completeConsensus(consensus, hconsensus, 0,
+ hconsensus.length, ignoreGapsInConsensusCalculation,
+ showSequenceLogo);
+ }
+ }
}
/**
*/
public void setShowSequenceLogo(boolean showSequenceLogo)
{
+ if (showSequenceLogo != this.showSequenceLogo)
+ {
+ // TODO: decouple settings setting from calculation when refactoring
+ // annotation update method from alignframe to viewport
+ this.showSequenceLogo = showSequenceLogo;
+ if (consensusThread != null)
+ {
+ consensusThread.updateAnnotation();
+ }
+ }
this.showSequenceLogo = showSequenceLogo;
}
}
/**
- * @return the includeAllConsensusSymbols
- */
- public boolean isIncludeAllConsensusSymbols()
- {
- return includeAllConsensusSymbols;
- }
-
- /**
- * @param includeAllConsensusSymbols
- * the includeAllConsensusSymbols to set
- */
- public void setIncludeAllConsensusSymbols(
- boolean includeAllConsensusSymbols)
- {
- this.includeAllConsensusSymbols = includeAllConsensusSymbols;
- }
-
- /**
*
* @return flag to indicate if the consensus histogram should be rendered by
* default
if (applyGlobalSettings || !oldrfs.containsKey(sg))
{
// set defaults for this group's conservation/consensus
- sg.setIncludeAllConsSymbols(showprf);
+ sg.setshowSequenceLogo(showprf);
sg.setShowConsensusHistogram(showConsHist);
}
if (conv)
}
});
pop.add(chist);
- final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
+ final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
"Show Group Logo", aa[selectedRow].groupRef
.isShowSequenceLogo());
- cprof.addActionListener(new ActionListener()
+ cprofl.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
// view
// can be
// updated.
- aaa.groupRef.setIncludeAllConsSymbols(cprof.getState());
+ aaa.groupRef.setshowSequenceLogo(cprofl.getState());
ap.repaint();
// ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
}
});
- pop.add(cprof);
+ pop.add(cprofl);
}
else
{
;
if (groups[i].hasShowSequenceLogo())
{
- sg.setIncludeAllConsSymbols(groups[i].isShowSequenceLogo());
+ sg.setshowSequenceLogo(groups[i].isShowSequenceLogo());
}
if (groups[i].hasIgnoreGapsinConsensus())
{
}
af.setMenusFromViewport(af.viewport);
- // This is done twice - why ?
- af.alignPanel.updateAnnotation(false); // recompute any autoannotation
// TODO: we don't need to do this if the viewport is aready visible.
Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(), view
.getHeight());