X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fappletgui%2FAlignViewport.java;h=40d3dd499a51bb149c8ce4c70616cc70c16bd648;hb=8878681ec11f85c050248236a96ffbcaf2f0497b;hp=51478f22f04a367394e66acf9f4c36762d364b72;hpb=588042b69abf8e60bcc950b24c283933c7dd422f;p=jalview.git diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index 51478f2..40d3dd4 100755 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -74,6 +74,17 @@ public class AlignViewport boolean scaleLeftWrapped = true; boolean scaleRightWrapped = true; + public Vector vconsensus; + AlignmentAnnotation consensus; + AlignmentAnnotation conservation; + AlignmentAnnotation quality; + + public int ConsPercGaps = 25; // JBPNote : This should be a scalable property! + + private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(this); + + boolean ignoreGapsInConsensusCalculation = false; + public AlignViewport(AlignmentI al, JalviewLite applet) { setAlignment(al); @@ -136,12 +147,6 @@ public class AlignViewport showSequenceFeatures = b; } - public Vector vconsensus; - AlignmentAnnotation consensus; - AlignmentAnnotation conservation; - AlignmentAnnotation quality; - - public int ConsPercGaps = 25; // JBPNote : This should be a scalable property! public void updateConservation() { @@ -264,18 +269,21 @@ public class AlignViewport for (int i = 0; i < alignment.getWidth(); i++) { hash = (Hashtable) vconsensus.elementAt(i); - float value = new Float(hash.get("maxCount").toString()).floatValue(); - value /= new Float(hash.get("size").toString()).floatValue(); + float value = 0; + if(ignoreGapsInConsensusCalculation) + value = ((Float)hash.get("pid_nogaps")).floatValue(); + else + value = ((Float)hash.get("pid_gaps")).floatValue(); - value *= 100; - String maxRes = 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 + "%"; annotations[i] = new Annotation(maxRes, mouseOver, ' ', value); @@ -295,6 +303,9 @@ public class AlignViewport consensus.annotations = annotations; } + if(globalColourScheme!=null) + globalColourScheme.setConsensus(vconsensus); + } public SequenceGroup getSelectionGroup() @@ -643,4 +654,58 @@ public class AlignViewport scaleRightWrapped = b; } + public void setIgnoreGapsConsensus(boolean b) + { + ignoreGapsInConsensusCalculation = b; + updateConsensus(); + if (globalColourScheme!=null) + { + globalColourScheme.setThreshold(globalColourScheme.getThreshold(), + ignoreGapsInConsensusCalculation); + + } + } + + /** + * Property change listener for changes in alignment + * + * @param listener DOCUMENT ME! + */ + public void addPropertyChangeListener( + java.beans.PropertyChangeListener listener) + { + changeSupport.addPropertyChangeListener(listener); + } + + /** + * DOCUMENT ME! + * + * @param listener DOCUMENT ME! + */ + public void removePropertyChangeListener( + java.beans.PropertyChangeListener listener) + { + changeSupport.removePropertyChangeListener(listener); + } + + /** + * Property change listener for changes in alignment + * + * @param prop DOCUMENT ME! + * @param oldvalue DOCUMENT ME! + * @param newvalue DOCUMENT ME! + */ + public void firePropertyChange(String prop, Object oldvalue, Object newvalue) + { + changeSupport.firePropertyChange(prop, oldvalue, newvalue); + } + + + + public boolean getIgnoreGapsConsensus() + { + return ignoreGapsInConsensusCalculation; + } + + }