Conservation colour scheme is no more
[jalview.git] / src / jalview / schemes / ScoreColourScheme.java
index b69e536..c11e1ec 100755 (executable)
@@ -52,6 +52,26 @@ public class ScoreColourScheme extends ResidueColourScheme
         this.scores = scores;\r
         this.min = min;\r
         this.max = max;\r
+\r
+        // Make colours in constructor\r
+        // Why wasn't this done earlier?\r
+        int i, iSize=scores.length;\r
+        colors = new Color[scores.length];\r
+        for (i = 0; i < iSize; i++)\r
+        {\r
+          float red = (float) (scores[i] - (float) min) / (float) (max - min);\r
+\r
+          if (red > 1.0f)\r
+          {\r
+            red = 1.0f;\r
+          }\r
+\r
+          if (red < 0.0f)\r
+          {\r
+            red = 0.0f;\r
+          }\r
+          colors[i] = makeColour(red);\r
+        }\r
     }\r
 \r
     /**\r
@@ -72,19 +92,6 @@ public class ScoreColourScheme extends ResidueColourScheme
             }\r
         }\r
 \r
-        float red = (float) (scores[((Integer) ResidueProperties.aaHash.get(s)).intValue()] -\r
-            (float) min) / (float) (max - min);\r
-\r
-        if (red > 1.0f)\r
-        {\r
-            red = 1.0f;\r
-        }\r
-\r
-        if (red < 0.0f)\r
-        {\r
-            red = 0.0f;\r
-        }\r
-\r
         char c = s.charAt(0);\r
 \r
         if (jalview.util.Comparison.isGap((c)))\r
@@ -92,8 +99,12 @@ public class ScoreColourScheme extends ResidueColourScheme
             return Color.white;\r
         }\r
 \r
-        // This isn';t great - pool of colours in here?\r
-        return makeColour(red);\r
+        currentColour = colors[((Integer) ResidueProperties.aaHash.get(s)).intValue()];\r
+\r
+        if(conservationColouring)\r
+         applyConservation(j);\r
+\r
+        return currentColour;\r
     }\r
 \r
     /**\r