JAL-3201 restore group colours correctly from project bug/JAL-3201groupClustal
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 11 Mar 2019 14:54:26 +0000 (14:54 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 11 Mar 2019 14:54:26 +0000 (14:54 +0000)
src/jalview/project/Jalview2XML.java
src/jalview/viewmodel/AlignmentViewport.java
test/jalview/project/Jalview2xmlTests.java

index e57dd01..518d271 100644 (file)
@@ -4971,21 +4971,22 @@ public class Jalview2XML
       }
     }
 
+    /*
+     * turn off 'alignment colour applies to all groups'
+     * while restoring global colour scheme
+     */
+    viewport.setColourAppliesToAllGroups(false);
     viewport.setGlobalColourScheme(cs);
     viewport.getResidueShading().setThreshold(pidThreshold,
             view.isIgnoreGapsinConsensus());
     viewport.getResidueShading()
             .setConsensus(viewport.getSequenceConsensusHash());
-    viewport.setColourAppliesToAllGroups(false);
-
     if (safeBoolean(view.isConservationSelected()) && cs != null)
     {
       viewport.getResidueShading()
               .setConservationInc(safeInt(view.getConsThreshold()));
     }
-
     af.changeColour(cs);
-
     viewport.setColourAppliesToAllGroups(true);
 
     viewport
index ca32ee7..8438492 100644 (file)
@@ -662,7 +662,8 @@ public abstract class AlignmentViewport
          * retain any colour thresholds per group while
          * changing choice of colour scheme (JAL-2386)
          */
-        sg.setColourScheme(cs.getInstance(sg, hiddenRepSequences));
+        sg.setColourScheme(
+                cs == null ? null : cs.getInstance(sg, hiddenRepSequences));
         if (cs != null)
         {
           sg.getGroupColourScheme().alignmentChanged(sg,
index 3f4ed71..f2199e0 100644 (file)
@@ -809,6 +809,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     /*
      * Colour alignment by Buried Index, Above 10% PID, By Conservation 20%
      */
+    av.setColourAppliesToAllGroups(false);
     af.changeColour_actionPerformed(JalviewColourScheme.Buried.toString());
     assertTrue(av.getGlobalColourScheme() instanceof BuriedColourScheme);
     af.abovePIDThreshold_actionPerformed(true);