X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignViewport.java;h=e98fb9f61d6ed43bd897aa93bdc3188a8bd0ba41;hb=9fff97021c2c637e426f6971d54dcf3fd4191985;hp=05927b65851f11d35a01006e9b2d47697ec5c55b;hpb=309f2ebc93eb5aab5478279a3c40914f216f01a4;p=jalview.git diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 05927b6..e98fb9f 100755 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -85,6 +85,8 @@ public class AlignViewport // JBPNote Prolly only need this in the applet version. private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(this); + boolean ignoreGapsInConsensusCalculation = false; + /** * Creates a new AlignViewport object. * @@ -147,6 +149,7 @@ public class AlignViewport if (globalColourScheme instanceof UserColourScheme) { globalColourScheme = UserDefinedColours.loadDefaultColours(); + ((UserColourScheme)globalColourScheme).setThreshold(0, getIgnoreGapsConsensus()); } if (globalColourScheme != null) @@ -304,18 +307,19 @@ public class AlignViewport { hash = (Hashtable) vconsensus.elementAt(i); - float value = Float.parseFloat(hash.get("maxCount").toString()); - value /= Float.parseFloat(hash.get("size").toString()); - - value *= 100; + float value = 0; + if(ignoreGapsInConsensusCalculation) + value = ((Float)hash.get("pid_nogaps")).floatValue(); + else + value = ((Float)hash.get("pid_gaps")).floatValue(); - String maxRes = hash.get("maxResidue") + " "; - String mouseOver = hash.get("maxResidue") + " "; + String maxRes = hash.get("maxResidue").toString(); + String mouseOver = hash.get("maxResidue")+" "; - if (maxRes.length() > 2) + if (maxRes.length() > 1) { mouseOver = "[" + maxRes + "] "; - maxRes = "+ "; + maxRes = "+"; } mouseOver += ((int) value + "%"); @@ -336,6 +340,9 @@ public class AlignViewport { consensus.annotations = annotations; } + + if(globalColourScheme!=null) + globalColourScheme.setConsensus(vconsensus); } /** @@ -1027,4 +1034,23 @@ public class AlignViewport { changeSupport.firePropertyChange(prop, oldvalue, newvalue); } + + public void setIgnoreGapsConsensus(boolean b) + { + ignoreGapsInConsensusCalculation = b; + updateConsensus(); + if(globalColourScheme!=null && globalColourScheme instanceof ResidueColourScheme) + { + ((ResidueColourScheme) globalColourScheme).setThreshold( + ((ResidueColourScheme) globalColourScheme).getThreshold(), ignoreGapsInConsensusCalculation); + + + } + + } + + public boolean getIgnoreGapsConsensus() + { + return ignoreGapsInConsensusCalculation; + } }