JAL-1680 JAL-1576 JAL-1233 all conservation and consensus calculation triggers and...
authorJim Procter <jprocter@issues.jalview.org>
Thu, 3 Sep 2015 20:35:49 +0000 (21:35 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 3 Sep 2015 20:35:49 +0000 (21:35 +0100)
src/jalview/appletgui/AlignFrame.java
src/jalview/gui/AlignFrame.java
src/jalview/schemes/RNAHelicesColourChooser.java

index 84be0dd..698fafc 100644 (file)
@@ -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);
   }
 
index 809609a..f04744d 100644 (file)
  */
 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);
   }
 
index fb47d92..1a13bbe 100644 (file)
@@ -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);
   }