/*\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) 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
import java.awt.*;\r
\r
+import jalview.analysis.*;\r
import jalview.datamodel.*;\r
\r
public class PIDColourScheme\r
this.thresholds = ResidueProperties.pidThresholds;\r
}\r
\r
- public Color findColour(String s, int j)\r
+ public Color findColour(char c, int j)\r
{\r
- char res = s.charAt(0);\r
- if ('a' <= res && res <= 'z')\r
+ if ('a' <= c && c <= 'z')\r
{\r
- s = String.valueOf(res -= ('a' - 'A'));\r
+ c -= ('a' - 'A');\r
}\r
\r
+ if (consensus == null\r
+ || j >= consensus.length\r
+ || consensus[j] == null)\r
+ {\r
+ return Color.white;\r
+ }\r
\r
- if ( (threshold != 0) && !aboveThreshold(s, j))\r
+ if ( (threshold != 0) && !aboveThreshold(c, j))\r
{\r
return Color.white;\r
}\r
\r
- currentColour = Color.white;\r
+ Color currentColour = Color.white;\r
\r
double sc = 0;\r
\r
- if ( (Integer.parseInt(consensus[j].get("maxCount").toString()) != -1) &&\r
- consensus[j].contains(s))\r
+ if (consensus.length <= j)\r
{\r
- sc = ((Float)consensus[j].get(ignoreGaps)).floatValue();\r
+ return Color.white;\r
+ }\r
\r
- if (!jalview.util.Comparison.isGap( res ))\r
+ if ( (Integer.parseInt(consensus[j].get(AAFrequency.MAXCOUNT).toString()) !=\r
+ -1) &&\r
+ consensus[j].contains(String.valueOf(c)))\r
+ {\r
+ sc = ( (Float) consensus[j].get(ignoreGaps)).floatValue();\r
+\r
+ if (!jalview.util.Comparison.isGap(c))\r
{\r
for (int i = 0; i < thresholds.length; i++)\r
{\r
}\r
}\r
\r
- if(conservationColouring)\r
- applyConservation(j);\r
+ if (conservationColouring)\r
+ {\r
+ currentColour = applyConservation(currentColour, j);\r
+ }\r
\r
return currentColour;\r
}\r