public class ResidueProperties\r
{\r
//Stores residue codes/names and colours and other things\r
- public static final Hashtable aaHash = new Hashtable(); // stores the number value of the aa\r
+ public static final int [] aaIndex; // aaHash version 2.1.1 and below\r
+ public static final int [] nucleotideIndex;\r
public static final Hashtable aa3Hash = new Hashtable();\r
public static final Hashtable aa2Triplet = new Hashtable();\r
- public static final Hashtable nucleotideHash = new Hashtable();\r
public static final Hashtable nucleotideName = new Hashtable();\r
\r
+\r
static\r
{\r
- aaHash.put("A", new Integer(0));\r
- aaHash.put("R", new Integer(1));\r
- aaHash.put("N", new Integer(2));\r
- aaHash.put("D", new Integer(3));\r
- aaHash.put("C", new Integer(4));\r
- aaHash.put("Q", new Integer(5));\r
- aaHash.put("E", new Integer(6));\r
- aaHash.put("G", new Integer(7));\r
- aaHash.put("H", new Integer(8));\r
- aaHash.put("I", new Integer(9));\r
- aaHash.put("L", new Integer(10));\r
- aaHash.put("K", new Integer(11));\r
- aaHash.put("M", new Integer(12));\r
- aaHash.put("F", new Integer(13));\r
- aaHash.put("P", new Integer(14));\r
- aaHash.put("S", new Integer(15));\r
- aaHash.put("T", new Integer(16));\r
- aaHash.put("W", new Integer(17));\r
- aaHash.put("Y", new Integer(18));\r
- aaHash.put("V", new Integer(19));\r
- aaHash.put("B", new Integer(20));\r
- aaHash.put("Z", new Integer(21));\r
- aaHash.put("X", new Integer(22));\r
- aaHash.put("U", new Integer(22));\r
- aaHash.put("a", new Integer(0));\r
- aaHash.put("r", new Integer(1));\r
- aaHash.put("n", new Integer(2));\r
- aaHash.put("d", new Integer(3));\r
- aaHash.put("c", new Integer(4));\r
- aaHash.put("q", new Integer(5));\r
- aaHash.put("e", new Integer(6));\r
- aaHash.put("g", new Integer(7));\r
- aaHash.put("h", new Integer(8));\r
- aaHash.put("i", new Integer(9));\r
- aaHash.put("l", new Integer(10));\r
- aaHash.put("k", new Integer(11));\r
- aaHash.put("m", new Integer(12));\r
- aaHash.put("f", new Integer(13));\r
- aaHash.put("p", new Integer(14));\r
- aaHash.put("s", new Integer(15));\r
- aaHash.put("t", new Integer(16));\r
- aaHash.put("w", new Integer(17));\r
- aaHash.put("y", new Integer(18));\r
- aaHash.put("v", new Integer(19));\r
- aaHash.put("b", new Integer(20));\r
- aaHash.put("z", new Integer(21));\r
- aaHash.put("x", new Integer(22));\r
- aaHash.put("u", new Integer(22));\r
- aaHash.put("-", new Integer(23));\r
- aaHash.put("*", new Integer(23));\r
- aaHash.put(".", new Integer(23));\r
- aaHash.put(" ", new Integer(23));\r
+ aaIndex = new int[132];\r
+ for(int i=0; i<132; i++)\r
+ aaIndex[i] = -1;\r
+\r
+ aaIndex['A'] = 0;\r
+ aaIndex['R'] = 1;\r
+ aaIndex['N'] = 2;\r
+ aaIndex['D'] = 3;\r
+ aaIndex['C'] = 4;\r
+ aaIndex['Q'] = 5;\r
+ aaIndex['E'] = 6;\r
+ aaIndex['G'] = 7;\r
+ aaIndex['H'] = 8;\r
+ aaIndex['I'] = 9;\r
+ aaIndex['L'] = 10;\r
+ aaIndex['K'] = 11;\r
+ aaIndex['M'] = 12;\r
+ aaIndex['F'] = 13;\r
+ aaIndex['P'] = 14;\r
+ aaIndex['S'] = 15;\r
+ aaIndex['T'] = 16;\r
+ aaIndex['W'] = 17;\r
+ aaIndex['Y'] = 18;\r
+ aaIndex['V'] = 19;\r
+ aaIndex['B'] = 20;\r
+ aaIndex['Z'] = 21;\r
+ aaIndex['X'] = 22;\r
+ aaIndex['U'] = 22;\r
+ aaIndex['a'] = 0;\r
+ aaIndex['r'] = 1;\r
+ aaIndex['n'] = 2;\r
+ aaIndex['d'] = 3;\r
+ aaIndex['c'] = 4;\r
+ aaIndex['q'] = 5;\r
+ aaIndex['e'] = 6;\r
+ aaIndex['g'] = 7;\r
+ aaIndex['h'] = 8;\r
+ aaIndex['i'] = 9;\r
+ aaIndex['l'] = 10;\r
+ aaIndex['k'] = 11;\r
+ aaIndex['m'] = 12;\r
+ aaIndex['f'] = 13;\r
+ aaIndex['p'] = 14;\r
+ aaIndex['s'] = 15;\r
+ aaIndex['t'] = 16;\r
+ aaIndex['w'] = 17;\r
+ aaIndex['y'] = 18;\r
+ aaIndex['v'] = 19;\r
+ aaIndex['b'] = 20;\r
+ aaIndex['z'] = 21;\r
+ aaIndex['x'] = 22;\r
+ aaIndex['u'] = 22;\r
+ aaIndex['-'] = 23;\r
+ aaIndex['*'] = 23;\r
+ aaIndex['.'] = 23;\r
+ aaIndex[' '] = 23;\r
}\r
\r
static\r
{\r
- nucleotideHash.put("A", new Integer(0));\r
- nucleotideHash.put("a", new Integer(0));\r
- nucleotideHash.put("C", new Integer(1));\r
- nucleotideHash.put("c", new Integer(1));\r
- nucleotideHash.put("G", new Integer(2));\r
- nucleotideHash.put("g", new Integer(2));\r
- nucleotideHash.put("T", new Integer(3));\r
- nucleotideHash.put("t", new Integer(3));\r
- nucleotideHash.put("U", new Integer(4));\r
- nucleotideHash.put("u", new Integer(4));\r
- nucleotideHash.put("I", new Integer(5));\r
- nucleotideHash.put("i", new Integer(5));\r
- nucleotideHash.put("X", new Integer(6));\r
- nucleotideHash.put("x", new Integer(6));\r
- nucleotideHash.put("R", new Integer(7));\r
- nucleotideHash.put("r", new Integer(7));\r
- nucleotideHash.put("Y", new Integer(8));\r
- nucleotideHash.put("y", new Integer(8));\r
- nucleotideHash.put("N", new Integer(9));\r
- nucleotideHash.put("n", new Integer(9));\r
+ nucleotideIndex = new int[132];\r
+ for (int i = 0; i < 132; i++)\r
+ nucleotideIndex[i] = -1;\r
+\r
+ nucleotideIndex['A'] = 0;\r
+ nucleotideIndex['a'] = 0;\r
+ nucleotideIndex['C'] = 1;\r
+ nucleotideIndex['c'] = 1;\r
+ nucleotideIndex['G'] = 2;\r
+ nucleotideIndex['g'] = 2;\r
+ nucleotideIndex['T'] = 3;\r
+ nucleotideIndex['t'] = 3;\r
+ nucleotideIndex['U'] = 4;\r
+ nucleotideIndex['u'] = 4;\r
+ nucleotideIndex['I'] = 5;\r
+ nucleotideIndex['i'] = 5;\r
+ nucleotideIndex['X'] = 6;\r
+ nucleotideIndex['x'] = 6;\r
+ nucleotideIndex['R'] = 7;\r
+ nucleotideIndex['r'] = 7;\r
+ nucleotideIndex['Y'] = 8;\r
+ nucleotideIndex['y'] = 8;\r
+ nucleotideIndex['N'] = 9;\r
+ nucleotideIndex['n'] = 9;\r
\r
\r
nucleotideName.put("A", "Adenine");\r
return hyd;\r
}\r
\r
- public static Hashtable getAAHash()\r
- {\r
- return aaHash;\r
- }\r
-\r
public static Hashtable getAA3Hash()\r
{\r
return aa3Hash;\r
\r
public static int getPAM250(String A1, String A2)\r
{\r
- Integer pog1 = (Integer) aaHash.get(A1);\r
- Integer pog2 = (Integer) aaHash.get(A2);\r
- int pog = ResidueProperties.PAM250[pog1.intValue()][pog2.intValue()];\r
+ int a = aaIndex[A1.charAt(0)];\r
+ int b = aaIndex[A2.charAt(0)];\r
+\r
+ int pog = ResidueProperties.PAM250[a][b];\r
\r
return pog;\r
}\r
\r
try\r
{\r
- Integer pog1 = (Integer) aaHash.get(A1);\r
- Integer pog2 = (Integer) aaHash.get(A2);\r
- pog = ResidueProperties.BLOSUM62[pog1.intValue()][pog2.intValue()];\r
+ int a = aaIndex[A1.charAt(0)];\r
+ int b = aaIndex[A2.charAt(0)];\r
+\r
+ pog = ResidueProperties.BLOSUM62[a][b];\r
}\r
catch (Exception e)\r
{\r