2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.schemes;
24 public class ResidueProperties
26 public static Hashtable scoreMatrices = new Hashtable();
28 // Stores residue codes/names and colours and other things
29 public static final int[] aaIndex; // aaHash version 2.1.1 and below
31 public static final int[] nucleotideIndex;
33 public static final int[] purinepyrimidineIndex;
35 public static final Hashtable aa3Hash = new Hashtable();
37 public static final Hashtable aa2Triplet = new Hashtable();
39 public static final Hashtable nucleotideName = new Hashtable();
43 aaIndex = new int[255];
44 for (int i = 0; i < 255; i++)
96 aaIndex['u'] = 22; // TODO: selenocystine triplet and codons needed. also
97 // extend subt. matrices
102 nucleotideIndex = new int[255];
103 for (int i = 0; i < 255; i++)
105 nucleotideIndex[i] = 10; // non-nucleotide symbols are all non-gap gaps.
108 nucleotideIndex['A'] = 0;
109 nucleotideIndex['a'] = 0;
110 nucleotideIndex['C'] = 1;
111 nucleotideIndex['c'] = 1;
112 nucleotideIndex['G'] = 2;
113 nucleotideIndex['g'] = 2;
114 nucleotideIndex['T'] = 3;
115 nucleotideIndex['t'] = 3;
116 nucleotideIndex['U'] = 4;
117 nucleotideIndex['u'] = 4;
118 nucleotideIndex['I'] = 5;
119 nucleotideIndex['i'] = 5;
120 nucleotideIndex['X'] = 6;
121 nucleotideIndex['x'] = 6;
122 nucleotideIndex['R'] = 7;
123 nucleotideIndex['r'] = 7;
124 nucleotideIndex['Y'] = 8;
125 nucleotideIndex['y'] = 8;
126 nucleotideIndex['N'] = 9;
127 nucleotideIndex['n'] = 9;
129 nucleotideName.put("A", "Adenine");
130 nucleotideName.put("a", "Adenine");
131 nucleotideName.put("G", "Guanine");
132 nucleotideName.put("g", "Guanine");
133 nucleotideName.put("C", "Cytosine");
134 nucleotideName.put("c", "Cytosine");
135 nucleotideName.put("T", "Thymine");
136 nucleotideName.put("t", "Thymine");
137 nucleotideName.put("U", "Uracil");
138 nucleotideName.put("u", "Uracil");
139 nucleotideName.put("I", "Inosine");
140 nucleotideName.put("i", "Inosine");
141 nucleotideName.put("X", "Xanthine");
142 nucleotideName.put("x", "Xanthine");
143 nucleotideName.put("R", "Unknown Purine");
144 nucleotideName.put("r", "Unknown Purine");
145 nucleotideName.put("Y", "Unknown Pyrimidine");
146 nucleotideName.put("y", "Unknown Pyrimidine");
147 nucleotideName.put("N", "Unknown");
148 nucleotideName.put("n", "Unknown");
149 nucleotideName.put("W", "Weak nucleotide (A or T)");
150 nucleotideName.put("w", "Weak nucleotide (A or T)");
151 nucleotideName.put("S", "Strong nucleotide (G or C)");
152 nucleotideName.put("s", "Strong nucleotide (G or C)");
153 nucleotideName.put("M", "Amino (A or C)");
154 nucleotideName.put("m", "Amino (A or C)");
155 nucleotideName.put("K", "Keto (G or T)");
156 nucleotideName.put("k", "Keto (G or T)");
157 nucleotideName.put("B", "Not A (G or C or T)");
158 nucleotideName.put("b", "Not A (G or C or T)");
159 nucleotideName.put("H", "Not G (A or C or T)");
160 nucleotideName.put("h", "Not G (A or C or T)");
161 nucleotideName.put("D", "Not C (A or G or T)");
162 nucleotideName.put("d", "Not C (A or G or T)");
163 nucleotideName.put("V", "Not T (A or G or C");
164 nucleotideName.put("v", "Not T (A or G or C");
170 purinepyrimidineIndex = new int[255];
171 for (int i = 0; i < 255; i++)
173 purinepyrimidineIndex[i] = 3; // non-nucleotide symbols are all non-gap
177 purinepyrimidineIndex['A'] = 0;
178 purinepyrimidineIndex['a'] = 0;
179 purinepyrimidineIndex['C'] = 1;
180 purinepyrimidineIndex['c'] = 1;
181 purinepyrimidineIndex['G'] = 0;
182 purinepyrimidineIndex['g'] = 0;
183 purinepyrimidineIndex['T'] = 1;
184 purinepyrimidineIndex['t'] = 1;
185 purinepyrimidineIndex['U'] = 1;
186 purinepyrimidineIndex['u'] = 1;
187 purinepyrimidineIndex['I'] = 2;
188 purinepyrimidineIndex['i'] = 2;
189 purinepyrimidineIndex['X'] = 2;
190 purinepyrimidineIndex['x'] = 2;
191 purinepyrimidineIndex['R'] = 0;
192 purinepyrimidineIndex['r'] = 0;
193 purinepyrimidineIndex['Y'] = 1;
194 purinepyrimidineIndex['y'] = 1;
195 purinepyrimidineIndex['N'] = 2;
196 purinepyrimidineIndex['n'] = 2;
201 aa3Hash.put("ALA", new Integer(0));
202 aa3Hash.put("ARG", new Integer(1));
203 aa3Hash.put("ASN", new Integer(2));
204 aa3Hash.put("ASP", new Integer(3)); // D
205 aa3Hash.put("CYS", new Integer(4));
206 aa3Hash.put("GLN", new Integer(5)); // Q
207 aa3Hash.put("GLU", new Integer(6)); // E
208 aa3Hash.put("GLY", new Integer(7));
209 aa3Hash.put("HIS", new Integer(8));
210 aa3Hash.put("ILE", new Integer(9));
211 aa3Hash.put("LEU", new Integer(10));
212 aa3Hash.put("LYS", new Integer(11));
213 aa3Hash.put("MET", new Integer(12));
214 aa3Hash.put("PHE", new Integer(13));
215 aa3Hash.put("PRO", new Integer(14));
216 aa3Hash.put("SER", new Integer(15));
217 aa3Hash.put("THR", new Integer(16));
218 aa3Hash.put("TRP", new Integer(17));
219 aa3Hash.put("TYR", new Integer(18));
220 aa3Hash.put("VAL", new Integer(19));
221 // IUB Nomenclature for ambiguous peptides
222 aa3Hash.put("ASX", new Integer(20)); // "B";
223 aa3Hash.put("GLX", new Integer(21)); // X
224 aa3Hash.put("XAA", new Integer(22)); // X unknown
225 aa3Hash.put("-", new Integer(23));
226 aa3Hash.put("*", new Integer(23));
227 aa3Hash.put(".", new Integer(23));
228 aa3Hash.put(" ", new Integer(23));
229 aa3Hash.put("Gap", new Integer(23));
234 aa2Triplet.put("A", "ALA");
235 aa2Triplet.put("a", "ALA");
236 aa2Triplet.put("R", "ARG");
237 aa2Triplet.put("r", "ARG");
238 aa2Triplet.put("N", "ASN");
239 aa2Triplet.put("n", "ASN");
240 aa2Triplet.put("D", "ASP");
241 aa2Triplet.put("d", "ASP");
242 aa2Triplet.put("C", "CYS");
243 aa2Triplet.put("c", "CYS");
244 aa2Triplet.put("Q", "GLN");
245 aa2Triplet.put("q", "GLN");
246 aa2Triplet.put("E", "GLU");
247 aa2Triplet.put("e", "GLU");
248 aa2Triplet.put("G", "GLY");
249 aa2Triplet.put("g", "GLY");
250 aa2Triplet.put("H", "HIS");
251 aa2Triplet.put("h", "HIS");
252 aa2Triplet.put("I", "ILE");
253 aa2Triplet.put("i", "ILE");
254 aa2Triplet.put("L", "LEU");
255 aa2Triplet.put("l", "LEU");
256 aa2Triplet.put("K", "LYS");
257 aa2Triplet.put("k", "LYS");
258 aa2Triplet.put("M", "MET");
259 aa2Triplet.put("m", "MET");
260 aa2Triplet.put("F", "PHE");
261 aa2Triplet.put("f", "PHE");
262 aa2Triplet.put("P", "PRO");
263 aa2Triplet.put("p", "PRO");
264 aa2Triplet.put("S", "SER");
265 aa2Triplet.put("s", "SER");
266 aa2Triplet.put("T", "THR");
267 aa2Triplet.put("t", "THR");
268 aa2Triplet.put("W", "TRP");
269 aa2Triplet.put("w", "TRP");
270 aa2Triplet.put("Y", "TYR");
271 aa2Triplet.put("y", "TYR");
272 aa2Triplet.put("V", "VAL");
273 aa2Triplet.put("v", "VAL");
276 public static final String[] aa =
277 { "A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F",
278 "P", "S", "T", "W", "Y", "V", "B", "Z", "X", "_", "*", ".", " " };
280 public static final Color midBlue = new Color(100, 100, 255);
282 public static final Vector scaleColours = new Vector();
286 scaleColours.addElement(new Color(114, 0, 147));
287 scaleColours.addElement(new Color(156, 0, 98));
288 scaleColours.addElement(new Color(190, 0, 0));
289 scaleColours.addElement(Color.red);
290 scaleColours.addElement(new Color(255, 125, 0));
291 scaleColours.addElement(Color.orange);
292 scaleColours.addElement(new Color(255, 194, 85));
293 scaleColours.addElement(Color.yellow);
294 scaleColours.addElement(new Color(255, 255, 181));
295 scaleColours.addElement(Color.white);
298 public static final Color[] taylor =
299 { new Color(204, 255, 0), // A Greenish-yellowy-yellow
300 new Color(0, 0, 255), // R Blueish-bluey-blue
301 new Color(204, 0, 255), // N Blueish-reddy-blue
302 new Color(255, 0, 0), // D Reddish-reddy-red
303 new Color(255, 255, 0), // C Yellowish-yellowy-yellow
304 new Color(255, 0, 204), // Q Reddish-bluey-red
305 new Color(255, 0, 102), // E Blueish-reddy-red
306 new Color(255, 153, 0), // G Yellowy-reddy-yellow
307 new Color(0, 102, 255), // H Greenish-bluey-blue
308 new Color(102, 255, 0), // I Greenish-yellowy-green
309 new Color(51, 255, 0), // L Yellowish-greeny-green
310 new Color(102, 0, 255), // K Reddish-bluey-blue
311 new Color(0, 255, 0), // M Greenish-greeny-green
312 new Color(0, 255, 102), // F Blueish-greeny-green
313 new Color(255, 204, 0), // P Reddish-yellowy-yellow
314 new Color(255, 51, 0), // S Yellowish-reddy-red
315 new Color(255, 102, 0), // T Reddish-yellowy-red
316 new Color(0, 204, 255), // W Blueish-greeny-green
317 new Color(0, 255, 204), // Y Greenish-bluey-green
318 new Color(153, 255, 0), // V Yellowish-greeny-yellow
327 public static final Color[] nucleotide =
328 { new Color(100, 247, 63), // A
329 new Color(255, 179, 64), // C
330 new Color(235, 65, 60), // G
331 new Color(60, 136, 238), // T
332 new Color(60, 136, 238), // U
333 Color.white, // I (inosine)
334 Color.white, // X (xanthine)
341 // Added for PurinePyrimidineColourScheme
342 public static final Color[] purinepyrimidine =
343 { new Color(255, 131, 250), // A, G, R purines purplish/orchid
344 new Color(64, 224, 208), // C,U, T, Y pyrimidines turquoise
345 Color.white, // all other nucleotides
350 public static final Color[] zappo =
359 midBlue,// Color.red, // H
380 // Dunno where I got these numbers from
381 public static final double[] hyd2 =
407 public static final double[] helix =
408 { 1.42, 0.98, 0.67, 1.01, 0.70, 1.11, 1.51, 0.57, 1.00, 1.08, 1.21, 1.16,
409 1.45, 1.13, 0.57, 0.77, 0.83, 1.08, 0.69, 1.06, 0.84, 1.31, 1.00, 0.0 };
411 public static final double helixmin = 0.57;
413 public static final double helixmax = 1.51;
415 public static final double[] strand =
416 { 0.83, 0.93, 0.89, 0.54, 1.19, 1.10, 0.37, 0.75, 0.87, 1.60, 1.30, 0.74,
417 1.05, 1.38, 0.55, 0.75, 1.19, 1.37, 1.47, 1.70, 0.72, 0.74, 1.0, 0.0 };
419 public static final double strandmin = 0.37;
421 public static final double strandmax = 1.7;
423 public static final double[] turn =
424 { 0.66, 0.95, 1.56, 1.46, 1.19, 0.98, 0.74, 1.56, 0.95, 0.47, 0.59, 1.01,
425 0.60, 0.60, 1.52, 1.43, 0.96, 0.96, 1.14, 0.50, 1.51, 0.86, 1.00, 0,
428 public static final double turnmin = 0.47;
430 public static final double turnmax = 1.56;
432 public static final double[] buried =
433 { 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,
434 0.6, 0.8, 0.7, 1.6, 0.5, 2.9, 0.4, 0.3, 1.358, 0.00 };
436 public static final double buriedmin = 0.05;
438 public static final double buriedmax = 4.6;
440 // This is hydropathy index
441 // Kyte, J., and Doolittle, R.F., J. Mol. Biol.
442 // 1157, 105-132, 1982
443 public static final double[] hyd =
444 { 1.8, -4.5, -3.5, -3.5, 2.5, -3.5, -3.5, -0.4, -3.2, 4.5, 3.8, -3.9,
445 1.9, 2.8, -1.6, -0.8, -0.7, -0.9, -1.3, 4.2, -3.5, -3.5, -0.49, 0.0 };
447 public static final double hydmax = 4.5;
449 public static final double hydmin = -3.9;
451 // public static final double hydmax = 1.38;
452 // public static final double hydmin = -2.53;
453 private static final int[][] BLOSUM62 =
455 { 4, -1, -2, -2, 0, -1, -1, 0, -2, -1, -1, -1, -1, -2, -1, 1, 0, -3,
456 -2, 0, -2, -1, 0, -4 },
457 { -1, 5, 0, -2, -3, 1, 0, -2, 0, -3, -2, 2, -1, -3, -2, -1, -1, -3,
458 -2, -3, -1, 0, -1, -4 },
459 { -2, 0, 6, 1, -3, 0, 0, 0, 1, -3, -3, 0, -2, -3, -2, 1, 0, -4, -2,
461 { -2, -2, 1, 6, -3, 0, 2, -1, -1, -3, -4, -1, -3, -3, -1, 0, -1, -4,
462 -3, -3, 4, 1, -1, -4 },
463 { 0, 3, -3, -3, 9, -3, -4, -3, -3, -1, -1, -3, -1, -2, -3, -1, -1,
464 -2, -2, -1, -3, -3, -2, -4 },
465 { -1, 1, 0, 0, -3, 5, 2, -2, 0, -3, -2, 1, 0, -3, -1, 0, -1, -2, -1,
467 { -1, 0, 0, 2, -4, 2, 5, -2, 0, -3, -3, 1, -2, -3, -1, 0, -1, -3, -2,
469 { 0, -2, 0, -1, -3, -2, -2, 6, -2, -4, -4, -2, -3, -3, -2, 0, -2, -2,
470 -3, -3, -1, -2, -1, -4 },
471 { -2, 0, 1, -1, -3, 0, 0, -2, 8, -3, -3, -1, -2, -1, -2, -1, -2, -2,
472 2, -3, 0, 0, -1, -4 },
473 { -1, -3, -3, -3, -1, -3, -3, -4, -3, 4, 2, -3, 1, 0, -3, -2, -1, -3,
474 -1, 3, -3, -3, -1, -4 },
475 { -1, -2, -3, -4, -1, -2, -3, -4, -3, 2, 4, -2, 2, 0, -3, -2, -1, -2,
476 -1, 1, -4, -3, -1, -4 },
477 { -1, 2, 0, -1, -3, 1, 1, -2, -1, -3, -2, 5, -1, -3, -1, 0, -1, -3,
478 -2, -2, 0, 1, -1, -4 },
479 { -1, -1, -2, -3, -1, 0, -2, -3, -2, 1, 2, -1, 5, 0, -2, -1, -1, -1,
480 -1, 1, -3, -1, -1, -4 },
481 { -2, -3, -3, -3, -2, -3, -3, -3, -1, 0, 0, -3, 0, 6, -4, -2, -2, 1,
482 3, -1, -3, -3, -1, -4 },
483 { -1, -2, -2, -1, -3, -1, -1, -2, -2, -3, -3, -1, -2, -4, 7, -1, -1,
484 -4, -3, -2, -2, -1, -2, -4 },
485 { 1, -1, 1, 0, -1, 0, 0, 0, -1, -2, -2, 0, -1, -2, -1, 4, 1, -3, -2,
487 { 0, -1, 0, -1, -1, -1, -1, -2, -2, -1, -1, -1, -1, -2, -1, 1, 5, -2,
488 -2, 0, -1, -1, 0, -4 },
489 { -3, -3, -4, -4, -2, -2, -3, -2, -2, -3, -2, -3, -1, 1, -4, -3, -2,
490 11, 2, -3, -4, -3, -2, -4 },
491 { -2, -2, -2, -3, -2, -1, -2, -3, 2, -1, -1, -2, -1, 3, -3, -2, -2,
492 2, 7, -1, -3, -2, -1, -4 },
493 { 0, -3, -3, -3, -1, -2, -2, -3, -3, 3, 1, -2, 1, -1, -2, -2, 0, -3,
494 -1, 4, -3, -2, -1, -4 },
495 { -2, -1, 3, 4, -3, 0, 1, -1, 0, -3, -4, 0, -3, -3, -2, 0, -1, -4,
496 -3, -3, 4, 1, -1, -4 },
497 { -1, 0, 0, 1, -3, 3, 4, -2, 0, -3, -3, 1, -1, -3, -1, 0, -1, -3, -2,
499 { 0, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, 0, 0,
500 -2, -1, -1, -1, -1, -1, -4 },
501 { -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
502 -4, -4, -4, -4, -4, -4, 1 }, };
504 static final int[][] PAM250 =
506 { 2, -2, 0, 0, -2, 0, 0, 1, -1, -1, -2, -1, -1, -3, 1, 1, 1, -6, -3,
508 { -2, 6, 0, -1, -4, 1, -1, -3, 2, -2, -3, 3, 0, -4, 0, 0, -1, 2, -4,
510 { 0, 0, 2, 2, -4, 1, 1, 0, 2, -2, -3, 1, -2, -3, 0, 1, 0, -4, -2, -2,
512 { 0, -1, 2, 4, -5, 2, 3, 1, 1, -2, -4, 0, -3, -6, -1, 0, 0, -7, -4,
514 { -2, -4, -4, -5, 12, -5, -5, -3, -3, -2, -6, -5, -5, -4, -3, 0, -2,
515 -8, 0, -2, -4, -5, -3, -8 },
516 { 0, 1, 1, 2, -5, 4, 2, -1, 3, -2, -2, 1, -1, -5, 0, -1, -1, -5, -4,
518 { 0, -1, 1, 3, -5, 2, 4, 0, 1, -2, -3, 0, -2, -5, -1, 0, 0, -7, -4,
520 { 1, -3, 0, 1, -3, -1, 0, 5, -2, -3, -4, -2, -3, -5, 0, 1, 0, -7, -5,
522 { -1, 2, 2, 1, -3, 3, 1, -2, 6, -2, -2, 0, -2, -2, 0, -1, -1, -3, 0,
524 { -1, -2, -2, -2, -2, -2, -2, -3, -2, 5, 2, -2, 2, 1, -2, -1, 0, -5,
525 -1, 4, -2, -2, -1, -8 },
526 { -2, -3, -3, -4, -6, -2, -3, -4, -2, 2, 6, -3, 4, 2, -3, -3, -2, -2,
527 -1, 2, -3, -3, -1, -8 },
528 { -1, 3, 1, 0, -5, 1, 0, -2, 0, -2, -3, 5, 0, -5, -1, 0, 0, -3, -4,
530 { -1, 0, -2, -3, -5, -1, -2, -3, -2, 2, 4, 0, 6, 0, -2, -2, -1, -4,
531 -2, 2, -2, -2, -1, -8 },
532 { -3, -4, -3, -6, -4, -5, -5, -5, -2, 1, 2, -5, 0, 9, -5, -3, -3, 0,
533 7, -1, -4, -5, -2, -8 },
534 { 1, 0, 0, -1, -3, 0, -1, 0, 0, -2, -3, -1, -2, -5, 6, 1, 0, -6, -5,
536 { 1, 0, 1, 0, 0, -1, 0, 1, -1, -1, -3, 0, -2, -3, 1, 2, 1, -2, -3,
538 { 1, -1, 0, 0, -2, -1, 0, 0, -1, 0, -2, 0, -1, -3, 0, 1, 3, -5, -3,
540 { -6, 2, -4, -7, -8, -5, -7, -7, -3, -5, -2, -3, -4, 0, -6, -2, -5,
541 17, 0, -6, -5, -6, -4, -8 },
542 { -3, -4, -2, -4, 0, -4, -4, -5, 0, -1, -1, -4, -2, 7, -5, -3, -3, 0,
543 10, -2, -3, -4, -2, -8 },
544 { 0, -2, -2, -2, -2, -2, -2, -1, -2, 4, 2, -2, 2, -1, -1, -1, 0, -6,
545 -2, 4, -2, -2, -1, -8 },
546 { 0, -1, 2, 3, -4, 1, 3, 0, 1, -2, -3, 1, -2, -4, -1, 0, 0, -5, -3,
548 { 0, 0, 1, 3, -5, 3, 3, 0, 2, -2, -3, 0, -2, -5, 0, 0, -1, -6, -4,
550 { 0, -1, 0, -1, -3, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, 0, 0, -4,
551 -2, -1, -1, -1, -1, -8 },
552 { -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
553 -8, -8, -8, -8, -8, -8, 1 }, };
555 public static final Hashtable ssHash = new Hashtable(); // stores the number
560 ssHash.put("H", Color.magenta);
561 ssHash.put("E", Color.yellow);
562 ssHash.put("-", Color.white);
563 ssHash.put(".", Color.white);
564 ssHash.put("S", Color.cyan);
565 ssHash.put("T", Color.blue);
566 ssHash.put("G", Color.pink);
567 ssHash.put("I", Color.pink);
568 ssHash.put("B", Color.yellow);
572 * new Color(60, 136, 238), // U Color.white, // I Color.white, // X
573 * Color.white, // R Color.white, // Y Color.white, // N Color.white, // Gap
575 static final int[][] DNA =
577 { 10, -8, -8, -8, 1, 0, 0, 0, 0, 0, 1 }, // C
578 { -8, 10, -8, -8, 1, 0, 0, 0, 0, 0, 1 }, // T
579 { -8, -8, 10, -8, 1, 0, 0, 0, 0, 0, 1 }, // A
580 { -8, -8, -8, 10, 1, 0, 0, 0, 0, 0, 1 }, // G
581 { 1, 1, 1, 1, 10, 0, 0, 0, 0, 0, 1 }, // -
582 { 1, 1, 1, 1, 1, 10, 0, 0, 0, 0, 1 }, // -
583 { 1, 1, 1, 1, 1, 0, 10, 0, 0, 0, 1 }, // -
584 { 1, 1, 1, 1, 1, 0, 0, 10, 0, 0, 1 }, // -
585 { 1, 1, 1, 1, 1, 0, 0, 0, 10, 0, 1 }, // -
586 { 1, 1, 1, 1, 1, 0, 0, 0, 0, 10, 1 }, // -
587 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, // -
590 * register matrices in list
594 scoreMatrices.put("BLOSUM62", new ScoreMatrix("BLOSUM62", BLOSUM62, 0));
595 scoreMatrices.put("PAM250", new ScoreMatrix("PAM250", PAM250, 0));
596 scoreMatrices.put("DNA", new ScoreMatrix("DNA", DNA, 1));
599 public static final Color[] pidColours =
600 { midBlue, new Color(153, 153, 255),
602 new Color(204, 204, 255), };
604 public static final float[] pidThresholds =
607 public static Hashtable codonHash = new Hashtable();
609 public static Vector Lys = new Vector();
611 public static Vector Asn = new Vector();
613 public static Vector Gln = new Vector();
615 public static Vector His = new Vector();
617 public static Vector Glu = new Vector();
619 public static Vector Asp = new Vector();
621 public static Vector Tyr = new Vector();
623 public static Vector Thr = new Vector();
625 public static Vector Pro = new Vector();
627 public static Vector Ala = new Vector();
629 public static Vector Ser = new Vector();
631 public static Vector Arg = new Vector();
633 public static Vector Gly = new Vector();
635 public static Vector Trp = new Vector();
637 public static Vector Cys = new Vector();
639 public static Vector Ile = new Vector();
641 public static Vector Met = new Vector();
643 public static Vector Leu = new Vector();
645 public static Vector Val = new Vector();
647 public static Vector Phe = new Vector();
649 public static Vector STOP = new Vector();
653 codonHash.put("K", Lys);
654 codonHash.put("N", Asn);
655 codonHash.put("Q", Gln);
656 codonHash.put("H", His);
657 codonHash.put("E", Glu);
658 codonHash.put("D", Asp);
659 codonHash.put("Y", Tyr);
660 codonHash.put("T", Thr);
661 codonHash.put("P", Pro);
662 codonHash.put("A", Ala);
663 codonHash.put("S", Ser);
664 codonHash.put("R", Arg);
665 codonHash.put("G", Gly);
666 codonHash.put("W", Trp);
667 codonHash.put("C", Cys);
668 codonHash.put("I", Ile);
669 codonHash.put("M", Met);
670 codonHash.put("L", Leu);
671 codonHash.put("V", Val);
672 codonHash.put("F", Phe);
673 codonHash.put("STOP", STOP);
676 public static Hashtable codonHash2 = new Hashtable();
680 codonHash2.put("AAA", "K");
681 codonHash2.put("AAG", "K");
682 codonHash2.put("AAC", "N");
683 codonHash2.put("AAT", "N");
685 codonHash2.put("CAA", "E");
686 codonHash2.put("CAG", "E");
687 codonHash2.put("CAC", "H");
688 codonHash2.put("CAT", "H");
690 codonHash2.put("GAA", "Q");
691 codonHash2.put("GAG", "Q");
692 codonHash2.put("GAC", "D");
693 codonHash2.put("GAT", "D");
695 codonHash2.put("TAC", "Y");
696 codonHash2.put("TAT", "Y");
698 codonHash2.put("ACA", "T");
699 codonHash2.put("AAG", "T");
700 codonHash2.put("ACC", "T");
701 codonHash2.put("ACT", "T");
703 codonHash2.put("CCA", "P");
704 codonHash2.put("CCG", "P");
705 codonHash2.put("CCC", "P");
706 codonHash2.put("CCT", "P");
708 codonHash2.put("GCA", "A");
709 codonHash2.put("GCG", "A");
710 codonHash2.put("GCC", "A");
711 codonHash2.put("GCT", "A");
713 codonHash2.put("TCA", "S");
714 codonHash2.put("TCG", "S");
715 codonHash2.put("TCC", "S");
716 codonHash2.put("TCT", "S");
717 codonHash2.put("AGC", "S");
718 codonHash2.put("AGT", "S");
720 codonHash2.put("AGA", "R");
721 codonHash2.put("AGG", "R");
722 codonHash2.put("CGA", "R");
723 codonHash2.put("CGG", "R");
724 codonHash2.put("CGC", "R");
725 codonHash2.put("CGT", "R");
727 codonHash2.put("GGA", "G");
728 codonHash2.put("GGG", "G");
729 codonHash2.put("GGC", "G");
730 codonHash2.put("GGT", "G");
732 codonHash2.put("TGA", "*");
733 codonHash2.put("TAA", "*");
734 codonHash2.put("TAG", "*");
736 codonHash2.put("TGG", "W");
738 codonHash2.put("TGC", "C");
739 codonHash2.put("TGT", "C");
741 codonHash2.put("ATA", "I");
742 codonHash2.put("ATC", "I");
743 codonHash2.put("ATT", "I");
745 codonHash2.put("ATG", "M");
747 codonHash2.put("CTA", "L");
748 codonHash2.put("CTG", "L");
749 codonHash2.put("CTC", "L");
750 codonHash2.put("CTT", "L");
751 codonHash2.put("TTA", "L");
752 codonHash2.put("TTG", "L");
754 codonHash2.put("GTA", "V");
755 codonHash2.put("GTG", "V");
756 codonHash2.put("GTC", "V");
757 codonHash2.put("GTT", "V");
759 codonHash2.put("TTC", "F");
760 codonHash2.put("TTT", "F");
765 Lys.addElement("AAA");
766 Lys.addElement("AAG");
767 Asn.addElement("AAC");
768 Asn.addElement("AAT");
770 Gln.addElement("CAA");
771 Gln.addElement("CAG");
772 His.addElement("CAC");
773 His.addElement("CAT");
775 Glu.addElement("GAA");
776 Glu.addElement("GAG");
777 Asp.addElement("GAC");
778 Asp.addElement("GAT");
780 Tyr.addElement("TAC");
781 Tyr.addElement("TAT");
783 Thr.addElement("ACA");
784 Thr.addElement("ACG");
785 Thr.addElement("ACC");
786 Thr.addElement("ACT");
788 Pro.addElement("CCA");
789 Pro.addElement("CCG");
790 Pro.addElement("CCC");
791 Pro.addElement("CCT");
793 Ala.addElement("GCA");
794 Ala.addElement("GCG");
795 Ala.addElement("GCC");
796 Ala.addElement("GCT");
798 Ser.addElement("TCA");
799 Ser.addElement("TCG");
800 Ser.addElement("TCC");
801 Ser.addElement("TCT");
802 Ser.addElement("AGC");
803 Ser.addElement("AGT");
805 Arg.addElement("AGA");
806 Arg.addElement("AGG");
807 Arg.addElement("CGA");
808 Arg.addElement("CGG");
809 Arg.addElement("CGC");
810 Arg.addElement("CGT");
812 Gly.addElement("GGA");
813 Gly.addElement("GGG");
814 Gly.addElement("GGC");
815 Gly.addElement("GGT");
817 STOP.addElement("TGA");
818 STOP.addElement("TAA");
819 STOP.addElement("TAG");
821 Trp.addElement("TGG");
823 Cys.addElement("TGC");
824 Cys.addElement("TGT");
826 Ile.addElement("ATA");
827 Ile.addElement("ATC");
828 Ile.addElement("ATT");
830 Met.addElement("ATG");
832 Leu.addElement("CTA");
833 Leu.addElement("CTG");
834 Leu.addElement("CTC");
835 Leu.addElement("CTT");
836 Leu.addElement("TTA");
837 Leu.addElement("TTG");
839 Val.addElement("GTA");
840 Val.addElement("GTG");
841 Val.addElement("GTC");
842 Val.addElement("GTT");
844 Phe.addElement("TTC");
845 Phe.addElement("TTT");
848 // Stores residue codes/names and colours and other things
849 public static Hashtable propHash = new Hashtable();
851 public static Hashtable hydrophobic = new Hashtable();
853 public static Hashtable polar = new Hashtable();
855 public static Hashtable small = new Hashtable();
857 public static Hashtable positive = new Hashtable();
859 public static Hashtable negative = new Hashtable();
861 public static Hashtable charged = new Hashtable();
863 public static Hashtable aromatic = new Hashtable();
865 public static Hashtable aliphatic = new Hashtable();
867 public static Hashtable tiny = new Hashtable();
869 public static Hashtable proline = new Hashtable();
873 hydrophobic.put("I", new Integer(1));
874 hydrophobic.put("L", new Integer(1));
875 hydrophobic.put("V", new Integer(1));
876 hydrophobic.put("C", new Integer(1));
877 hydrophobic.put("A", new Integer(1));
878 hydrophobic.put("G", new Integer(1));
879 hydrophobic.put("M", new Integer(1));
880 hydrophobic.put("F", new Integer(1));
881 hydrophobic.put("Y", new Integer(1));
882 hydrophobic.put("W", new Integer(1));
883 hydrophobic.put("H", new Integer(1));
884 hydrophobic.put("K", new Integer(1));
885 hydrophobic.put("X", new Integer(1));
886 hydrophobic.put("-", new Integer(1));
887 hydrophobic.put("*", new Integer(1));
888 hydrophobic.put("R", new Integer(0));
889 hydrophobic.put("E", new Integer(0));
890 hydrophobic.put("Q", new Integer(0));
891 hydrophobic.put("D", new Integer(0));
892 hydrophobic.put("N", new Integer(0));
893 hydrophobic.put("S", new Integer(0));
894 hydrophobic.put("T", new Integer(0));
895 hydrophobic.put("P", new Integer(0));
900 polar.put("Y", new Integer(1));
901 polar.put("W", new Integer(1));
902 polar.put("H", new Integer(1));
903 polar.put("K", new Integer(1));
904 polar.put("R", new Integer(1));
905 polar.put("E", new Integer(1));
906 polar.put("Q", new Integer(1));
907 polar.put("D", new Integer(1));
908 polar.put("N", new Integer(1));
909 polar.put("S", new Integer(1));
910 polar.put("T", new Integer(1));
911 polar.put("X", new Integer(1));
912 polar.put("-", new Integer(1));
913 polar.put("*", new Integer(1));
914 polar.put("I", new Integer(0));
915 polar.put("L", new Integer(0));
916 polar.put("V", new Integer(0));
917 polar.put("C", new Integer(0));
918 polar.put("A", new Integer(0));
919 polar.put("G", new Integer(0));
920 polar.put("M", new Integer(0));
921 polar.put("F", new Integer(0));
922 polar.put("P", new Integer(0));
927 small.put("I", new Integer(0));
928 small.put("L", new Integer(0));
929 small.put("V", new Integer(1));
930 small.put("C", new Integer(1));
931 small.put("A", new Integer(1));
932 small.put("G", new Integer(1));
933 small.put("M", new Integer(0));
934 small.put("F", new Integer(0));
935 small.put("Y", new Integer(0));
936 small.put("W", new Integer(0));
937 small.put("H", new Integer(0));
938 small.put("K", new Integer(0));
939 small.put("R", new Integer(0));
940 small.put("E", new Integer(0));
941 small.put("Q", new Integer(0));
942 small.put("D", new Integer(1));
943 small.put("N", new Integer(1));
944 small.put("S", new Integer(1));
945 small.put("T", new Integer(1));
946 small.put("P", new Integer(1));
947 small.put("-", new Integer(1));
948 small.put("*", new Integer(1));
953 positive.put("I", new Integer(0));
954 positive.put("L", new Integer(0));
955 positive.put("V", new Integer(0));
956 positive.put("C", new Integer(0));
957 positive.put("A", new Integer(0));
958 positive.put("G", new Integer(0));
959 positive.put("M", new Integer(0));
960 positive.put("F", new Integer(0));
961 positive.put("Y", new Integer(0));
962 positive.put("W", new Integer(0));
963 positive.put("H", new Integer(1));
964 positive.put("K", new Integer(1));
965 positive.put("R", new Integer(1));
966 positive.put("E", new Integer(0));
967 positive.put("Q", new Integer(0));
968 positive.put("D", new Integer(0));
969 positive.put("N", new Integer(0));
970 positive.put("S", new Integer(0));
971 positive.put("T", new Integer(0));
972 positive.put("P", new Integer(0));
973 positive.put("-", new Integer(1));
974 positive.put("*", new Integer(1));
979 negative.put("I", new Integer(0));
980 negative.put("L", new Integer(0));
981 negative.put("V", new Integer(0));
982 negative.put("C", new Integer(0));
983 negative.put("A", new Integer(0));
984 negative.put("G", new Integer(0));
985 negative.put("M", new Integer(0));
986 negative.put("F", new Integer(0));
987 negative.put("Y", new Integer(0));
988 negative.put("W", new Integer(0));
989 negative.put("H", new Integer(0));
990 negative.put("K", new Integer(0));
991 negative.put("R", new Integer(0));
992 negative.put("E", new Integer(1));
993 negative.put("Q", new Integer(0));
994 negative.put("D", new Integer(1));
995 negative.put("N", new Integer(0));
996 negative.put("S", new Integer(0));
997 negative.put("T", new Integer(0));
998 negative.put("P", new Integer(0));
999 negative.put("-", new Integer(1));
1000 negative.put("*", new Integer(1));
1005 charged.put("I", new Integer(0));
1006 charged.put("L", new Integer(0));
1007 charged.put("V", new Integer(0));
1008 charged.put("C", new Integer(0));
1009 charged.put("A", new Integer(0));
1010 charged.put("G", new Integer(0));
1011 charged.put("M", new Integer(0));
1012 charged.put("F", new Integer(0));
1013 charged.put("Y", new Integer(0));
1014 charged.put("W", new Integer(0));
1015 charged.put("H", new Integer(1));
1016 charged.put("K", new Integer(1));
1017 charged.put("R", new Integer(1));
1018 charged.put("E", new Integer(1));
1019 charged.put("Q", new Integer(0));
1020 charged.put("D", new Integer(1));
1021 charged.put("N", new Integer(0)); // Asparagine is polar but not charged.
1022 // Alternative would be charged and
1023 // negative (in basic form)?
1024 charged.put("S", new Integer(0));
1025 charged.put("T", new Integer(0));
1026 charged.put("P", new Integer(0));
1027 charged.put("-", new Integer(1));
1028 charged.put("*", new Integer(1));
1033 aromatic.put("I", new Integer(0));
1034 aromatic.put("L", new Integer(0));
1035 aromatic.put("V", new Integer(0));
1036 aromatic.put("C", new Integer(0));
1037 aromatic.put("A", new Integer(0));
1038 aromatic.put("G", new Integer(0));
1039 aromatic.put("M", new Integer(0));
1040 aromatic.put("F", new Integer(1));
1041 aromatic.put("Y", new Integer(1));
1042 aromatic.put("W", new Integer(1));
1043 aromatic.put("H", new Integer(1));
1044 aromatic.put("K", new Integer(0));
1045 aromatic.put("R", new Integer(0));
1046 aromatic.put("E", new Integer(0));
1047 aromatic.put("Q", new Integer(0));
1048 aromatic.put("D", new Integer(0));
1049 aromatic.put("N", new Integer(0));
1050 aromatic.put("S", new Integer(0));
1051 aromatic.put("T", new Integer(0));
1052 aromatic.put("P", new Integer(0));
1053 aromatic.put("-", new Integer(1));
1054 aromatic.put("*", new Integer(1));
1059 aliphatic.put("I", new Integer(1));
1060 aliphatic.put("L", new Integer(1));
1061 aliphatic.put("V", new Integer(1));
1062 aliphatic.put("C", new Integer(0));
1063 aliphatic.put("A", new Integer(0));
1064 aliphatic.put("G", new Integer(0));
1065 aliphatic.put("M", new Integer(0));
1066 aliphatic.put("F", new Integer(0));
1067 aliphatic.put("Y", new Integer(0));
1068 aliphatic.put("W", new Integer(0));
1069 aliphatic.put("H", new Integer(0));
1070 aliphatic.put("K", new Integer(0));
1071 aliphatic.put("R", new Integer(0));
1072 aliphatic.put("E", new Integer(0));
1073 aliphatic.put("Q", new Integer(0));
1074 aliphatic.put("D", new Integer(0));
1075 aliphatic.put("N", new Integer(0));
1076 aliphatic.put("S", new Integer(0));
1077 aliphatic.put("T", new Integer(0));
1078 aliphatic.put("P", new Integer(0));
1079 aliphatic.put("-", new Integer(1));
1080 aliphatic.put("*", new Integer(1));
1085 tiny.put("I", new Integer(0));
1086 tiny.put("L", new Integer(0));
1087 tiny.put("V", new Integer(0));
1088 tiny.put("C", new Integer(0));
1089 tiny.put("A", new Integer(1));
1090 tiny.put("G", new Integer(1));
1091 tiny.put("M", new Integer(0));
1092 tiny.put("F", new Integer(0));
1093 tiny.put("Y", new Integer(0));
1094 tiny.put("W", new Integer(0));
1095 tiny.put("H", new Integer(0));
1096 tiny.put("K", new Integer(0));
1097 tiny.put("R", new Integer(0));
1098 tiny.put("E", new Integer(0));
1099 tiny.put("Q", new Integer(0));
1100 tiny.put("D", new Integer(0));
1101 tiny.put("N", new Integer(0));
1102 tiny.put("S", new Integer(1));
1103 tiny.put("T", new Integer(0));
1104 tiny.put("P", new Integer(0));
1105 tiny.put("-", new Integer(1));
1106 tiny.put("*", new Integer(1));
1111 proline.put("I", new Integer(0));
1112 proline.put("L", new Integer(0));
1113 proline.put("V", new Integer(0));
1114 proline.put("C", new Integer(0));
1115 proline.put("A", new Integer(0));
1116 proline.put("G", new Integer(0));
1117 proline.put("M", new Integer(0));
1118 proline.put("F", new Integer(0));
1119 proline.put("Y", new Integer(0));
1120 proline.put("W", new Integer(0));
1121 proline.put("H", new Integer(0));
1122 proline.put("K", new Integer(0));
1123 proline.put("R", new Integer(0));
1124 proline.put("E", new Integer(0));
1125 proline.put("Q", new Integer(0));
1126 proline.put("D", new Integer(0));
1127 proline.put("N", new Integer(0));
1128 proline.put("S", new Integer(0));
1129 proline.put("T", new Integer(0));
1130 proline.put("P", new Integer(1));
1131 proline.put("-", new Integer(1));
1132 proline.put("*", new Integer(1));
1137 propHash.put("hydrophobic", hydrophobic);
1138 propHash.put("small", small);
1139 propHash.put("positive", positive);
1140 propHash.put("negative", negative);
1141 propHash.put("charged", charged);
1142 propHash.put("aromatic", aromatic);
1143 propHash.put("aliphatic", aliphatic);
1144 propHash.put("tiny", tiny);
1145 propHash.put("proline", proline);
1146 propHash.put("polar", polar);
1149 private ResidueProperties()
1153 public static double getHydmax()
1158 public static double getHydmin()
1163 public static double[] getHyd()
1168 public static Hashtable getAA3Hash()
1173 public static int[][] getDNA()
1175 return ResidueProperties.DNA;
1178 public static int[][] getBLOSUM62()
1180 return ResidueProperties.BLOSUM62;
1183 public static int getPAM250(String A1, String A2)
1185 return getPAM250(A1.charAt(0), A2.charAt(0));
1188 public static int getBLOSUM62(char c1, char c2)
1194 int a = aaIndex[c1];
1195 int b = aaIndex[c2];
1197 pog = ResidueProperties.BLOSUM62[a][b];
1198 } catch (Exception e)
1200 // System.out.println("Unknown residue in " + A1 + " " + A2);
1206 public static Vector getCodons(String res)
1208 if (codonHash.containsKey(res))
1210 return (Vector) codonHash.get(res);
1216 public static String codonTranslate(String lccodon)
1218 String codon = lccodon.toUpperCase();
1219 // all base ambiguity codes yield an 'X' amino acid residue
1220 if (codon.indexOf('X') > -1 || codon.indexOf('N') > -1)
1224 Enumeration e = codonHash.keys();
1226 while (e.hasMoreElements())
1228 String key = (String) e.nextElement();
1229 Vector tmp = (Vector) codonHash.get(key);
1231 if (tmp.contains(codon))
1240 public static int[][] getDefaultPeptideMatrix()
1242 return ResidueProperties.getBLOSUM62();
1245 public static int[][] getDefaultDnaMatrix()
1247 return ResidueProperties.getDNA();
1251 * get a ScoreMatrix based on its string name
1254 * @return matrix in scoreMatrices with key pwtype or null
1256 public static ScoreMatrix getScoreMatrix(String pwtype)
1258 Object val = scoreMatrices.get(pwtype);
1261 return (ScoreMatrix) val;
1266 public static int getPAM250(char c, char d)
1271 int pog = ResidueProperties.PAM250[a][b];
1276 public static Hashtable toDssp3State;
1279 toDssp3State = new Hashtable();
1280 toDssp3State.put("H", "H");
1281 toDssp3State.put("E", "E");
1282 toDssp3State.put("C", " ");
1283 toDssp3State.put(" ", " ");
1284 toDssp3State.put("T", " ");
1285 toDssp3State.put("B", "E");
1286 toDssp3State.put("G", "H");
1287 toDssp3State.put("I", "H");
1288 toDssp3State.put("X", " ");
1292 * translate from other dssp secondary structure alphabets to 3-state
1295 * @return ssstring as a three-state secondary structure assignment.
1297 public static String getDssp3state(String ssstring)
1299 if (ssstring == null)
1303 StringBuffer ss = new StringBuffer();
1304 for (int i = 0; i < ssstring.length(); i++)
1306 String ssc = ssstring.substring(i, i + 1);
1307 if (toDssp3State.containsKey(ssc))
1309 ss.append((String) toDssp3State.get(ssc));
1316 return ss.toString();
1320 * Used by getRNASecStrucState
1323 public static Hashtable toRNAssState;
1326 toRNAssState = new Hashtable();
1327 toRNAssState.put(")", "S");
1328 toRNAssState.put("(", "S");
1332 * translate to RNA secondary structure representation
1335 * @return ssstring as a RNA-state secondary structure assignment.
1337 public static String getRNASecStrucState(String ssstring)
1339 if (ssstring == null)
1343 StringBuffer ss = new StringBuffer();
1344 for (int i = 0; i < ssstring.length(); i++)
1346 String ssc = ssstring.substring(i, i + 1);
1347 if (toRNAssState.containsKey(ssc))
1349 ss.append((String) toRNAssState.get(ssc));
1356 return ss.toString();
1359 // main method generates perl representation of residue property hash
1361 public static void main(String[] args)
1363 Hashtable aa = new Hashtable();
1364 System.out.println("my %aa = {");
1365 // invert property hashes
1366 Enumeration prop = propHash.keys();
1367 while (prop.hasMoreElements())
1369 String pname = (String) prop.nextElement();
1370 Hashtable phash = (Hashtable) propHash.get(pname);
1371 Enumeration res = phash.keys();
1372 while (res.hasMoreElements())
1374 String rname = (String) res.nextElement();
1375 Vector aprops = (Vector) aa.get(rname);
1378 aprops = new Vector();
1379 aa.put(rname, aprops);
1381 Integer hasprop = (Integer) phash.get(rname);
1382 if (hasprop.intValue() == 1)
1384 aprops.addElement(pname);
1388 Enumeration res = aa.keys();
1389 while (res.hasMoreElements())
1391 String rname = (String) res.nextElement();
1393 System.out.print("'" + rname + "' => [");
1394 Enumeration props = ((Vector) aa.get(rname)).elements();
1395 while (props.hasMoreElements())
1397 System.out.print("'" + (String) props.nextElement() + "'");
1398 if (props.hasMoreElements())
1400 System.out.println(", ");
1403 System.out.println("]" + (res.hasMoreElements() ? "," : ""));
1405 System.out.println("};");