From 52c82458a18df360ea80de64e03aca1fe473f813 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 1 Feb 2005 19:03:56 +0000 Subject: [PATCH] Update PID or conservationSlider if necessary --- src/jalview/gui/SeqPanel.java | 66 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 7 deletions(-) diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 7b3fae3..ab2e1ef 100755 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -12,7 +12,7 @@ public class SeqPanel extends JPanel { public SeqCanvas seqCanvas; - public AlignmentPanel parent; + public AlignmentPanel ap; protected int startres; protected int lastres; @@ -33,7 +33,7 @@ public class SeqPanel extends JPanel setLayout(new BorderLayout()); add(seqCanvas, BorderLayout.CENTER); - parent = p; + ap = p; addMouseMotionListener( new MouseMotionAdapter() { @@ -86,13 +86,13 @@ public class SeqPanel extends JPanel seqEditOccurred = -1; - parent.RefreshPanels(); + ap.RefreshPanels(); repaint(); } public void doMousePressed(MouseEvent evt) { - parent.alignFrame.addHistoryItem("sequence edit"); + ap.alignFrame.addHistoryItem("sequence edit"); int seq; int res; @@ -168,7 +168,7 @@ public class SeqPanel extends JPanel if(aa!="") text.append(" Residue: "+aa+" ("+ av.getAlignment().getSequenceAt(seq).findPosition(res)+")"); - parent.alignFrame.statusBar.setText(text.toString()); + ap.alignFrame.statusBar.setText(text.toString()); } @@ -362,10 +362,21 @@ public class SeqPanel extends JPanel sg.addSequence( (Sequence)av.getAlignment().getSequenceAt(seq) ); av.setRubberbandGroup( sg ); 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"); + } + } else if( javax.swing.SwingUtilities.isRightMouseButton(evt)) { - jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu( parent , null); + jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu( ap , null); pop.show(this, evt.getX(), evt.getY()); // edit the properties of existing group @@ -393,6 +404,47 @@ public class SeqPanel extends JPanel public void doMouseReleasedDefineMode(MouseEvent evt) { + + if(stretchGroup.cs instanceof ClustalxColourScheme) + { + stretchGroup.cs = new ClustalxColourScheme(stretchGroup.sequences, av.alignment.getWidth()); + seqCanvas.paintFlag = true; + repaint(); + } + + else if(stretchGroup.cs instanceof ConservationColourScheme) + { + ConservationColourScheme ccs = (ConservationColourScheme)stretchGroup.cs; + + Conservation c = new Conservation("Group", + ResidueProperties.propHash, 3, stretchGroup.sequences, 0, + av.alignment.getWidth() ); + + c.calculate(); + c.verdict(false, 100); + ccs = new ConservationColourScheme(c, ccs.cs); + + stretchGroup.cs = ccs; + + + Desktop.setConservationSliderSource(ap, stretchGroup.cs, stretchGroup.getName()) ; + + seqCanvas.paintFlag = true; + repaint(); + } + else + { + 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()); + } + + } + + changeEndRes = false; changeStartRes = false; stretchGroup = null; @@ -411,7 +463,7 @@ public class SeqPanel extends JPanel changeEndRes = true; else if(stretchGroup.getStartRes()==res) - // Edit end res position of selected group + // Edit start res position of selected group changeStartRes = true; -- 1.7.10.2