X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignViewport.java;h=eedc8637a906cbebedf5954e85bad31a334e463f;hb=6486a5333807ca300db4a28a6bf9899f5dddf5a6;hp=0cbbdb496ab70751cf89b20a66ccd1252fa48813;hpb=d423f22792e47dbc800ae220a58677f988971d06;p=jalview.git diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 0cbbdb4..eedc863 100755 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -433,6 +433,8 @@ public class AlignViewport implements SelectionSource 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); } /** @@ -476,11 +478,6 @@ public class AlignViewport implements SelectionSource 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) @@ -556,10 +553,8 @@ public class AlignViewport implements SelectionSource 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) { @@ -582,6 +577,27 @@ public class AlignViewport implements SelectionSource 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) + { + // TODO: make calls thread-safe, so if another thread calls this method, it will either return or wait until one calculation is finished. + if (immediate + || (!updatingConsensus && consensus != null && hconsensus != null)) + { + AAFrequency.completeConsensus(consensus, hconsensus, 0, + hconsensus.length, ignoreGapsInConsensusCalculation, + showSequenceLogo); + } + } } /** @@ -2205,6 +2221,16 @@ public class AlignViewport implements SelectionSource */ 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; } @@ -2252,24 +2278,6 @@ public class AlignViewport implements SelectionSource } /** - * @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