From 8da7acff9214ddaf0e6d28e76219ab51bd38e62d Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 1 Sep 2005 13:20:56 +0000 Subject: [PATCH] Use propertyListener for alignment edits --- src/jalview/appletgui/AlignFrame.java | 123 +++++++++++------------- src/jalview/appletgui/AlignViewport.java | 49 ++++++++-- src/jalview/appletgui/AlignmentPanel.java | 16 +-- src/jalview/appletgui/AnnotationPanel.java | 2 + src/jalview/appletgui/CutAndPasteTransfer.java | 6 +- src/jalview/appletgui/PairwiseAlignPanel.java | 16 +-- src/jalview/appletgui/SeqPanel.java | 100 +------------------ src/jalview/gui/AlignFrame.java | 120 ++++++++++------------- src/jalview/gui/AlignViewport.java | 9 -- src/jalview/gui/AlignmentPanel.java | 2 +- src/jalview/gui/RedundancyPanel.java | 14 +-- src/jalview/gui/SeqPanel.java | 92 +----------------- 12 files changed, 180 insertions(+), 369 deletions(-) diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 56efb03..5641846 100755 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -39,24 +39,6 @@ public class AlignFrame public static final int NEW_WINDOW_HEIGHT = 500; jalview.bin.JalviewLite applet; - public AlignFrame(AlignmentI al) - { - this.applet = null; - viewport = new AlignViewport(al, null); - alignPanel = new AlignmentPanel(this, viewport); - add(alignPanel); - alignPanel.validate(); - - this.addWindowListener(new WindowAdapter() - { - public void windowClosing(WindowEvent e) - { - closeMenuItem_actionPerformed(null); - } - }); - - } - public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet) { @@ -91,6 +73,15 @@ public class AlignFrame } } + String param = applet.getParameter("sortBy"); + if(param!=null) + { + if (param.equalsIgnoreCase("Id")) + sortIDMenuItem_actionPerformed(null); + else if (param.equalsIgnoreCase("Pairwise Identity")) + sortPairwiseMenuItem_actionPerformed(null); + } + this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) @@ -99,13 +90,21 @@ public class AlignFrame } }); - - + viewport.addPropertyChangeListener(new java.beans.PropertyChangeListener() + { + public void propertyChange(java.beans.PropertyChangeEvent evt) + { + if (evt.getPropertyName().equals("alignment")) + { + alignmentChanged(); + } + } + }); } public void inputText_actionPerformed(ActionEvent e) { - CutAndPasteTransfer cap = new CutAndPasteTransfer(true); + CutAndPasteTransfer cap = new CutAndPasteTransfer(true, applet); Frame frame = new Frame(); frame.add(cap); jalview.bin.JalviewLite.addFrame(frame, "Cut & Paste Input", 500, 500); @@ -113,7 +112,7 @@ public class AlignFrame protected void outputText_actionPerformed(ActionEvent e) { - CutAndPasteTransfer cap = new CutAndPasteTransfer(false); + CutAndPasteTransfer cap = new CutAndPasteTransfer(false, applet); Frame frame = new Frame(); frame.add(cap); jalview.bin.JalviewLite.addFrame(frame, @@ -172,7 +171,7 @@ public class AlignFrame redoList.push(new HistoryItem(hi.getDescription(), viewport.alignment, HistoryItem.HIDE)); restoreHistoryItem(hi); - resetAllColourSchemes(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } protected void redoMenuItem_actionPerformed(ActionEvent e) @@ -180,10 +179,7 @@ public class AlignFrame HistoryItem hi = (HistoryItem) redoList.pop(); restoreHistoryItem(hi); updateEditMenuBar(); - viewport.updateConsensus(); - resetAllColourSchemes(); - alignPanel.repaint(); - alignPanel.repaint(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } // used by undo and redo @@ -227,9 +223,7 @@ public class AlignFrame updateEditMenuBar(); - viewport.updateConsensus(); - viewport.updateConservation(); - alignPanel.repaint(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } public void moveSelectedSequences(boolean up) @@ -420,10 +414,7 @@ public class AlignFrame { viewport.setEndSeq(viewport.alignment.getHeight()); viewport.alignment.getWidth(); - viewport.updateConservation(); - viewport.updateConsensus(); - resetAllColourSchemes(); - alignPanel.repaint(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } } @@ -489,10 +480,7 @@ public class AlignFrame catch (Exception ex) {} } - viewport.updateConservation(); - viewport.updateConsensus(); - resetAllColourSchemes(); - alignPanel.repaint(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } @@ -562,8 +550,7 @@ public class AlignFrame viewport.alignment.deleteGroup(sg); } } - resetAllColourSchemes(); - alignPanel.repaint(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } } @@ -590,8 +577,7 @@ public class AlignFrame viewport.alignment.deleteGroup(sg); } } - resetAllColourSchemes(); - alignPanel.repaint(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } } @@ -611,10 +597,7 @@ public class AlignFrame viewport.setStartRes(seq.findIndex(startRes)-1); - viewport.updateConservation(); - viewport.updateConsensus(); - resetAllColourSchemes(); - alignPanel.repaint(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } public void removeAllGapsMenuItem_actionPerformed(ActionEvent e) @@ -665,8 +648,13 @@ public class AlignFrame } viewport.setStartRes(seq.findIndex(startRes)-1); - viewport.updateConservation(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); + } + + public void alignmentChanged() + { viewport.updateConsensus(); + viewport.updateConservation (); resetAllColourSchemes(); alignPanel.repaint(); } @@ -676,27 +664,26 @@ public class AlignFrame ColourSchemeI cs = viewport.globalColourScheme; if(cs!=null) { - cs.setConsensus(viewport.vconsensus); - if(cs.conservationApplied()) - { - Alignment al = (Alignment) viewport.alignment; - Conservation c = new Conservation("All", - ResidueProperties.propHash, 3, - al.getSequences(), 0, - al.getWidth() - 1); - c.calculate(); - c.verdict(false, viewport.ConsPercGaps); + if (cs instanceof ClustalxColourScheme) + { + ( (ClustalxColourScheme) viewport.getGlobalColourScheme()). + resetClustalX(viewport.alignment.getSequences(), + viewport.alignment.getWidth()); + } - cs.setConservation(c); - } - } + cs.setConsensus(viewport.vconsensus); + if (cs.conservationApplied()) + { + Alignment al = (Alignment) viewport.alignment; + Conservation c = new Conservation("All", + ResidueProperties.propHash, 3, + al.getSequences(), 0, + al.getWidth() - 1); + c.calculate(); + c.verdict(false, viewport.ConsPercGaps); - if(viewport.getGlobalColourScheme()!=null - && viewport.getGlobalColourScheme() instanceof ClustalxColourScheme) - { - ((ClustalxColourScheme)viewport.getGlobalColourScheme()). - resetClustalX(viewport.alignment.getSequences(), - viewport.alignment.getWidth()); + cs.setConservation(c); + } } int s, sSize = viewport.alignment.getGroups().size(); @@ -707,9 +694,7 @@ public class AlignFrame { ((ClustalxColourScheme)sg.cs).resetClustalX(sg.sequences, sg.getWidth()); } - sg.recalcConservation(); - } } @@ -1100,7 +1085,7 @@ public class AlignFrame if (viewport.getSelectionGroup().getSize() > 1) { Frame frame = new Frame(); - frame.add(new PairwiseAlignPanel(viewport)); + frame.add(new PairwiseAlignPanel(alignPanel)); jalview.bin.JalviewLite.addFrame(frame, "Pairwise Alignment", 600, 500); } } diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index 4b4d74d..40d3dd4 100755 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -74,6 +74,14 @@ 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; @@ -139,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() { @@ -662,9 +664,44 @@ public class AlignViewport 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; diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index 1930866..cf383ac 100755 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -172,6 +172,9 @@ public class AlignmentPanel hscrollFillerPanel.setSize(d); alignFrame.pack(); + + if(overviewPanel!=null) + overviewPanel.updateOverviewImage(); } public void setIdWidth(int w, int h) @@ -465,13 +468,8 @@ public class AlignmentPanel idPanel.idCanvas.setSize(d.width, seqPanel.seqCanvas.getSize().height); annotationSpaceFillerHolder.setSize(d.width, annotationPanel.getSize().height); - alabels.setSize(d.width, annotationPanel.getSize().height); - alabels.repaint(); - idPanel.idCanvas.repaint(); - seqPanel.seqCanvas.repaint(); - scalePanel.repaint(); - annotationPanel.repaint(); + alabels.setSize(d.width, annotationPanel.getSize().height); if (av.getWrapAlignment()) { @@ -487,5 +485,11 @@ public class AlignmentPanel setScrollValues(av.getStartRes(), av.getStartSeq()); } + alabels.repaint(); + idPanel.idCanvas.repaint(); + seqPanel.seqCanvas.repaint(); + scalePanel.repaint(); + annotationPanel.repaint(); + } } diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index c6d3b4e..6399b1c 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -192,6 +192,8 @@ public class AnnotationPanel public void paint(Graphics g) { + g.setColor(Color.white); + g.fillRect(0,0, getSize().width, getSize().height); imgWidth = (av.endRes - av.startRes + 1) * av.charWidth; if (image == null || imgWidth != image.getWidth(this)) diff --git a/src/jalview/appletgui/CutAndPasteTransfer.java b/src/jalview/appletgui/CutAndPasteTransfer.java index 46f3d70..f8c3756 100755 --- a/src/jalview/appletgui/CutAndPasteTransfer.java +++ b/src/jalview/appletgui/CutAndPasteTransfer.java @@ -29,9 +29,11 @@ import jalview.jbappletgui.*; public class CutAndPasteTransfer extends GCutAndPasteTransfer { - public CutAndPasteTransfer(boolean forImport) + jalview.bin.JalviewLite applet; + public CutAndPasteTransfer(boolean forImport, jalview.bin.JalviewLite mainApplet) { super(); + applet = mainApplet; if (!forImport) { @@ -76,7 +78,7 @@ public class CutAndPasteTransfer if (sequences != null) { - AlignFrame af = new AlignFrame(new Alignment(sequences)); + AlignFrame af = new AlignFrame(new Alignment(sequences), applet); jalview.bin.JalviewLite.addFrame(af, "Cut & Paste input - " + format, AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT); diff --git a/src/jalview/appletgui/PairwiseAlignPanel.java b/src/jalview/appletgui/PairwiseAlignPanel.java index 55cf2cc..0ff2708 100755 --- a/src/jalview/appletgui/PairwiseAlignPanel.java +++ b/src/jalview/appletgui/PairwiseAlignPanel.java @@ -31,16 +31,16 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel { Vector sequences = new Vector(); - AlignViewport av; + AlignmentPanel ap; - public PairwiseAlignPanel(AlignViewport av) + public PairwiseAlignPanel(AlignmentPanel ap) { super(); - this.av = av; - float scores[][] = new float[av.getAlignment().getHeight()][av.getAlignment(). + this.ap = ap; + float scores[][] = new float[ap.av.alignment.getHeight()][ap.av.alignment. getHeight()]; double totscore = 0; - int count = av.getSelectionGroup().getSize(); + int count = ap.av.getSelectionGroup().getSize(); int acount = 0; for (int i = 1; i < count; i++) @@ -48,8 +48,8 @@ public class PairwiseAlignPanel for (int j = 0; j < i; j++) { acount++; - AlignSeq as = new AlignSeq(av.getSelectionGroup().getSequenceAt(i), - av.getSelectionGroup().getSequenceAt(j), + AlignSeq as = new AlignSeq(ap.av.getSelectionGroup().getSequenceAt(i), + ap.av.getSelectionGroup().getSequenceAt(j), "pep"); as.calcScoreMatrix(); @@ -88,7 +88,7 @@ public class PairwiseAlignPanel seq[i] = (Sequence) sequences.elementAt(i); } - AlignFrame af = new AlignFrame(new Alignment(seq)); + AlignFrame af = new AlignFrame(new Alignment(seq), ap.alignFrame.applet); jalview.bin.JalviewLite.addFrame(af, "Pairwise Aligned Sequences", AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT); diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java index d7f11bb..fb11579 100755 --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -459,105 +459,7 @@ public class SeqPanel ap.alignFrame.updateEditMenuBar(); } - av.updateConservation(); - av.updateConsensus(); - - - //Does the edit affect any groups? - ////////////////////////////// - Vector groupsToUpdate = new Vector(); - SequenceGroup sg = av.getSelectionGroup(); - - int s, g, gSize = av.alignment.getGroups().size(); - if (sg != null) - { - groupsToUpdate.addElement(av.getSelectionGroup()); - int sSize = sg.getSize(); - for (s = 0; s < sSize; s++) - { - SequenceI seq = sg.getSequenceAt(s); - - for (g = 0; g < gSize; g++) - { - SequenceGroup sg2 = (SequenceGroup) av.alignment.getGroups(). - elementAt( - g); - if (sg2.sequences.contains(seq)) - { - if (!groupsToUpdate.contains(sg2)) - groupsToUpdate.addElement(sg2); - continue; - } - } - } - } - else - { - SequenceI seq = av.alignment.getSequenceAt(startseq); - for (g = 0; g < gSize; g++) - { - SequenceGroup sg2 = (SequenceGroup) av.alignment.getGroups().elementAt( - g); - if (sg2.sequences.contains(seq)) - { - if (!groupsToUpdate.contains(sg2)) - groupsToUpdate.addElement(sg2); - continue; - } - } - } - - gSize = groupsToUpdate.size(); - for (g = 0; g < gSize; g++) - { - ( (SequenceGroup) groupsToUpdate.elementAt(g)).recalcConservation(); - } - ////End of updating groups - ////////////////////////////////////////// - - - // Y O Y CLUSTALX - ColourSchemeI cs = av.getGlobalColourScheme(); - - if (av.getSelectionGroup() != null) - { - av.getSelectionGroup().recalcConservation(); - } - - if(cs!=null) - { - if (cs.conservationApplied()) - { - jalview.analysis.Conservation c = new jalview.analysis.Conservation("All", - ResidueProperties.propHash, 3, - av.alignment.getSequences(), - 0, av.alignment.getWidth() - 1); - c.calculate(); - c.verdict(false, av.ConsPercGaps); - - if (cs instanceof ClustalxColourScheme) - { - ((ClustalxColourScheme)cs). - resetClustalX(av.alignment.getSequences(), - av.alignment.getWidth()); - cs.setConservation(c); - av.setGlobalColourScheme(cs); - } - else - { - cs.setConservation(c); - av.setGlobalColourScheme(cs); - } - - } - - if (cs instanceof ClustalxColourScheme) - { - ( (ClustalxColourScheme) cs).resetClustalX(av.alignment.getSequences(), - av.alignment.getWidth()); - av.setGlobalColourScheme(cs); - } - } + av.firePropertyChange("alignment", null,av.getAlignment().getSequences()); } ////////////////////////////////////////// diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index ada2421..4b28166 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -76,21 +76,26 @@ public class AlignFrame getPreferredSize()); alignPanel.setAnnotationVisible(viewport.getShowAnnotation()); + String sortby = jalview.bin.Cache.getDefault("SORT_ALIGNMENT", "No sort"); + + if(sortby.equals("Id")) + sortIDMenuItem_actionPerformed(null); + else if(sortby.equals("Pairwise Identity")) + sortPairwiseMenuItem_actionPerformed(null); + getContentPane().add(alignPanel, java.awt.BorderLayout.CENTER); - addInternalFrameListener(new InternalFrameAdapter() + viewport.addPropertyChangeListener(new PropertyChangeListener() { - public void internalFrameActivated(InternalFrameEvent evt) - { - javax.swing.SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - alignPanel.requestFocus(); - } - }); - } - }); + public void propertyChange(PropertyChangeEvent evt) + { + if (evt.getPropertyName().equals("alignment")) + { + alignmentChanged(); + } + } + }); + addServiceListeners(); } @@ -410,7 +415,7 @@ public class AlignFrame redoList.push(new HistoryItem(hi.getDescription(), viewport.alignment, HistoryItem.HIDE)); restoreHistoryItem(hi); - resetAllColourSchemes(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } /** @@ -423,9 +428,7 @@ public class AlignFrame HistoryItem hi = (HistoryItem) redoList.pop(); restoreHistoryItem(hi); updateEditMenuBar(); - viewport.updateConsensus(); - resetAllColourSchemes(); - alignPanel.repaint(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } // used by undo and redo @@ -470,9 +473,6 @@ public class AlignFrame updateEditMenuBar(); - viewport.updateConsensus(); - viewport.updateConservation(); - alignPanel.repaint(); viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } @@ -701,21 +701,17 @@ public class AlignFrame } else { - viewport.firePropertyChange("alignment", null, - viewport.getAlignment().getSequences()); viewport.setEndSeq(viewport.alignment.getHeight()); viewport.alignment.getWidth(); - viewport.updateConservation(); - viewport.updateConsensus(); - resetAllColourSchemes(); - alignPanel.repaint(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } } catch (Exception ex) { + // could be anything being pasted in here } - // could be anything being pasted in here + } /** @@ -786,7 +782,6 @@ public class AlignFrame viewport.getAlignment().getSequences()); } - viewport.resetSeqLimits(alignPanel.seqPanel.seqCanvas.getHeight()); if (viewport.getAlignment().getHeight() < 1) { @@ -798,11 +793,6 @@ public class AlignFrame { } } - - viewport.updateConservation(); - viewport.updateConsensus(); - resetAllColourSchemes(); - alignPanel.repaint(); } /** @@ -911,8 +901,7 @@ public class AlignFrame } } - resetAllColourSchemes(); - alignPanel.repaint(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } } @@ -950,8 +939,7 @@ public class AlignFrame } } - resetAllColourSchemes(); - alignPanel.repaint(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } } @@ -974,10 +962,7 @@ public class AlignFrame viewport.setStartRes(seq.findIndex(startRes)-1); - resetAllColourSchemes(); - viewport.updateConservation(); - viewport.updateConsensus(); - alignPanel.repaint(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } /** @@ -1040,39 +1025,42 @@ public class AlignFrame viewport.setStartRes(seq.findIndex(startRes)-1); - viewport.updateConservation(); - viewport.updateConsensus(); - resetAllColourSchemes(); - alignPanel.repaint(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } + public void alignmentChanged() + { + viewport.updateConsensus(); + viewport.updateConservation(); + resetAllColourSchemes(); + alignPanel.repaint(); + } void resetAllColourSchemes() { ColourSchemeI cs = viewport.globalColourScheme; if(cs!=null) { - cs.setConsensus(viewport.vconsensus); - if(cs.conservationApplied()) - { - Alignment al = (Alignment) viewport.alignment; - Conservation c = new Conservation("All", - ResidueProperties.propHash, 3, - al.getSequences(), 0, - al.getWidth() - 1); - c.calculate(); - c.verdict(false, viewport.ConsPercGaps); + if (cs instanceof ClustalxColourScheme) + { + ( (ClustalxColourScheme) viewport.getGlobalColourScheme()). + resetClustalX(viewport.alignment.getSequences(), + viewport.alignment.getWidth()); + } - cs.setConservation(c); - } - } + cs.setConsensus(viewport.vconsensus); + if (cs.conservationApplied()) + { + Alignment al = (Alignment) viewport.alignment; + Conservation c = new Conservation("All", + ResidueProperties.propHash, 3, + al.getSequences(), 0, + al.getWidth() - 1); + c.calculate(); + c.verdict(false, viewport.ConsPercGaps); - if(viewport.getGlobalColourScheme()!=null - && viewport.getGlobalColourScheme() instanceof ClustalxColourScheme) - { - ((ClustalxColourScheme)viewport.getGlobalColourScheme()). - resetClustalX(viewport.alignment.getSequences(), - viewport.alignment.getWidth()); + cs.setConservation(c); + } } int s, sSize = viewport.alignment.getGroups().size(); @@ -1083,9 +1071,7 @@ public class AlignFrame { ((ClustalxColourScheme)sg.cs).resetClustalX(sg.sequences, sg.getWidth()); } - sg.recalcConservation(); - } } @@ -1113,9 +1099,7 @@ public class AlignFrame } } - viewport.updateConservation(); - viewport.updateConsensus(); - alignPanel.repaint(); + alignmentChanged(); } /** diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index f951792..ea974d5 100755 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -851,15 +851,6 @@ public class AlignViewport return colSel; } - /** - * DOCUMENT ME! - * - * @param height DOCUMENT ME! - */ - public void resetSeqLimits(int height) - { - setEndSeq(height / getCharHeight()); - } /** * DOCUMENT ME! diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index ae61383..19f50d0 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -171,7 +171,7 @@ public class AlignmentPanel extends GAlignmentPanel } if(overviewPanel!=null) - overviewPanel.updateOverviewImage(); + overviewPanel.setBoxPosition(); repaint(); } diff --git a/src/jalview/gui/RedundancyPanel.java b/src/jalview/gui/RedundancyPanel.java index 17b5dfa..3901b1f 100755 --- a/src/jalview/gui/RedundancyPanel.java +++ b/src/jalview/gui/RedundancyPanel.java @@ -75,8 +75,7 @@ public class RedundancyPanel extends GSliderPanel { float threshold = slider.getValue(); Vector del; - HistoryItem it; - historyList.push(it = new HistoryItem("Remove redundancy", + historyList.push(new HistoryItem("Remove redundancy", ap.av.alignment, HistoryItem.HIDE)); if ((historyList.size() == 1) || @@ -127,9 +126,9 @@ public class RedundancyPanel extends GSliderPanel } } - ap.av.firePropertyChange("alignment", null, - ap.av.getAlignment().getSequences()); - ap.av.resetSeqLimits(ap.seqPanel.seqCanvas.getHeight()); + ap.av.firePropertyChange("alignment", null, ap.av.getAlignment().getSequences()); + af.updateEditMenuBar(); + if (ap.av.getAlignment().getHeight() < 1) { @@ -141,11 +140,6 @@ public class RedundancyPanel extends GSliderPanel { } } - - ap.av.updateConservation(); - ap.av.updateConsensus(); - af.updateEditMenuBar(); - ap.repaint(); } /** diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 62d95ea..8146be0 100755 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -585,98 +585,8 @@ public class SeqPanel extends JPanel ap.alignFrame.updateEditMenuBar(); } - av.updateConservation(); - av.updateConsensus(); + av.firePropertyChange("alignment", null,av.getAlignment().getSequences()); - //Does the edit affect any groups? - ////////////////////////////// - Vector groupsToUpdate = new Vector(); - SequenceGroup sg = av.getSelectionGroup(); - - int s, g, gSize = av.alignment.getGroups().size(); - if (sg != null) - { - groupsToUpdate.addElement(av.getSelectionGroup()); - int sSize = sg.getSize(); - for (s = 0; s < sSize; s++) - { - SequenceI seq = sg.getSequenceAt(s); - - for (g = 0; g < gSize; g++) - { - SequenceGroup sg2 = (SequenceGroup) av.alignment.getGroups(). - elementAt( - g); - if (sg2.sequences.contains(seq)) - { - if (!groupsToUpdate.contains(sg2)) - groupsToUpdate.addElement(sg2); - continue; - } - } - } - } - else - { - SequenceI seq = av.alignment.getSequenceAt(startseq); - for (g = 0; g < gSize; g++) - { - SequenceGroup sg2 = (SequenceGroup) av.alignment.getGroups().elementAt( - g); - if (sg2.sequences.contains(seq)) - { - if (!groupsToUpdate.contains(sg2)) - groupsToUpdate.addElement(sg2); - continue; - } - } - } - - gSize = groupsToUpdate.size(); - for (g = 0; g < gSize; g++) - { - ( (SequenceGroup) groupsToUpdate.elementAt(g)).recalcConservation(); - } - ////End of updating groups - ////////////////////////////////////////// - - // Y O Y CLUSTALX - ColourSchemeI cs = av.getGlobalColourScheme(); - if(cs!=null) - { - if (cs.conservationApplied()) - { - Conservation c = new Conservation("All", - ResidueProperties.propHash, 3, - av.alignment.getSequences(), - 0, av.alignment.getWidth() - 1); - c.calculate(); - c.verdict(false, av.ConsPercGaps); - - if (cs instanceof ClustalxColourScheme) - { - ((ClustalxColourScheme)cs). - resetClustalX(av.alignment.getSequences(), - av.alignment.getWidth()); - - cs.setConservation(c); - av.setGlobalColourScheme(cs); - } - else - { - cs.setConservation(c); - av.setGlobalColourScheme(cs); - } - - } - - if (cs instanceof ClustalxColourScheme) - { - ( (ClustalxColourScheme) cs).resetClustalX(av.alignment.getSequences(), - av.alignment.getWidth()); - av.setGlobalColourScheme(cs); - } - } } /** -- 1.7.10.2