/*\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
int threshold = 0;\r
\r
/* Set when threshold colouring to either pid_gaps or pid_nogaps*/\r
- protected String ignoreGaps = "pid_gaps";\r
+ protected String ignoreGaps = AAFrequency.PID_GAPS;\r
\r
/** Consenus as a hashtable array */\r
Hashtable [] consensus;\r
*/\r
public Color findColour(String aa)\r
{\r
- return colors[((Integer) (ResidueProperties.aaHash.get(aa))).intValue()];\r
+ return colors[ResidueProperties.aaIndex[aa.charAt(0)]];\r
}\r
\r
\r
public Color findColour(String s, int j)\r
{\r
\r
- int index = ((Integer) (ResidueProperties.aaHash.get(s))).intValue();\r
+ int index = ResidueProperties.aaIndex[s.charAt(0)];\r
\r
if ((threshold == 0) || aboveThreshold(ResidueProperties.aa[index], j))\r
{\r
{\r
threshold = ct;\r
if(ignoreGaps)\r
- this.ignoreGaps = "pid_nogaps";\r
+ this.ignoreGaps = AAFrequency.PID_NOGAPS;\r
else\r
- this.ignoreGaps = "pid_gaps";\r
+ this.ignoreGaps = AAFrequency.PID_GAPS;\r
}\r
\r
/**\r
*/\r
public boolean aboveThreshold(String s, int j)\r
{\r
- if ((((Integer) consensus[j].get("maxCount")).intValue() != -1) &&\r
- consensus[j].contains(s))\r
+ char c = s.charAt(0);\r
+ if ('a' <= c && c <= 'z')\r
{\r
- if (((Float)consensus[j].get(ignoreGaps)).floatValue() >= threshold)\r
- {\r
- return true;\r
- }\r
+ // TO UPPERCASE !!!\r
+ //Faster than toUpperCase\r
+ c -= ('a' - 'A');\r
+ s = String.valueOf(c);\r
+ }\r
+\r
+ if (consensus == null || consensus[j] == null)\r
+ return false;\r
+\r
+ if ( ( ( (Integer) consensus[j].get(AAFrequency.MAXCOUNT)).intValue() != -1) &&\r
+ consensus[j].contains(s))\r
+ {\r
+ if ( ( (Float) consensus[j].get(ignoreGaps)).floatValue() >= threshold)\r
+ {\r
+ return true;\r
+ }\r
}\r
\r
return false;\r
*\r
* @param consensus DOCUMENT ME!\r
*/\r
- public void setConsensus(Vector vconsensus)\r
+ public void setConsensus(Hashtable [] consensus)\r
{\r
- if(vconsensus==null)\r
+ if(consensus==null)\r
return;\r
\r
- int i, iSize=vconsensus.size();\r
- consensus = new Hashtable[iSize];\r
- for(i=0; i<iSize; i++)\r
- consensus[i] = (Hashtable)vconsensus.elementAt(i);\r
+ this.consensus = consensus;\r
}\r
\r
\r
+\r
public void setConservation(Conservation cons)\r
{\r
if(cons==null)\r