From: Jim Procter Date: Thu, 3 Sep 2015 20:35:49 +0000 (+0100) Subject: JAL-1680 JAL-1576 JAL-1233 all conservation and consensus calculation triggers and... X-Git-Tag: Release_2_10_0~498 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c481263f09ded05e611977fadf2b5941f21cbeea;p=jalview.git JAL-1680 JAL-1576 JAL-1233 all conservation and consensus calculation triggers and applying colour schemes to subgroups are refactored to viewport model --- diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 84be0dd..698fafc 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -2574,7 +2574,6 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, public void changeColour(ColourSchemeI cs) { - int threshold = 0; if (cs != null) { @@ -2597,15 +2596,6 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } viewport.setGlobalColourScheme(cs); - if (alignPanel.getOverviewPanel() != null) - { - alignPanel.getOverviewPanel().updateOverviewImage(); - } - - jalview.structure.StructureSelectionManager - .getStructureSelectionManager(viewport.applet) - .sequenceColoursChanged(alignPanel); - alignPanel.paintAlignment(true); } diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 809609a..f04744d 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -20,10 +20,8 @@ */ package jalview.gui; -import jalview.analysis.AAFrequency; import jalview.analysis.AlignmentSorter; import jalview.analysis.AlignmentUtils; -import jalview.analysis.Conservation; import jalview.analysis.CrossRef; import jalview.analysis.Dna; import jalview.analysis.ParseProperties; @@ -3499,115 +3497,27 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ public void changeColour(ColourSchemeI cs) { - // TODO: compare with applet and pull up to model method - int threshold = 0; + // TODO: pull up to controller method if (cs != null) { + // Make sure viewport is up to date w.r.t. any sliders if (viewport.getAbovePIDThreshold()) { - threshold = SliderPanel.setPIDSliderSource(alignPanel, cs, + int threshold = SliderPanel.setPIDSliderSource(alignPanel, cs, "Background"); - cs.setThreshold(threshold, viewport.isIgnoreGapsConsensus()); - } - else - { - cs.setThreshold(0, viewport.isIgnoreGapsConsensus()); + viewport.setThreshold(threshold); } if (viewport.getConservationSelected()) { - - Alignment al = (Alignment) viewport.getAlignment(); - Conservation c = new Conservation("All", - ResidueProperties.propHash, 3, al.getSequences(), 0, - al.getWidth() - 1); - - c.calculate(); - c.verdict(false, viewport.getConsPercGaps()); - - cs.setConservation(c); - cs.setConservationInc(SliderPanel.setConservationSlider(alignPanel, cs, "Background")); } - else - { - cs.setConservation(null); - } - - cs.setConsensus(viewport.getSequenceConsensusHash()); } viewport.setGlobalColourScheme(cs); - if (viewport.getColourAppliesToAllGroups()) - { - - for (SequenceGroup sg : viewport.getAlignment().getGroups()) - { - if (cs == null) - { - sg.cs = null; - continue; - } - - if (cs instanceof ClustalxColourScheme) - { - sg.cs = new ClustalxColourScheme(sg, - viewport.getHiddenRepSequences()); - } - else if (cs instanceof UserColourScheme) - { - sg.cs = new UserColourScheme(((UserColourScheme) cs).getColours()); - } - else - { - try - { - sg.cs = cs.getClass().newInstance(); - } catch (Exception ex) - { - } - } - - if (viewport.getAbovePIDThreshold() - || cs instanceof PIDColourScheme - || cs instanceof Blosum62ColourScheme) - { - sg.cs.setThreshold(threshold, viewport.isIgnoreGapsConsensus()); - - sg.cs.setConsensus(AAFrequency.calculate( - sg.getSequences(viewport.getHiddenRepSequences()), - sg.getStartRes(), sg.getEndRes() + 1)); - } - else - { - sg.cs.setThreshold(0, viewport.isIgnoreGapsConsensus()); - } - - if (viewport.getConservationSelected()) - { - Conservation c = new Conservation("Group", - ResidueProperties.propHash, 3, sg.getSequences(viewport - .getHiddenRepSequences()), sg.getStartRes(), - sg.getEndRes() + 1); - c.calculate(); - c.verdict(false, viewport.getConsPercGaps()); - sg.cs.setConservation(c); - } - else - { - sg.cs.setConservation(null); - } - } - } - - if (alignPanel.getOverviewPanel() != null) - { - alignPanel.getOverviewPanel().updateOverviewImage(); - } - alignPanel.paintAlignment(true); } diff --git a/src/jalview/schemes/RNAHelicesColourChooser.java b/src/jalview/schemes/RNAHelicesColourChooser.java index fb47d92..1a13bbe 100644 --- a/src/jalview/schemes/RNAHelicesColourChooser.java +++ b/src/jalview/schemes/RNAHelicesColourChooser.java @@ -109,20 +109,6 @@ public class RNAHelicesColourChooser av.setGlobalColourScheme(rhc); - if (av.getAlignment().getGroups() != null) - { - for (SequenceGroup sg : ap.getAlignment().getGroups()) - { - if (sg.cs == null) - { - continue; - } - - sg.cs = new RNAHelicesColour(sg); - - } - } - ap.paintAlignment(true); }