2 * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
3 * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 package jalview.schemes;
25 public class ResidueProperties
27 public static Hashtable scoreMatrices = new Hashtable();
29 // Stores residue codes/names and colours and other things
30 public static final int[] aaIndex; // aaHash version 2.1.1 and below
32 public static final int[] nucleotideIndex;
34 public static final Hashtable aa3Hash = new Hashtable();
36 public static final Hashtable aa2Triplet = new Hashtable();
38 public static final Hashtable nucleotideName = new Hashtable();
42 aaIndex = new int[255];
43 for (int i = 0; i < 255; i++)
95 aaIndex['u'] = 22; // TODO: selenocystine triplet and codons needed. also
96 // extend subt. matrices
101 nucleotideIndex = new int[255];
102 for (int i = 0; i < 255; i++)
104 nucleotideIndex[i] = -1;
107 nucleotideIndex['A'] = 0;
108 nucleotideIndex['a'] = 0;
109 nucleotideIndex['C'] = 1;
110 nucleotideIndex['c'] = 1;
111 nucleotideIndex['G'] = 2;
112 nucleotideIndex['g'] = 2;
113 nucleotideIndex['T'] = 3;
114 nucleotideIndex['t'] = 3;
115 nucleotideIndex['U'] = 4;
116 nucleotideIndex['u'] = 4;
117 nucleotideIndex['I'] = 5;
118 nucleotideIndex['i'] = 5;
119 nucleotideIndex['X'] = 6;
120 nucleotideIndex['x'] = 6;
121 nucleotideIndex['R'] = 7;
122 nucleotideIndex['r'] = 7;
123 nucleotideIndex['Y'] = 8;
124 nucleotideIndex['y'] = 8;
125 nucleotideIndex['N'] = 9;
126 nucleotideIndex['n'] = 9;
128 nucleotideName.put("A", "Adenine");
129 nucleotideName.put("a", "Adenine");
130 nucleotideName.put("G", "Guanine");
131 nucleotideName.put("g", "Guanine");
132 nucleotideName.put("C", "Cytosine");
133 nucleotideName.put("c", "Cytosine");
134 nucleotideName.put("T", "Thymine");
135 nucleotideName.put("t", "Thymine");
136 nucleotideName.put("U", "Uracil");
137 nucleotideName.put("u", "Uracil");
138 nucleotideName.put("I", "Inosine");
139 nucleotideName.put("i", "Inosine");
140 nucleotideName.put("X", "Xanthine");
141 nucleotideName.put("x", "Xanthine");
142 nucleotideName.put("R", "Unknown Purine");
143 nucleotideName.put("r", "Unknown Purine");
144 nucleotideName.put("Y", "Unknown Pyrimidine");
145 nucleotideName.put("y", "Unknown Pyrimidine");
146 nucleotideName.put("N", "Unknown");
147 nucleotideName.put("n", "Unknown");
152 aa3Hash.put("ALA", new Integer(0));
153 aa3Hash.put("ARG", new Integer(1));
154 aa3Hash.put("ASN", new Integer(2));
155 aa3Hash.put("ASP", new Integer(3)); // D
156 aa3Hash.put("CYS", new Integer(4));
157 aa3Hash.put("GLN", new Integer(5)); // Q
158 aa3Hash.put("GLU", new Integer(6)); // E
159 aa3Hash.put("GLY", new Integer(7));
160 aa3Hash.put("HIS", new Integer(8));
161 aa3Hash.put("ILE", new Integer(9));
162 aa3Hash.put("LEU", new Integer(10));
163 aa3Hash.put("LYS", new Integer(11));
164 aa3Hash.put("MET", new Integer(12));
165 aa3Hash.put("PHE", new Integer(13));
166 aa3Hash.put("PRO", new Integer(14));
167 aa3Hash.put("SER", new Integer(15));
168 aa3Hash.put("THR", new Integer(16));
169 aa3Hash.put("TRP", new Integer(17));
170 aa3Hash.put("TYR", new Integer(18));
171 aa3Hash.put("VAL", new Integer(19));
172 // IUB Nomenclature for ambiguous peptides
173 aa3Hash.put("ASX", new Integer(20)); // "B";
174 aa3Hash.put("GLX", new Integer(21)); // X
175 aa3Hash.put("XAA", new Integer(22)); // X unknown
176 aa3Hash.put("-", new Integer(23));
177 aa3Hash.put("*", new Integer(23));
178 aa3Hash.put(".", new Integer(23));
179 aa3Hash.put(" ", new Integer(23));
180 aa3Hash.put("Gap", new Integer(23));
185 aa2Triplet.put("A", "ALA");
186 aa2Triplet.put("a", "ALA");
187 aa2Triplet.put("R", "ARG");
188 aa2Triplet.put("r", "ARG");
189 aa2Triplet.put("N", "ASN");
190 aa2Triplet.put("n", "ASN");
191 aa2Triplet.put("D", "ASP");
192 aa2Triplet.put("d", "ASP");
193 aa2Triplet.put("C", "CYS");
194 aa2Triplet.put("c", "CYS");
195 aa2Triplet.put("Q", "GLN");
196 aa2Triplet.put("q", "GLN");
197 aa2Triplet.put("E", "GLU");
198 aa2Triplet.put("e", "GLU");
199 aa2Triplet.put("G", "GLY");
200 aa2Triplet.put("g", "GLY");
201 aa2Triplet.put("H", "HIS");
202 aa2Triplet.put("h", "HIS");
203 aa2Triplet.put("I", "ILE");
204 aa2Triplet.put("i", "ILE");
205 aa2Triplet.put("L", "LEU");
206 aa2Triplet.put("l", "LEU");
207 aa2Triplet.put("K", "LYS");
208 aa2Triplet.put("k", "LYS");
209 aa2Triplet.put("M", "MET");
210 aa2Triplet.put("m", "MET");
211 aa2Triplet.put("F", "PHE");
212 aa2Triplet.put("f", "PHE");
213 aa2Triplet.put("P", "PRO");
214 aa2Triplet.put("p", "PRO");
215 aa2Triplet.put("S", "SER");
216 aa2Triplet.put("s", "SER");
217 aa2Triplet.put("T", "THR");
218 aa2Triplet.put("t", "THR");
219 aa2Triplet.put("W", "TRP");
220 aa2Triplet.put("w", "TRP");
221 aa2Triplet.put("Y", "TYR");
222 aa2Triplet.put("y", "TYR");
223 aa2Triplet.put("V", "VAL");
224 aa2Triplet.put("v", "VAL");
227 public static final String[] aa =
228 { "A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F",
229 "P", "S", "T", "W", "Y", "V", "B", "Z", "X", "_", "*", ".", " " };
231 public static final Color midBlue = new Color(100, 100, 255);
233 public static final Vector scaleColours = new Vector();
237 scaleColours.addElement(new Color(114, 0, 147));
238 scaleColours.addElement(new Color(156, 0, 98));
239 scaleColours.addElement(new Color(190, 0, 0));
240 scaleColours.addElement(Color.red);
241 scaleColours.addElement(new Color(255, 125, 0));
242 scaleColours.addElement(Color.orange);
243 scaleColours.addElement(new Color(255, 194, 85));
244 scaleColours.addElement(Color.yellow);
245 scaleColours.addElement(new Color(255, 255, 181));
246 scaleColours.addElement(Color.white);
249 public static final Color[] taylor =
250 { new Color(204, 255, 0), // A Greenish-yellowy-yellow
251 new Color(0, 0, 255), // R Blueish-bluey-blue
252 new Color(204, 0, 255), // N Blueish-reddy-blue
253 new Color(255, 0, 0), // D Reddish-reddy-red
254 new Color(255, 255, 0), // C Yellowish-yellowy-yellow
255 new Color(255, 0, 204), // Q Reddish-bluey-red
256 new Color(255, 0, 102), // E Blueish-reddy-red
257 new Color(255, 153, 0), // G Yellowy-reddy-yellow
258 new Color(0, 102, 255), // H Greenish-bluey-blue
259 new Color(102, 255, 0), // I Greenish-yellowy-green
260 new Color(51, 255, 0), // L Yellowish-greeny-green
261 new Color(102, 0, 255), // K Reddish-bluey-blue
262 new Color(0, 255, 0), // M Greenish-greeny-green
263 new Color(0, 255, 102), // F Blueish-greeny-green
264 new Color(255, 204, 0), // P Reddish-yellowy-yellow
265 new Color(255, 51, 0), // S Yellowish-reddy-red
266 new Color(255, 102, 0), // T Reddish-yellowy-red
267 new Color(0, 204, 255), // W Blueish-greeny-green
268 new Color(0, 255, 204), // Y Greenish-bluey-green
269 new Color(153, 255, 0), // V Yellowish-greeny-yellow
278 public static final Color[] nucleotide =
279 { new Color(100, 247, 63), // A
280 new Color(255, 179, 64), // C
281 new Color(235, 65, 60), // G
282 new Color(60, 136, 238), // T
283 new Color(60, 136, 238) // U
287 public static final Color[] zappo =
296 midBlue,// Color.red, // H
317 // Dunno where I got these numbers from
318 public static final double[] hyd2 =
344 public static final double[] helix =
345 { 1.42, 0.98, 0.67, 1.01, 0.70, 1.11, 1.51, 0.57, 1.00, 1.08, 1.21, 1.16,
346 1.45, 1.13, 0.57, 0.77, 0.83, 1.08, 0.69, 1.06, 0.84, 1.31, 1.00, 0.0 };
348 public static final double helixmin = 0.57;
350 public static final double helixmax = 1.51;
352 public static final double[] strand =
353 { 0.83, 0.93, 0.89, 0.54, 1.19, 1.10, 0.37, 0.75, 0.87, 1.60, 1.30, 0.74,
354 1.05, 1.38, 0.55, 0.75, 1.19, 1.37, 1.47, 1.70, 0.72, 0.74, 1.0, 0.0 };
356 public static final double strandmin = 0.37;
358 public static final double strandmax = 1.7;
360 public static final double[] turn =
361 { 0.66, 0.95, 1.56, 1.46, 1.19, 0.98, 0.74, 1.56, 0.95, 0.47, 0.59, 1.01,
362 0.60, 0.60, 1.52, 1.43, 0.96, 0.96, 1.14, 0.50, 1.51, 0.86, 1.00, 0,
365 public static final double turnmin = 0.47;
367 public static final double turnmax = 1.56;
369 public static final double[] buried =
370 { 1.7, 0.1, 0.4, 0.4, 4.6, 0.3, 0.3, 1.8, 0.8, 3.1, 2.4, 0.05, 1.9, 2.2,
371 0.6, 0.8, 0.7, 1.6, 0.5, 2.9, 0.4, 0.3, 1.358, 0.00 };
373 public static final double buriedmin = 0.05;
375 public static final double buriedmax = 4.6;
377 // This is hydropathy index
378 // Kyte, J., and Doolittle, R.F., J. Mol. Biol.
379 // 1157, 105-132, 1982
380 public static final double[] hyd =
381 { 1.8, -4.5, -3.5, -3.5, 2.5, -3.5, -3.5, -0.4, -3.2, 4.5, 3.8, -3.9,
382 1.9, 2.8, -1.6, -0.8, -0.7, -0.9, -1.3, 4.2, -3.5, -3.5, -0.49, 0.0 };
384 public static final double hydmax = 4.5;
386 public static final double hydmin = -3.9;
388 // public static final double hydmax = 1.38;
389 // public static final double hydmin = -2.53;
390 private static final int[][] BLOSUM62 =
392 { 4, -1, -2, -2, 0, -1, -1, 0, -2, -1, -1, -1, -1, -2, -1, 1, 0, -3,
393 -2, 0, -2, -1, 0, -4 },
394 { -1, 5, 0, -2, -3, 1, 0, -2, 0, -3, -2, 2, -1, -3, -2, -1, -1, -3,
395 -2, -3, -1, 0, -1, -4 },
396 { -2, 0, 6, 1, -3, 0, 0, 0, 1, -3, -3, 0, -2, -3, -2, 1, 0, -4, -2,
398 { -2, -2, 1, 6, -3, 0, 2, -1, -1, -3, -4, -1, -3, -3, -1, 0, -1, -4,
399 -3, -3, 4, 1, -1, -4 },
400 { 0, 3, -3, -3, 9, -3, -4, -3, -3, -1, -1, -3, -1, -2, -3, -1, -1,
401 -2, -2, -1, -3, -3, -2, -4 },
402 { -1, 1, 0, 0, -3, 5, 2, -2, 0, -3, -2, 1, 0, -3, -1, 0, -1, -2, -1,
404 { -1, 0, 0, 2, -4, 2, 5, -2, 0, -3, -3, 1, -2, -3, -1, 0, -1, -3, -2,
406 { 0, -2, 0, -1, -3, -2, -2, 6, -2, -4, -4, -2, -3, -3, -2, 0, -2, -2,
407 -3, -3, -1, -2, -1, -4 },
408 { -2, 0, 1, -1, -3, 0, 0, -2, 8, -3, -3, -1, -2, -1, -2, -1, -2, -2,
409 2, -3, 0, 0, -1, -4 },
410 { -1, -3, -3, -3, -1, -3, -3, -4, -3, 4, 2, -3, 1, 0, -3, -2, -1, -3,
411 -1, 3, -3, -3, -1, -4 },
412 { -1, -2, -3, -4, -1, -2, -3, -4, -3, 2, 4, -2, 2, 0, -3, -2, -1, -2,
413 -1, 1, -4, -3, -1, -4 },
414 { -1, 2, 0, -1, -3, 1, 1, -2, -1, -3, -2, 5, -1, -3, -1, 0, -1, -3,
415 -2, -2, 0, 1, -1, -4 },
416 { -1, -1, -2, -3, -1, 0, -2, -3, -2, 1, 2, -1, 5, 0, -2, -1, -1, -1,
417 -1, 1, -3, -1, -1, -4 },
418 { -2, -3, -3, -3, -2, -3, -3, -3, -1, 0, 0, -3, 0, 6, -4, -2, -2, 1,
419 3, -1, -3, -3, -1, -4 },
420 { -1, -2, -2, -1, -3, -1, -1, -2, -2, -3, -3, -1, -2, -4, 7, -1, -1,
421 -4, -3, -2, -2, -1, -2, -4 },
422 { 1, -1, 1, 0, -1, 0, 0, 0, -1, -2, -2, 0, -1, -2, -1, 4, 1, -3, -2,
424 { 0, -1, 0, -1, -1, -1, -1, -2, -2, -1, -1, -1, -1, -2, -1, 1, 5, -2,
425 -2, 0, -1, -1, 0, -4 },
426 { -3, -3, -4, -4, -2, -2, -3, -2, -2, -3, -2, -3, -1, 1, -4, -3, -2,
427 11, 2, -3, -4, -3, -2, -4 },
428 { -2, -2, -2, -3, -2, -1, -2, -3, 2, -1, -1, -2, -1, 3, -3, -2, -2,
429 2, 7, -1, -3, -2, -1, -4 },
430 { 0, -3, -3, -3, -1, -2, -2, -3, -3, 3, 1, -2, 1, -1, -2, -2, 0, -3,
431 -1, 4, -3, -2, -1, -4 },
432 { -2, -1, 3, 4, -3, 0, 1, -1, 0, -3, -4, 0, -3, -3, -2, 0, -1, -4,
433 -3, -3, 4, 1, -1, -4 },
434 { -1, 0, 0, 1, -3, 3, 4, -2, 0, -3, -3, 1, -1, -3, -1, 0, -1, -3, -2,
436 { 0, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, 0, 0,
437 -2, -1, -1, -1, -1, -1, -4 },
438 { -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
439 -4, -4, -4, -4, -4, -4, 1 }, };
441 static final int[][] PAM250 =
443 { 2, -2, 0, 0, -2, 0, 0, 1, -1, -1, -2, -1, -1, -3, 1, 1, 1, -6, -3,
445 { -2, 6, 0, -1, -4, 1, -1, -3, 2, -2, -3, 3, 0, -4, 0, 0, -1, 2, -4,
447 { 0, 0, 2, 2, -4, 1, 1, 0, 2, -2, -3, 1, -2, -3, 0, 1, 0, -4, -2, -2,
449 { 0, -1, 2, 4, -5, 2, 3, 1, 1, -2, -4, 0, -3, -6, -1, 0, 0, -7, -4,
451 { -2, -4, -4, -5, 12, -5, -5, -3, -3, -2, -6, -5, -5, -4, -3, 0, -2,
452 -8, 0, -2, -4, -5, -3, -8 },
453 { 0, 1, 1, 2, -5, 4, 2, -1, 3, -2, -2, 1, -1, -5, 0, -1, -1, -5, -4,
455 { 0, -1, 1, 3, -5, 2, 4, 0, 1, -2, -3, 0, -2, -5, -1, 0, 0, -7, -4,
457 { 1, -3, 0, 1, -3, -1, 0, 5, -2, -3, -4, -2, -3, -5, 0, 1, 0, -7, -5,
459 { -1, 2, 2, 1, -3, 3, 1, -2, 6, -2, -2, 0, -2, -2, 0, -1, -1, -3, 0,
461 { -1, -2, -2, -2, -2, -2, -2, -3, -2, 5, 2, -2, 2, 1, -2, -1, 0, -5,
462 -1, 4, -2, -2, -1, -8 },
463 { -2, -3, -3, -4, -6, -2, -3, -4, -2, 2, 6, -3, 4, 2, -3, -3, -2, -2,
464 -1, 2, -3, -3, -1, -8 },
465 { -1, 3, 1, 0, -5, 1, 0, -2, 0, -2, -3, 5, 0, -5, -1, 0, 0, -3, -4,
467 { -1, 0, -2, -3, -5, -1, -2, -3, -2, 2, 4, 0, 6, 0, -2, -2, -1, -4,
468 -2, 2, -2, -2, -1, -8 },
469 { -3, -4, -3, -6, -4, -5, -5, -5, -2, 1, 2, -5, 0, 9, -5, -3, -3, 0,
470 7, -1, -4, -5, -2, -8 },
471 { 1, 0, 0, -1, -3, 0, -1, 0, 0, -2, -3, -1, -2, -5, 6, 1, 0, -6, -5,
473 { 1, 0, 1, 0, 0, -1, 0, 1, -1, -1, -3, 0, -2, -3, 1, 2, 1, -2, -3,
475 { 1, -1, 0, 0, -2, -1, 0, 0, -1, 0, -2, 0, -1, -3, 0, 1, 3, -5, -3,
477 { -6, 2, -4, -7, -8, -5, -7, -7, -3, -5, -2, -3, -4, 0, -6, -2, -5,
478 17, 0, -6, -5, -6, -4, -8 },
479 { -3, -4, -2, -4, 0, -4, -4, -5, 0, -1, -1, -4, -2, 7, -5, -3, -3, 0,
480 10, -2, -3, -4, -2, -8 },
481 { 0, -2, -2, -2, -2, -2, -2, -1, -2, 4, 2, -2, 2, -1, -1, -1, 0, -6,
482 -2, 4, -2, -2, -1, -8 },
483 { 0, -1, 2, 3, -4, 1, 3, 0, 1, -2, -3, 1, -2, -4, -1, 0, 0, -5, -3,
485 { 0, 0, 1, 3, -5, 3, 3, 0, 2, -2, -3, 0, -2, -5, 0, 0, -1, -6, -4,
487 { 0, -1, 0, -1, -3, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, 0, 0, -4,
488 -2, -1, -1, -1, -1, -8 },
489 { -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
490 -8, -8, -8, -8, -8, -8, 1 }, };
492 public static final Hashtable ssHash = new Hashtable(); // stores the number
497 ssHash.put("H", Color.magenta);
498 ssHash.put("E", Color.yellow);
499 ssHash.put("-", Color.white);
500 ssHash.put(".", Color.white);
501 ssHash.put("S", Color.cyan);
502 ssHash.put("T", Color.blue);
503 ssHash.put("G", Color.pink);
504 ssHash.put("I", Color.pink);
505 ssHash.put("B", Color.yellow);
508 static final int[][] DNA =
510 { 5, -4, -4, -4, 1 }, // C
511 { -4, 5, -4, -4, 1 }, // T
512 { -4, -4, 5, -4, 1 }, // A
513 { -4, -4, -4, 5, 1 }, // G
514 { 1, 1, 1, 1, 1 }, // -
517 * register matrices in list
521 scoreMatrices.put("BLOSUM62", new ScoreMatrix("BLOSUM62", BLOSUM62, 0));
522 scoreMatrices.put("PAM250", new ScoreMatrix("PAM250", PAM250, 0));
523 scoreMatrices.put("DNA", new ScoreMatrix("DNA", DNA, 1));
526 public static final Color[] pidColours =
527 { midBlue, new Color(153, 153, 255),
529 new Color(204, 204, 255), };
531 public static final float[] pidThresholds =
534 public static Hashtable codonHash = new Hashtable();
536 public static Vector Lys = new Vector();
538 public static Vector Asn = new Vector();
540 public static Vector Gln = new Vector();
542 public static Vector His = new Vector();
544 public static Vector Glu = new Vector();
546 public static Vector Asp = new Vector();
548 public static Vector Tyr = new Vector();
550 public static Vector Thr = new Vector();
552 public static Vector Pro = new Vector();
554 public static Vector Ala = new Vector();
556 public static Vector Ser = new Vector();
558 public static Vector Arg = new Vector();
560 public static Vector Gly = new Vector();
562 public static Vector Trp = new Vector();
564 public static Vector Cys = new Vector();
566 public static Vector Ile = new Vector();
568 public static Vector Met = new Vector();
570 public static Vector Leu = new Vector();
572 public static Vector Val = new Vector();
574 public static Vector Phe = new Vector();
576 public static Vector STOP = new Vector();
580 codonHash.put("K", Lys);
581 codonHash.put("N", Asn);
582 codonHash.put("Q", Gln);
583 codonHash.put("H", His);
584 codonHash.put("E", Glu);
585 codonHash.put("D", Asp);
586 codonHash.put("Y", Tyr);
587 codonHash.put("T", Thr);
588 codonHash.put("P", Pro);
589 codonHash.put("A", Ala);
590 codonHash.put("S", Ser);
591 codonHash.put("R", Arg);
592 codonHash.put("G", Gly);
593 codonHash.put("W", Trp);
594 codonHash.put("C", Cys);
595 codonHash.put("I", Ile);
596 codonHash.put("M", Met);
597 codonHash.put("L", Leu);
598 codonHash.put("V", Val);
599 codonHash.put("F", Phe);
600 codonHash.put("STOP", STOP);
603 public static Hashtable codonHash2 = new Hashtable();
607 codonHash2.put("AAA", "K");
608 codonHash2.put("AAG", "K");
609 codonHash2.put("AAC", "N");
610 codonHash2.put("AAT", "N");
612 codonHash2.put("CAA", "E");
613 codonHash2.put("CAG", "E");
614 codonHash2.put("CAC", "H");
615 codonHash2.put("CAT", "H");
617 codonHash2.put("GAA", "Q");
618 codonHash2.put("GAG", "Q");
619 codonHash2.put("GAC", "D");
620 codonHash2.put("GAT", "D");
622 codonHash2.put("TAC", "Y");
623 codonHash2.put("TAT", "Y");
625 codonHash2.put("ACA", "T");
626 codonHash2.put("AAG", "T");
627 codonHash2.put("ACC", "T");
628 codonHash2.put("ACT", "T");
630 codonHash2.put("CCA", "P");
631 codonHash2.put("CCG", "P");
632 codonHash2.put("CCC", "P");
633 codonHash2.put("CCT", "P");
635 codonHash2.put("GCA", "A");
636 codonHash2.put("GCG", "A");
637 codonHash2.put("GCC", "A");
638 codonHash2.put("GCT", "A");
640 codonHash2.put("TCA", "S");
641 codonHash2.put("TCG", "S");
642 codonHash2.put("TCC", "S");
643 codonHash2.put("TCT", "S");
644 codonHash2.put("AGC", "S");
645 codonHash2.put("AGT", "S");
647 codonHash2.put("AGA", "R");
648 codonHash2.put("AGG", "R");
649 codonHash2.put("CGA", "R");
650 codonHash2.put("CGG", "R");
651 codonHash2.put("CGC", "R");
652 codonHash2.put("CGT", "R");
654 codonHash2.put("GGA", "G");
655 codonHash2.put("GGG", "G");
656 codonHash2.put("GGC", "G");
657 codonHash2.put("GGT", "G");
659 codonHash2.put("TGA", "*");
660 codonHash2.put("TAA", "*");
661 codonHash2.put("TAG", "*");
663 codonHash2.put("TGG", "W");
665 codonHash2.put("TGC", "C");
666 codonHash2.put("TGT", "C");
668 codonHash2.put("ATA", "I");
669 codonHash2.put("ATC", "I");
670 codonHash2.put("ATT", "I");
672 codonHash2.put("ATG", "M");
674 codonHash2.put("CTA", "L");
675 codonHash2.put("CTG", "L");
676 codonHash2.put("CTC", "L");
677 codonHash2.put("CTT", "L");
678 codonHash2.put("TTA", "L");
679 codonHash2.put("TTG", "L");
681 codonHash2.put("GTA", "V");
682 codonHash2.put("GTG", "V");
683 codonHash2.put("GTC", "V");
684 codonHash2.put("GTT", "V");
686 codonHash2.put("TTC", "F");
687 codonHash2.put("TTT", "F");
692 Lys.addElement("AAA");
693 Lys.addElement("AAG");
694 Asn.addElement("AAC");
695 Asn.addElement("AAT");
697 Gln.addElement("CAA");
698 Gln.addElement("CAG");
699 His.addElement("CAC");
700 His.addElement("CAT");
702 Glu.addElement("GAA");
703 Glu.addElement("GAG");
704 Asp.addElement("GAC");
705 Asp.addElement("GAT");
707 Tyr.addElement("TAC");
708 Tyr.addElement("TAT");
710 Thr.addElement("ACA");
711 Thr.addElement("ACG");
712 Thr.addElement("ACC");
713 Thr.addElement("ACT");
715 Pro.addElement("CCA");
716 Pro.addElement("CCG");
717 Pro.addElement("CCC");
718 Pro.addElement("CCT");
720 Ala.addElement("GCA");
721 Ala.addElement("GCG");
722 Ala.addElement("GCC");
723 Ala.addElement("GCT");
725 Ser.addElement("TCA");
726 Ser.addElement("TCG");
727 Ser.addElement("TCC");
728 Ser.addElement("TCT");
729 Ser.addElement("AGC");
730 Ser.addElement("AGT");
732 Arg.addElement("AGA");
733 Arg.addElement("AGG");
734 Arg.addElement("CGA");
735 Arg.addElement("CGG");
736 Arg.addElement("CGC");
737 Arg.addElement("CGT");
739 Gly.addElement("GGA");
740 Gly.addElement("GGG");
741 Gly.addElement("GGC");
742 Gly.addElement("GGT");
744 STOP.addElement("TGA");
745 STOP.addElement("TAA");
746 STOP.addElement("TAG");
748 Trp.addElement("TGG");
750 Cys.addElement("TGC");
751 Cys.addElement("TGT");
753 Ile.addElement("ATA");
754 Ile.addElement("ATC");
755 Ile.addElement("ATT");
757 Met.addElement("ATG");
759 Leu.addElement("CTA");
760 Leu.addElement("CTG");
761 Leu.addElement("CTC");
762 Leu.addElement("CTT");
763 Leu.addElement("TTA");
764 Leu.addElement("TTG");
766 Val.addElement("GTA");
767 Val.addElement("GTG");
768 Val.addElement("GTC");
769 Val.addElement("GTT");
771 Phe.addElement("TTC");
772 Phe.addElement("TTT");
775 // Stores residue codes/names and colours and other things
776 public static Hashtable propHash = new Hashtable();
778 public static Hashtable hydrophobic = new Hashtable();
780 public static Hashtable polar = new Hashtable();
782 public static Hashtable small = new Hashtable();
784 public static Hashtable positive = new Hashtable();
786 public static Hashtable negative = new Hashtable();
788 public static Hashtable charged = new Hashtable();
790 public static Hashtable aromatic = new Hashtable();
792 public static Hashtable aliphatic = new Hashtable();
794 public static Hashtable tiny = new Hashtable();
796 public static Hashtable proline = new Hashtable();
800 hydrophobic.put("I", new Integer(1));
801 hydrophobic.put("L", new Integer(1));
802 hydrophobic.put("V", new Integer(1));
803 hydrophobic.put("C", new Integer(1));
804 hydrophobic.put("A", new Integer(1));
805 hydrophobic.put("G", new Integer(1));
806 hydrophobic.put("M", new Integer(1));
807 hydrophobic.put("F", new Integer(1));
808 hydrophobic.put("Y", new Integer(1));
809 hydrophobic.put("W", new Integer(1));
810 hydrophobic.put("H", new Integer(1));
811 hydrophobic.put("K", new Integer(1));
812 hydrophobic.put("X", new Integer(1));
813 hydrophobic.put("-", new Integer(1));
814 hydrophobic.put("*", new Integer(1));
815 hydrophobic.put("R", new Integer(0));
816 hydrophobic.put("E", new Integer(0));
817 hydrophobic.put("Q", new Integer(0));
818 hydrophobic.put("D", new Integer(0));
819 hydrophobic.put("N", new Integer(0));
820 hydrophobic.put("S", new Integer(0));
821 hydrophobic.put("T", new Integer(0));
822 hydrophobic.put("P", new Integer(0));
827 polar.put("Y", new Integer(1));
828 polar.put("W", new Integer(1));
829 polar.put("H", new Integer(1));
830 polar.put("K", new Integer(1));
831 polar.put("R", new Integer(1));
832 polar.put("E", new Integer(1));
833 polar.put("Q", new Integer(1));
834 polar.put("D", new Integer(1));
835 polar.put("N", new Integer(1));
836 polar.put("S", new Integer(1));
837 polar.put("T", new Integer(1));
838 polar.put("X", new Integer(1));
839 polar.put("-", new Integer(1));
840 polar.put("*", new Integer(1));
841 polar.put("I", new Integer(0));
842 polar.put("L", new Integer(0));
843 polar.put("V", new Integer(0));
844 polar.put("C", new Integer(0));
845 polar.put("A", new Integer(0));
846 polar.put("G", new Integer(0));
847 polar.put("M", new Integer(0));
848 polar.put("F", new Integer(0));
849 polar.put("P", new Integer(0));
854 small.put("I", new Integer(0));
855 small.put("L", new Integer(0));
856 small.put("V", new Integer(1));
857 small.put("C", new Integer(1));
858 small.put("A", new Integer(1));
859 small.put("G", new Integer(1));
860 small.put("M", new Integer(0));
861 small.put("F", new Integer(0));
862 small.put("Y", new Integer(0));
863 small.put("W", new Integer(0));
864 small.put("H", new Integer(0));
865 small.put("K", new Integer(0));
866 small.put("R", new Integer(0));
867 small.put("E", new Integer(0));
868 small.put("Q", new Integer(0));
869 small.put("D", new Integer(1));
870 small.put("N", new Integer(1));
871 small.put("S", new Integer(1));
872 small.put("T", new Integer(1));
873 small.put("P", new Integer(1));
874 small.put("-", new Integer(1));
875 small.put("*", new Integer(1));
880 positive.put("I", new Integer(0));
881 positive.put("L", new Integer(0));
882 positive.put("V", new Integer(0));
883 positive.put("C", new Integer(0));
884 positive.put("A", new Integer(0));
885 positive.put("G", new Integer(0));
886 positive.put("M", new Integer(0));
887 positive.put("F", new Integer(0));
888 positive.put("Y", new Integer(0));
889 positive.put("W", new Integer(0));
890 positive.put("H", new Integer(1));
891 positive.put("K", new Integer(1));
892 positive.put("R", new Integer(1));
893 positive.put("E", new Integer(0));
894 positive.put("Q", new Integer(0));
895 positive.put("D", new Integer(0));
896 positive.put("N", new Integer(0));
897 positive.put("S", new Integer(0));
898 positive.put("T", new Integer(0));
899 positive.put("P", new Integer(0));
900 positive.put("-", new Integer(1));
901 positive.put("*", new Integer(1));
906 negative.put("I", new Integer(0));
907 negative.put("L", new Integer(0));
908 negative.put("V", new Integer(0));
909 negative.put("C", new Integer(0));
910 negative.put("A", new Integer(0));
911 negative.put("G", new Integer(0));
912 negative.put("M", new Integer(0));
913 negative.put("F", new Integer(0));
914 negative.put("Y", new Integer(0));
915 negative.put("W", new Integer(0));
916 negative.put("H", new Integer(0));
917 negative.put("K", new Integer(0));
918 negative.put("R", new Integer(0));
919 negative.put("E", new Integer(1));
920 negative.put("Q", new Integer(0));
921 negative.put("D", new Integer(1));
922 negative.put("N", new Integer(0));
923 negative.put("S", new Integer(0));
924 negative.put("T", new Integer(0));
925 negative.put("P", new Integer(0));
926 negative.put("-", new Integer(1));
927 negative.put("*", new Integer(1));
932 charged.put("I", new Integer(0));
933 charged.put("L", new Integer(0));
934 charged.put("V", new Integer(0));
935 charged.put("C", new Integer(0));
936 charged.put("A", new Integer(0));
937 charged.put("G", new Integer(0));
938 charged.put("M", new Integer(0));
939 charged.put("F", new Integer(0));
940 charged.put("Y", new Integer(0));
941 charged.put("W", new Integer(0));
942 charged.put("H", new Integer(1));
943 charged.put("K", new Integer(1));
944 charged.put("R", new Integer(1));
945 charged.put("E", new Integer(1));
946 charged.put("Q", new Integer(0));
947 charged.put("D", new Integer(1));
948 charged.put("N", new Integer(0)); // Asparagine is polar but not charged. Alternative would be charged and negative (in basic form)?
949 charged.put("S", new Integer(0));
950 charged.put("T", new Integer(0));
951 charged.put("P", new Integer(0));
952 charged.put("-", new Integer(1));
953 charged.put("*", new Integer(1));
958 aromatic.put("I", new Integer(0));
959 aromatic.put("L", new Integer(0));
960 aromatic.put("V", new Integer(0));
961 aromatic.put("C", new Integer(0));
962 aromatic.put("A", new Integer(0));
963 aromatic.put("G", new Integer(0));
964 aromatic.put("M", new Integer(0));
965 aromatic.put("F", new Integer(1));
966 aromatic.put("Y", new Integer(1));
967 aromatic.put("W", new Integer(1));
968 aromatic.put("H", new Integer(1));
969 aromatic.put("K", new Integer(0));
970 aromatic.put("R", new Integer(0));
971 aromatic.put("E", new Integer(0));
972 aromatic.put("Q", new Integer(0));
973 aromatic.put("D", new Integer(0));
974 aromatic.put("N", new Integer(0));
975 aromatic.put("S", new Integer(0));
976 aromatic.put("T", new Integer(0));
977 aromatic.put("P", new Integer(0));
978 aromatic.put("-", new Integer(1));
979 aromatic.put("*", new Integer(1));
984 aliphatic.put("I", new Integer(1));
985 aliphatic.put("L", new Integer(1));
986 aliphatic.put("V", new Integer(1));
987 aliphatic.put("C", new Integer(0));
988 aliphatic.put("A", new Integer(0));
989 aliphatic.put("G", new Integer(0));
990 aliphatic.put("M", new Integer(0));
991 aliphatic.put("F", new Integer(0));
992 aliphatic.put("Y", new Integer(0));
993 aliphatic.put("W", new Integer(0));
994 aliphatic.put("H", new Integer(0));
995 aliphatic.put("K", new Integer(0));
996 aliphatic.put("R", new Integer(0));
997 aliphatic.put("E", new Integer(0));
998 aliphatic.put("Q", new Integer(0));
999 aliphatic.put("D", new Integer(0));
1000 aliphatic.put("N", new Integer(0));
1001 aliphatic.put("S", new Integer(0));
1002 aliphatic.put("T", new Integer(0));
1003 aliphatic.put("P", new Integer(0));
1004 aliphatic.put("-", new Integer(1));
1005 aliphatic.put("*", new Integer(1));
1010 tiny.put("I", new Integer(0));
1011 tiny.put("L", new Integer(0));
1012 tiny.put("V", new Integer(0));
1013 tiny.put("C", new Integer(0));
1014 tiny.put("A", new Integer(1));
1015 tiny.put("G", new Integer(1));
1016 tiny.put("M", new Integer(0));
1017 tiny.put("F", new Integer(0));
1018 tiny.put("Y", new Integer(0));
1019 tiny.put("W", new Integer(0));
1020 tiny.put("H", new Integer(0));
1021 tiny.put("K", new Integer(0));
1022 tiny.put("R", new Integer(0));
1023 tiny.put("E", new Integer(0));
1024 tiny.put("Q", new Integer(0));
1025 tiny.put("D", new Integer(0));
1026 tiny.put("N", new Integer(0));
1027 tiny.put("S", new Integer(1));
1028 tiny.put("T", new Integer(0));
1029 tiny.put("P", new Integer(0));
1030 tiny.put("-", new Integer(1));
1031 tiny.put("*", new Integer(1));
1036 proline.put("I", new Integer(0));
1037 proline.put("L", new Integer(0));
1038 proline.put("V", new Integer(0));
1039 proline.put("C", new Integer(0));
1040 proline.put("A", new Integer(0));
1041 proline.put("G", new Integer(0));
1042 proline.put("M", new Integer(0));
1043 proline.put("F", new Integer(0));
1044 proline.put("Y", new Integer(0));
1045 proline.put("W", new Integer(0));
1046 proline.put("H", new Integer(0));
1047 proline.put("K", new Integer(0));
1048 proline.put("R", new Integer(0));
1049 proline.put("E", new Integer(0));
1050 proline.put("Q", new Integer(0));
1051 proline.put("D", new Integer(0));
1052 proline.put("N", new Integer(0));
1053 proline.put("S", new Integer(0));
1054 proline.put("T", new Integer(0));
1055 proline.put("P", new Integer(1));
1056 proline.put("-", new Integer(1));
1057 proline.put("*", new Integer(1));
1062 propHash.put("hydrophobic", hydrophobic);
1063 propHash.put("small", small);
1064 propHash.put("positive", positive);
1065 propHash.put("negative", negative);
1066 propHash.put("charged", charged);
1067 propHash.put("aromatic", aromatic);
1068 propHash.put("aliphatic", aliphatic);
1069 propHash.put("tiny", tiny);
1070 propHash.put("proline", proline);
1071 propHash.put("polar", polar);
1074 private ResidueProperties()
1078 public static double getHydmax()
1083 public static double getHydmin()
1088 public static double[] getHyd()
1093 public static Hashtable getAA3Hash()
1098 public static int[][] getDNA()
1100 return ResidueProperties.DNA;
1103 public static int[][] getBLOSUM62()
1105 return ResidueProperties.BLOSUM62;
1108 public static int getPAM250(String A1, String A2)
1110 return getPAM250(A1.charAt(0), A2.charAt(0));
1113 public static int getBLOSUM62(char c1, char c2)
1119 int a = aaIndex[c1];
1120 int b = aaIndex[c2];
1122 pog = ResidueProperties.BLOSUM62[a][b];
1123 } catch (Exception e)
1125 // System.out.println("Unknown residue in " + A1 + " " + A2);
1131 public static Vector getCodons(String res)
1133 if (codonHash.containsKey(res))
1135 return (Vector) codonHash.get(res);
1141 public static String codonTranslate(String lccodon)
1143 String codon=lccodon.toUpperCase();
1144 // all base ambiguity codes yield an 'X' amino acid residue
1145 if (codon.indexOf('X')>-1 || codon.indexOf('N')>-1)
1149 Enumeration e = codonHash.keys();
1151 while (e.hasMoreElements())
1153 String key = (String) e.nextElement();
1154 Vector tmp = (Vector) codonHash.get(key);
1156 if (tmp.contains(codon))
1165 public static int[][] getDefaultPeptideMatrix()
1167 return ResidueProperties.getBLOSUM62();
1170 public static int[][] getDefaultDnaMatrix()
1172 return ResidueProperties.getDNA();
1176 * get a ScoreMatrix based on its string name
1179 * @return matrix in scoreMatrices with key pwtype or null
1181 public static ScoreMatrix getScoreMatrix(String pwtype)
1183 Object val = scoreMatrices.get(pwtype);
1186 return (ScoreMatrix) val;
1191 public static int getPAM250(char c, char d)
1196 int pog = ResidueProperties.PAM250[a][b];
1201 public static Hashtable toDssp3State;
1204 toDssp3State = new Hashtable();
1205 toDssp3State.put("H", "H");
1206 toDssp3State.put("E", "E");
1207 toDssp3State.put("C", " ");
1208 toDssp3State.put(" ", " ");
1209 toDssp3State.put("T", " ");
1210 toDssp3State.put("B", "E");
1211 toDssp3State.put("G", "H");
1212 toDssp3State.put("I", "H");
1213 toDssp3State.put("X", " ");
1217 * translate from other dssp secondary structure alphabets to 3-state
1220 * @return ssstring as a three-state secondary structure assignment.
1222 public static String getDssp3state(String ssstring)
1224 if (ssstring == null)
1228 StringBuffer ss = new StringBuffer();
1229 for (int i = 0; i < ssstring.length(); i++)
1231 String ssc = ssstring.substring(i, i + 1);
1232 if (toDssp3State.containsKey(ssc))
1234 ss.append((String) toDssp3State.get(ssc));
1241 return ss.toString();
1244 // main method generates perl representation of residue property hash
1246 public static void main(String[] args)
1248 Hashtable aa = new Hashtable();
1249 System.out.println("my %aa = {");
1250 // invert property hashes
1251 Enumeration prop = propHash.keys();
1252 while (prop.hasMoreElements())
1254 String pname = (String) prop.nextElement();
1255 Hashtable phash = (Hashtable) propHash.get(pname);
1256 Enumeration res = phash.keys();
1257 while (res.hasMoreElements())
1259 String rname = (String) res.nextElement();
1260 Vector aprops = (Vector) aa.get(rname);
1263 aprops = new Vector();
1264 aa.put(rname, aprops);
1266 Integer hasprop = (Integer) phash.get(rname);
1267 if (hasprop.intValue() == 1)
1269 aprops.addElement(pname);
1273 Enumeration res = aa.keys();
1274 while (res.hasMoreElements())
1276 String rname = (String) res.nextElement();
1278 System.out.print("'" + rname + "' => [");
1279 Enumeration props = ((Vector) aa.get(rname)).elements();
1280 while (props.hasMoreElements())
1282 System.out.print("'" + (String) props.nextElement() + "'");
1283 if (props.hasMoreElements())
1285 System.out.println(", ");
1288 System.out.println("]" + (res.hasMoreElements() ? "," : ""));
1290 System.out.println("};");