From 6d5aff5f7ace98b6416c7e9dc2a8fdc6ad194902 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 15 Apr 2005 15:00:57 +0000 Subject: [PATCH] pid and conservation changes --- src/jalview/gui/PopupMenu.java | 37 ++++++++++++++++++++++--------------- src/jalview/gui/SeqPanel.java | 23 ++++++----------------- 2 files changed, 28 insertions(+), 32 deletions(-) diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 8d505ea..b04530c 100755 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -395,22 +395,28 @@ public class PopupMenu extends JPopupMenu protected void abovePIDColour_actionPerformed(ActionEvent e) { - if(abovePIDColour.isSelected()) -{ + SequenceGroup sg = getGroup(); + if (abovePIDColour.isSelected()) + { + sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0, + ap.av.alignment.getWidth())); + int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup().getName()); + if (sg.cs instanceof ResidueColourScheme) + ( (ResidueColourScheme)sg. cs).setThreshold(threshold); + else if (sg.cs instanceof ScoreColourScheme) + ( (ScoreColourScheme) sg.cs).setThreshold(threshold); - Desktop.setPIDSliderSource(ap, getGroup().cs, getGroup().getName()); - refresh(); -} -else // remove PIDColouring -{ - ColourSchemeI cs = getGroup().cs; - ResidueColourScheme rcs = (ResidueColourScheme)cs; - rcs.setThreshold(0); - getGroup().cs = rcs; - refresh(); -} + SliderPanel.showPIDSlider(); + } + else // remove PIDColouring + { + ResidueColourScheme rcs = (ResidueColourScheme) sg.cs; + rcs.setThreshold(0); + sg.cs = rcs; + } + refresh(); } @@ -434,7 +440,7 @@ else // remove PIDColouring protected void BLOSUM62Colour_actionPerformed(ActionEvent e) { - getGroup().cs = new Blosum62ColourScheme(ap.av); + getGroup().cs = new Blosum62ColourScheme(); refresh(); } @@ -464,7 +470,8 @@ else // remove PIDColouring sg.cs = ccs; - Desktop.setConservationSliderSource(ap, ccs, sg.getName()); + SliderPanel.setConservationSlider(ap, ccs, sg.getName()); + SliderPanel.showConservationSlider(); } else // remove ConservationColouring { diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 3bfc7db..0fa6d17 100755 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -420,14 +420,9 @@ public class SeqPanel extends JPanel stretchGroup = sg; if(av.getConservationSelected()) - Desktop.setConservationSliderSource(ap, av.getGlobalColourScheme(), "Background"); - else if(av.getGlobalColourScheme()!=null && av.getGlobalColourScheme().canThreshold()) - { - ResidueColourScheme rcs = (ResidueColourScheme) av.getGlobalColourScheme(); - int threshold = rcs.getThreshold(); - if (threshold > 0) - Desktop.setPIDSliderSource(ap, av.getGlobalColourScheme(), "Background"); - } + SliderPanel.setConservationSlider(ap, av.getGlobalColourScheme(), "Background"); + if(av.getAbovePIDThreshold()) + SliderPanel.setPIDSliderSource(ap, av.getGlobalColourScheme(), "Background"); } else if( javax.swing.SwingUtilities.isRightMouseButton(evt)) @@ -472,13 +467,9 @@ public class SeqPanel extends JPanel else if(stretchGroup.cs instanceof ConservationColourScheme) { - ConservationColourScheme ccs = (ConservationColourScheme)stretchGroup.cs; - - + ConservationColourScheme ccs = (ConservationColourScheme)stretchGroup.cs; stretchGroup.cs = ccs; - - - Desktop.setConservationSliderSource(ap, stretchGroup.cs, stretchGroup.getName()) ; + SliderPanel.setConservationSlider(ap, stretchGroup.cs, stretchGroup.getName()) ; repaint(); } @@ -487,9 +478,7 @@ public class SeqPanel extends JPanel if(stretchGroup.cs !=null && stretchGroup.cs.canThreshold()) { ResidueColourScheme rcs = (ResidueColourScheme) stretchGroup.cs; - int threshold = rcs.getThreshold(); - if(threshold>0) - Desktop.setPIDSliderSource(ap, stretchGroup.cs, stretchGroup.getName()); + SliderPanel.setPIDSliderSource(ap, stretchGroup.cs, stretchGroup.getName()); } } -- 1.7.10.2