CurrentColour must not be accessed by multiple sequence renderers
authoramwaterhouse <Andrew Waterhouse>
Tue, 28 Nov 2006 16:48:11 +0000 (16:48 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 28 Nov 2006 16:48:11 +0000 (16:48 +0000)
src/jalview/schemes/AnnotationColourGradient.java
src/jalview/schemes/Blosum62ColourScheme.java
src/jalview/schemes/ClustalxColourScheme.java
src/jalview/schemes/NucleotideColourScheme.java
src/jalview/schemes/PIDColourScheme.java
src/jalview/schemes/ResidueColourScheme.java
src/jalview/schemes/ScoreColourScheme.java
src/jalview/schemes/UserColourScheme.java

index c67eafc..8367cad 100755 (executable)
@@ -141,7 +141,7 @@ public class AnnotationColourGradient extends ResidueColourScheme
      */\r
     public Color findColour(String n, int j)\r
     {\r
-        currentColour = Color.white;\r
+        Color currentColour = Color.white;\r
 \r
         if ((threshold == 0) || aboveThreshold(n, j))\r
         {\r
@@ -179,7 +179,7 @@ public class AnnotationColourGradient extends ResidueColourScheme
         }\r
 \r
         if(conservationColouring)\r
-         applyConservation(j);\r
+         applyConservation(currentColour, j);\r
 \r
        return currentColour;\r
     }\r
index ec5d4f1..d3b93bf 100755 (executable)
@@ -32,6 +32,7 @@ public class Blosum62ColourScheme
 \r
   public Color findColour(String s, int j)\r
   {\r
+\r
     char res = s.charAt(0);\r
     if ('a' <= res && res <= 'z' )\r
     {\r
@@ -47,6 +48,8 @@ public class Blosum62ColourScheme
       return Color.white;\r
     }\r
 \r
+    Color currentColour;\r
+\r
     if (!jalview.util.Comparison.isGap( res ))\r
     {\r
       String max = (String) consensus[j].get(AAFrequency.MAXRESIDUE);\r
@@ -79,7 +82,7 @@ public class Blosum62ColourScheme
       }\r
 \r
       if(conservationColouring)\r
-         applyConservation(j);\r
+         applyConservation(currentColour, j);\r
     }\r
     else\r
     {\r
index 04610ef..ce30de8 100755 (executable)
@@ -247,12 +247,10 @@ public class ClustalxColourScheme
 \r
   public Color findColour(String s, int j)\r
   {\r
-\r
-    if(cons2.length<=j)\r
-      return currentColour;\r
+    Color currentColour;\r
 \r
 \r
-    if ( (threshold != 0) && !aboveThreshold(s, j))\r
+    if ( cons2.length<=j || (threshold != 0 && !aboveThreshold(s, j)))\r
     {\r
       return Color.white;\r
     }\r
@@ -283,7 +281,7 @@ public class ClustalxColourScheme
     }\r
 \r
     if(conservationColouring)\r
-         applyConservation(j);\r
+         applyConservation(currentColour, j);\r
 \r
     return currentColour;\r
   }\r
index 6aaef7d..f36bcad 100755 (executable)
@@ -60,6 +60,7 @@ public class NucleotideColourScheme extends ResidueColourScheme
      */\r
     public Color findColour(String n, int j)\r
     {\r
+        Color currentColour;\r
         if ((threshold == 0) || aboveThreshold(n, j))\r
         {\r
             try\r
@@ -77,7 +78,7 @@ public class NucleotideColourScheme extends ResidueColourScheme
         }\r
 \r
         if(conservationColouring)\r
-         applyConservation(j);\r
+         applyConservation(currentColour, j);\r
 \r
        return currentColour;\r
     }\r
index 8061e67..b287384 100755 (executable)
@@ -56,7 +56,7 @@ public class PIDColourScheme
       return Color.white;\r
     }\r
 \r
-    currentColour = Color.white;\r
+    Color currentColour = Color.white;\r
 \r
     double sc = 0;\r
 \r
@@ -83,7 +83,7 @@ public class PIDColourScheme
       }\r
 \r
     if(conservationColouring)\r
-         applyConservation(j);\r
+         applyConservation(currentColour, j);\r
 \r
     return currentColour;\r
   }\r
index 64fd62e..bf83665 100755 (executable)
@@ -52,12 +52,6 @@ public class ResidueColourScheme implements ColourSchemeI
    /** DOCUMENT ME!! */\r
    int inc = 30;\r
 \r
-   /**\r
-    * The colour to be calculated, manipulated and returned\r
-    */\r
-   Color currentColour = null;\r
-\r
-\r
 \r
     /**\r
      * Creates a new ResidueColourScheme object.\r
@@ -90,7 +84,7 @@ public class ResidueColourScheme implements ColourSchemeI
 \r
    public Color findColour(String s, int j)\r
    {\r
-\r
+       Color currentColour;\r
        int index = ResidueProperties.aaIndex[s.charAt(0)];\r
 \r
        if ((threshold == 0) || aboveThreshold(ResidueProperties.aa[index], j))\r
@@ -103,7 +97,7 @@ public class ResidueColourScheme implements ColourSchemeI
        }\r
 \r
        if(conservationColouring)\r
-         applyConservation(j);\r
+         applyConservation(currentColour, j);\r
 \r
 \r
        return currentColour;\r
@@ -227,7 +221,7 @@ public class ResidueColourScheme implements ColourSchemeI
     * @return DOCUMENT ME!\r
     */\r
 \r
-   void applyConservation(int i)\r
+   void applyConservation(Color currentColour, int i)\r
    {\r
 \r
      if ((conservation[i] != '*') && (conservation[i] != '+'))\r
index 1f9116c..c9f7fc8 100755 (executable)
@@ -99,10 +99,10 @@ public class ScoreColourScheme extends ResidueColourScheme
             return Color.white;\r
         }\r
 \r
-        currentColour = colors[ ResidueProperties.aaIndex[c] ];\r
+        Color currentColour = colors[ ResidueProperties.aaIndex[c] ];\r
 \r
         if(conservationColouring)\r
-         applyConservation(j);\r
+         applyConservation(currentColour, j);\r
 \r
         return currentColour;\r
     }\r
index 3349283..9d61279 100755 (executable)
@@ -188,6 +188,7 @@ public class UserColourScheme
 \r
   public Color findColour(String s, int j)\r
   {\r
+      Color currentColour;\r
       int index = ResidueProperties.aaIndex[s.charAt(0)];\r
 \r
       if ((threshold == 0) || aboveThreshold(ResidueProperties.aa[index], j))\r
@@ -203,7 +204,7 @@ public class UserColourScheme
       }\r
 \r
       if(conservationColouring)\r
-        applyConservation(j);\r
+        applyConservation(currentColour, j);\r
 \r
 \r
       return currentColour;\r