/*\r
* Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2007 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
*/\r
package jalview.schemes;\r
\r
-\r
import java.awt.*;\r
-import jalview.analysis.AAFrequency;\r
+\r
+import jalview.analysis.*;\r
\r
public class Blosum62ColourScheme\r
extends ResidueColourScheme\r
super();\r
}\r
\r
- public Color findColour(String s, int j)\r
+ public Color findColour(char res, int j)\r
{\r
- char res = s.charAt(0);\r
- if ('a' <= res && res <= 'z' )\r
+ if ('a' <= res && res <= 'z')\r
{\r
- // TO UPPERCASE !!!\r
- s = String.valueOf( res -= ('a' - 'A') );\r
+ // TO UPPERCASE !!!\r
+ res -= ('a' - 'A');\r
}\r
\r
if (consensus == null ||\r
j >= consensus.length ||\r
consensus[j] == null ||\r
- (threshold != 0 && !aboveThreshold(s, j)))\r
+ (threshold != 0 && !aboveThreshold(res, j)))\r
{\r
return Color.white;\r
}\r
\r
- if (!jalview.util.Comparison.isGap( res ))\r
+ Color currentColour;\r
+\r
+ if (!jalview.util.Comparison.isGap(res))\r
{\r
String max = (String) consensus[j].get(AAFrequency.MAXRESIDUE);\r
\r
- if (max.indexOf(s) > -1)\r
+ if (max.indexOf(res) > -1)\r
{\r
currentColour = new Color(154, 154, 255);\r
}\r
\r
do\r
{\r
- c += ResidueProperties.getBLOSUM62(max.substring(max_aa,\r
- max_aa + 1), s);\r
+ c += ResidueProperties.getBLOSUM62(\r
+ max.charAt(max_aa), res);\r
}\r
while (++max_aa < n);\r
\r
}\r
}\r
\r
- if(conservationColouring)\r
- applyConservation(j);\r
+ if (conservationColouring)\r
+ {\r
+ currentColour = applyConservation(currentColour, j);\r
+ }\r
}\r
else\r
{\r