CurrentColour must not be accessed by multiple sequence renderers
[jalview.git] / src / jalview / schemes / Blosum62ColourScheme.java
index 2c0836d..d3b93bf 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
  *\r
  * This program is free software; you can redistribute it and/or\r
  * modify it under the terms of the GNU General Public License\r
@@ -20,6 +20,7 @@ package jalview.schemes;
 \r
 \r
 import java.awt.*;\r
+import jalview.analysis.AAFrequency;\r
 \r
 public class Blosum62ColourScheme\r
     extends ResidueColourScheme\r
@@ -31,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
@@ -38,15 +40,19 @@ public class Blosum62ColourScheme
        s = String.valueOf( res -= ('a' - 'A') );\r
     }\r
 \r
-\r
-    if ( j>=consensus.length || (threshold != 0 && !aboveThreshold(s, j) ))\r
+    if (consensus == null ||\r
+        j >= consensus.length ||\r
+        consensus[j] == null ||\r
+        (threshold != 0 && !aboveThreshold(s, j)))\r
     {\r
       return Color.white;\r
     }\r
 \r
+    Color currentColour;\r
+\r
     if (!jalview.util.Comparison.isGap( res ))\r
     {\r
-      String max = (String) consensus[j].get("maxResidue");\r
+      String max = (String) consensus[j].get(AAFrequency.MAXRESIDUE);\r
 \r
       if (max.indexOf(s) > -1)\r
       {\r
@@ -76,7 +82,7 @@ public class Blosum62ColourScheme
       }\r
 \r
       if(conservationColouring)\r
-         applyConservation(j);\r
+         applyConservation(currentColour, j);\r
     }\r
     else\r
     {\r