X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAlignViewport.java;h=50a90fee2685a166a53eea56aa0a2d04a6d66f58;hb=65f3b4a9eadadb7540c329e710bce082ea1dd8a7;hp=51478f22f04a367394e66acf9f4c36762d364b72;hpb=588042b69abf8e60bcc950b24c283933c7dd422f;p=jalview.git diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index 51478f2..50a90fe 100755 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -36,7 +36,7 @@ public class AlignViewport int startSeq; int endSeq; - boolean showFullId = true; + boolean showJVSuffix = true; boolean showText = true; boolean showColourText = false; boolean showBoxes = true; @@ -57,8 +57,7 @@ public class AlignViewport int charHeight; int charWidth; - int chunkWidth; - int chunkHeight; + int wrappedWidth; Font font = new Font("SansSerif", Font.PLAIN, 10); AlignmentI alignment; @@ -74,6 +73,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); @@ -88,7 +98,7 @@ public class AlignViewport String param = applet.getParameter("showFullId"); if (param != null) { - showFullId = Boolean.valueOf(param).booleanValue(); + showJVSuffix = Boolean.valueOf(param).booleanValue(); } param = applet.getParameter("showAnnotation"); @@ -136,15 +146,12 @@ 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() { + if(alignment.isNucleotide()) + return; + Conservation cons = new jalview.analysis.Conservation("All", jalview.schemes.ResidueProperties.propHash, 3, alignment.getSequences(), 0, @@ -214,7 +221,7 @@ public class AlignViewport annotations, 0f, // cons.qualityRange[0].floatValue(), 11f, // cons.qualityRange[1].floatValue() - 1); + AlignmentAnnotation.BAR_GRAPH); if (showConservation) { alignment.addAnnotation(conservation); @@ -224,7 +231,7 @@ public class AlignViewport qannotations, cons.qualityRange[0].floatValue(), cons.qualityRange[1].floatValue(), - 1); + AlignmentAnnotation.BAR_GRAPH); if (showQuality) { alignment.addAnnotation(quality); @@ -264,18 +271,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); @@ -284,7 +294,7 @@ public class AlignViewport if (consensus == null) { consensus = new AlignmentAnnotation("Consensus", - "PID", annotations, 0f, 100f, 1); + "PID", annotations, 0f, 100f, AlignmentAnnotation.BAR_GRAPH); if (showConsensus) { alignment.addAnnotation(consensus); @@ -295,6 +305,9 @@ public class AlignViewport consensus.annotations = annotations; } + if(globalColourScheme!=null) + globalColourScheme.setConsensus(vconsensus); + } public SequenceGroup getSelectionGroup() @@ -429,24 +442,14 @@ public class AlignViewport return charHeight; } - public void setChunkWidth(int w) - { - this.chunkWidth = w; - } - - public int getChunkWidth() - { - return chunkWidth; - } - - public void setChunkHeight(int h) + public void setWrappedWidth(int w) { - this.chunkHeight = h; + this.wrappedWidth = w; } - public int getChunkHeight() + public int getwrappedWidth() { - return chunkHeight; + return wrappedWidth; } public AlignmentI getAlignment() @@ -593,14 +596,14 @@ public class AlignViewport return colourAppliesToAllGroups; } - public boolean getShowFullId() + public boolean getShowJVSuffix() { - return showFullId; + return showJVSuffix; } - public void setShowFullId(boolean b) + public void setShowJVSuffix(boolean b) { - showFullId = b; + showJVSuffix = b; } public boolean getShowAnnotation() @@ -643,4 +646,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; + } + + }