+ StringTokenizer st = new StringTokenizer(paramValue, ";");\r
+ StringTokenizer st2;\r
+ String token = null, colour, residues;\r
+ try\r
+ {\r
+ while (st.hasMoreElements())\r
+ {\r
+ token = st.nextToken().trim();\r
+ residues = token.substring(0, token.indexOf("="));\r
+ colour = token.substring(token.indexOf("=") + 1);\r
+\r
+ st2 = new StringTokenizer(residues, " ,");\r
+ while (st2.hasMoreTokens())\r
+ {\r
+ token = st2.nextToken();\r
+\r
+ if (ResidueProperties.aaIndex[token.charAt(0)] == -1)\r
+ {\r
+ continue;\r
+ }\r
+\r
+ int colIndex = ResidueProperties.aaIndex[token.charAt(0)];\r
+\r
+ if (token.equalsIgnoreCase("lowerCase"))\r
+ {\r
+ if (lowerCaseColours == null)\r
+ {\r
+ lowerCaseColours = new Color[23];\r
+ }\r
+ for (int i = 0; i < 23; i++)\r
+ {\r
+ if (lowerCaseColours[i] == null)\r
+ {\r
+ lowerCaseColours[i] = getColourFromString(colour);\r
+ }\r
+ }\r
+\r
+ continue;\r
+ }\r
+\r
+ if (token.equals(token.toLowerCase()))\r
+ {\r
+ if (lowerCaseColours == null)\r
+ {\r
+ lowerCaseColours = new Color[23];\r
+ }\r
+ lowerCaseColours[colIndex] = getColourFromString(colour);\r
+ }\r
+ else\r
+ {\r
+ colors[colIndex] = getColourFromString(colour);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ System.out.println("Error parsing userDefinedColours:\n"\r
+ + token + "\n" + ex);\r
+ }\r
+\r
+ }\r
+\r
+ public Color findColour(char c, int j)\r
+ {\r
+ Color currentColour;\r
+ int index = ResidueProperties.aaIndex[c];\r
+\r
+ if ( (threshold == 0) || aboveThreshold(c, j))\r
+ {\r
+ if (lowerCaseColours != null && 'a' <= c && c <= 'z')\r
+ {\r
+ currentColour = lowerCaseColours[index];\r
+ }\r
+ else\r
+ {\r
+ currentColour = colors[index];\r
+ }\r
+ }\r
+ else\r
+ {\r
+ currentColour = Color.white;\r
+ }\r
+\r
+ if (conservationColouring)\r
+ {\r
+ currentColour = applyConservation(currentColour, j);\r
+ }\r
+\r
+ return currentColour;\r