2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.schemes;
23 import jalview.analysis.scoremodels.FeatureScoreModel;
24 import jalview.analysis.scoremodels.PIDScoreModel;
25 import jalview.api.analysis.ScoreModelI;
27 import java.awt.Color;
28 import java.util.ArrayList;
29 import java.util.Enumeration;
30 import java.util.HashMap;
31 import java.util.Hashtable;
32 import java.util.List;
34 import java.util.Vector;
36 public class ResidueProperties
38 public static Hashtable<String, ScoreModelI> scoreMatrices = new Hashtable<String, ScoreModelI>();
40 // Stores residue codes/names and colours and other things
41 public static final int[] aaIndex; // aaHash version 2.1.1 and below
43 public static final int[] nucleotideIndex;
45 public static final int[] purinepyrimidineIndex;
47 public static final Map<String, Integer> aa3Hash = new HashMap<String, Integer>();
49 public static final Map<String, String> aa2Triplet = new HashMap<String, String>();
51 public static final Map<String, String> nucleotideName = new HashMap<String, String>();
53 // lookup from modified amino acid (e.g. MSE) to canonical form (e.g. MET)
54 public static final Map<String, String> modifications = new HashMap<String, String>();
58 aaIndex = new int[255];
59 for (int i = 0; i < 255; i++)
111 aaIndex['u'] = 22; // TODO: selenocystine triplet and codons needed. also
112 // extend subt. matrices
116 * maximum (gap) index for matrices involving protein alphabet
118 public final static int maxProteinIndex = 23;
121 * maximum (gap) index for matrices involving nucleotide alphabet
123 public final static int maxNucleotideIndex = 10;
127 nucleotideIndex = new int[255];
128 for (int i = 0; i < 255; i++)
130 nucleotideIndex[i] = 10; // non-nucleotide symbols are all non-gap gaps.
133 nucleotideIndex['A'] = 0;
134 nucleotideIndex['a'] = 0;
135 nucleotideIndex['C'] = 1;
136 nucleotideIndex['c'] = 1;
137 nucleotideIndex['G'] = 2;
138 nucleotideIndex['g'] = 2;
139 nucleotideIndex['T'] = 3;
140 nucleotideIndex['t'] = 3;
141 nucleotideIndex['U'] = 4;
142 nucleotideIndex['u'] = 4;
143 nucleotideIndex['I'] = 5;
144 nucleotideIndex['i'] = 5;
145 nucleotideIndex['X'] = 6;
146 nucleotideIndex['x'] = 6;
147 nucleotideIndex['R'] = 7;
148 nucleotideIndex['r'] = 7;
149 nucleotideIndex['Y'] = 8;
150 nucleotideIndex['y'] = 8;
151 nucleotideIndex['N'] = 9;
152 nucleotideIndex['n'] = 9;
154 nucleotideName.put("A", "Adenine");
155 nucleotideName.put("a", "Adenine");
156 nucleotideName.put("G", "Guanine");
157 nucleotideName.put("g", "Guanine");
158 nucleotideName.put("C", "Cytosine");
159 nucleotideName.put("c", "Cytosine");
160 nucleotideName.put("T", "Thymine");
161 nucleotideName.put("t", "Thymine");
162 nucleotideName.put("U", "Uracil");
163 nucleotideName.put("u", "Uracil");
164 nucleotideName.put("I", "Inosine");
165 nucleotideName.put("i", "Inosine");
166 nucleotideName.put("X", "Xanthine");
167 nucleotideName.put("x", "Xanthine");
168 nucleotideName.put("R", "Unknown Purine");
169 nucleotideName.put("r", "Unknown Purine");
170 nucleotideName.put("Y", "Unknown Pyrimidine");
171 nucleotideName.put("y", "Unknown Pyrimidine");
172 nucleotideName.put("N", "Unknown");
173 nucleotideName.put("n", "Unknown");
174 nucleotideName.put("W", "Weak nucleotide (A or T)");
175 nucleotideName.put("w", "Weak nucleotide (A or T)");
176 nucleotideName.put("S", "Strong nucleotide (G or C)");
177 nucleotideName.put("s", "Strong nucleotide (G or C)");
178 nucleotideName.put("M", "Amino (A or C)");
179 nucleotideName.put("m", "Amino (A or C)");
180 nucleotideName.put("K", "Keto (G or T)");
181 nucleotideName.put("k", "Keto (G or T)");
182 nucleotideName.put("B", "Not A (G or C or T)");
183 nucleotideName.put("b", "Not A (G or C or T)");
184 nucleotideName.put("H", "Not G (A or C or T)");
185 nucleotideName.put("h", "Not G (A or C or T)");
186 nucleotideName.put("D", "Not C (A or G or T)");
187 nucleotideName.put("d", "Not C (A or G or T)");
188 nucleotideName.put("V", "Not T (A or G or C");
189 nucleotideName.put("v", "Not T (A or G or C");
195 purinepyrimidineIndex = new int[255];
196 for (int i = 0; i < 255; i++)
198 purinepyrimidineIndex[i] = 3; // non-nucleotide symbols are all non-gap
202 purinepyrimidineIndex['A'] = 0;
203 purinepyrimidineIndex['a'] = 0;
204 purinepyrimidineIndex['C'] = 1;
205 purinepyrimidineIndex['c'] = 1;
206 purinepyrimidineIndex['G'] = 0;
207 purinepyrimidineIndex['g'] = 0;
208 purinepyrimidineIndex['T'] = 1;
209 purinepyrimidineIndex['t'] = 1;
210 purinepyrimidineIndex['U'] = 1;
211 purinepyrimidineIndex['u'] = 1;
212 purinepyrimidineIndex['I'] = 2;
213 purinepyrimidineIndex['i'] = 2;
214 purinepyrimidineIndex['X'] = 2;
215 purinepyrimidineIndex['x'] = 2;
216 purinepyrimidineIndex['R'] = 0;
217 purinepyrimidineIndex['r'] = 0;
218 purinepyrimidineIndex['Y'] = 1;
219 purinepyrimidineIndex['y'] = 1;
220 purinepyrimidineIndex['N'] = 2;
221 purinepyrimidineIndex['n'] = 2;
226 aa3Hash.put("ALA", new Integer(0));
227 aa3Hash.put("ARG", new Integer(1));
228 aa3Hash.put("ASN", new Integer(2));
229 aa3Hash.put("ASP", new Integer(3)); // D
230 aa3Hash.put("CYS", new Integer(4));
231 aa3Hash.put("GLN", new Integer(5)); // Q
232 aa3Hash.put("GLU", new Integer(6)); // E
233 aa3Hash.put("GLY", new Integer(7));
234 aa3Hash.put("HIS", new Integer(8));
235 aa3Hash.put("ILE", new Integer(9));
236 aa3Hash.put("LEU", new Integer(10));
237 aa3Hash.put("LYS", new Integer(11));
238 aa3Hash.put("MET", new Integer(12));
239 aa3Hash.put("PHE", new Integer(13));
240 aa3Hash.put("PRO", new Integer(14));
241 aa3Hash.put("SER", new Integer(15));
242 aa3Hash.put("THR", new Integer(16));
243 aa3Hash.put("TRP", new Integer(17));
244 aa3Hash.put("TYR", new Integer(18));
245 aa3Hash.put("VAL", new Integer(19));
246 // IUB Nomenclature for ambiguous peptides
247 aa3Hash.put("ASX", new Integer(20)); // "B";
248 aa3Hash.put("GLX", new Integer(21)); // Z
249 aa3Hash.put("XAA", new Integer(22)); // X unknown
250 aa3Hash.put("-", new Integer(23));
251 aa3Hash.put("*", new Integer(23));
252 aa3Hash.put(".", new Integer(23));
253 aa3Hash.put(" ", new Integer(23));
254 aa3Hash.put("Gap", new Integer(23));
255 aa3Hash.put("UR3", new Integer(24));
260 aa2Triplet.put("A", "ALA");
261 aa2Triplet.put("a", "ALA");
262 aa2Triplet.put("R", "ARG");
263 aa2Triplet.put("r", "ARG");
264 aa2Triplet.put("N", "ASN");
265 aa2Triplet.put("n", "ASN");
266 aa2Triplet.put("D", "ASP");
267 aa2Triplet.put("d", "ASP");
268 aa2Triplet.put("C", "CYS");
269 aa2Triplet.put("c", "CYS");
270 aa2Triplet.put("Q", "GLN");
271 aa2Triplet.put("q", "GLN");
272 aa2Triplet.put("E", "GLU");
273 aa2Triplet.put("e", "GLU");
274 aa2Triplet.put("G", "GLY");
275 aa2Triplet.put("g", "GLY");
276 aa2Triplet.put("H", "HIS");
277 aa2Triplet.put("h", "HIS");
278 aa2Triplet.put("I", "ILE");
279 aa2Triplet.put("i", "ILE");
280 aa2Triplet.put("L", "LEU");
281 aa2Triplet.put("l", "LEU");
282 aa2Triplet.put("K", "LYS");
283 aa2Triplet.put("k", "LYS");
284 aa2Triplet.put("M", "MET");
285 aa2Triplet.put("m", "MET");
286 aa2Triplet.put("F", "PHE");
287 aa2Triplet.put("f", "PHE");
288 aa2Triplet.put("P", "PRO");
289 aa2Triplet.put("p", "PRO");
290 aa2Triplet.put("S", "SER");
291 aa2Triplet.put("s", "SER");
292 aa2Triplet.put("T", "THR");
293 aa2Triplet.put("t", "THR");
294 aa2Triplet.put("W", "TRP");
295 aa2Triplet.put("w", "TRP");
296 aa2Triplet.put("Y", "TYR");
297 aa2Triplet.put("y", "TYR");
298 aa2Triplet.put("V", "VAL");
299 aa2Triplet.put("v", "VAL");
302 public static final String[] aa = { "A", "R", "N", "D", "C", "Q", "E",
303 "G", "H", "I", "L", "K", "M", "F", "P", "S", "T", "W", "Y", "V", "B",
304 "Z", "X", "_", "*", ".", " ", "U" };
306 public static final Color midBlue = new Color(100, 100, 255);
308 public static final Vector scaleColours = new Vector();
312 scaleColours.addElement(new Color(114, 0, 147));
313 scaleColours.addElement(new Color(156, 0, 98));
314 scaleColours.addElement(new Color(190, 0, 0));
315 scaleColours.addElement(Color.red);
316 scaleColours.addElement(new Color(255, 125, 0));
317 scaleColours.addElement(Color.orange);
318 scaleColours.addElement(new Color(255, 194, 85));
319 scaleColours.addElement(Color.yellow);
320 scaleColours.addElement(new Color(255, 255, 181));
321 scaleColours.addElement(Color.white);
324 public static final Color[] taylor = { new Color(204, 255, 0), // A
325 // Greenish-yellowy-yellow
326 new Color(0, 0, 255), // R Blueish-bluey-blue
327 new Color(204, 0, 255), // N Blueish-reddy-blue
328 new Color(255, 0, 0), // D Reddish-reddy-red
329 new Color(255, 255, 0), // C Yellowish-yellowy-yellow
330 new Color(255, 0, 204), // Q Reddish-bluey-red
331 new Color(255, 0, 102), // E Blueish-reddy-red
332 new Color(255, 153, 0), // G Yellowy-reddy-yellow
333 new Color(0, 102, 255), // H Greenish-bluey-blue
334 new Color(102, 255, 0), // I Greenish-yellowy-green
335 new Color(51, 255, 0), // L Yellowish-greeny-green
336 new Color(102, 0, 255), // K Reddish-bluey-blue
337 new Color(0, 255, 0), // M Greenish-greeny-green
338 new Color(0, 255, 102), // F Blueish-greeny-green
339 new Color(255, 204, 0), // P Reddish-yellowy-yellow
340 new Color(255, 51, 0), // S Yellowish-reddy-red
341 new Color(255, 102, 0), // T Reddish-yellowy-red
342 new Color(0, 204, 255), // W Blueish-greeny-green
343 new Color(0, 255, 204), // Y Greenish-bluey-green
344 new Color(153, 255, 0), // V Yellowish-greeny-yellow
353 public static final Color[] nucleotide = { new Color(100, 247, 63), // A
354 new Color(255, 179, 64), // C
355 new Color(235, 65, 60), // G
356 new Color(60, 136, 238), // T
357 new Color(60, 136, 238), // U
358 Color.white, // I (inosine)
359 Color.white, // X (xanthine)
366 // Added for PurinePyrimidineColourScheme
367 public static final Color[] purinepyrimidine = {
368 new Color(255, 131, 250), // A, G, R purines purplish/orchid
369 new Color(64, 224, 208), // C,U, T, Y pyrimidines turquoise
370 Color.white, // all other nucleotides
375 public static final Color[] zappo = { Color.pink, // A
383 midBlue,// Color.red, // H
404 // Dunno where I got these numbers from
405 public static final double[] hyd2 = { 0.62, // A
430 public static final double[] helix = { 1.42, 0.98, 0.67, 1.01, 0.70,
431 1.11, 1.51, 0.57, 1.00, 1.08, 1.21, 1.16, 1.45, 1.13, 0.57, 0.77,
432 0.83, 1.08, 0.69, 1.06, 0.84, 1.31, 1.00, 0.0 };
434 public static final double helixmin = 0.57;
436 public static final double helixmax = 1.51;
438 public static final double[] strand = { 0.83, 0.93, 0.89, 0.54, 1.19,
439 1.10, 0.37, 0.75, 0.87, 1.60, 1.30, 0.74, 1.05, 1.38, 0.55, 0.75,
440 1.19, 1.37, 1.47, 1.70, 0.72, 0.74, 1.0, 0.0 };
442 public static final double strandmin = 0.37;
444 public static final double strandmax = 1.7;
446 public static final double[] turn = { 0.66, 0.95, 1.56, 1.46, 1.19, 0.98,
447 0.74, 1.56, 0.95, 0.47, 0.59, 1.01, 0.60, 0.60, 1.52, 1.43, 0.96,
448 0.96, 1.14, 0.50, 1.51, 0.86, 1.00, 0, 0 };
450 public static final double turnmin = 0.47;
452 public static final double turnmax = 1.56;
454 public static final double[] buried = { 1.7, 0.1, 0.4, 0.4, 4.6, 0.3,
455 0.3, 1.8, 0.8, 3.1, 2.4, 0.05, 1.9, 2.2, 0.6, 0.8, 0.7, 1.6, 0.5,
456 2.9, 0.4, 0.3, 1.358, 0.00 };
458 public static final double buriedmin = 0.05;
460 public static final double buriedmax = 4.6;
462 // This is hydropathy index
463 // Kyte, J., and Doolittle, R.F., J. Mol. Biol.
464 // 1157, 105-132, 1982
465 public static final double[] hyd = { 1.8, -4.5, -3.5, -3.5, 2.5, -3.5,
466 -3.5, -0.4, -3.2, 4.5, 3.8, -3.9, 1.9, 2.8, -1.6, -0.8, -0.7, -0.9,
467 -1.3, 4.2, -3.5, -3.5, -0.49, 0.0 };
469 public static final double hydmax = 4.5;
471 public static final double hydmin = -3.9;
473 // public static final double hydmax = 1.38;
474 // public static final double hydmin = -2.53;
475 private static final int[][] BLOSUM62 = {
476 { 4, -1, -2, -2, 0, -1, -1, 0, -2, -1, -1, -1, -1, -2, -1, 1, 0, -3,
477 -2, 0, -2, -1, 0, -4 },
478 { -1, 5, 0, -2, -3, 1, 0, -2, 0, -3, -2, 2, -1, -3, -2, -1, -1, -3,
479 -2, -3, -1, 0, -1, -4 },
480 { -2, 0, 6, 1, -3, 0, 0, 0, 1, -3, -3, 0, -2, -3, -2, 1, 0, -4, -2,
482 { -2, -2, 1, 6, -3, 0, 2, -1, -1, -3, -4, -1, -3, -3, -1, 0, -1, -4,
483 -3, -3, 4, 1, -1, -4 },
484 { 0, 3, -3, -3, 9, -3, -4, -3, -3, -1, -1, -3, -1, -2, -3, -1, -1,
485 -2, -2, -1, -3, -3, -2, -4 },
486 { -1, 1, 0, 0, -3, 5, 2, -2, 0, -3, -2, 1, 0, -3, -1, 0, -1, -2, -1,
488 { -1, 0, 0, 2, -4, 2, 5, -2, 0, -3, -3, 1, -2, -3, -1, 0, -1, -3, -2,
490 { 0, -2, 0, -1, -3, -2, -2, 6, -2, -4, -4, -2, -3, -3, -2, 0, -2, -2,
491 -3, -3, -1, -2, -1, -4 },
492 { -2, 0, 1, -1, -3, 0, 0, -2, 8, -3, -3, -1, -2, -1, -2, -1, -2, -2,
493 2, -3, 0, 0, -1, -4 },
494 { -1, -3, -3, -3, -1, -3, -3, -4, -3, 4, 2, -3, 1, 0, -3, -2, -1, -3,
495 -1, 3, -3, -3, -1, -4 },
496 { -1, -2, -3, -4, -1, -2, -3, -4, -3, 2, 4, -2, 2, 0, -3, -2, -1, -2,
497 -1, 1, -4, -3, -1, -4 },
498 { -1, 2, 0, -1, -3, 1, 1, -2, -1, -3, -2, 5, -1, -3, -1, 0, -1, -3,
499 -2, -2, 0, 1, -1, -4 },
500 { -1, -1, -2, -3, -1, 0, -2, -3, -2, 1, 2, -1, 5, 0, -2, -1, -1, -1,
501 -1, 1, -3, -1, -1, -4 },
502 { -2, -3, -3, -3, -2, -3, -3, -3, -1, 0, 0, -3, 0, 6, -4, -2, -2, 1,
503 3, -1, -3, -3, -1, -4 },
504 { -1, -2, -2, -1, -3, -1, -1, -2, -2, -3, -3, -1, -2, -4, 7, -1, -1,
505 -4, -3, -2, -2, -1, -2, -4 },
506 { 1, -1, 1, 0, -1, 0, 0, 0, -1, -2, -2, 0, -1, -2, -1, 4, 1, -3, -2,
508 { 0, -1, 0, -1, -1, -1, -1, -2, -2, -1, -1, -1, -1, -2, -1, 1, 5, -2,
509 -2, 0, -1, -1, 0, -4 },
510 { -3, -3, -4, -4, -2, -2, -3, -2, -2, -3, -2, -3, -1, 1, -4, -3, -2,
511 11, 2, -3, -4, -3, -2, -4 },
512 { -2, -2, -2, -3, -2, -1, -2, -3, 2, -1, -1, -2, -1, 3, -3, -2, -2,
513 2, 7, -1, -3, -2, -1, -4 },
514 { 0, -3, -3, -3, -1, -2, -2, -3, -3, 3, 1, -2, 1, -1, -2, -2, 0, -3,
515 -1, 4, -3, -2, -1, -4 },
516 { -2, -1, 3, 4, -3, 0, 1, -1, 0, -3, -4, 0, -3, -3, -2, 0, -1, -4,
517 -3, -3, 4, 1, -1, -4 },
518 { -1, 0, 0, 1, -3, 3, 4, -2, 0, -3, -3, 1, -1, -3, -1, 0, -1, -3, -2,
520 { 0, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, 0, 0,
521 -2, -1, -1, -1, -1, -1, -4 },
522 { -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
523 -4, -4, -4, -4, -4, -4, 1 }, };
525 static final int[][] PAM250 = {
526 { 2, -2, 0, 0, -2, 0, 0, 1, -1, -1, -2, -1, -1, -3, 1, 1, 1, -6, -3,
528 { -2, 6, 0, -1, -4, 1, -1, -3, 2, -2, -3, 3, 0, -4, 0, 0, -1, 2, -4,
530 { 0, 0, 2, 2, -4, 1, 1, 0, 2, -2, -3, 1, -2, -3, 0, 1, 0, -4, -2, -2,
532 { 0, -1, 2, 4, -5, 2, 3, 1, 1, -2, -4, 0, -3, -6, -1, 0, 0, -7, -4,
534 { -2, -4, -4, -5, 12, -5, -5, -3, -3, -2, -6, -5, -5, -4, -3, 0, -2,
535 -8, 0, -2, -4, -5, -3, -8 },
536 { 0, 1, 1, 2, -5, 4, 2, -1, 3, -2, -2, 1, -1, -5, 0, -1, -1, -5, -4,
538 { 0, -1, 1, 3, -5, 2, 4, 0, 1, -2, -3, 0, -2, -5, -1, 0, 0, -7, -4,
540 { 1, -3, 0, 1, -3, -1, 0, 5, -2, -3, -4, -2, -3, -5, 0, 1, 0, -7, -5,
542 { -1, 2, 2, 1, -3, 3, 1, -2, 6, -2, -2, 0, -2, -2, 0, -1, -1, -3, 0,
544 { -1, -2, -2, -2, -2, -2, -2, -3, -2, 5, 2, -2, 2, 1, -2, -1, 0, -5,
545 -1, 4, -2, -2, -1, -8 },
546 { -2, -3, -3, -4, -6, -2, -3, -4, -2, 2, 6, -3, 4, 2, -3, -3, -2, -2,
547 -1, 2, -3, -3, -1, -8 },
548 { -1, 3, 1, 0, -5, 1, 0, -2, 0, -2, -3, 5, 0, -5, -1, 0, 0, -3, -4,
550 { -1, 0, -2, -3, -5, -1, -2, -3, -2, 2, 4, 0, 6, 0, -2, -2, -1, -4,
551 -2, 2, -2, -2, -1, -8 },
552 { -3, -4, -3, -6, -4, -5, -5, -5, -2, 1, 2, -5, 0, 9, -5, -3, -3, 0,
553 7, -1, -4, -5, -2, -8 },
554 { 1, 0, 0, -1, -3, 0, -1, 0, 0, -2, -3, -1, -2, -5, 6, 1, 0, -6, -5,
556 { 1, 0, 1, 0, 0, -1, 0, 1, -1, -1, -3, 0, -2, -3, 1, 2, 1, -2, -3,
558 { 1, -1, 0, 0, -2, -1, 0, 0, -1, 0, -2, 0, -1, -3, 0, 1, 3, -5, -3,
560 { -6, 2, -4, -7, -8, -5, -7, -7, -3, -5, -2, -3, -4, 0, -6, -2, -5,
561 17, 0, -6, -5, -6, -4, -8 },
562 { -3, -4, -2, -4, 0, -4, -4, -5, 0, -1, -1, -4, -2, 7, -5, -3, -3, 0,
563 10, -2, -3, -4, -2, -8 },
564 { 0, -2, -2, -2, -2, -2, -2, -1, -2, 4, 2, -2, 2, -1, -1, -1, 0, -6,
565 -2, 4, -2, -2, -1, -8 },
566 { 0, -1, 2, 3, -4, 1, 3, 0, 1, -2, -3, 1, -2, -4, -1, 0, 0, -5, -3,
568 { 0, 0, 1, 3, -5, 3, 3, 0, 2, -2, -3, 0, -2, -5, 0, 0, -1, -6, -4,
570 { 0, -1, 0, -1, -3, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, 0, 0, -4,
571 -2, -1, -1, -1, -1, -8 },
572 { -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
573 -8, -8, -8, -8, -8, -8, 1 }, };
575 public static final Hashtable ssHash = new Hashtable(); // stores the number
580 ssHash.put("H", Color.magenta);
581 ssHash.put("E", Color.yellow);
582 ssHash.put("-", Color.white);
583 ssHash.put(".", Color.white);
584 ssHash.put("S", Color.cyan);
585 ssHash.put("T", Color.blue);
586 ssHash.put("G", Color.pink);
587 ssHash.put("I", Color.pink);
588 ssHash.put("B", Color.yellow);
592 * new Color(60, 136, 238), // U Color.white, // I Color.white, // X
593 * Color.white, // R Color.white, // Y Color.white, // N Color.white, // Gap
596 // JBPNote: patch matrix for T/U equivalence when working with DNA or RNA.
597 // Will equate sequences if working with mixed nucleotide sets.
598 // treats T and U identically. R and Y weak equivalence with AG and CTU.
599 // N matches any other base weakly
601 static final int[][] DNA = { { 10, -8, -8, -8, -8, 1, 1, 1, -8, 1, 1 }, // A
602 { -8, 10, -8, -8, -8, 1, 1, -8, 1, 1, 1 }, // C
603 { -8, -8, 10, -8, -8, 1, 1, 1, -8, 1, 1 }, // G
604 { -8, -8, -8, 10, 10, 1, 1, -8, 1, 1, 1 }, // T
605 { -8, -8, -8, 10, 10, 1, 1, -8, 1, 1, 1 }, // U
606 { 1, 1, 1, 1, 1, 10, 0, 0, 0, 1, 1 }, // I
607 { 1, 1, 1, 1, 1, 0, 10, 0, 0, 1, 1 }, // X
608 { 1, -8, 1, -8, -8, 0, 0, 10, -8, 1, 1 }, // R
609 { -8, 1, -8, 1, 1, 0, 0, -8, 10, 1, 1 }, // Y
610 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 1 }, // N
611 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, // -
614 * register matrices in list
618 scoreMatrices.put("BLOSUM62", new ScoreMatrix("BLOSUM62", BLOSUM62, 0));
619 scoreMatrices.put("PAM250", new ScoreMatrix("PAM250", PAM250, 0));
620 scoreMatrices.put("DNA", new ScoreMatrix("DNA", DNA, 1));
624 public static final Color[] pidColours = { midBlue,
625 new Color(153, 153, 255),
627 new Color(204, 204, 255), };
629 public static final float[] pidThresholds = { 80, 60, 40, };
631 public static Map<String, List<String>> codonHash = new HashMap<String, List<String>>();
633 private static List<String> Lys = new ArrayList<String>();
635 private static List<String> Asn = new ArrayList<String>();
637 private static List<String> Gln = new ArrayList<String>();
639 private static List<String> His = new ArrayList<String>();
641 private static List<String> Glu = new ArrayList<String>();
643 private static List<String> Asp = new ArrayList<String>();
645 private static List<String> Tyr = new ArrayList<String>();
647 private static List<String> Thr = new ArrayList<String>();
649 private static List<String> Pro = new ArrayList<String>();
651 private static List<String> Ala = new ArrayList<String>();
653 private static List<String> Ser = new ArrayList<String>();
655 private static List<String> Arg = new ArrayList<String>();
657 private static List<String> Gly = new ArrayList<String>();
659 private static List<String> Trp = new ArrayList<String>();
661 private static List<String> Cys = new ArrayList<String>();
663 private static List<String> Ile = new ArrayList<String>();
665 private static List<String> Met = new ArrayList<String>();
667 private static List<String> Leu = new ArrayList<String>();
669 private static List<String> Val = new ArrayList<String>();
671 private static List<String> Phe = new ArrayList<String>();
673 public static List<String> STOP = new ArrayList<String>();
675 public static String START = "ATG";
679 codonHash.put("K", Lys);
680 codonHash.put("N", Asn);
681 codonHash.put("Q", Gln);
682 codonHash.put("H", His);
683 codonHash.put("E", Glu);
684 codonHash.put("D", Asp);
685 codonHash.put("Y", Tyr);
686 codonHash.put("T", Thr);
687 codonHash.put("P", Pro);
688 codonHash.put("A", Ala);
689 codonHash.put("S", Ser);
690 codonHash.put("R", Arg);
691 codonHash.put("G", Gly);
692 codonHash.put("W", Trp);
693 codonHash.put("C", Cys);
694 codonHash.put("I", Ile);
695 codonHash.put("M", Met);
696 codonHash.put("L", Leu);
697 codonHash.put("V", Val);
698 codonHash.put("F", Phe);
699 codonHash.put("STOP", STOP);
703 * Nucleotide Ambiguity Codes
705 public static final Map<String, String[]> ambiguityCodes = new Hashtable<String, String[]>();
708 * Codon triplets with additional symbols for unambiguous codons that include
711 public static final Hashtable<String, String> codonHash2 = new Hashtable<String, String>();
714 * all ambiguity codes for a given base
716 public final static Hashtable<String, List<String>> _ambiguityCodes = new Hashtable<String, List<String>>();
721 * Ambiguity codes as per http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html
723 ambiguityCodes.put("R", new String[] { "A", "G" });
724 ambiguityCodes.put("Y", new String[] { "T", "C" });
725 ambiguityCodes.put("W", new String[] { "A", "T" });
726 ambiguityCodes.put("S", new String[] { "G", "C" });
727 ambiguityCodes.put("M", new String[] { "A", "C" });
728 ambiguityCodes.put("K", new String[] { "G", "T" });
729 ambiguityCodes.put("H", new String[] { "A", "T", "C" });
730 ambiguityCodes.put("B", new String[] { "G", "T", "C" });
731 ambiguityCodes.put("V", new String[] { "G", "A", "C" });
732 ambiguityCodes.put("D", new String[] { "G", "A", "T" });
733 ambiguityCodes.put("N", new String[] { "G", "A", "T", "C" });
735 // Now build codon translation table
736 codonHash2.put("AAA", "K");
737 codonHash2.put("AAG", "K");
738 codonHash2.put("AAC", "N");
739 codonHash2.put("AAT", "N");
741 codonHash2.put("CAA", "Q");
742 codonHash2.put("CAG", "Q");
743 codonHash2.put("CAC", "H");
744 codonHash2.put("CAT", "H");
746 codonHash2.put("GAA", "E");
747 codonHash2.put("GAG", "E");
748 codonHash2.put("GAC", "D");
749 codonHash2.put("GAT", "D");
751 codonHash2.put("TAC", "Y");
752 codonHash2.put("TAT", "Y");
754 codonHash2.put("ACA", "T");
755 codonHash2.put("ACC", "T");
756 codonHash2.put("ACT", "T");
757 codonHash2.put("ACG", "T");
759 codonHash2.put("CCA", "P");
760 codonHash2.put("CCG", "P");
761 codonHash2.put("CCC", "P");
762 codonHash2.put("CCT", "P");
764 codonHash2.put("GCA", "A");
765 codonHash2.put("GCG", "A");
766 codonHash2.put("GCC", "A");
767 codonHash2.put("GCT", "A");
769 codonHash2.put("TCA", "S");
770 codonHash2.put("TCG", "S");
771 codonHash2.put("TCC", "S");
772 codonHash2.put("TCT", "S");
773 codonHash2.put("AGC", "S");
774 codonHash2.put("AGT", "S");
776 codonHash2.put("AGA", "R");
777 codonHash2.put("AGG", "R");
778 codonHash2.put("CGA", "R");
779 codonHash2.put("CGG", "R");
780 codonHash2.put("CGC", "R");
781 codonHash2.put("CGT", "R");
783 codonHash2.put("GGA", "G");
784 codonHash2.put("GGG", "G");
785 codonHash2.put("GGC", "G");
786 codonHash2.put("GGT", "G");
788 codonHash2.put("TGA", "*");
789 codonHash2.put("TAA", "*");
790 codonHash2.put("TAG", "*");
792 codonHash2.put("TGG", "W");
794 codonHash2.put("TGC", "C");
795 codonHash2.put("TGT", "C");
797 codonHash2.put("ATA", "I");
798 codonHash2.put("ATC", "I");
799 codonHash2.put("ATT", "I");
801 codonHash2.put("ATG", "M");
803 codonHash2.put("CTA", "L");
804 codonHash2.put("CTG", "L");
805 codonHash2.put("CTC", "L");
806 codonHash2.put("CTT", "L");
807 codonHash2.put("TTA", "L");
808 codonHash2.put("TTG", "L");
810 codonHash2.put("GTA", "V");
811 codonHash2.put("GTG", "V");
812 codonHash2.put("GTC", "V");
813 codonHash2.put("GTT", "V");
815 codonHash2.put("TTC", "F");
816 codonHash2.put("TTT", "F");
818 buildAmbiguityCodonSet();
822 * programmatic generation of codons including ambiguity codes
824 public static void buildAmbiguityCodonSet()
826 if (_ambiguityCodes.size() > 0)
829 .println("Ignoring multiple calls to buildAmbiguityCodonSet");
832 // Invert the ambiguity code set
833 for (Map.Entry<String, String[]> acode : ambiguityCodes.entrySet())
835 for (String r : acode.getValue())
837 List<String> codesfor = _ambiguityCodes.get(r);
838 if (codesfor == null)
840 _ambiguityCodes.put(r, codesfor = new ArrayList<String>());
842 if (!codesfor.contains(acode.getKey()))
844 codesfor.add(acode.getKey());
849 .println("Inconsistency in the IUBMB ambiguity code nomenclature table: collision for "
850 + acode.getKey() + " in residue " + r);
854 // and programmatically add in the ambiguity codes that yield the same amino
856 String[] unambcodons = codonHash2.keySet().toArray(
857 new String[codonHash2.size()]);
858 for (String codon : unambcodons)
860 String residue = codonHash2.get(codon);
861 String acodon[][] = new String[codon.length()][];
862 for (int i = 0, iSize = codon.length(); i < iSize; i++)
864 String _ac = "" + codon.charAt(i);
865 List<String> acodes = _ambiguityCodes.get(_ac);
868 acodon[i] = acodes.toArray(new String[acodes.size()]);
872 acodon[i] = new String[] {};
875 // enumerate all combinations and test for veracity of translation
876 int tpos[] = new int[codon.length()], cpos[] = new int[codon.length()];
877 for (int i = 0; i < tpos.length; i++)
881 tpos[acodon.length - 1] = 0;
883 while (tpos[0] < acodon[0].length)
885 // make all codons for this combination
886 char allres[][] = new char[tpos.length][];
889 for (ipos = 0; ipos < tpos.length; ipos++)
891 if (acodon[ipos].length == 0 || tpos[ipos] < 0)
893 _acodon += codon.charAt(ipos);
894 allres[ipos] = new char[] { codon.charAt(ipos) };
898 _acodon += acodon[ipos][tpos[ipos]];
899 String[] altbase = ambiguityCodes.get(acodon[ipos][tpos[ipos]]);
900 allres[ipos] = new char[altbase.length];
902 for (String ab : altbase)
904 allres[ipos][j++] = ab.charAt(0);
908 // test all codons for this combination
909 for (ipos = 0; ipos < cpos.length; ipos++)
913 boolean valid = true;
917 for (j = 0; j < cpos.length; j++)
919 _codon += allres[j][cpos[j]];
921 String tr = codonHash2.get(_codon);
922 if (valid = (tr != null && tr.equals(residue)))
924 // advance to next combination
925 ipos = acodon.length - 1;
926 while (++cpos[ipos] >= allres[ipos].length && ipos > 0)
932 } while (valid && cpos[0] < allres[0].length);
935 // Add this to the set of codons we will translate
936 // System.out.println("Adding ambiguity codon: " + _acodon + " for "
938 codonHash2.put(_acodon, residue);
942 // System.err.println("Rejecting ambiguity codon: " + _acodon
943 // + " for " + residue);
946 ipos = acodon.length - 1;
947 while (++tpos[ipos] >= acodon[ipos].length && ipos > 0)
1042 // Stores residue codes/names and colours and other things
1043 public static Hashtable propHash = new Hashtable();
1045 public static Hashtable hydrophobic = new Hashtable();
1047 public static Hashtable polar = new Hashtable();
1049 public static Hashtable small = new Hashtable();
1051 public static Hashtable positive = new Hashtable();
1053 public static Hashtable negative = new Hashtable();
1055 public static Hashtable charged = new Hashtable();
1057 public static Hashtable aromatic = new Hashtable();
1059 public static Hashtable aliphatic = new Hashtable();
1061 public static Hashtable tiny = new Hashtable();
1063 public static Hashtable proline = new Hashtable();
1067 hydrophobic.put("I", new Integer(1));
1068 hydrophobic.put("L", new Integer(1));
1069 hydrophobic.put("V", new Integer(1));
1070 hydrophobic.put("C", new Integer(1));
1071 hydrophobic.put("A", new Integer(1));
1072 hydrophobic.put("G", new Integer(1));
1073 hydrophobic.put("M", new Integer(1));
1074 hydrophobic.put("F", new Integer(1));
1075 hydrophobic.put("Y", new Integer(1));
1076 hydrophobic.put("W", new Integer(1));
1077 hydrophobic.put("H", new Integer(1));
1078 hydrophobic.put("K", new Integer(1));
1079 hydrophobic.put("X", new Integer(1));
1080 hydrophobic.put("-", new Integer(1));
1081 hydrophobic.put("*", new Integer(1));
1082 hydrophobic.put("R", new Integer(0));
1083 hydrophobic.put("E", new Integer(0));
1084 hydrophobic.put("Q", new Integer(0));
1085 hydrophobic.put("D", new Integer(0));
1086 hydrophobic.put("N", new Integer(0));
1087 hydrophobic.put("S", new Integer(0));
1088 hydrophobic.put("T", new Integer(0));
1089 hydrophobic.put("P", new Integer(0));
1094 polar.put("Y", new Integer(1));
1095 polar.put("W", new Integer(1));
1096 polar.put("H", new Integer(1));
1097 polar.put("K", new Integer(1));
1098 polar.put("R", new Integer(1));
1099 polar.put("E", new Integer(1));
1100 polar.put("Q", new Integer(1));
1101 polar.put("D", new Integer(1));
1102 polar.put("N", new Integer(1));
1103 polar.put("S", new Integer(1));
1104 polar.put("T", new Integer(1));
1105 polar.put("X", new Integer(1));
1106 polar.put("-", new Integer(1));
1107 polar.put("*", new Integer(1));
1108 polar.put("I", new Integer(0));
1109 polar.put("L", new Integer(0));
1110 polar.put("V", new Integer(0));
1111 polar.put("C", new Integer(0));
1112 polar.put("A", new Integer(0));
1113 polar.put("G", new Integer(0));
1114 polar.put("M", new Integer(0));
1115 polar.put("F", new Integer(0));
1116 polar.put("P", new Integer(0));
1121 small.put("I", new Integer(0));
1122 small.put("L", new Integer(0));
1123 small.put("V", new Integer(1));
1124 small.put("C", new Integer(1));
1125 small.put("A", new Integer(1));
1126 small.put("G", new Integer(1));
1127 small.put("M", new Integer(0));
1128 small.put("F", new Integer(0));
1129 small.put("Y", new Integer(0));
1130 small.put("W", new Integer(0));
1131 small.put("H", new Integer(0));
1132 small.put("K", new Integer(0));
1133 small.put("R", new Integer(0));
1134 small.put("E", new Integer(0));
1135 small.put("Q", new Integer(0));
1136 small.put("D", new Integer(1));
1137 small.put("N", new Integer(1));
1138 small.put("S", new Integer(1));
1139 small.put("T", new Integer(1));
1140 small.put("P", new Integer(1));
1141 small.put("-", new Integer(1));
1142 small.put("*", new Integer(1));
1147 positive.put("I", new Integer(0));
1148 positive.put("L", new Integer(0));
1149 positive.put("V", new Integer(0));
1150 positive.put("C", new Integer(0));
1151 positive.put("A", new Integer(0));
1152 positive.put("G", new Integer(0));
1153 positive.put("M", new Integer(0));
1154 positive.put("F", new Integer(0));
1155 positive.put("Y", new Integer(0));
1156 positive.put("W", new Integer(0));
1157 positive.put("H", new Integer(1));
1158 positive.put("K", new Integer(1));
1159 positive.put("R", new Integer(1));
1160 positive.put("E", new Integer(0));
1161 positive.put("Q", new Integer(0));
1162 positive.put("D", new Integer(0));
1163 positive.put("N", new Integer(0));
1164 positive.put("S", new Integer(0));
1165 positive.put("T", new Integer(0));
1166 positive.put("P", new Integer(0));
1167 positive.put("-", new Integer(1));
1168 positive.put("*", new Integer(1));
1173 negative.put("I", new Integer(0));
1174 negative.put("L", new Integer(0));
1175 negative.put("V", new Integer(0));
1176 negative.put("C", new Integer(0));
1177 negative.put("A", new Integer(0));
1178 negative.put("G", new Integer(0));
1179 negative.put("M", new Integer(0));
1180 negative.put("F", new Integer(0));
1181 negative.put("Y", new Integer(0));
1182 negative.put("W", new Integer(0));
1183 negative.put("H", new Integer(0));
1184 negative.put("K", new Integer(0));
1185 negative.put("R", new Integer(0));
1186 negative.put("E", new Integer(1));
1187 negative.put("Q", new Integer(0));
1188 negative.put("D", new Integer(1));
1189 negative.put("N", new Integer(0));
1190 negative.put("S", new Integer(0));
1191 negative.put("T", new Integer(0));
1192 negative.put("P", new Integer(0));
1193 negative.put("-", new Integer(1));
1194 negative.put("*", new Integer(1));
1199 charged.put("I", new Integer(0));
1200 charged.put("L", new Integer(0));
1201 charged.put("V", new Integer(0));
1202 charged.put("C", new Integer(0));
1203 charged.put("A", new Integer(0));
1204 charged.put("G", new Integer(0));
1205 charged.put("M", new Integer(0));
1206 charged.put("F", new Integer(0));
1207 charged.put("Y", new Integer(0));
1208 charged.put("W", new Integer(0));
1209 charged.put("H", new Integer(1));
1210 charged.put("K", new Integer(1));
1211 charged.put("R", new Integer(1));
1212 charged.put("E", new Integer(1));
1213 charged.put("Q", new Integer(0));
1214 charged.put("D", new Integer(1));
1215 charged.put("N", new Integer(0)); // Asparagine is polar but not charged.
1216 // Alternative would be charged and
1217 // negative (in basic form)?
1218 charged.put("S", new Integer(0));
1219 charged.put("T", new Integer(0));
1220 charged.put("P", new Integer(0));
1221 charged.put("-", new Integer(1));
1222 charged.put("*", new Integer(1));
1227 aromatic.put("I", new Integer(0));
1228 aromatic.put("L", new Integer(0));
1229 aromatic.put("V", new Integer(0));
1230 aromatic.put("C", new Integer(0));
1231 aromatic.put("A", new Integer(0));
1232 aromatic.put("G", new Integer(0));
1233 aromatic.put("M", new Integer(0));
1234 aromatic.put("F", new Integer(1));
1235 aromatic.put("Y", new Integer(1));
1236 aromatic.put("W", new Integer(1));
1237 aromatic.put("H", new Integer(1));
1238 aromatic.put("K", new Integer(0));
1239 aromatic.put("R", new Integer(0));
1240 aromatic.put("E", new Integer(0));
1241 aromatic.put("Q", new Integer(0));
1242 aromatic.put("D", new Integer(0));
1243 aromatic.put("N", new Integer(0));
1244 aromatic.put("S", new Integer(0));
1245 aromatic.put("T", new Integer(0));
1246 aromatic.put("P", new Integer(0));
1247 aromatic.put("-", new Integer(1));
1248 aromatic.put("*", new Integer(1));
1253 aliphatic.put("I", new Integer(1));
1254 aliphatic.put("L", new Integer(1));
1255 aliphatic.put("V", new Integer(1));
1256 aliphatic.put("C", new Integer(0));
1257 aliphatic.put("A", new Integer(0));
1258 aliphatic.put("G", new Integer(0));
1259 aliphatic.put("M", new Integer(0));
1260 aliphatic.put("F", new Integer(0));
1261 aliphatic.put("Y", new Integer(0));
1262 aliphatic.put("W", new Integer(0));
1263 aliphatic.put("H", new Integer(0));
1264 aliphatic.put("K", new Integer(0));
1265 aliphatic.put("R", new Integer(0));
1266 aliphatic.put("E", new Integer(0));
1267 aliphatic.put("Q", new Integer(0));
1268 aliphatic.put("D", new Integer(0));
1269 aliphatic.put("N", new Integer(0));
1270 aliphatic.put("S", new Integer(0));
1271 aliphatic.put("T", new Integer(0));
1272 aliphatic.put("P", new Integer(0));
1273 aliphatic.put("-", new Integer(1));
1274 aliphatic.put("*", new Integer(1));
1279 tiny.put("I", new Integer(0));
1280 tiny.put("L", new Integer(0));
1281 tiny.put("V", new Integer(0));
1282 tiny.put("C", new Integer(0));
1283 tiny.put("A", new Integer(1));
1284 tiny.put("G", new Integer(1));
1285 tiny.put("M", new Integer(0));
1286 tiny.put("F", new Integer(0));
1287 tiny.put("Y", new Integer(0));
1288 tiny.put("W", new Integer(0));
1289 tiny.put("H", new Integer(0));
1290 tiny.put("K", new Integer(0));
1291 tiny.put("R", new Integer(0));
1292 tiny.put("E", new Integer(0));
1293 tiny.put("Q", new Integer(0));
1294 tiny.put("D", new Integer(0));
1295 tiny.put("N", new Integer(0));
1296 tiny.put("S", new Integer(1));
1297 tiny.put("T", new Integer(0));
1298 tiny.put("P", new Integer(0));
1299 tiny.put("-", new Integer(1));
1300 tiny.put("*", new Integer(1));
1305 proline.put("I", new Integer(0));
1306 proline.put("L", new Integer(0));
1307 proline.put("V", new Integer(0));
1308 proline.put("C", new Integer(0));
1309 proline.put("A", new Integer(0));
1310 proline.put("G", new Integer(0));
1311 proline.put("M", new Integer(0));
1312 proline.put("F", new Integer(0));
1313 proline.put("Y", new Integer(0));
1314 proline.put("W", new Integer(0));
1315 proline.put("H", new Integer(0));
1316 proline.put("K", new Integer(0));
1317 proline.put("R", new Integer(0));
1318 proline.put("E", new Integer(0));
1319 proline.put("Q", new Integer(0));
1320 proline.put("D", new Integer(0));
1321 proline.put("N", new Integer(0));
1322 proline.put("S", new Integer(0));
1323 proline.put("T", new Integer(0));
1324 proline.put("P", new Integer(1));
1325 proline.put("-", new Integer(1));
1326 proline.put("*", new Integer(1));
1331 propHash.put("hydrophobic", hydrophobic);
1332 propHash.put("small", small);
1333 propHash.put("positive", positive);
1334 propHash.put("negative", negative);
1335 propHash.put("charged", charged);
1336 propHash.put("aromatic", aromatic);
1337 propHash.put("aliphatic", aliphatic);
1338 propHash.put("tiny", tiny);
1339 propHash.put("proline", proline);
1340 propHash.put("polar", polar);
1344 int[][] propMatrixF = new int[maxProteinIndex][maxProteinIndex], propMatrixPos = new int[maxProteinIndex][maxProteinIndex], propMatrixEpos = new int[maxProteinIndex][maxProteinIndex];
1345 for (int i = 0; i < maxProteinIndex; i++)
1347 int maxF = 0, maxP = 0, maxEP = 0;
1357 for (int j = i + 1; j < maxProteinIndex; j++)
1368 propMatrixF[i][j] = 0;
1369 propMatrixPos[i][j] = 0;
1370 propMatrixEpos[i][j] = 0;
1371 for (Enumeration<String> en = propHash.keys(); en.hasMoreElements();)
1373 String ph = en.nextElement();
1374 Map<String, Integer> pph = (Map<String, Integer>) propHash
1376 if (pph.get(ic) != null && pph.get(jc) != null)
1378 int icp = pph.get(ic).intValue(), jcp = pph.get(jc).intValue();
1379 // Still working on these definitions.
1380 propMatrixPos[i][j] += icp == jcp && icp > 0 ? 2 : 0;
1381 propMatrixPos[j][i] += icp == jcp && icp > 0 ? 2 : 0;
1382 propMatrixF[i][j] += icp == jcp ? 2 : 0;
1383 propMatrixF[j][i] += icp == jcp ? 2 : 0;
1384 propMatrixEpos[i][j] += icp == jcp ? (1 + icp * 2) : 0;
1385 propMatrixEpos[j][i] += icp == jcp ? (1 + icp * 2) : 0;
1388 if (maxF < propMatrixF[i][j])
1390 maxF = propMatrixF[i][j];
1392 if (maxP < propMatrixPos[i][j])
1394 maxP = propMatrixPos[i][j];
1396 if (maxEP < propMatrixEpos[i][j])
1398 maxEP = propMatrixEpos[i][j];
1401 propMatrixF[i][i] = maxF;
1402 propMatrixPos[i][i] = maxP;
1403 propMatrixEpos[i][i] = maxEP;
1405 // JAL-1512 comment out physicochemical score matrices for 2.8.1 release
1406 // scoreMatrices.put("Conservation Pos", new
1407 // ScoreMatrix("Conservation Pos",propMatrixPos,0));
1408 // scoreMatrices.put("Conservation Both", new
1409 // ScoreMatrix("Conservation Both",propMatrixF,0));
1410 // scoreMatrices.put("Conservation EnhPos", new
1411 // ScoreMatrix("Conservation EnhPos",propMatrixEpos,0));
1412 scoreMatrices.put("PID", new PIDScoreModel());
1413 scoreMatrices.put("Displayed Features", new FeatureScoreModel());
1416 private ResidueProperties()
1420 public static double getHydmax()
1425 public static double getHydmin()
1430 public static double[] getHyd()
1435 public static Map<String, Integer> getAA3Hash()
1440 public static int[][] getDNA()
1442 return ResidueProperties.DNA;
1445 public static int[][] getBLOSUM62()
1447 return ResidueProperties.BLOSUM62;
1450 public static int getPAM250(String A1, String A2)
1452 return getPAM250(A1.charAt(0), A2.charAt(0));
1455 public static int getBLOSUM62(char c1, char c2)
1461 int a = aaIndex[c1];
1462 int b = aaIndex[c2];
1464 pog = ResidueProperties.BLOSUM62[a][b];
1465 } catch (Exception e)
1467 // System.out.println("Unknown residue in " + A1 + " " + A2);
1473 public static Vector getCodons(String res)
1475 if (codonHash.containsKey(res))
1477 return (Vector) codonHash.get(res);
1483 public static String codonTranslate(String lccodon)
1487 return _codonTranslate(lccodon);
1489 String cdn = codonHash2.get(lccodon.toUpperCase());
1490 if ("*".equals(cdn))
1497 public static String _codonTranslate(String lccodon)
1499 String codon = lccodon.toUpperCase();
1500 // all base ambiguity codes yield an 'X' amino acid residue
1501 if (codon.indexOf('X') > -1 || codon.indexOf('N') > -1)
1505 for (String key : codonHash.keySet())
1507 if (codonHash.get(key).contains(codon))
1516 public static int[][] getDefaultPeptideMatrix()
1518 return ResidueProperties.getBLOSUM62();
1521 public static int[][] getDefaultDnaMatrix()
1523 return ResidueProperties.getDNA();
1527 * get a ScoreMatrix based on its string name
1530 * @return matrix in scoreMatrices with key pwtype or null
1532 public static ScoreMatrix getScoreMatrix(String pwtype)
1534 Object val = scoreMatrices.get(pwtype);
1535 if (val != null && val instanceof ScoreMatrix)
1537 return (ScoreMatrix) val;
1543 * get a ScoreModel based on its string name
1546 * @return scoremodel of type pwtype or null
1548 public static ScoreModelI getScoreModel(String pwtype)
1550 return scoreMatrices.get(pwtype);
1553 public static int getPAM250(char c, char d)
1558 int pog = ResidueProperties.PAM250[a][b];
1563 public static Hashtable toDssp3State;
1566 toDssp3State = new Hashtable();
1567 toDssp3State.put("H", "H");
1568 toDssp3State.put("E", "E");
1569 toDssp3State.put("C", " ");
1570 toDssp3State.put(" ", " ");
1571 toDssp3State.put("T", " ");
1572 toDssp3State.put("B", "E");
1573 toDssp3State.put("G", "H");
1574 toDssp3State.put("I", "H");
1575 toDssp3State.put("X", " ");
1579 * translate from other dssp secondary structure alphabets to 3-state
1582 * @return ssstring as a three-state secondary structure assignment.
1584 public static String getDssp3state(String ssstring)
1586 if (ssstring == null)
1590 StringBuffer ss = new StringBuffer();
1591 for (int i = 0; i < ssstring.length(); i++)
1593 String ssc = ssstring.substring(i, i + 1);
1594 if (toDssp3State.containsKey(ssc))
1596 ss.append((String) toDssp3State.get(ssc));
1603 return ss.toString();
1607 * Used by getRNASecStrucState
1610 public static Hashtable<String, String> toRNAssState;
1612 public static boolean RNAcloseParen[] = new boolean[255];
1615 toRNAssState = new Hashtable<String, String>();
1616 toRNAssState.put(")", "(");
1617 toRNAssState.put("(", "(");
1618 toRNAssState.put("]", "[");
1619 toRNAssState.put("[", "[");
1620 toRNAssState.put("{", "{");
1621 toRNAssState.put("}", "{");
1622 toRNAssState.put(">", ">");
1623 toRNAssState.put("<", ">");
1624 toRNAssState.put("A", "A");
1625 toRNAssState.put("a", "A");
1626 toRNAssState.put("B", "B");
1627 toRNAssState.put("b", "B");
1628 toRNAssState.put("C", "C");
1629 toRNAssState.put("c", "C");
1630 toRNAssState.put("D", "D");
1631 toRNAssState.put("d", "D");
1632 toRNAssState.put("E", "E");
1633 toRNAssState.put("e", "E");
1634 toRNAssState.put("F", "F");
1635 toRNAssState.put("f", "F");
1636 toRNAssState.put("G", "G");
1637 toRNAssState.put("g", "G");
1638 toRNAssState.put("H", "H");
1639 toRNAssState.put("h", "H");
1640 toRNAssState.put("I", "I");
1641 toRNAssState.put("i", "I");
1642 toRNAssState.put("J", "J");
1643 toRNAssState.put("j", "J");
1644 toRNAssState.put("K", "K");
1645 toRNAssState.put("k", "K");
1646 toRNAssState.put("L", "L");
1647 toRNAssState.put("l", "L");
1648 toRNAssState.put("M", "M");
1649 toRNAssState.put("m", "M");
1650 toRNAssState.put("N", "N");
1651 toRNAssState.put("n", "N");
1652 toRNAssState.put("O", "O");
1653 toRNAssState.put("o", "O");
1654 toRNAssState.put("P", "P");
1655 toRNAssState.put("p", "P");
1656 toRNAssState.put("Q", "Q");
1657 toRNAssState.put("q", "Q");
1658 toRNAssState.put("R", "R");
1659 toRNAssState.put("r", "R");
1660 toRNAssState.put("S", "S");
1661 toRNAssState.put("s", "S");
1662 toRNAssState.put("T", "T");
1663 toRNAssState.put("t", "T");
1664 toRNAssState.put("U", "U");
1665 toRNAssState.put("u", "U");
1666 toRNAssState.put("V", "V");
1667 toRNAssState.put("v", "V");
1668 toRNAssState.put("W", "W");
1669 toRNAssState.put("w", "W");
1670 toRNAssState.put("X", "X");
1671 toRNAssState.put("x", "X");
1672 toRNAssState.put("Y", "Y");
1673 toRNAssState.put("y", "Y");
1674 toRNAssState.put("Z", "Z");
1675 toRNAssState.put("z", "Z");
1676 for (int p = 0; p < RNAcloseParen.length; p++)
1678 RNAcloseParen[p] = false;
1680 for (String k : toRNAssState.keySet())
1682 RNAcloseParen[k.charAt(0)] = k.charAt(0) != toRNAssState.get(k)
1689 modifications.put("MSE", "MET"); // Selenomethionine
1690 // the rest tbc; from
1691 // http://sourceforge.net/p/jmol/mailman/message/12833570/
1692 // modifications.put("CSE", "CYS"); // Selenocysteine
1693 // modifications.put("PTR", "TYR"); // Phosphotyrosine
1694 // modifications.put("SEP", "SER"); // Phosphoserine
1695 // modifications.put("HYP", "PRO"); // 4-hydroxyproline
1696 // modifications.put("5HP", "GLU"); // Pyroglutamic acid; 5-hydroxyproline
1697 // modifications.put("PCA", "GLU"); // Pyroglutamic acid
1698 // modifications.put("LYZ", "LYS"); // 5-hydroxylysine
1700 // Additional protein alphabets used in the SCOP database and PDB files
1702 // https://github.com/biopython/biopython/blob/master/Bio/Data/SCOPData.py
1703 modifications.put("00C", "CYS");
1704 modifications.put("01W", "XAA");
1705 modifications.put("02K", "ALA");
1706 modifications.put("03Y", "CYS");
1707 modifications.put("07O", "CYS");
1708 modifications.put("08P", "CYS");
1709 modifications.put("0A0", "ASP");
1710 modifications.put("0A1", "TYR");
1711 modifications.put("0A2", "LYS");
1712 modifications.put("0A8", "CYS");
1713 modifications.put("0AA", "VAL");
1714 modifications.put("0AB", "VAL");
1715 modifications.put("0AC", "GLY");
1716 modifications.put("0AD", "GLY");
1717 modifications.put("0AF", "TRP");
1718 modifications.put("0AG", "LEU");
1719 modifications.put("0AH", "SER");
1720 modifications.put("0AK", "ASP");
1721 modifications.put("0AM", "ALA");
1722 modifications.put("0AP", "CYS");
1723 modifications.put("0AU", "UR3");
1724 modifications.put("0AV", "ALA");
1725 modifications.put("0AZ", "PRO");
1726 modifications.put("0BN", "PHE");
1727 modifications.put("0C ", "CYS");
1728 modifications.put("0CS", "ALA");
1729 modifications.put("0DC", "CYS");
1730 modifications.put("0DG", "GLY");
1731 modifications.put("0DT", "THR");
1732 modifications.put("0FL", "ALA");
1733 modifications.put("0G ", "GLY");
1734 modifications.put("0NC", "ALA");
1735 modifications.put("0SP", "ALA");
1736 modifications.put("0U ", "UR3");
1737 modifications.put("0YG", "YG");
1738 modifications.put("10C", "CYS");
1739 modifications.put("125", "UR3");
1740 modifications.put("126", "UR3");
1741 modifications.put("127", "UR3");
1742 modifications.put("128", "ASN");
1743 modifications.put("12A", "ALA");
1744 modifications.put("143", "CYS");
1745 modifications.put("175", "ASG");
1746 modifications.put("193", "XAA");
1747 modifications.put("1AP", "ALA");
1748 modifications.put("1MA", "ALA");
1749 modifications.put("1MG", "GLY");
1750 modifications.put("1PA", "PHE");
1751 modifications.put("1PI", "ALA");
1752 modifications.put("1PR", "ASN");
1753 modifications.put("1SC", "CYS");
1754 modifications.put("1TQ", "TRP");
1755 modifications.put("1TY", "TYR");
1756 modifications.put("1X6", "SER");
1757 modifications.put("200", "PHE");
1758 modifications.put("23F", "PHE");
1759 modifications.put("23S", "XAA");
1760 modifications.put("26B", "THR");
1761 modifications.put("2AD", "XAA");
1762 modifications.put("2AG", "ALA");
1763 modifications.put("2AO", "XAA");
1764 modifications.put("2AR", "ALA");
1765 modifications.put("2AS", "XAA");
1766 modifications.put("2AT", "THR");
1767 modifications.put("2AU", "UR3");
1768 modifications.put("2BD", "ILE");
1769 modifications.put("2BT", "THR");
1770 modifications.put("2BU", "ALA");
1771 modifications.put("2CO", "CYS");
1772 modifications.put("2DA", "ALA");
1773 modifications.put("2DF", "ASN");
1774 modifications.put("2DM", "ASN");
1775 modifications.put("2DO", "XAA");
1776 modifications.put("2DT", "THR");
1777 modifications.put("2EG", "GLY");
1778 modifications.put("2FE", "ASN");
1779 modifications.put("2FI", "ASN");
1780 modifications.put("2FM", "MET");
1781 modifications.put("2GT", "THR");
1782 modifications.put("2HF", "HIS");
1783 modifications.put("2LU", "LEU");
1784 modifications.put("2MA", "ALA");
1785 modifications.put("2MG", "GLY");
1786 modifications.put("2ML", "LEU");
1787 modifications.put("2MR", "ARG");
1788 modifications.put("2MT", "PRO");
1789 modifications.put("2MU", "UR3");
1790 modifications.put("2NT", "THR");
1791 modifications.put("2OM", "UR3");
1792 modifications.put("2OT", "THR");
1793 modifications.put("2PI", "XAA");
1794 modifications.put("2PR", "GLY");
1795 modifications.put("2SA", "ASN");
1796 modifications.put("2SI", "XAA");
1797 modifications.put("2ST", "THR");
1798 modifications.put("2TL", "THR");
1799 modifications.put("2TY", "TYR");
1800 modifications.put("2VA", "VAL");
1801 modifications.put("2XA", "CYS");
1802 modifications.put("32S", "XAA");
1803 modifications.put("32T", "XAA");
1804 modifications.put("3AH", "HIS");
1805 modifications.put("3AR", "XAA");
1806 modifications.put("3CF", "PHE");
1807 modifications.put("3DA", "ALA");
1808 modifications.put("3DR", "ASN");
1809 modifications.put("3GA", "ALA");
1810 modifications.put("3MD", "ASP");
1811 modifications.put("3ME", "UR3");
1812 modifications.put("3NF", "TYR");
1813 modifications.put("3QN", "LYS");
1814 modifications.put("3TY", "XAA");
1815 modifications.put("3XH", "GLY");
1816 modifications.put("4AC", "ASN");
1817 modifications.put("4BF", "TYR");
1818 modifications.put("4CF", "PHE");
1819 modifications.put("4CY", "MET");
1820 modifications.put("4DP", "TRP");
1821 modifications.put("4F3", "GYG");
1822 modifications.put("4FB", "PRO");
1823 modifications.put("4FW", "TRP");
1824 modifications.put("4HT", "TRP");
1825 modifications.put("4IN", "TRP");
1826 modifications.put("4MF", "ASN");
1827 modifications.put("4MM", "XAA");
1828 modifications.put("4OC", "CYS");
1829 modifications.put("4PC", "CYS");
1830 modifications.put("4PD", "CYS");
1831 modifications.put("4PE", "CYS");
1832 modifications.put("4PH", "PHE");
1833 modifications.put("4SC", "CYS");
1834 modifications.put("4SU", "UR3");
1835 modifications.put("4TA", "ASN");
1836 modifications.put("4U7", "ALA");
1837 modifications.put("56A", "HIS");
1838 modifications.put("5AA", "ALA");
1839 modifications.put("5AB", "ALA");
1840 modifications.put("5AT", "THR");
1841 modifications.put("5BU", "UR3");
1842 modifications.put("5CG", "GLY");
1843 modifications.put("5CM", "CYS");
1844 modifications.put("5CS", "CYS");
1845 modifications.put("5FA", "ALA");
1846 modifications.put("5FC", "CYS");
1847 modifications.put("5FU", "UR3");
1848 modifications.put("5HP", "GLU");
1849 modifications.put("5HT", "THR");
1850 modifications.put("5HU", "UR3");
1851 modifications.put("5IC", "CYS");
1852 modifications.put("5IT", "THR");
1853 modifications.put("5IU", "UR3");
1854 modifications.put("5MC", "CYS");
1855 modifications.put("5MD", "ASN");
1856 modifications.put("5MU", "UR3");
1857 modifications.put("5NC", "CYS");
1858 modifications.put("5PC", "CYS");
1859 modifications.put("5PY", "THR");
1860 modifications.put("5SE", "UR3");
1861 modifications.put("5ZA", "TWG");
1862 modifications.put("64T", "THR");
1863 modifications.put("6CL", "LYS");
1864 modifications.put("6CT", "THR");
1865 modifications.put("6CW", "TRP");
1866 modifications.put("6HA", "ALA");
1867 modifications.put("6HC", "CYS");
1868 modifications.put("6HG", "GLY");
1869 modifications.put("6HN", "LYS");
1870 modifications.put("6HT", "THR");
1871 modifications.put("6IA", "ALA");
1872 modifications.put("6MA", "ALA");
1873 modifications.put("6MC", "ALA");
1874 modifications.put("6MI", "ASN");
1875 modifications.put("6MT", "ALA");
1876 modifications.put("6MZ", "ASN");
1877 modifications.put("6OG", "GLY");
1878 modifications.put("70U", "UR3");
1879 modifications.put("7DA", "ALA");
1880 modifications.put("7GU", "GLY");
1881 modifications.put("7JA", "ILE");
1882 modifications.put("7MG", "GLY");
1883 modifications.put("8AN", "ALA");
1884 modifications.put("8FG", "GLY");
1885 modifications.put("8MG", "GLY");
1886 modifications.put("8OG", "GLY");
1887 modifications.put("9NE", "GLU");
1888 modifications.put("9NF", "PHE");
1889 modifications.put("9NR", "ARG");
1890 modifications.put("9NV", "VAL");
1891 modifications.put("A ", "ALA");
1892 modifications.put("A1P", "ASN");
1893 modifications.put("A23", "ALA");
1894 modifications.put("A2L", "ALA");
1895 modifications.put("A2M", "ALA");
1896 modifications.put("A34", "ALA");
1897 modifications.put("A35", "ALA");
1898 modifications.put("A38", "ALA");
1899 modifications.put("A39", "ALA");
1900 modifications.put("A3A", "ALA");
1901 modifications.put("A3P", "ALA");
1902 modifications.put("A40", "ALA");
1903 modifications.put("A43", "ALA");
1904 modifications.put("A44", "ALA");
1905 modifications.put("A47", "ALA");
1906 modifications.put("A5L", "ALA");
1907 modifications.put("A5M", "CYS");
1908 modifications.put("A5N", "ASN");
1909 modifications.put("A5O", "ALA");
1910 modifications.put("A66", "XAA");
1911 modifications.put("AA3", "ALA");
1912 modifications.put("AA4", "ALA");
1913 modifications.put("AAR", "ARG");
1914 modifications.put("AB7", "XAA");
1915 modifications.put("ABA", "ALA");
1916 modifications.put("ABR", "ALA");
1917 modifications.put("ABS", "ALA");
1918 modifications.put("ABT", "ASN");
1919 modifications.put("ACB", "ASP");
1920 modifications.put("ACL", "ARG");
1921 modifications.put("AD2", "ALA");
1922 modifications.put("ADD", "XAA");
1923 modifications.put("ADX", "ASN");
1924 modifications.put("AEA", "XAA");
1925 modifications.put("AEI", "ASP");
1926 modifications.put("AET", "ALA");
1927 modifications.put("AFA", "ASN");
1928 modifications.put("AFF", "ASN");
1929 modifications.put("AFG", "GLY");
1930 modifications.put("AGM", "ARG");
1931 modifications.put("AGT", "CYS");
1932 modifications.put("AHB", "ASN");
1933 modifications.put("AHH", "XAA");
1934 modifications.put("AHO", "ALA");
1935 modifications.put("AHP", "ALA");
1936 modifications.put("AHS", "XAA");
1937 modifications.put("AHT", "XAA");
1938 modifications.put("AIB", "ALA");
1939 modifications.put("AKL", "ASP");
1940 modifications.put("AKZ", "ASP");
1941 modifications.put("ALA", "ALA");
1942 modifications.put("ALC", "ALA");
1943 modifications.put("ALM", "ALA");
1944 modifications.put("ALN", "ALA");
1945 modifications.put("ALO", "THR");
1946 modifications.put("ALQ", "XAA");
1947 modifications.put("ALS", "ALA");
1948 modifications.put("ALT", "ALA");
1949 modifications.put("ALV", "ALA");
1950 modifications.put("ALY", "LYS");
1951 modifications.put("AN8", "ALA");
1952 modifications.put("AP7", "ALA");
1953 modifications.put("APE", "XAA");
1954 modifications.put("APH", "ALA");
1955 modifications.put("API", "LYS");
1956 modifications.put("APK", "LYS");
1957 modifications.put("APM", "XAA");
1958 modifications.put("APP", "XAA");
1959 modifications.put("AR2", "ARG");
1960 modifications.put("AR4", "GLU");
1961 modifications.put("AR7", "ARG");
1962 modifications.put("ARG", "ARG");
1963 modifications.put("ARM", "ARG");
1964 modifications.put("ARO", "ARG");
1965 modifications.put("ARV", "XAA");
1966 modifications.put("AS ", "ALA");
1967 modifications.put("AS2", "ASP");
1968 modifications.put("AS9", "XAA");
1969 modifications.put("ASA", "ASP");
1970 modifications.put("ASB", "ASP");
1971 modifications.put("ASI", "ASP");
1972 modifications.put("ASK", "ASP");
1973 modifications.put("ASL", "ASP");
1974 modifications.put("ASM", "XAA");
1975 modifications.put("ASN", "ASN");
1976 modifications.put("ASP", "ASP");
1977 modifications.put("ASQ", "ASP");
1978 modifications.put("ASU", "ASN");
1979 modifications.put("ASX", "ASX");
1980 modifications.put("ATD", "THR");
1981 modifications.put("ATL", "THR");
1982 modifications.put("ATM", "THR");
1983 modifications.put("AVC", "ALA");
1984 modifications.put("AVN", "XAA");
1985 modifications.put("AYA", "ALA");
1986 modifications.put("AYG", "AYG");
1987 modifications.put("AZK", "LYS");
1988 modifications.put("AZS", "SER");
1989 modifications.put("AZY", "TYR");
1990 modifications.put("B1F", "PHE");
1991 modifications.put("B1P", "ASN");
1992 modifications.put("B2A", "ALA");
1993 modifications.put("B2F", "PHE");
1994 modifications.put("B2I", "ILE");
1995 modifications.put("B2V", "VAL");
1996 modifications.put("B3A", "ALA");
1997 modifications.put("B3D", "ASP");
1998 modifications.put("B3E", "GLU");
1999 modifications.put("B3K", "LYS");
2000 modifications.put("B3L", "XAA");
2001 modifications.put("B3M", "XAA");
2002 modifications.put("B3Q", "XAA");
2003 modifications.put("B3S", "SER");
2004 modifications.put("B3T", "XAA");
2005 modifications.put("B3U", "HIS");
2006 modifications.put("B3X", "ASN");
2007 modifications.put("B3Y", "TYR");
2008 modifications.put("BB6", "CYS");
2009 modifications.put("BB7", "CYS");
2010 modifications.put("BB8", "PHE");
2011 modifications.put("BB9", "CYS");
2012 modifications.put("BBC", "CYS");
2013 modifications.put("BCS", "CYS");
2014 modifications.put("BE2", "XAA");
2015 modifications.put("BFD", "ASP");
2016 modifications.put("BG1", "SER");
2017 modifications.put("BGM", "GLY");
2018 modifications.put("BH2", "ASP");
2019 modifications.put("BHD", "ASP");
2020 modifications.put("BIF", "PHE");
2021 modifications.put("BIL", "XAA");
2022 modifications.put("BIU", "ILE");
2023 modifications.put("BJH", "XAA");
2024 modifications.put("BLE", "LEU");
2025 modifications.put("BLY", "LYS");
2026 modifications.put("BMP", "ASN");
2027 modifications.put("BMT", "THR");
2028 modifications.put("BNN", "PHE");
2029 modifications.put("BNO", "XAA");
2030 modifications.put("BOE", "THR");
2031 modifications.put("BOR", "ARG");
2032 modifications.put("BPE", "CYS");
2033 modifications.put("BRU", "UR3");
2034 modifications.put("BSE", "SER");
2035 modifications.put("BT5", "ASN");
2036 modifications.put("BTA", "LEU");
2037 modifications.put("BTC", "CYS");
2038 modifications.put("BTR", "TRP");
2039 modifications.put("BUC", "CYS");
2040 modifications.put("BUG", "VAL");
2041 modifications.put("BVP", "UR3");
2042 modifications.put("BZG", "ASN");
2043 modifications.put("C ", "CYS");
2044 modifications.put("C12", "TYG");
2045 modifications.put("C1X", "LYS");
2046 modifications.put("C25", "CYS");
2047 modifications.put("C2L", "CYS");
2048 modifications.put("C2S", "CYS");
2049 modifications.put("C31", "CYS");
2050 modifications.put("C32", "CYS");
2051 modifications.put("C34", "CYS");
2052 modifications.put("C36", "CYS");
2053 modifications.put("C37", "CYS");
2054 modifications.put("C38", "CYS");
2055 modifications.put("C3Y", "CYS");
2056 modifications.put("C42", "CYS");
2057 modifications.put("C43", "CYS");
2058 modifications.put("C45", "CYS");
2059 modifications.put("C46", "CYS");
2060 modifications.put("C49", "CYS");
2061 modifications.put("C4R", "CYS");
2062 modifications.put("C4S", "CYS");
2063 modifications.put("C5C", "CYS");
2064 modifications.put("C66", "XAA");
2065 modifications.put("C6C", "CYS");
2066 modifications.put("C99", "TFG");
2067 modifications.put("CAF", "CYS");
2068 modifications.put("CAL", "XAA");
2069 modifications.put("CAR", "CYS");
2070 modifications.put("CAS", "CYS");
2071 modifications.put("CAV", "XAA");
2072 modifications.put("CAY", "CYS");
2073 modifications.put("CB2", "CYS");
2074 modifications.put("CBR", "CYS");
2075 modifications.put("CBV", "CYS");
2076 modifications.put("CCC", "CYS");
2077 modifications.put("CCL", "LYS");
2078 modifications.put("CCS", "CYS");
2079 modifications.put("CCY", "CYG");
2080 modifications.put("CDE", "XAA");
2081 modifications.put("CDV", "XAA");
2082 modifications.put("CDW", "CYS");
2083 modifications.put("CEA", "CYS");
2084 modifications.put("CFL", "CYS");
2085 modifications.put("CFY", "FCYG"); // check
2086 modifications.put("CG1", "GLY");
2087 modifications.put("CGA", "GLU");
2088 modifications.put("CGU", "GLU");
2089 modifications.put("CH ", "CYS");
2090 modifications.put("CH6", "MYG");
2091 modifications.put("CH7", "KYG");
2092 modifications.put("CHF", "XAA");
2093 modifications.put("CHG", "XAA");
2094 modifications.put("CHP", "GLY");
2095 modifications.put("CHS", "XAA");
2096 modifications.put("CIR", "ARG");
2097 modifications.put("CJO", "GYG");
2098 modifications.put("CLE", "LEU");
2099 modifications.put("CLG", "LYS");
2100 modifications.put("CLH", "LYS");
2101 modifications.put("CLV", "AFG");
2102 modifications.put("CM0", "ASN");
2103 modifications.put("CME", "CYS");
2104 modifications.put("CMH", "CYS");
2105 modifications.put("CML", "CYS");
2106 modifications.put("CMR", "CYS");
2107 modifications.put("CMT", "CYS");
2108 modifications.put("CNU", "UR3");
2109 modifications.put("CP1", "CYS");
2110 modifications.put("CPC", "XAA");
2111 modifications.put("CPI", "XAA");
2112 modifications.put("CQR", "GYG");
2113 modifications.put("CR0", "TLG");
2114 modifications.put("CR2", "GYG");
2115 modifications.put("CR5", "GLY");
2116 modifications.put("CR7", "KYG");
2117 modifications.put("CR8", "HYG");
2118 modifications.put("CRF", "TWG");
2119 modifications.put("CRG", "THG");
2120 modifications.put("CRK", "MYG");
2121 modifications.put("CRO", "GYG");
2122 modifications.put("CRQ", "QYG");
2123 modifications.put("CRU", "EYG");
2124 modifications.put("CRW", "ASG");
2125 modifications.put("CRX", "ASG");
2126 modifications.put("CS0", "CYS");
2127 modifications.put("CS1", "CYS");
2128 modifications.put("CS3", "CYS");
2129 modifications.put("CS4", "CYS");
2130 modifications.put("CS8", "ASN");
2131 modifications.put("CSA", "CYS");
2132 modifications.put("CSB", "CYS");
2133 modifications.put("CSD", "CYS");
2134 modifications.put("CSE", "CYS");
2135 modifications.put("CSF", "CYS");
2136 modifications.put("CSH", "SHG");
2137 modifications.put("CSI", "GLY");
2138 modifications.put("CSJ", "CYS");
2139 modifications.put("CSL", "CYS");
2140 modifications.put("CSO", "CYS");
2141 modifications.put("CSP", "CYS");
2142 modifications.put("CSR", "CYS");
2143 modifications.put("CSS", "CYS");
2144 modifications.put("CSU", "CYS");
2145 modifications.put("CSW", "CYS");
2146 modifications.put("CSX", "CYS");
2147 modifications.put("CSY", "SYG");
2148 modifications.put("CSZ", "CYS");
2149 modifications.put("CTE", "TRP");
2150 modifications.put("CTG", "THR");
2151 modifications.put("CTH", "THR");
2152 modifications.put("CUC", "XAA");
2153 modifications.put("CWR", "SER");
2154 modifications.put("CXM", "MET");
2155 modifications.put("CY0", "CYS");
2156 modifications.put("CY1", "CYS");
2157 modifications.put("CY3", "CYS");
2158 modifications.put("CY4", "CYS");
2159 modifications.put("CYA", "CYS");
2160 modifications.put("CYD", "CYS");
2161 modifications.put("CYF", "CYS");
2162 modifications.put("CYG", "CYS");
2163 modifications.put("CYJ", "XAA");
2164 modifications.put("CYM", "CYS");
2165 modifications.put("CYQ", "CYS");
2166 modifications.put("CYR", "CYS");
2167 modifications.put("CYS", "CYS");
2168 modifications.put("CZ2", "CYS");
2169 modifications.put("CZO", "GYG");
2170 modifications.put("CZZ", "CYS");
2171 modifications.put("D11", "THR");
2172 modifications.put("D1P", "ASN");
2173 modifications.put("D3 ", "ASN");
2174 modifications.put("D33", "ASN");
2175 modifications.put("D3P", "GLY");
2176 modifications.put("D3T", "THR");
2177 modifications.put("D4M", "THR");
2178 modifications.put("D4P", "XAA");
2179 modifications.put("DA ", "ALA");
2180 modifications.put("DA2", "XAA");
2181 modifications.put("DAB", "ALA");
2182 modifications.put("DAH", "PHE");
2183 modifications.put("DAL", "ALA");
2184 modifications.put("DAR", "ARG");
2185 modifications.put("DAS", "ASP");
2186 modifications.put("DBB", "THR");
2187 modifications.put("DBM", "ASN");
2188 modifications.put("DBS", "SER");
2189 modifications.put("DBU", "THR");
2190 modifications.put("DBY", "TYR");
2191 modifications.put("DBZ", "ALA");
2192 modifications.put("DC ", "CYS");
2193 modifications.put("DC2", "CYS");
2194 modifications.put("DCG", "GLY");
2195 modifications.put("DCI", "XAA");
2196 modifications.put("DCL", "XAA");
2197 modifications.put("DCT", "CYS");
2198 modifications.put("DCY", "CYS");
2199 modifications.put("DDE", "HIS");
2200 modifications.put("DDG", "GLY");
2201 modifications.put("DDN", "UR3");
2202 modifications.put("DDX", "ASN");
2203 modifications.put("DFC", "CYS");
2204 modifications.put("DFG", "GLY");
2205 modifications.put("DFI", "XAA");
2206 modifications.put("DFO", "XAA");
2207 modifications.put("DFT", "ASN");
2208 modifications.put("DG ", "GLY");
2209 modifications.put("DGH", "GLY");
2210 modifications.put("DGI", "GLY");
2211 modifications.put("DGL", "GLU");
2212 modifications.put("DGN", "GLN");
2213 modifications.put("DHA", "SER");
2214 modifications.put("DHI", "HIS");
2215 modifications.put("DHL", "XAA");
2216 modifications.put("DHN", "VAL");
2217 modifications.put("DHP", "XAA");
2218 modifications.put("DHU", "UR3");
2219 modifications.put("DHV", "VAL");
2220 modifications.put("DI ", "ILE");
2221 modifications.put("DIL", "ILE");
2222 modifications.put("DIR", "ARG");
2223 modifications.put("DIV", "VAL");
2224 modifications.put("DLE", "LEU");
2225 modifications.put("DLS", "LYS");
2226 modifications.put("DLY", "LYS");
2227 modifications.put("DM0", "LYS");
2228 modifications.put("DMH", "ASN");
2229 modifications.put("DMK", "ASP");
2230 modifications.put("DMT", "XAA");
2231 modifications.put("DN ", "ASN");
2232 modifications.put("DNE", "LEU");
2233 modifications.put("DNG", "LEU");
2234 modifications.put("DNL", "LYS");
2235 modifications.put("DNM", "LEU");
2236 modifications.put("DNP", "ALA");
2237 modifications.put("DNR", "CYS");
2238 modifications.put("DNS", "LYS");
2239 modifications.put("DOA", "XAA");
2240 modifications.put("DOC", "CYS");
2241 modifications.put("DOH", "ASP");
2242 modifications.put("DON", "LEU");
2243 modifications.put("DPB", "THR");
2244 modifications.put("DPH", "PHE");
2245 modifications.put("DPL", "PRO");
2246 modifications.put("DPP", "ALA");
2247 modifications.put("DPQ", "TYR");
2248 modifications.put("DPR", "PRO");
2249 modifications.put("DPY", "ASN");
2250 modifications.put("DRM", "UR3");
2251 modifications.put("DRP", "ASN");
2252 modifications.put("DRT", "THR");
2253 modifications.put("DRZ", "ASN");
2254 modifications.put("DSE", "SER");
2255 modifications.put("DSG", "ASN");
2256 modifications.put("DSN", "SER");
2257 modifications.put("DSP", "ASP");
2258 modifications.put("DT ", "THR");
2259 modifications.put("DTH", "THR");
2260 modifications.put("DTR", "TRP");
2261 modifications.put("DTY", "TYR");
2262 modifications.put("DU ", "UR3");
2263 modifications.put("DVA", "VAL");
2264 modifications.put("DXD", "ASN");
2265 modifications.put("DXN", "ASN");
2266 modifications.put("DYG", "DYG");
2267 modifications.put("DYS", "CYS");
2268 modifications.put("DZM", "ALA");
2269 modifications.put("E ", "ALA");
2270 modifications.put("E1X", "ALA");
2271 modifications.put("ECC", "GLN");
2272 modifications.put("EDA", "ALA");
2273 modifications.put("EFC", "CYS");
2274 modifications.put("EHP", "PHE");
2275 modifications.put("EIT", "THR");
2276 modifications.put("ENP", "ASN");
2277 modifications.put("ESB", "TYR");
2278 modifications.put("ESC", "MET");
2279 modifications.put("EXB", "XAA");
2280 modifications.put("EXY", "LEU");
2281 modifications.put("EY5", "ASN");
2282 modifications.put("EYS", "XAA");
2283 modifications.put("F2F", "PHE");
2284 modifications.put("FA2", "ALA");
2285 modifications.put("FA5", "ASN");
2286 modifications.put("FAG", "ASN");
2287 modifications.put("FAI", "ASN");
2288 modifications.put("FB5", "ALA");
2289 modifications.put("FB6", "ALA");
2290 modifications.put("FCL", "PHE");
2291 modifications.put("FFD", "ASN");
2292 modifications.put("FGA", "GLU");
2293 modifications.put("FGL", "GLY");
2294 modifications.put("FGP", "SER");
2295 modifications.put("FHL", "XAA");
2296 modifications.put("FHO", "LYS");
2297 modifications.put("FHU", "UR3");
2298 modifications.put("FLA", "ALA");
2299 modifications.put("FLE", "LEU");
2300 modifications.put("FLT", "TYR");
2301 modifications.put("FME", "MET");
2302 modifications.put("FMG", "GLY");
2303 modifications.put("FMU", "ASN");
2304 modifications.put("FOE", "CYS");
2305 modifications.put("FOX", "GLY");
2306 modifications.put("FP9", "PRO");
2307 modifications.put("FPA", "PHE");
2308 modifications.put("FRD", "XAA");
2309 modifications.put("FT6", "TRP");
2310 modifications.put("FTR", "TRP");
2311 modifications.put("FTY", "TYR");
2312 modifications.put("FVA", "VAL");
2313 modifications.put("FZN", "LYS");
2314 modifications.put("G ", "GLY");
2315 modifications.put("G25", "GLY");
2316 modifications.put("G2L", "GLY");
2317 modifications.put("G2S", "GLY");
2318 modifications.put("G31", "GLY");
2319 modifications.put("G32", "GLY");
2320 modifications.put("G33", "GLY");
2321 modifications.put("G36", "GLY");
2322 modifications.put("G38", "GLY");
2323 modifications.put("G42", "GLY");
2324 modifications.put("G46", "GLY");
2325 modifications.put("G47", "GLY");
2326 modifications.put("G48", "GLY");
2327 modifications.put("G49", "GLY");
2328 modifications.put("G4P", "ASN");
2329 modifications.put("G7M", "GLY");
2330 modifications.put("GAO", "GLY");
2331 modifications.put("GAU", "GLU");
2332 modifications.put("GCK", "CYS");
2333 modifications.put("GCM", "XAA");
2334 modifications.put("GDP", "GLY");
2335 modifications.put("GDR", "GLY");
2336 modifications.put("GFL", "GLY");
2337 modifications.put("GGL", "GLU");
2338 modifications.put("GH3", "GLY");
2339 modifications.put("GHG", "GLN");
2340 modifications.put("GHP", "GLY");
2341 modifications.put("GL3", "GLY");
2342 modifications.put("GLH", "GLN");
2343 modifications.put("GLJ", "GLU");
2344 modifications.put("GLK", "GLU");
2345 modifications.put("GLM", "XAA");
2346 modifications.put("GLN", "GLN");
2347 modifications.put("GLQ", "GLU");
2348 modifications.put("GLU", "GLU");
2349 modifications.put("GLX", "GLX");
2350 modifications.put("GLY", "GLY");
2351 modifications.put("GLZ", "GLY");
2352 modifications.put("GMA", "GLU");
2353 modifications.put("GMS", "GLY");
2354 modifications.put("GMU", "UR3");
2355 modifications.put("GN7", "GLY");
2356 modifications.put("GND", "XAA");
2357 modifications.put("GNE", "ASN");
2358 modifications.put("GOM", "GLY");
2359 modifications.put("GPL", "LYS");
2360 modifications.put("GS ", "GLY");
2361 modifications.put("GSC", "GLY");
2362 modifications.put("GSR", "GLY");
2363 modifications.put("GSS", "GLY");
2364 modifications.put("GSU", "GLU");
2365 modifications.put("GT9", "CYS");
2366 modifications.put("GTP", "GLY");
2367 modifications.put("GVL", "XAA");
2368 modifications.put("GYC", "CYG");
2369 modifications.put("GYS", "SYG");
2370 modifications.put("H2U", "UR3");
2371 modifications.put("H5M", "PRO");
2372 modifications.put("HAC", "ALA");
2373 modifications.put("HAR", "ARG");
2374 modifications.put("HBN", "HIS");
2375 modifications.put("HCS", "XAA");
2376 modifications.put("HDP", "UR3");
2377 modifications.put("HEU", "UR3");
2378 modifications.put("HFA", "XAA");
2379 modifications.put("HGL", "XAA");
2380 modifications.put("HHI", "HIS");
2381 modifications.put("HHK", "AK"); // check
2382 modifications.put("HIA", "HIS");
2383 modifications.put("HIC", "HIS");
2384 modifications.put("HIP", "HIS");
2385 modifications.put("HIQ", "HIS");
2386 modifications.put("HIS", "HIS");
2387 modifications.put("HL2", "LEU");
2388 modifications.put("HLU", "LEU");
2389 modifications.put("HMR", "ARG");
2390 modifications.put("HOL", "ASN");
2391 modifications.put("HPC", "PHE");
2392 modifications.put("HPE", "PHE");
2393 modifications.put("HPH", "PHE");
2394 modifications.put("HPQ", "PHE");
2395 modifications.put("HQA", "ALA");
2396 modifications.put("HRG", "ARG");
2397 modifications.put("HRP", "TRP");
2398 modifications.put("HS8", "HIS");
2399 modifications.put("HS9", "HIS");
2400 modifications.put("HSE", "SER");
2401 modifications.put("HSL", "SER");
2402 modifications.put("HSO", "HIS");
2403 modifications.put("HTI", "CYS");
2404 modifications.put("HTN", "ASN");
2405 modifications.put("HTR", "TRP");
2406 modifications.put("HV5", "ALA");
2407 modifications.put("HVA", "VAL");
2408 modifications.put("HY3", "PRO");
2409 modifications.put("HYP", "PRO");
2410 modifications.put("HZP", "PRO");
2411 modifications.put("I ", "ILE");
2412 modifications.put("I2M", "ILE");
2413 modifications.put("I58", "LYS");
2414 modifications.put("I5C", "CYS");
2415 modifications.put("IAM", "ALA");
2416 modifications.put("IAR", "ARG");
2417 modifications.put("IAS", "ASP");
2418 modifications.put("IC ", "CYS");
2419 modifications.put("IEL", "LYS");
2420 modifications.put("IEY", "HYG");
2421 modifications.put("IG ", "GLY");
2422 modifications.put("IGL", "GLY");
2423 modifications.put("IGU", "GLY");
2424 modifications.put("IIC", "SHG");
2425 modifications.put("IIL", "ILE");
2426 modifications.put("ILE", "ILE");
2427 modifications.put("ILG", "GLU");
2428 modifications.put("ILX", "ILE");
2429 modifications.put("IMC", "CYS");
2430 modifications.put("IML", "ILE");
2431 modifications.put("IOY", "PHE");
2432 modifications.put("IPG", "GLY");
2433 modifications.put("IPN", "ASN");
2434 modifications.put("IRN", "ASN");
2435 modifications.put("IT1", "LYS");
2436 modifications.put("IU ", "UR3");
2437 modifications.put("IYR", "TYR");
2438 modifications.put("IYT", "THR");
2439 modifications.put("IZO", "MET");
2440 modifications.put("JJJ", "CYS");
2441 modifications.put("JJK", "CYS");
2442 modifications.put("JJL", "CYS");
2443 modifications.put("JW5", "ASN");
2444 modifications.put("K1R", "CYS");
2445 modifications.put("KAG", "GLY");
2446 modifications.put("KCX", "LYS");
2447 modifications.put("KGC", "LYS");
2448 modifications.put("KNB", "ALA");
2449 modifications.put("KOR", "MET");
2450 modifications.put("KPI", "LYS");
2451 modifications.put("KST", "LYS");
2452 modifications.put("KYQ", "LYS");
2453 modifications.put("L2A", "XAA");
2454 modifications.put("LA2", "LYS");
2455 modifications.put("LAA", "ASP");
2456 modifications.put("LAL", "ALA");
2457 modifications.put("LBY", "LYS");
2458 modifications.put("LC ", "CYS");
2459 modifications.put("LCA", "ALA");
2460 modifications.put("LCC", "ASN");
2461 modifications.put("LCG", "GLY");
2462 modifications.put("LCH", "ASN");
2463 modifications.put("LCK", "LYS");
2464 modifications.put("LCX", "LYS");
2465 modifications.put("LDH", "LYS");
2466 modifications.put("LED", "LEU");
2467 modifications.put("LEF", "LEU");
2468 modifications.put("LEH", "LEU");
2469 modifications.put("LEI", "VAL");
2470 modifications.put("LEM", "LEU");
2471 modifications.put("LEN", "LEU");
2472 modifications.put("LET", "XAA");
2473 modifications.put("LEU", "LEU");
2474 modifications.put("LEX", "LEU");
2475 modifications.put("LG ", "GLY");
2476 modifications.put("LGP", "GLY");
2477 modifications.put("LHC", "XAA");
2478 modifications.put("LHU", "UR3");
2479 modifications.put("LKC", "ASN");
2480 modifications.put("LLP", "LYS");
2481 modifications.put("LLY", "LYS");
2482 modifications.put("LME", "GLU");
2483 modifications.put("LMF", "LYS");
2484 modifications.put("LMQ", "GLN");
2485 modifications.put("LMS", "ASN");
2486 modifications.put("LP6", "LYS");
2487 modifications.put("LPD", "PRO");
2488 modifications.put("LPG", "GLY");
2489 modifications.put("LPL", "XAA");
2490 modifications.put("LPS", "SER");
2491 modifications.put("LSO", "XAA");
2492 modifications.put("LTA", "XAA");
2493 modifications.put("LTR", "TRP");
2494 modifications.put("LVG", "GLY");
2495 modifications.put("LVN", "VAL");
2496 modifications.put("LYF", "LYS");
2497 modifications.put("LYK", "LYS");
2498 modifications.put("LYM", "LYS");
2499 modifications.put("LYN", "LYS");
2500 modifications.put("LYR", "LYS");
2501 modifications.put("LYS", "LYS");
2502 modifications.put("LYX", "LYS");
2503 modifications.put("LYZ", "LYS");
2504 modifications.put("M0H", "CYS");
2505 modifications.put("M1G", "GLY");
2506 modifications.put("M2G", "GLY");
2507 modifications.put("M2L", "LYS");
2508 modifications.put("M2S", "MET");
2509 modifications.put("M30", "GLY");
2510 modifications.put("M3L", "LYS");
2511 modifications.put("M5M", "CYS");
2512 modifications.put("MA ", "ALA");
2513 modifications.put("MA6", "ALA");
2514 modifications.put("MA7", "ALA");
2515 modifications.put("MAA", "ALA");
2516 modifications.put("MAD", "ALA");
2517 modifications.put("MAI", "ARG");
2518 modifications.put("MBQ", "TYR");
2519 modifications.put("MBZ", "ASN");
2520 modifications.put("MC1", "SER");
2521 modifications.put("MCG", "XAA");
2522 modifications.put("MCL", "LYS");
2523 modifications.put("MCS", "CYS");
2524 modifications.put("MCY", "CYS");
2525 modifications.put("MD3", "CYS");
2526 modifications.put("MD6", "GLY");
2527 modifications.put("MDH", "XAA");
2528 modifications.put("MDO", "ASG");
2529 modifications.put("MDR", "ASN");
2530 modifications.put("MEA", "PHE");
2531 modifications.put("MED", "MET");
2532 modifications.put("MEG", "GLU");
2533 modifications.put("MEN", "ASN");
2534 modifications.put("MEP", "UR3");
2535 modifications.put("MEQ", "GLN");
2536 modifications.put("MET", "MET");
2537 modifications.put("MEU", "GLY");
2538 modifications.put("MF3", "XAA");
2539 modifications.put("MFC", "GYG");
2540 modifications.put("MG1", "GLY");
2541 modifications.put("MGG", "ARG");
2542 modifications.put("MGN", "GLN");
2543 modifications.put("MGQ", "ALA");
2544 modifications.put("MGV", "GLY");
2545 modifications.put("MGY", "GLY");
2546 modifications.put("MHL", "LEU");
2547 modifications.put("MHO", "MET");
2548 modifications.put("MHS", "HIS");
2549 modifications.put("MIA", "ALA");
2550 modifications.put("MIS", "SER");
2551 modifications.put("MK8", "LEU");
2552 modifications.put("ML3", "LYS");
2553 modifications.put("MLE", "LEU");
2554 modifications.put("MLL", "LEU");
2555 modifications.put("MLY", "LYS");
2556 modifications.put("MLZ", "LYS");
2557 modifications.put("MME", "MET");
2558 modifications.put("MMO", "ARG");
2559 modifications.put("MMT", "THR");
2560 modifications.put("MND", "ASN");
2561 modifications.put("MNL", "LEU");
2562 modifications.put("MNU", "UR3");
2563 modifications.put("MNV", "VAL");
2564 modifications.put("MOD", "XAA");
2565 modifications.put("MP8", "PRO");
2566 modifications.put("MPH", "XAA");
2567 modifications.put("MPJ", "XAA");
2568 modifications.put("MPQ", "GLY");
2569 modifications.put("MRG", "GLY");
2570 modifications.put("MSA", "GLY");
2571 modifications.put("MSE", "MET");
2572 modifications.put("MSL", "MET");
2573 modifications.put("MSO", "MET");
2574 modifications.put("MSP", "XAA");
2575 modifications.put("MT2", "MET");
2576 modifications.put("MTR", "THR");
2577 modifications.put("MTU", "ALA");
2578 modifications.put("MTY", "TYR");
2579 modifications.put("MVA", "VAL");
2580 modifications.put("N ", "ASN");
2581 modifications.put("N10", "SER");
2582 modifications.put("N2C", "XAA");
2583 modifications.put("N5I", "ASN");
2584 modifications.put("N5M", "CYS");
2585 modifications.put("N6G", "GLY");
2586 modifications.put("N7P", "PRO");
2587 modifications.put("NA8", "ALA");
2588 modifications.put("NAL", "ALA");
2589 modifications.put("NAM", "ALA");
2590 modifications.put("NB8", "ASN");
2591 modifications.put("NBQ", "TYR");
2592 modifications.put("NC1", "SER");
2593 modifications.put("NCB", "ALA");
2594 modifications.put("NCX", "ASN");
2595 modifications.put("NCY", "XAA");
2596 modifications.put("NDF", "PHE");
2597 modifications.put("NDN", "UR3");
2598 modifications.put("NEM", "HIS");
2599 modifications.put("NEP", "HIS");
2600 modifications.put("NF2", "ASN");
2601 modifications.put("NFA", "PHE");
2602 modifications.put("NHL", "GLU");
2603 modifications.put("NIT", "XAA");
2604 modifications.put("NIY", "TYR");
2605 modifications.put("NLE", "LEU");
2606 modifications.put("NLN", "LEU");
2607 modifications.put("NLO", "LEU");
2608 modifications.put("NLP", "LEU");
2609 modifications.put("NLQ", "GLN");
2610 modifications.put("NMC", "GLY");
2611 modifications.put("NMM", "ARG");
2612 modifications.put("NMS", "THR");
2613 modifications.put("NMT", "THR");
2614 modifications.put("NNH", "ARG");
2615 modifications.put("NP3", "ASN");
2616 modifications.put("NPH", "CYS");
2617 modifications.put("NPI", "ALA");
2618 modifications.put("NRP", "LYG");
2619 modifications.put("NRQ", "MYG");
2620 modifications.put("NSK", "XAA");
2621 modifications.put("NTY", "TYR");
2622 modifications.put("NVA", "VAL");
2623 modifications.put("NYC", "TWG");
2624 modifications.put("NYG", "NYG");
2625 modifications.put("NYM", "ASN");
2626 modifications.put("NYS", "CYS");
2627 modifications.put("NZH", "HIS");
2628 modifications.put("O12", "XAA");
2629 modifications.put("O2C", "ASN");
2630 modifications.put("O2G", "GLY");
2631 modifications.put("OAD", "ASN");
2632 modifications.put("OAS", "SER");
2633 modifications.put("OBF", "XAA");
2634 modifications.put("OBS", "XAA");
2635 modifications.put("OCS", "CYS");
2636 modifications.put("OCY", "CYS");
2637 modifications.put("ODP", "ASN");
2638 modifications.put("OHI", "HIS");
2639 modifications.put("OHS", "ASP");
2640 modifications.put("OIC", "XAA");
2641 modifications.put("OIP", "ILE");
2642 modifications.put("OLE", "XAA");
2643 modifications.put("OLT", "THR");
2644 modifications.put("OLZ", "SER");
2645 modifications.put("OMC", "CYS");
2646 modifications.put("OMG", "GLY");
2647 modifications.put("OMT", "MET");
2648 modifications.put("OMU", "UR3");
2649 modifications.put("ONE", "UR3");
2650 modifications.put("ONH", "ALA");
2651 modifications.put("ONL", "XAA");
2652 modifications.put("OPR", "ARG");
2653 modifications.put("ORN", "ALA");
2654 modifications.put("ORQ", "ARG");
2655 modifications.put("OSE", "SER");
2656 modifications.put("OTB", "XAA");
2657 modifications.put("OTH", "THR");
2658 modifications.put("OTY", "TYR");
2659 modifications.put("OXX", "ASP");
2660 modifications.put("P ", "GLY");
2661 modifications.put("P1L", "CYS");
2662 modifications.put("P1P", "ASN");
2663 modifications.put("P2T", "THR");
2664 modifications.put("P2U", "UR3");
2665 modifications.put("P2Y", "PRO");
2666 modifications.put("P5P", "ALA");
2667 modifications.put("PAQ", "TYR");
2668 modifications.put("PAS", "ASP");
2669 modifications.put("PAT", "TRP");
2670 modifications.put("PAU", "ALA");
2671 modifications.put("PBB", "CYS");
2672 modifications.put("PBF", "PHE");
2673 modifications.put("PBT", "ASN");
2674 modifications.put("PCA", "GLU");
2675 modifications.put("PCC", "PRO");
2676 modifications.put("PCE", "XAA");
2677 modifications.put("PCS", "PHE");
2678 modifications.put("PDL", "XAA");
2679 modifications.put("PDU", "UR3");
2680 modifications.put("PEC", "CYS");
2681 modifications.put("PF5", "PHE");
2682 modifications.put("PFF", "PHE");
2683 modifications.put("PFX", "XAA");
2684 modifications.put("PG1", "SER");
2685 modifications.put("PG7", "GLY");
2686 modifications.put("PG9", "GLY");
2687 modifications.put("PGL", "XAA");
2688 modifications.put("PGN", "GLY");
2689 modifications.put("PGP", "GLY");
2690 modifications.put("PGY", "GLY");
2691 modifications.put("PHA", "PHE");
2692 modifications.put("PHD", "ASP");
2693 modifications.put("PHE", "PHE");
2694 modifications.put("PHI", "PHE");
2695 modifications.put("PHL", "PHE");
2696 modifications.put("PHM", "PHE");
2697 modifications.put("PIA", "AYG");
2698 modifications.put("PIV", "XAA");
2699 modifications.put("PLE", "LEU");
2700 modifications.put("PM3", "PHE");
2701 modifications.put("PMT", "CYS");
2702 modifications.put("POM", "PRO");
2703 modifications.put("PPN", "PHE");
2704 modifications.put("PPU", "ALA");
2705 modifications.put("PPW", "GLY");
2706 modifications.put("PQ1", "ASN");
2707 modifications.put("PR3", "CYS");
2708 modifications.put("PR5", "ALA");
2709 modifications.put("PR9", "PRO");
2710 modifications.put("PRN", "ALA");
2711 modifications.put("PRO", "PRO");
2712 modifications.put("PRS", "PRO");
2713 modifications.put("PSA", "PHE");
2714 modifications.put("PSH", "HIS");
2715 modifications.put("PST", "THR");
2716 modifications.put("PSU", "UR3");
2717 modifications.put("PSW", "CYS");
2718 modifications.put("PTA", "XAA");
2719 modifications.put("PTH", "TYR");
2720 modifications.put("PTM", "TYR");
2721 modifications.put("PTR", "TYR");
2722 modifications.put("PU ", "ALA");
2723 modifications.put("PUY", "ASN");
2724 modifications.put("PVH", "HIS");
2725 modifications.put("PVL", "XAA");
2726 modifications.put("PYA", "ALA");
2727 modifications.put("PYO", "UR3");
2728 modifications.put("PYX", "CYS");
2729 modifications.put("PYY", "ASN");
2730 modifications.put("QLG", "QLG");
2731 modifications.put("QMM", "GLN");
2732 modifications.put("QPA", "CYS");
2733 modifications.put("QPH", "PHE");
2734 modifications.put("QUO", "GLY");
2735 modifications.put("R ", "ALA");
2736 modifications.put("R1A", "CYS");
2737 modifications.put("R4K", "TRP");
2738 modifications.put("RC7", "HYG");
2739 modifications.put("RE0", "TRP");
2740 modifications.put("RE3", "TRP");
2741 modifications.put("RIA", "ALA");
2742 modifications.put("RMP", "ALA");
2743 modifications.put("RON", "XAA");
2744 modifications.put("RT ", "THR");
2745 modifications.put("RTP", "ASN");
2746 modifications.put("S1H", "SER");
2747 modifications.put("S2C", "CYS");
2748 modifications.put("S2D", "ALA");
2749 modifications.put("S2M", "THR");
2750 modifications.put("S2P", "ALA");
2751 modifications.put("S4A", "ALA");
2752 modifications.put("S4C", "CYS");
2753 modifications.put("S4G", "GLY");
2754 modifications.put("S4U", "UR3");
2755 modifications.put("S6G", "GLY");
2756 modifications.put("SAC", "SER");
2757 modifications.put("SAH", "CYS");
2758 modifications.put("SAR", "GLY");
2759 modifications.put("SBL", "SER");
2760 modifications.put("SC ", "CYS");
2761 modifications.put("SCH", "CYS");
2762 modifications.put("SCS", "CYS");
2763 modifications.put("SCY", "CYS");
2764 modifications.put("SD2", "XAA");
2765 modifications.put("SDG", "GLY");
2766 modifications.put("SDP", "SER");
2767 modifications.put("SEB", "SER");
2768 modifications.put("SEC", "ALA");
2769 modifications.put("SEG", "ALA");
2770 modifications.put("SEL", "SER");
2771 modifications.put("SEM", "SER");
2772 modifications.put("SEN", "SER");
2773 modifications.put("SEP", "SER");
2774 modifications.put("SER", "SER");
2775 modifications.put("SET", "SER");
2776 modifications.put("SGB", "SER");
2777 modifications.put("SHC", "CYS");
2778 modifications.put("SHP", "GLY");
2779 modifications.put("SHR", "LYS");
2780 modifications.put("SIB", "CYS");
2781 modifications.put("SIC", "DC"); // check
2782 modifications.put("SLA", "PRO");
2783 modifications.put("SLR", "PRO");
2784 modifications.put("SLZ", "LYS");
2785 modifications.put("SMC", "CYS");
2786 modifications.put("SME", "MET");
2787 modifications.put("SMF", "PHE");
2788 modifications.put("SMP", "ALA");
2789 modifications.put("SMT", "THR");
2790 modifications.put("SNC", "CYS");
2791 modifications.put("SNN", "ASN");
2792 modifications.put("SOC", "CYS");
2793 modifications.put("SOS", "ASN");
2794 modifications.put("SOY", "SER");
2795 modifications.put("SPT", "THR");
2796 modifications.put("SRA", "ALA");
2797 modifications.put("SSU", "UR3");
2798 modifications.put("STY", "TYR");
2799 modifications.put("SUB", "XAA");
2800 modifications.put("SUI", "DG");
2801 modifications.put("SUN", "SER");
2802 modifications.put("SUR", "UR3");
2803 modifications.put("SVA", "SER");
2804 modifications.put("SVV", "SER");
2805 modifications.put("SVW", "SER");
2806 modifications.put("SVX", "SER");
2807 modifications.put("SVY", "SER");
2808 modifications.put("SVZ", "XAA");
2809 modifications.put("SWG", "SWG");
2810 modifications.put("SYS", "CYS");
2811 modifications.put("T ", "THR");
2812 modifications.put("T11", "PHE");
2813 modifications.put("T23", "THR");
2814 modifications.put("T2S", "THR");
2815 modifications.put("T2T", "ASN");
2816 modifications.put("T31", "UR3");
2817 modifications.put("T32", "THR");
2818 modifications.put("T36", "THR");
2819 modifications.put("T37", "THR");
2820 modifications.put("T38", "THR");
2821 modifications.put("T39", "THR");
2822 modifications.put("T3P", "THR");
2823 modifications.put("T41", "THR");
2824 modifications.put("T48", "THR");
2825 modifications.put("T49", "THR");
2826 modifications.put("T4S", "THR");
2827 modifications.put("T5O", "UR3");
2828 modifications.put("T5S", "THR");
2829 modifications.put("T66", "XAA");
2830 modifications.put("T6A", "ALA");
2831 modifications.put("TA3", "THR");
2832 modifications.put("TA4", "XAA");
2833 modifications.put("TAF", "THR");
2834 modifications.put("TAL", "ASN");
2835 modifications.put("TAV", "ASP");
2836 modifications.put("TBG", "VAL");
2837 modifications.put("TBM", "THR");
2838 modifications.put("TC1", "CYS");
2839 modifications.put("TCP", "THR");
2840 modifications.put("TCQ", "TYR");
2841 modifications.put("TCR", "TRP");
2842 modifications.put("TCY", "ALA");
2843 modifications.put("TDD", "LEU");
2844 modifications.put("TDY", "THR");
2845 modifications.put("TFE", "THR");
2846 modifications.put("TFO", "ALA");
2847 modifications.put("TFQ", "PHE");
2848 modifications.put("TFT", "THR");
2849 modifications.put("TGP", "GLY");
2850 modifications.put("TH6", "THR");
2851 modifications.put("THC", "THR");
2852 modifications.put("THO", "XAA");
2853 modifications.put("THR", "THR");
2854 modifications.put("THX", "ASN");
2855 modifications.put("THZ", "ARG");
2856 modifications.put("TIH", "ALA");
2857 modifications.put("TLB", "ASN");
2858 modifications.put("TLC", "THR");
2859 modifications.put("TLN", "UR3");
2860 modifications.put("TMB", "THR");
2861 modifications.put("TMD", "THR");
2862 modifications.put("TNB", "CYS");
2863 modifications.put("TNR", "SER");
2864 modifications.put("TOX", "TRP");
2865 modifications.put("TP1", "THR");
2866 modifications.put("TPC", "CYS");
2867 modifications.put("TPG", "GLY");
2868 modifications.put("TPH", "XAA");
2869 modifications.put("TPL", "TRP");
2870 modifications.put("TPO", "THR");
2871 modifications.put("TPQ", "TYR");
2872 modifications.put("TQI", "TRP");
2873 modifications.put("TQQ", "TRP");
2874 modifications.put("TRF", "TRP");
2875 modifications.put("TRG", "LYS");
2876 modifications.put("TRN", "TRP");
2877 modifications.put("TRO", "TRP");
2878 modifications.put("TRP", "TRP");
2879 modifications.put("TRQ", "TRP");
2880 modifications.put("TRW", "TRP");
2881 modifications.put("TRX", "TRP");
2882 modifications.put("TS ", "ASN");
2883 modifications.put("TST", "XAA");
2884 modifications.put("TT ", "ASN");
2885 modifications.put("TTD", "THR");
2886 modifications.put("TTI", "UR3");
2887 modifications.put("TTM", "THR");
2888 modifications.put("TTQ", "TRP");
2889 modifications.put("TTS", "TYR");
2890 modifications.put("TY1", "TYR");
2891 modifications.put("TY2", "TYR");
2892 modifications.put("TY3", "TYR");
2893 modifications.put("TY5", "TYR");
2894 modifications.put("TYB", "TYR");
2895 modifications.put("TYI", "TYR");
2896 modifications.put("TYJ", "TYR");
2897 modifications.put("TYN", "TYR");
2898 modifications.put("TYO", "TYR");
2899 modifications.put("TYQ", "TYR");
2900 modifications.put("TYR", "TYR");
2901 modifications.put("TYS", "TYR");
2902 modifications.put("TYT", "TYR");
2903 modifications.put("TYU", "ASN");
2904 modifications.put("TYW", "TYR");
2905 modifications.put("TYX", "XAA");
2906 modifications.put("TYY", "TYR");
2907 modifications.put("TZB", "XAA");
2908 modifications.put("TZO", "XAA");
2909 modifications.put("U ", "UR3");
2910 modifications.put("U25", "UR3");
2911 modifications.put("U2L", "UR3");
2912 modifications.put("U2N", "UR3");
2913 modifications.put("U2P", "UR3");
2914 modifications.put("U31", "UR3");
2915 modifications.put("U33", "UR3");
2916 modifications.put("U34", "UR3");
2917 modifications.put("U36", "UR3");
2918 modifications.put("U37", "UR3");
2919 modifications.put("U8U", "UR3");
2920 modifications.put("UAR", "UR3");
2921 modifications.put("UCL", "UR3");
2922 modifications.put("UD5", "UR3");
2923 modifications.put("UDP", "ASN");
2924 modifications.put("UFP", "ASN");
2925 modifications.put("UFR", "UR3");
2926 modifications.put("UFT", "UR3");
2927 modifications.put("UMA", "ALA");
2928 modifications.put("UMP", "UR3");
2929 modifications.put("UMS", "UR3");
2930 modifications.put("UN1", "XAA");
2931 modifications.put("UN2", "XAA");
2932 modifications.put("UNK", "XAA");
2933 modifications.put("UR3", "UR3");
2934 modifications.put("URD", "UR3");
2935 modifications.put("US1", "UR3");
2936 modifications.put("US2", "UR3");
2937 modifications.put("US3", "THR");
2938 modifications.put("US5", "UR3");
2939 modifications.put("USM", "UR3");
2940 modifications.put("VAD", "VAL");
2941 modifications.put("VAF", "VAL");
2942 modifications.put("VAL", "VAL");
2943 modifications.put("VB1", "LYS");
2944 modifications.put("VDL", "XAA");
2945 modifications.put("VLL", "XAA");
2946 modifications.put("VLM", "XAA");
2947 modifications.put("VMS", "XAA");
2948 modifications.put("VOL", "XAA");
2949 modifications.put("WCR", "GYG");
2950 modifications.put("X ", "GLY");
2951 modifications.put("X2W", "GLU");
2952 modifications.put("X4A", "ASN");
2953 modifications.put("X9Q", "AFG");
2954 modifications.put("XAD", "ALA");
2955 modifications.put("XAE", "ASN");
2956 modifications.put("XAL", "ALA");
2957 modifications.put("XAR", "ASN");
2958 modifications.put("XCL", "CYS");
2959 modifications.put("XCN", "CYS");
2960 modifications.put("XCP", "XAA");
2961 modifications.put("XCR", "CYS");
2962 modifications.put("XCS", "ASN");
2963 modifications.put("XCT", "CYS");
2964 modifications.put("XCY", "CYS");
2965 modifications.put("XGA", "ASN");
2966 modifications.put("XGL", "GLY");
2967 modifications.put("XGR", "GLY");
2968 modifications.put("XGU", "GLY");
2969 modifications.put("XPR", "PRO");
2970 modifications.put("XSN", "ASN");
2971 modifications.put("XTH", "THR");
2972 modifications.put("XTL", "THR");
2973 modifications.put("XTR", "THR");
2974 modifications.put("XTS", "GLY");
2975 modifications.put("XTY", "ASN");
2976 modifications.put("XUA", "ALA");
2977 modifications.put("XUG", "GLY");
2978 modifications.put("XX1", "LYS");
2979 modifications.put("XXY", "THG");
2980 modifications.put("XYG", "DYG");
2981 modifications.put("Y ", "ALA");
2982 modifications.put("YCM", "CYS");
2983 modifications.put("YG ", "GLY");
2984 modifications.put("YOF", "TYR");
2985 modifications.put("YRR", "ASN");
2986 modifications.put("YYG", "GLY");
2987 modifications.put("Z ", "CYS");
2988 modifications.put("Z01", "ALA");
2989 modifications.put("ZAD", "ALA");
2990 modifications.put("ZAL", "ALA");
2991 modifications.put("ZBC", "CYS");
2992 modifications.put("ZBU", "UR3");
2993 modifications.put("ZCL", "PHE");
2994 modifications.put("ZCY", "CYS");
2995 modifications.put("ZDU", "UR3");
2996 modifications.put("ZFB", "XAA");
2997 modifications.put("ZGU", "GLY");
2998 modifications.put("ZHP", "ASN");
2999 modifications.put("ZTH", "THR");
3000 modifications.put("ZU0", "THR");
3001 modifications.put("ZZJ", "ALA");
3005 public static String getCanonicalAminoAcid(String aa)
3007 String canonical = modifications.get(aa);
3008 return canonical == null ? aa : canonical;
3012 * translate to RNA secondary structure representation
3015 * @return ssstring as a RNA-state secondary structure assignment.
3017 public static String getRNASecStrucState(String ssstring)
3019 if (ssstring == null)
3023 StringBuffer ss = new StringBuffer();
3024 for (int i = 0; i < ssstring.length(); i++)
3026 String ssc = ssstring.substring(i, i + 1);
3027 if (toRNAssState.containsKey(ssc))
3029 // valid ss character - so return it
3030 ss.append(ssc); // (String) toRNAssState.get(ssc));
3037 return ss.toString();
3040 public static boolean isCloseParenRNA(char dc)
3042 return RNAcloseParen[dc];
3045 // main method generates perl representation of residue property hash
3047 public static void main(String[] args)
3049 Hashtable aa = new Hashtable();
3050 System.out.println("my %aa = {");
3051 // invert property hashes
3052 Enumeration prop = propHash.keys();
3053 while (prop.hasMoreElements())
3055 String pname = (String) prop.nextElement();
3056 Hashtable phash = (Hashtable) propHash.get(pname);
3057 Enumeration res = phash.keys();
3058 while (res.hasMoreElements())
3060 String rname = (String) res.nextElement();
3061 Vector aprops = (Vector) aa.get(rname);
3064 aprops = new Vector();
3065 aa.put(rname, aprops);
3067 Integer hasprop = (Integer) phash.get(rname);
3068 if (hasprop.intValue() == 1)
3070 aprops.addElement(pname);
3074 Enumeration res = aa.keys();
3075 while (res.hasMoreElements())
3077 String rname = (String) res.nextElement();
3079 System.out.print("'" + rname + "' => [");
3080 Enumeration props = ((Vector) aa.get(rname)).elements();
3081 while (props.hasMoreElements())
3083 System.out.print("'" + (String) props.nextElement() + "'");
3084 if (props.hasMoreElements())
3086 System.out.println(", ");
3089 System.out.println("]" + (res.hasMoreElements() ? "," : ""));
3091 System.out.println("};");
3097 * Returns a list of residue characters for the specified inputs
3100 * @param includeAmbiguous
3103 public static List<String> getResidues(boolean nucleotide,
3104 boolean includeAmbiguous)
3106 List<String> result = new ArrayList<String>();
3109 for (String nuc : nucleotideName.keySet())
3111 int val = nucleotideIndex[nuc.charAt(0)];
3112 if ((!includeAmbiguous && val > 4) || (val >= maxNucleotideIndex))
3116 nuc = nuc.toUpperCase();
3117 if (!result.contains(nuc))
3128 for (String res : aa3Hash.keySet())
3130 int index = aa3Hash.get(res).intValue();
3131 if ((!includeAmbiguous && index >= 20) || index >= maxProteinIndex)
3135 res = res.toUpperCase();
3136 if (!result.contains(res))
3147 * Returns the single letter code for a three letter code, or '0' if not known
3149 * @param threeLetterCode
3150 * not case sensitive
3153 public static char getSingleCharacterCode(String threeLetterCode)
3155 if (threeLetterCode == null)
3159 Integer index = ResidueProperties.aa3Hash.get(threeLetterCode
3161 return index == null ? '0' : aa[index].charAt(0);