/*\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
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
}\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
return Color.white;\r
}\r
\r
- // This isn';t great - pool of colours in here?\r
- return makeColour(red);\r
+ currentColour = colors[ ResidueProperties.aaIndex[s.charAt(0)] ];\r
+\r
+ if(conservationColouring)\r
+ applyConservation(j);\r
+\r
+ return currentColour;\r
}\r
\r
/**\r