/*
* Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
* Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Jalview. If not, see .
* The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
import jalview.analysis.scoremodels.FeatureScoreModel;
import jalview.analysis.scoremodels.PIDScoreModel;
import jalview.api.analysis.ScoreModelI;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Vector;
public class ResidueProperties
{
public static Hashtable scoreMatrices = new Hashtable();
// Stores residue codes/names and colours and other things
public static final int[] aaIndex; // aaHash version 2.1.1 and below
public static final int[] nucleotideIndex;
public static final int[] purinepyrimidineIndex;
public static final Map aa3Hash = new HashMap();
public static final Map aa2Triplet = new HashMap();
public static final Map nucleotideName = new HashMap();
// lookup from modified amino acid (e.g. MSE) to canonical form (e.g. MET)
public static final Map modifications = new HashMap();
static
{
aaIndex = new int[255];
for (int i = 0; i < 255; i++)
{
aaIndex[i] = 23;
}
aaIndex['A'] = 0;
aaIndex['R'] = 1;
aaIndex['N'] = 2;
aaIndex['D'] = 3;
aaIndex['C'] = 4;
aaIndex['Q'] = 5;
aaIndex['E'] = 6;
aaIndex['G'] = 7;
aaIndex['H'] = 8;
aaIndex['I'] = 9;
aaIndex['L'] = 10;
aaIndex['K'] = 11;
aaIndex['M'] = 12;
aaIndex['F'] = 13;
aaIndex['P'] = 14;
aaIndex['S'] = 15;
aaIndex['T'] = 16;
aaIndex['W'] = 17;
aaIndex['Y'] = 18;
aaIndex['V'] = 19;
aaIndex['B'] = 20;
aaIndex['Z'] = 21;
aaIndex['X'] = 22;
aaIndex['U'] = 22;
aaIndex['a'] = 0;
aaIndex['r'] = 1;
aaIndex['n'] = 2;
aaIndex['d'] = 3;
aaIndex['c'] = 4;
aaIndex['q'] = 5;
aaIndex['e'] = 6;
aaIndex['g'] = 7;
aaIndex['h'] = 8;
aaIndex['i'] = 9;
aaIndex['l'] = 10;
aaIndex['k'] = 11;
aaIndex['m'] = 12;
aaIndex['f'] = 13;
aaIndex['p'] = 14;
aaIndex['s'] = 15;
aaIndex['t'] = 16;
aaIndex['w'] = 17;
aaIndex['y'] = 18;
aaIndex['v'] = 19;
aaIndex['b'] = 20;
aaIndex['z'] = 21;
aaIndex['x'] = 22;
aaIndex['u'] = 22; // TODO: selenocystine triplet and codons needed. also
// extend subt. matrices
}
/**
* maximum (gap) index for matrices involving protein alphabet
*/
public final static int maxProteinIndex = 23;
/**
* maximum (gap) index for matrices involving nucleotide alphabet
*/
public final static int maxNucleotideIndex = 10;
static
{
nucleotideIndex = new int[255];
for (int i = 0; i < 255; i++)
{
nucleotideIndex[i] = 10; // non-nucleotide symbols are all non-gap gaps.
}
nucleotideIndex['A'] = 0;
nucleotideIndex['a'] = 0;
nucleotideIndex['C'] = 1;
nucleotideIndex['c'] = 1;
nucleotideIndex['G'] = 2;
nucleotideIndex['g'] = 2;
nucleotideIndex['T'] = 3;
nucleotideIndex['t'] = 3;
nucleotideIndex['U'] = 4;
nucleotideIndex['u'] = 4;
nucleotideIndex['I'] = 5;
nucleotideIndex['i'] = 5;
nucleotideIndex['X'] = 6;
nucleotideIndex['x'] = 6;
nucleotideIndex['R'] = 7;
nucleotideIndex['r'] = 7;
nucleotideIndex['Y'] = 8;
nucleotideIndex['y'] = 8;
nucleotideIndex['N'] = 9;
nucleotideIndex['n'] = 9;
nucleotideName.put("A", "Adenine");
nucleotideName.put("a", "Adenine");
nucleotideName.put("G", "Guanine");
nucleotideName.put("g", "Guanine");
nucleotideName.put("C", "Cytosine");
nucleotideName.put("c", "Cytosine");
nucleotideName.put("T", "Thymine");
nucleotideName.put("t", "Thymine");
nucleotideName.put("U", "Uracil");
nucleotideName.put("u", "Uracil");
nucleotideName.put("I", "Inosine");
nucleotideName.put("i", "Inosine");
nucleotideName.put("X", "Xanthine");
nucleotideName.put("x", "Xanthine");
nucleotideName.put("R", "Unknown Purine");
nucleotideName.put("r", "Unknown Purine");
nucleotideName.put("Y", "Unknown Pyrimidine");
nucleotideName.put("y", "Unknown Pyrimidine");
nucleotideName.put("N", "Unknown");
nucleotideName.put("n", "Unknown");
nucleotideName.put("W", "Weak nucleotide (A or T)");
nucleotideName.put("w", "Weak nucleotide (A or T)");
nucleotideName.put("S", "Strong nucleotide (G or C)");
nucleotideName.put("s", "Strong nucleotide (G or C)");
nucleotideName.put("M", "Amino (A or C)");
nucleotideName.put("m", "Amino (A or C)");
nucleotideName.put("K", "Keto (G or T)");
nucleotideName.put("k", "Keto (G or T)");
nucleotideName.put("B", "Not A (G or C or T)");
nucleotideName.put("b", "Not A (G or C or T)");
nucleotideName.put("H", "Not G (A or C or T)");
nucleotideName.put("h", "Not G (A or C or T)");
nucleotideName.put("D", "Not C (A or G or T)");
nucleotideName.put("d", "Not C (A or G or T)");
nucleotideName.put("V", "Not T (A or G or C");
nucleotideName.put("v", "Not T (A or G or C");
}
static
{
purinepyrimidineIndex = new int[255];
for (int i = 0; i < 255; i++)
{
purinepyrimidineIndex[i] = 3; // non-nucleotide symbols are all non-gap
// gaps.
}
purinepyrimidineIndex['A'] = 0;
purinepyrimidineIndex['a'] = 0;
purinepyrimidineIndex['C'] = 1;
purinepyrimidineIndex['c'] = 1;
purinepyrimidineIndex['G'] = 0;
purinepyrimidineIndex['g'] = 0;
purinepyrimidineIndex['T'] = 1;
purinepyrimidineIndex['t'] = 1;
purinepyrimidineIndex['U'] = 1;
purinepyrimidineIndex['u'] = 1;
purinepyrimidineIndex['I'] = 2;
purinepyrimidineIndex['i'] = 2;
purinepyrimidineIndex['X'] = 2;
purinepyrimidineIndex['x'] = 2;
purinepyrimidineIndex['R'] = 0;
purinepyrimidineIndex['r'] = 0;
purinepyrimidineIndex['Y'] = 1;
purinepyrimidineIndex['y'] = 1;
purinepyrimidineIndex['N'] = 2;
purinepyrimidineIndex['n'] = 2;
}
static
{
aa3Hash.put("ALA", new Integer(0));
aa3Hash.put("ARG", new Integer(1));
aa3Hash.put("ASN", new Integer(2));
aa3Hash.put("ASP", new Integer(3)); // D
aa3Hash.put("CYS", new Integer(4));
aa3Hash.put("GLN", new Integer(5)); // Q
aa3Hash.put("GLU", new Integer(6)); // E
aa3Hash.put("GLY", new Integer(7));
aa3Hash.put("HIS", new Integer(8));
aa3Hash.put("ILE", new Integer(9));
aa3Hash.put("LEU", new Integer(10));
aa3Hash.put("LYS", new Integer(11));
aa3Hash.put("MET", new Integer(12));
aa3Hash.put("PHE", new Integer(13));
aa3Hash.put("PRO", new Integer(14));
aa3Hash.put("SER", new Integer(15));
aa3Hash.put("THR", new Integer(16));
aa3Hash.put("TRP", new Integer(17));
aa3Hash.put("TYR", new Integer(18));
aa3Hash.put("VAL", new Integer(19));
// IUB Nomenclature for ambiguous peptides
aa3Hash.put("ASX", new Integer(20)); // "B";
aa3Hash.put("GLX", new Integer(21)); // Z
aa3Hash.put("XAA", new Integer(22)); // X unknown
aa3Hash.put("-", new Integer(23));
aa3Hash.put("*", new Integer(23));
aa3Hash.put(".", new Integer(23));
aa3Hash.put(" ", new Integer(23));
aa3Hash.put("Gap", new Integer(23));
aa3Hash.put("UR3", new Integer(24));
}
static
{
aa2Triplet.put("A", "ALA");
aa2Triplet.put("a", "ALA");
aa2Triplet.put("R", "ARG");
aa2Triplet.put("r", "ARG");
aa2Triplet.put("N", "ASN");
aa2Triplet.put("n", "ASN");
aa2Triplet.put("D", "ASP");
aa2Triplet.put("d", "ASP");
aa2Triplet.put("C", "CYS");
aa2Triplet.put("c", "CYS");
aa2Triplet.put("Q", "GLN");
aa2Triplet.put("q", "GLN");
aa2Triplet.put("E", "GLU");
aa2Triplet.put("e", "GLU");
aa2Triplet.put("G", "GLY");
aa2Triplet.put("g", "GLY");
aa2Triplet.put("H", "HIS");
aa2Triplet.put("h", "HIS");
aa2Triplet.put("I", "ILE");
aa2Triplet.put("i", "ILE");
aa2Triplet.put("L", "LEU");
aa2Triplet.put("l", "LEU");
aa2Triplet.put("K", "LYS");
aa2Triplet.put("k", "LYS");
aa2Triplet.put("M", "MET");
aa2Triplet.put("m", "MET");
aa2Triplet.put("F", "PHE");
aa2Triplet.put("f", "PHE");
aa2Triplet.put("P", "PRO");
aa2Triplet.put("p", "PRO");
aa2Triplet.put("S", "SER");
aa2Triplet.put("s", "SER");
aa2Triplet.put("T", "THR");
aa2Triplet.put("t", "THR");
aa2Triplet.put("W", "TRP");
aa2Triplet.put("w", "TRP");
aa2Triplet.put("Y", "TYR");
aa2Triplet.put("y", "TYR");
aa2Triplet.put("V", "VAL");
aa2Triplet.put("v", "VAL");
}
public static final String[] aa = { "A", "R", "N", "D", "C", "Q", "E",
"G", "H", "I", "L", "K", "M", "F", "P", "S", "T", "W", "Y", "V", "B",
"Z", "X", "_", "*", ".", " ", "U" };
public static final Color midBlue = new Color(100, 100, 255);
public static final Vector scaleColours = new Vector();
static
{
scaleColours.addElement(new Color(114, 0, 147));
scaleColours.addElement(new Color(156, 0, 98));
scaleColours.addElement(new Color(190, 0, 0));
scaleColours.addElement(Color.red);
scaleColours.addElement(new Color(255, 125, 0));
scaleColours.addElement(Color.orange);
scaleColours.addElement(new Color(255, 194, 85));
scaleColours.addElement(Color.yellow);
scaleColours.addElement(new Color(255, 255, 181));
scaleColours.addElement(Color.white);
}
public static final Color[] taylor = { new Color(204, 255, 0), // A
// Greenish-yellowy-yellow
new Color(0, 0, 255), // R Blueish-bluey-blue
new Color(204, 0, 255), // N Blueish-reddy-blue
new Color(255, 0, 0), // D Reddish-reddy-red
new Color(255, 255, 0), // C Yellowish-yellowy-yellow
new Color(255, 0, 204), // Q Reddish-bluey-red
new Color(255, 0, 102), // E Blueish-reddy-red
new Color(255, 153, 0), // G Yellowy-reddy-yellow
new Color(0, 102, 255), // H Greenish-bluey-blue
new Color(102, 255, 0), // I Greenish-yellowy-green
new Color(51, 255, 0), // L Yellowish-greeny-green
new Color(102, 0, 255), // K Reddish-bluey-blue
new Color(0, 255, 0), // M Greenish-greeny-green
new Color(0, 255, 102), // F Blueish-greeny-green
new Color(255, 204, 0), // P Reddish-yellowy-yellow
new Color(255, 51, 0), // S Yellowish-reddy-red
new Color(255, 102, 0), // T Reddish-yellowy-red
new Color(0, 204, 255), // W Blueish-greeny-green
new Color(0, 255, 204), // Y Greenish-bluey-green
new Color(153, 255, 0), // V Yellowish-greeny-yellow
Color.white, // B
Color.white, // Z
Color.white, // X
Color.white, // -
Color.white, // *
Color.white // .
};
public static final Color[] nucleotide = { new Color(100, 247, 63), // A
new Color(255, 179, 64), // C
new Color(235, 65, 60), // G
new Color(60, 136, 238), // T
new Color(60, 136, 238), // U
Color.white, // I (inosine)
Color.white, // X (xanthine)
Color.white, // R
Color.white, // Y
Color.white, // N
Color.white, // Gap
};
// Added for PurinePyrimidineColourScheme
public static final Color[] purinepyrimidine = {
new Color(255, 131, 250), // A, G, R purines purplish/orchid
new Color(64, 224, 208), // C,U, T, Y pyrimidines turquoise
Color.white, // all other nucleotides
Color.white // Gap
};
// Zappo
public static final Color[] zappo = { Color.pink, // A
midBlue, // R
Color.green, // N
Color.red, // D
Color.yellow, // C
Color.green, // Q
Color.red, // E
Color.magenta, // G
midBlue,// Color.red, // H
Color.pink, // I
Color.pink, // L
midBlue, // K
Color.pink, // M
Color.orange, // F
Color.magenta, // P
Color.green, // S
Color.green, // T
Color.orange, // W
Color.orange, // Y
Color.pink, // V
Color.white, // B
Color.white, // Z
Color.white, // X
Color.white, // -
Color.white, // *
Color.white, // .
Color.white // ' '
};
// Dunno where I got these numbers from
public static final double[] hyd2 = { 0.62, // A
0.29, // R
-0.90, // N
-0.74, // D
1.19, // C
0.48, // Q
-0.40, // E
1.38, // G
-1.50, // H
1.06, // I
0.64, // L
-0.78, // K
0.12, // M
-0.85, // F
-2.53, // P
-0.18, // S
-0.05, // T
1.08, // W
0.81, // Y
0.0, // V
0.26, // B
0.0, // Z
0.0 // X
};
public static final double[] helix = { 1.42, 0.98, 0.67, 1.01, 0.70,
1.11, 1.51, 0.57, 1.00, 1.08, 1.21, 1.16, 1.45, 1.13, 0.57, 0.77,
0.83, 1.08, 0.69, 1.06, 0.84, 1.31, 1.00, 0.0 };
public static final double helixmin = 0.57;
public static final double helixmax = 1.51;
public static final double[] strand = { 0.83, 0.93, 0.89, 0.54, 1.19,
1.10, 0.37, 0.75, 0.87, 1.60, 1.30, 0.74, 1.05, 1.38, 0.55, 0.75,
1.19, 1.37, 1.47, 1.70, 0.72, 0.74, 1.0, 0.0 };
public static final double strandmin = 0.37;
public static final double strandmax = 1.7;
public static final double[] turn = { 0.66, 0.95, 1.56, 1.46, 1.19, 0.98,
0.74, 1.56, 0.95, 0.47, 0.59, 1.01, 0.60, 0.60, 1.52, 1.43, 0.96,
0.96, 1.14, 0.50, 1.51, 0.86, 1.00, 0, 0 };
public static final double turnmin = 0.47;
public static final double turnmax = 1.56;
public static final double[] buried = { 1.7, 0.1, 0.4, 0.4, 4.6, 0.3,
0.3, 1.8, 0.8, 3.1, 2.4, 0.05, 1.9, 2.2, 0.6, 0.8, 0.7, 1.6, 0.5,
2.9, 0.4, 0.3, 1.358, 0.00 };
public static final double buriedmin = 0.05;
public static final double buriedmax = 4.6;
// This is hydropathy index
// Kyte, J., and Doolittle, R.F., J. Mol. Biol.
// 1157, 105-132, 1982
public static final double[] hyd = { 1.8, -4.5, -3.5, -3.5, 2.5, -3.5,
-3.5, -0.4, -3.2, 4.5, 3.8, -3.9, 1.9, 2.8, -1.6, -0.8, -0.7, -0.9,
-1.3, 4.2, -3.5, -3.5, -0.49, 0.0 };
public static final double hydmax = 4.5;
public static final double hydmin = -3.9;
// public static final double hydmax = 1.38;
// public static final double hydmin = -2.53;
private static final int[][] BLOSUM62 = {
{ 4, -1, -2, -2, 0, -1, -1, 0, -2, -1, -1, -1, -1, -2, -1, 1, 0, -3,
-2, 0, -2, -1, 0, -4 },
{ -1, 5, 0, -2, -3, 1, 0, -2, 0, -3, -2, 2, -1, -3, -2, -1, -1, -3,
-2, -3, -1, 0, -1, -4 },
{ -2, 0, 6, 1, -3, 0, 0, 0, 1, -3, -3, 0, -2, -3, -2, 1, 0, -4, -2,
-3, 3, 0, -1, -4 },
{ -2, -2, 1, 6, -3, 0, 2, -1, -1, -3, -4, -1, -3, -3, -1, 0, -1, -4,
-3, -3, 4, 1, -1, -4 },
{ 0, 3, -3, -3, 9, -3, -4, -3, -3, -1, -1, -3, -1, -2, -3, -1, -1,
-2, -2, -1, -3, -3, -2, -4 },
{ -1, 1, 0, 0, -3, 5, 2, -2, 0, -3, -2, 1, 0, -3, -1, 0, -1, -2, -1,
-2, 0, 3, -1, -4 },
{ -1, 0, 0, 2, -4, 2, 5, -2, 0, -3, -3, 1, -2, -3, -1, 0, -1, -3, -2,
-2, 1, 4, -1, -4 },
{ 0, -2, 0, -1, -3, -2, -2, 6, -2, -4, -4, -2, -3, -3, -2, 0, -2, -2,
-3, -3, -1, -2, -1, -4 },
{ -2, 0, 1, -1, -3, 0, 0, -2, 8, -3, -3, -1, -2, -1, -2, -1, -2, -2,
2, -3, 0, 0, -1, -4 },
{ -1, -3, -3, -3, -1, -3, -3, -4, -3, 4, 2, -3, 1, 0, -3, -2, -1, -3,
-1, 3, -3, -3, -1, -4 },
{ -1, -2, -3, -4, -1, -2, -3, -4, -3, 2, 4, -2, 2, 0, -3, -2, -1, -2,
-1, 1, -4, -3, -1, -4 },
{ -1, 2, 0, -1, -3, 1, 1, -2, -1, -3, -2, 5, -1, -3, -1, 0, -1, -3,
-2, -2, 0, 1, -1, -4 },
{ -1, -1, -2, -3, -1, 0, -2, -3, -2, 1, 2, -1, 5, 0, -2, -1, -1, -1,
-1, 1, -3, -1, -1, -4 },
{ -2, -3, -3, -3, -2, -3, -3, -3, -1, 0, 0, -3, 0, 6, -4, -2, -2, 1,
3, -1, -3, -3, -1, -4 },
{ -1, -2, -2, -1, -3, -1, -1, -2, -2, -3, -3, -1, -2, -4, 7, -1, -1,
-4, -3, -2, -2, -1, -2, -4 },
{ 1, -1, 1, 0, -1, 0, 0, 0, -1, -2, -2, 0, -1, -2, -1, 4, 1, -3, -2,
-2, 0, 0, 0, -4 },
{ 0, -1, 0, -1, -1, -1, -1, -2, -2, -1, -1, -1, -1, -2, -1, 1, 5, -2,
-2, 0, -1, -1, 0, -4 },
{ -3, -3, -4, -4, -2, -2, -3, -2, -2, -3, -2, -3, -1, 1, -4, -3, -2,
11, 2, -3, -4, -3, -2, -4 },
{ -2, -2, -2, -3, -2, -1, -2, -3, 2, -1, -1, -2, -1, 3, -3, -2, -2,
2, 7, -1, -3, -2, -1, -4 },
{ 0, -3, -3, -3, -1, -2, -2, -3, -3, 3, 1, -2, 1, -1, -2, -2, 0, -3,
-1, 4, -3, -2, -1, -4 },
{ -2, -1, 3, 4, -3, 0, 1, -1, 0, -3, -4, 0, -3, -3, -2, 0, -1, -4,
-3, -3, 4, 1, -1, -4 },
{ -1, 0, 0, 1, -3, 3, 4, -2, 0, -3, -3, 1, -1, -3, -1, 0, -1, -3, -2,
-2, 1, 4, -1, -4 },
{ 0, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, 0, 0,
-2, -1, -1, -1, -1, -1, -4 },
{ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
-4, -4, -4, -4, -4, -4, 1 }, };
static final int[][] PAM250 = {
{ 2, -2, 0, 0, -2, 0, 0, 1, -1, -1, -2, -1, -1, -3, 1, 1, 1, -6, -3,
0, 0, 0, 0, -8 },
{ -2, 6, 0, -1, -4, 1, -1, -3, 2, -2, -3, 3, 0, -4, 0, 0, -1, 2, -4,
-2, -1, 0, -1, -8 },
{ 0, 0, 2, 2, -4, 1, 1, 0, 2, -2, -3, 1, -2, -3, 0, 1, 0, -4, -2, -2,
2, 1, 0, -8 },
{ 0, -1, 2, 4, -5, 2, 3, 1, 1, -2, -4, 0, -3, -6, -1, 0, 0, -7, -4,
-2, 3, 3, -1, -8 },
{ -2, -4, -4, -5, 12, -5, -5, -3, -3, -2, -6, -5, -5, -4, -3, 0, -2,
-8, 0, -2, -4, -5, -3, -8 },
{ 0, 1, 1, 2, -5, 4, 2, -1, 3, -2, -2, 1, -1, -5, 0, -1, -1, -5, -4,
-2, 1, 3, -1, -8 },
{ 0, -1, 1, 3, -5, 2, 4, 0, 1, -2, -3, 0, -2, -5, -1, 0, 0, -7, -4,
-2, 3, 3, -1, -8 },
{ 1, -3, 0, 1, -3, -1, 0, 5, -2, -3, -4, -2, -3, -5, 0, 1, 0, -7, -5,
-1, 0, 0, -1, -8 },
{ -1, 2, 2, 1, -3, 3, 1, -2, 6, -2, -2, 0, -2, -2, 0, -1, -1, -3, 0,
-2, 1, 2, -1, -8 },
{ -1, -2, -2, -2, -2, -2, -2, -3, -2, 5, 2, -2, 2, 1, -2, -1, 0, -5,
-1, 4, -2, -2, -1, -8 },
{ -2, -3, -3, -4, -6, -2, -3, -4, -2, 2, 6, -3, 4, 2, -3, -3, -2, -2,
-1, 2, -3, -3, -1, -8 },
{ -1, 3, 1, 0, -5, 1, 0, -2, 0, -2, -3, 5, 0, -5, -1, 0, 0, -3, -4,
-2, 1, 0, -1, -8 },
{ -1, 0, -2, -3, -5, -1, -2, -3, -2, 2, 4, 0, 6, 0, -2, -2, -1, -4,
-2, 2, -2, -2, -1, -8 },
{ -3, -4, -3, -6, -4, -5, -5, -5, -2, 1, 2, -5, 0, 9, -5, -3, -3, 0,
7, -1, -4, -5, -2, -8 },
{ 1, 0, 0, -1, -3, 0, -1, 0, 0, -2, -3, -1, -2, -5, 6, 1, 0, -6, -5,
-1, -1, 0, -1, -8 },
{ 1, 0, 1, 0, 0, -1, 0, 1, -1, -1, -3, 0, -2, -3, 1, 2, 1, -2, -3,
-1, 0, 0, 0, -8 },
{ 1, -1, 0, 0, -2, -1, 0, 0, -1, 0, -2, 0, -1, -3, 0, 1, 3, -5, -3,
0, 0, -1, 0, -8 },
{ -6, 2, -4, -7, -8, -5, -7, -7, -3, -5, -2, -3, -4, 0, -6, -2, -5,
17, 0, -6, -5, -6, -4, -8 },
{ -3, -4, -2, -4, 0, -4, -4, -5, 0, -1, -1, -4, -2, 7, -5, -3, -3, 0,
10, -2, -3, -4, -2, -8 },
{ 0, -2, -2, -2, -2, -2, -2, -1, -2, 4, 2, -2, 2, -1, -1, -1, 0, -6,
-2, 4, -2, -2, -1, -8 },
{ 0, -1, 2, 3, -4, 1, 3, 0, 1, -2, -3, 1, -2, -4, -1, 0, 0, -5, -3,
-2, 3, 2, -1, -8 },
{ 0, 0, 1, 3, -5, 3, 3, 0, 2, -2, -3, 0, -2, -5, 0, 0, -1, -6, -4,
-2, 2, 3, -1, -8 },
{ 0, -1, 0, -1, -3, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, 0, 0, -4,
-2, -1, -1, -1, -1, -8 },
{ -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
-8, -8, -8, -8, -8, -8, 1 }, };
public static final Hashtable ssHash = new Hashtable(); // stores the number
// value of the aa
static
{
ssHash.put("H", Color.magenta);
ssHash.put("E", Color.yellow);
ssHash.put("-", Color.white);
ssHash.put(".", Color.white);
ssHash.put("S", Color.cyan);
ssHash.put("T", Color.blue);
ssHash.put("G", Color.pink);
ssHash.put("I", Color.pink);
ssHash.put("B", Color.yellow);
}
/*
* new Color(60, 136, 238), // U Color.white, // I Color.white, // X
* Color.white, // R Color.white, // Y Color.white, // N Color.white, // Gap
*/
// JBPNote: patch matrix for T/U equivalence when working with DNA or RNA.
// Will equate sequences if working with mixed nucleotide sets.
// treats T and U identically. R and Y weak equivalence with AG and CTU.
// N matches any other base weakly
//
static final int[][] DNA = { { 10, -8, -8, -8, -8, 1, 1, 1, -8, 1, 1 }, // A
{ -8, 10, -8, -8, -8, 1, 1, -8, 1, 1, 1 }, // C
{ -8, -8, 10, -8, -8, 1, 1, 1, -8, 1, 1 }, // G
{ -8, -8, -8, 10, 10, 1, 1, -8, 1, 1, 1 }, // T
{ -8, -8, -8, 10, 10, 1, 1, -8, 1, 1, 1 }, // U
{ 1, 1, 1, 1, 1, 10, 0, 0, 0, 1, 1 }, // I
{ 1, 1, 1, 1, 1, 0, 10, 0, 0, 1, 1 }, // X
{ 1, -8, 1, -8, -8, 0, 0, 10, -8, 1, 1 }, // R
{ -8, 1, -8, 1, 1, 0, 0, -8, 10, 1, 1 }, // Y
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 1 }, // N
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, // -
};
/**
* register matrices in list
*/
static
{
scoreMatrices.put("BLOSUM62", new ScoreMatrix("BLOSUM62", BLOSUM62, 0));
scoreMatrices.put("PAM250", new ScoreMatrix("PAM250", PAM250, 0));
scoreMatrices.put("DNA", new ScoreMatrix("DNA", DNA, 1));
}
public static final Color[] pidColours = { midBlue,
new Color(153, 153, 255),
// Color.lightGray,
new Color(204, 204, 255), };
public static final float[] pidThresholds = { 80, 60, 40, };
public static Map> codonHash = new HashMap>();
private static List Lys = new ArrayList();
private static List Asn = new ArrayList();
private static List Gln = new ArrayList();
private static List His = new ArrayList();
private static List Glu = new ArrayList();
private static List Asp = new ArrayList();
private static List Tyr = new ArrayList();
private static List Thr = new ArrayList();
private static List Pro = new ArrayList();
private static List Ala = new ArrayList();
private static List Ser = new ArrayList();
private static List Arg = new ArrayList();
private static List Gly = new ArrayList();
private static List Trp = new ArrayList();
private static List Cys = new ArrayList();
private static List Ile = new ArrayList();
private static List Met = new ArrayList();
private static List Leu = new ArrayList();
private static List Val = new ArrayList();
private static List Phe = new ArrayList();
public static List STOP = new ArrayList();
public static String START = "ATG";
static
{
codonHash.put("K", Lys);
codonHash.put("N", Asn);
codonHash.put("Q", Gln);
codonHash.put("H", His);
codonHash.put("E", Glu);
codonHash.put("D", Asp);
codonHash.put("Y", Tyr);
codonHash.put("T", Thr);
codonHash.put("P", Pro);
codonHash.put("A", Ala);
codonHash.put("S", Ser);
codonHash.put("R", Arg);
codonHash.put("G", Gly);
codonHash.put("W", Trp);
codonHash.put("C", Cys);
codonHash.put("I", Ile);
codonHash.put("M", Met);
codonHash.put("L", Leu);
codonHash.put("V", Val);
codonHash.put("F", Phe);
codonHash.put("STOP", STOP);
}
/**
* Nucleotide Ambiguity Codes
*/
public static final Map ambiguityCodes = new Hashtable();
/**
* Codon triplets with additional symbols for unambiguous codons that include
* ambiguity codes
*/
public static final Hashtable codonHash2 = new Hashtable();
/**
* all ambiguity codes for a given base
*/
public final static Hashtable> _ambiguityCodes = new Hashtable>();
static
{
/*
* Ambiguity codes as per http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html
*/
ambiguityCodes.put("R", new String[] { "A", "G" });
ambiguityCodes.put("Y", new String[] { "T", "C" });
ambiguityCodes.put("W", new String[] { "A", "T" });
ambiguityCodes.put("S", new String[] { "G", "C" });
ambiguityCodes.put("M", new String[] { "A", "C" });
ambiguityCodes.put("K", new String[] { "G", "T" });
ambiguityCodes.put("H", new String[] { "A", "T", "C" });
ambiguityCodes.put("B", new String[] { "G", "T", "C" });
ambiguityCodes.put("V", new String[] { "G", "A", "C" });
ambiguityCodes.put("D", new String[] { "G", "A", "T" });
ambiguityCodes.put("N", new String[] { "G", "A", "T", "C" });
// Now build codon translation table
codonHash2.put("AAA", "K");
codonHash2.put("AAG", "K");
codonHash2.put("AAC", "N");
codonHash2.put("AAT", "N");
codonHash2.put("CAA", "Q");
codonHash2.put("CAG", "Q");
codonHash2.put("CAC", "H");
codonHash2.put("CAT", "H");
codonHash2.put("GAA", "E");
codonHash2.put("GAG", "E");
codonHash2.put("GAC", "D");
codonHash2.put("GAT", "D");
codonHash2.put("TAC", "Y");
codonHash2.put("TAT", "Y");
codonHash2.put("ACA", "T");
codonHash2.put("ACC", "T");
codonHash2.put("ACT", "T");
codonHash2.put("ACG", "T");
codonHash2.put("CCA", "P");
codonHash2.put("CCG", "P");
codonHash2.put("CCC", "P");
codonHash2.put("CCT", "P");
codonHash2.put("GCA", "A");
codonHash2.put("GCG", "A");
codonHash2.put("GCC", "A");
codonHash2.put("GCT", "A");
codonHash2.put("TCA", "S");
codonHash2.put("TCG", "S");
codonHash2.put("TCC", "S");
codonHash2.put("TCT", "S");
codonHash2.put("AGC", "S");
codonHash2.put("AGT", "S");
codonHash2.put("AGA", "R");
codonHash2.put("AGG", "R");
codonHash2.put("CGA", "R");
codonHash2.put("CGG", "R");
codonHash2.put("CGC", "R");
codonHash2.put("CGT", "R");
codonHash2.put("GGA", "G");
codonHash2.put("GGG", "G");
codonHash2.put("GGC", "G");
codonHash2.put("GGT", "G");
codonHash2.put("TGA", "*");
codonHash2.put("TAA", "*");
codonHash2.put("TAG", "*");
codonHash2.put("TGG", "W");
codonHash2.put("TGC", "C");
codonHash2.put("TGT", "C");
codonHash2.put("ATA", "I");
codonHash2.put("ATC", "I");
codonHash2.put("ATT", "I");
codonHash2.put("ATG", "M");
codonHash2.put("CTA", "L");
codonHash2.put("CTG", "L");
codonHash2.put("CTC", "L");
codonHash2.put("CTT", "L");
codonHash2.put("TTA", "L");
codonHash2.put("TTG", "L");
codonHash2.put("GTA", "V");
codonHash2.put("GTG", "V");
codonHash2.put("GTC", "V");
codonHash2.put("GTT", "V");
codonHash2.put("TTC", "F");
codonHash2.put("TTT", "F");
buildAmbiguityCodonSet();
}
/**
* programmatic generation of codons including ambiguity codes
*/
public static void buildAmbiguityCodonSet()
{
if (_ambiguityCodes.size() > 0)
{
System.err
.println("Ignoring multiple calls to buildAmbiguityCodonSet");
return;
}
// Invert the ambiguity code set
for (Map.Entry acode : ambiguityCodes.entrySet())
{
for (String r : acode.getValue())
{
List codesfor = _ambiguityCodes.get(r);
if (codesfor == null)
{
_ambiguityCodes.put(r, codesfor = new ArrayList());
}
if (!codesfor.contains(acode.getKey()))
{
codesfor.add(acode.getKey());
}
else
{
System.err
.println("Inconsistency in the IUBMB ambiguity code nomenclature table: collision for "
+ acode.getKey() + " in residue " + r);
}
}
}
// and programmatically add in the ambiguity codes that yield the same amino
// acid
String[] unambcodons = codonHash2.keySet().toArray(
new String[codonHash2.size()]);
for (String codon : unambcodons)
{
String residue = codonHash2.get(codon);
String acodon[][] = new String[codon.length()][];
for (int i = 0, iSize = codon.length(); i < iSize; i++)
{
String _ac = "" + codon.charAt(i);
List acodes = _ambiguityCodes.get(_ac);
if (acodes != null)
{
acodon[i] = acodes.toArray(new String[acodes.size()]);
}
else
{
acodon[i] = new String[] {};
}
}
// enumerate all combinations and test for veracity of translation
int tpos[] = new int[codon.length()], cpos[] = new int[codon.length()];
for (int i = 0; i < tpos.length; i++)
{
tpos[i] = -1;
}
tpos[acodon.length - 1] = 0;
int ipos, j;
while (tpos[0] < acodon[0].length)
{
// make all codons for this combination
char allres[][] = new char[tpos.length][];
String _acodon = "";
char _anuc;
for (ipos = 0; ipos < tpos.length; ipos++)
{
if (acodon[ipos].length == 0 || tpos[ipos] < 0)
{
_acodon += codon.charAt(ipos);
allres[ipos] = new char[] { codon.charAt(ipos) };
}
else
{
_acodon += acodon[ipos][tpos[ipos]];
String[] altbase = ambiguityCodes.get(acodon[ipos][tpos[ipos]]);
allres[ipos] = new char[altbase.length];
j = 0;
for (String ab : altbase)
{
allres[ipos][j++] = ab.charAt(0);
}
}
}
// test all codons for this combination
for (ipos = 0; ipos < cpos.length; ipos++)
{
cpos[ipos] = 0;
}
boolean valid = true;
do
{
String _codon = "";
for (j = 0; j < cpos.length; j++)
{
_codon += allres[j][cpos[j]];
}
String tr = codonHash2.get(_codon);
if (valid = (tr != null && tr.equals(residue)))
{
// advance to next combination
ipos = acodon.length - 1;
while (++cpos[ipos] >= allres[ipos].length && ipos > 0)
{
cpos[ipos] = 0;
ipos--;
}
}
} while (valid && cpos[0] < allres[0].length);
if (valid)
{
// Add this to the set of codons we will translate
// System.out.println("Adding ambiguity codon: " + _acodon + " for "
// + residue);
codonHash2.put(_acodon, residue);
}
else
{
// System.err.println("Rejecting ambiguity codon: " + _acodon
// + " for " + residue);
}
// next combination
ipos = acodon.length - 1;
while (++tpos[ipos] >= acodon[ipos].length && ipos > 0)
{
tpos[ipos] = -1;
ipos--;
}
}
}
}
static
{
Lys.add("AAA");
Lys.add("AAG");
Asn.add("AAC");
Asn.add("AAT");
Gln.add("CAA");
Gln.add("CAG");
His.add("CAC");
His.add("CAT");
Glu.add("GAA");
Glu.add("GAG");
Asp.add("GAC");
Asp.add("GAT");
Tyr.add("TAC");
Tyr.add("TAT");
Thr.add("ACA");
Thr.add("ACG");
Thr.add("ACC");
Thr.add("ACT");
Pro.add("CCA");
Pro.add("CCG");
Pro.add("CCC");
Pro.add("CCT");
Ala.add("GCA");
Ala.add("GCG");
Ala.add("GCC");
Ala.add("GCT");
Ser.add("TCA");
Ser.add("TCG");
Ser.add("TCC");
Ser.add("TCT");
Ser.add("AGC");
Ser.add("AGT");
Arg.add("AGA");
Arg.add("AGG");
Arg.add("CGA");
Arg.add("CGG");
Arg.add("CGC");
Arg.add("CGT");
Gly.add("GGA");
Gly.add("GGG");
Gly.add("GGC");
Gly.add("GGT");
STOP.add("TGA");
STOP.add("TAA");
STOP.add("TAG");
Trp.add("TGG");
Cys.add("TGC");
Cys.add("TGT");
Ile.add("ATA");
Ile.add("ATC");
Ile.add("ATT");
Met.add("ATG");
Leu.add("CTA");
Leu.add("CTG");
Leu.add("CTC");
Leu.add("CTT");
Leu.add("TTA");
Leu.add("TTG");
Val.add("GTA");
Val.add("GTG");
Val.add("GTC");
Val.add("GTT");
Phe.add("TTC");
Phe.add("TTT");
}
// Stores residue codes/names and colours and other things
public static Hashtable propHash = new Hashtable();
public static Hashtable hydrophobic = new Hashtable();
public static Hashtable polar = new Hashtable();
public static Hashtable small = new Hashtable();
public static Hashtable positive = new Hashtable();
public static Hashtable negative = new Hashtable();
public static Hashtable charged = new Hashtable();
public static Hashtable aromatic = new Hashtable();
public static Hashtable aliphatic = new Hashtable();
public static Hashtable tiny = new Hashtable();
public static Hashtable proline = new Hashtable();
static
{
hydrophobic.put("I", new Integer(1));
hydrophobic.put("L", new Integer(1));
hydrophobic.put("V", new Integer(1));
hydrophobic.put("C", new Integer(1));
hydrophobic.put("A", new Integer(1));
hydrophobic.put("G", new Integer(1));
hydrophobic.put("M", new Integer(1));
hydrophobic.put("F", new Integer(1));
hydrophobic.put("Y", new Integer(1));
hydrophobic.put("W", new Integer(1));
hydrophobic.put("H", new Integer(1));
hydrophobic.put("K", new Integer(1));
hydrophobic.put("X", new Integer(1));
hydrophobic.put("-", new Integer(1));
hydrophobic.put("*", new Integer(1));
hydrophobic.put("R", new Integer(0));
hydrophobic.put("E", new Integer(0));
hydrophobic.put("Q", new Integer(0));
hydrophobic.put("D", new Integer(0));
hydrophobic.put("N", new Integer(0));
hydrophobic.put("S", new Integer(0));
hydrophobic.put("T", new Integer(0));
hydrophobic.put("P", new Integer(0));
}
static
{
polar.put("Y", new Integer(1));
polar.put("W", new Integer(1));
polar.put("H", new Integer(1));
polar.put("K", new Integer(1));
polar.put("R", new Integer(1));
polar.put("E", new Integer(1));
polar.put("Q", new Integer(1));
polar.put("D", new Integer(1));
polar.put("N", new Integer(1));
polar.put("S", new Integer(1));
polar.put("T", new Integer(1));
polar.put("X", new Integer(1));
polar.put("-", new Integer(1));
polar.put("*", new Integer(1));
polar.put("I", new Integer(0));
polar.put("L", new Integer(0));
polar.put("V", new Integer(0));
polar.put("C", new Integer(0));
polar.put("A", new Integer(0));
polar.put("G", new Integer(0));
polar.put("M", new Integer(0));
polar.put("F", new Integer(0));
polar.put("P", new Integer(0));
}
static
{
small.put("I", new Integer(0));
small.put("L", new Integer(0));
small.put("V", new Integer(1));
small.put("C", new Integer(1));
small.put("A", new Integer(1));
small.put("G", new Integer(1));
small.put("M", new Integer(0));
small.put("F", new Integer(0));
small.put("Y", new Integer(0));
small.put("W", new Integer(0));
small.put("H", new Integer(0));
small.put("K", new Integer(0));
small.put("R", new Integer(0));
small.put("E", new Integer(0));
small.put("Q", new Integer(0));
small.put("D", new Integer(1));
small.put("N", new Integer(1));
small.put("S", new Integer(1));
small.put("T", new Integer(1));
small.put("P", new Integer(1));
small.put("-", new Integer(1));
small.put("*", new Integer(1));
}
static
{
positive.put("I", new Integer(0));
positive.put("L", new Integer(0));
positive.put("V", new Integer(0));
positive.put("C", new Integer(0));
positive.put("A", new Integer(0));
positive.put("G", new Integer(0));
positive.put("M", new Integer(0));
positive.put("F", new Integer(0));
positive.put("Y", new Integer(0));
positive.put("W", new Integer(0));
positive.put("H", new Integer(1));
positive.put("K", new Integer(1));
positive.put("R", new Integer(1));
positive.put("E", new Integer(0));
positive.put("Q", new Integer(0));
positive.put("D", new Integer(0));
positive.put("N", new Integer(0));
positive.put("S", new Integer(0));
positive.put("T", new Integer(0));
positive.put("P", new Integer(0));
positive.put("-", new Integer(1));
positive.put("*", new Integer(1));
}
static
{
negative.put("I", new Integer(0));
negative.put("L", new Integer(0));
negative.put("V", new Integer(0));
negative.put("C", new Integer(0));
negative.put("A", new Integer(0));
negative.put("G", new Integer(0));
negative.put("M", new Integer(0));
negative.put("F", new Integer(0));
negative.put("Y", new Integer(0));
negative.put("W", new Integer(0));
negative.put("H", new Integer(0));
negative.put("K", new Integer(0));
negative.put("R", new Integer(0));
negative.put("E", new Integer(1));
negative.put("Q", new Integer(0));
negative.put("D", new Integer(1));
negative.put("N", new Integer(0));
negative.put("S", new Integer(0));
negative.put("T", new Integer(0));
negative.put("P", new Integer(0));
negative.put("-", new Integer(1));
negative.put("*", new Integer(1));
}
static
{
charged.put("I", new Integer(0));
charged.put("L", new Integer(0));
charged.put("V", new Integer(0));
charged.put("C", new Integer(0));
charged.put("A", new Integer(0));
charged.put("G", new Integer(0));
charged.put("M", new Integer(0));
charged.put("F", new Integer(0));
charged.put("Y", new Integer(0));
charged.put("W", new Integer(0));
charged.put("H", new Integer(1));
charged.put("K", new Integer(1));
charged.put("R", new Integer(1));
charged.put("E", new Integer(1));
charged.put("Q", new Integer(0));
charged.put("D", new Integer(1));
charged.put("N", new Integer(0)); // Asparagine is polar but not charged.
// Alternative would be charged and
// negative (in basic form)?
charged.put("S", new Integer(0));
charged.put("T", new Integer(0));
charged.put("P", new Integer(0));
charged.put("-", new Integer(1));
charged.put("*", new Integer(1));
}
static
{
aromatic.put("I", new Integer(0));
aromatic.put("L", new Integer(0));
aromatic.put("V", new Integer(0));
aromatic.put("C", new Integer(0));
aromatic.put("A", new Integer(0));
aromatic.put("G", new Integer(0));
aromatic.put("M", new Integer(0));
aromatic.put("F", new Integer(1));
aromatic.put("Y", new Integer(1));
aromatic.put("W", new Integer(1));
aromatic.put("H", new Integer(1));
aromatic.put("K", new Integer(0));
aromatic.put("R", new Integer(0));
aromatic.put("E", new Integer(0));
aromatic.put("Q", new Integer(0));
aromatic.put("D", new Integer(0));
aromatic.put("N", new Integer(0));
aromatic.put("S", new Integer(0));
aromatic.put("T", new Integer(0));
aromatic.put("P", new Integer(0));
aromatic.put("-", new Integer(1));
aromatic.put("*", new Integer(1));
}
static
{
aliphatic.put("I", new Integer(1));
aliphatic.put("L", new Integer(1));
aliphatic.put("V", new Integer(1));
aliphatic.put("C", new Integer(0));
aliphatic.put("A", new Integer(0));
aliphatic.put("G", new Integer(0));
aliphatic.put("M", new Integer(0));
aliphatic.put("F", new Integer(0));
aliphatic.put("Y", new Integer(0));
aliphatic.put("W", new Integer(0));
aliphatic.put("H", new Integer(0));
aliphatic.put("K", new Integer(0));
aliphatic.put("R", new Integer(0));
aliphatic.put("E", new Integer(0));
aliphatic.put("Q", new Integer(0));
aliphatic.put("D", new Integer(0));
aliphatic.put("N", new Integer(0));
aliphatic.put("S", new Integer(0));
aliphatic.put("T", new Integer(0));
aliphatic.put("P", new Integer(0));
aliphatic.put("-", new Integer(1));
aliphatic.put("*", new Integer(1));
}
static
{
tiny.put("I", new Integer(0));
tiny.put("L", new Integer(0));
tiny.put("V", new Integer(0));
tiny.put("C", new Integer(0));
tiny.put("A", new Integer(1));
tiny.put("G", new Integer(1));
tiny.put("M", new Integer(0));
tiny.put("F", new Integer(0));
tiny.put("Y", new Integer(0));
tiny.put("W", new Integer(0));
tiny.put("H", new Integer(0));
tiny.put("K", new Integer(0));
tiny.put("R", new Integer(0));
tiny.put("E", new Integer(0));
tiny.put("Q", new Integer(0));
tiny.put("D", new Integer(0));
tiny.put("N", new Integer(0));
tiny.put("S", new Integer(1));
tiny.put("T", new Integer(0));
tiny.put("P", new Integer(0));
tiny.put("-", new Integer(1));
tiny.put("*", new Integer(1));
}
static
{
proline.put("I", new Integer(0));
proline.put("L", new Integer(0));
proline.put("V", new Integer(0));
proline.put("C", new Integer(0));
proline.put("A", new Integer(0));
proline.put("G", new Integer(0));
proline.put("M", new Integer(0));
proline.put("F", new Integer(0));
proline.put("Y", new Integer(0));
proline.put("W", new Integer(0));
proline.put("H", new Integer(0));
proline.put("K", new Integer(0));
proline.put("R", new Integer(0));
proline.put("E", new Integer(0));
proline.put("Q", new Integer(0));
proline.put("D", new Integer(0));
proline.put("N", new Integer(0));
proline.put("S", new Integer(0));
proline.put("T", new Integer(0));
proline.put("P", new Integer(1));
proline.put("-", new Integer(1));
proline.put("*", new Integer(1));
}
static
{
propHash.put("hydrophobic", hydrophobic);
propHash.put("small", small);
propHash.put("positive", positive);
propHash.put("negative", negative);
propHash.put("charged", charged);
propHash.put("aromatic", aromatic);
propHash.put("aliphatic", aliphatic);
propHash.put("tiny", tiny);
propHash.put("proline", proline);
propHash.put("polar", polar);
}
static
{
int[][] propMatrixF = new int[maxProteinIndex][maxProteinIndex], propMatrixPos = new int[maxProteinIndex][maxProteinIndex], propMatrixEpos = new int[maxProteinIndex][maxProteinIndex];
for (int i = 0; i < maxProteinIndex; i++)
{
int maxF = 0, maxP = 0, maxEP = 0;
String ic = "";
if (aa.length > i)
{
ic += aa[i];
}
else
{
ic = "-";
}
for (int j = i + 1; j < maxProteinIndex; j++)
{
String jc = "";
if (aa.length > j)
{
jc += aa[j];
}
else
{
jc = "-";
}
propMatrixF[i][j] = 0;
propMatrixPos[i][j] = 0;
propMatrixEpos[i][j] = 0;
for (Enumeration en = propHash.keys(); en.hasMoreElements();)
{
String ph = en.nextElement();
Map pph = (Map) propHash
.get(ph);
if (pph.get(ic) != null && pph.get(jc) != null)
{
int icp = pph.get(ic).intValue(), jcp = pph.get(jc).intValue();
// Still working on these definitions.
propMatrixPos[i][j] += icp == jcp && icp > 0 ? 2 : 0;
propMatrixPos[j][i] += icp == jcp && icp > 0 ? 2 : 0;
propMatrixF[i][j] += icp == jcp ? 2 : 0;
propMatrixF[j][i] += icp == jcp ? 2 : 0;
propMatrixEpos[i][j] += icp == jcp ? (1 + icp * 2) : 0;
propMatrixEpos[j][i] += icp == jcp ? (1 + icp * 2) : 0;
}
}
if (maxF < propMatrixF[i][j])
{
maxF = propMatrixF[i][j];
}
if (maxP < propMatrixPos[i][j])
{
maxP = propMatrixPos[i][j];
}
if (maxEP < propMatrixEpos[i][j])
{
maxEP = propMatrixEpos[i][j];
}
}
propMatrixF[i][i] = maxF;
propMatrixPos[i][i] = maxP;
propMatrixEpos[i][i] = maxEP;
}
// JAL-1512 comment out physicochemical score matrices for 2.8.1 release
// scoreMatrices.put("Conservation Pos", new
// ScoreMatrix("Conservation Pos",propMatrixPos,0));
// scoreMatrices.put("Conservation Both", new
// ScoreMatrix("Conservation Both",propMatrixF,0));
// scoreMatrices.put("Conservation EnhPos", new
// ScoreMatrix("Conservation EnhPos",propMatrixEpos,0));
scoreMatrices.put("PID", new PIDScoreModel());
scoreMatrices.put("Displayed Features", new FeatureScoreModel());
}
private ResidueProperties()
{
}
public static double getHydmax()
{
return hydmax;
}
public static double getHydmin()
{
return hydmin;
}
public static double[] getHyd()
{
return hyd;
}
public static Map getAA3Hash()
{
return aa3Hash;
}
public static int[][] getDNA()
{
return ResidueProperties.DNA;
}
public static int[][] getBLOSUM62()
{
return ResidueProperties.BLOSUM62;
}
public static int getPAM250(String A1, String A2)
{
return getPAM250(A1.charAt(0), A2.charAt(0));
}
public static int getBLOSUM62(char c1, char c2)
{
int pog = 0;
try
{
int a = aaIndex[c1];
int b = aaIndex[c2];
pog = ResidueProperties.BLOSUM62[a][b];
} catch (Exception e)
{
// System.out.println("Unknown residue in " + A1 + " " + A2);
}
return pog;
}
public static Vector getCodons(String res)
{
if (codonHash.containsKey(res))
{
return (Vector) codonHash.get(res);
}
return null;
}
public static String codonTranslate(String lccodon)
{
if (false)
{
return _codonTranslate(lccodon);
}
String cdn = codonHash2.get(lccodon.toUpperCase());
if ("*".equals(cdn))
{
return "STOP";
}
return cdn;
}
public static String _codonTranslate(String lccodon)
{
String codon = lccodon.toUpperCase();
// all base ambiguity codes yield an 'X' amino acid residue
if (codon.indexOf('X') > -1 || codon.indexOf('N') > -1)
{
return "X";
}
for (String key : codonHash.keySet())
{
if (codonHash.get(key).contains(codon))
{
return key;
}
}
return null;
}
public static int[][] getDefaultPeptideMatrix()
{
return ResidueProperties.getBLOSUM62();
}
public static int[][] getDefaultDnaMatrix()
{
return ResidueProperties.getDNA();
}
/**
* get a ScoreMatrix based on its string name
*
* @param pwtype
* @return matrix in scoreMatrices with key pwtype or null
*/
public static ScoreMatrix getScoreMatrix(String pwtype)
{
Object val = scoreMatrices.get(pwtype);
if (val != null && val instanceof ScoreMatrix)
{
return (ScoreMatrix) val;
}
return null;
}
/**
* get a ScoreModel based on its string name
*
* @param pwtype
* @return scoremodel of type pwtype or null
*/
public static ScoreModelI getScoreModel(String pwtype)
{
return scoreMatrices.get(pwtype);
}
public static int getPAM250(char c, char d)
{
int a = aaIndex[c];
int b = aaIndex[d];
int pog = ResidueProperties.PAM250[a][b];
return pog;
}
public static Hashtable toDssp3State;
static
{
toDssp3State = new Hashtable();
toDssp3State.put("H", "H");
toDssp3State.put("E", "E");
toDssp3State.put("C", " ");
toDssp3State.put(" ", " ");
toDssp3State.put("T", " ");
toDssp3State.put("B", "E");
toDssp3State.put("G", "H");
toDssp3State.put("I", "H");
toDssp3State.put("X", " ");
}
/**
* translate from other dssp secondary structure alphabets to 3-state
*
* @param ssstring
* @return ssstring as a three-state secondary structure assignment.
*/
public static String getDssp3state(String ssstring)
{
if (ssstring == null)
{
return null;
}
StringBuffer ss = new StringBuffer();
for (int i = 0; i < ssstring.length(); i++)
{
String ssc = ssstring.substring(i, i + 1);
if (toDssp3State.containsKey(ssc))
{
ss.append((String) toDssp3State.get(ssc));
}
else
{
ss.append(" ");
}
}
return ss.toString();
}
/**
* Used by getRNASecStrucState
*
*/
public static Hashtable toRNAssState;
public static boolean RNAcloseParen[] = new boolean[255];
static
{
toRNAssState = new Hashtable();
toRNAssState.put(")", "(");
toRNAssState.put("(", "(");
toRNAssState.put("]", "[");
toRNAssState.put("[", "[");
toRNAssState.put("{", "{");
toRNAssState.put("}", "{");
toRNAssState.put(">", ">");
toRNAssState.put("<", ">");
toRNAssState.put("A", "A");
toRNAssState.put("a", "A");
toRNAssState.put("B", "B");
toRNAssState.put("b", "B");
toRNAssState.put("C", "C");
toRNAssState.put("c", "C");
toRNAssState.put("D", "D");
toRNAssState.put("d", "D");
toRNAssState.put("E", "E");
toRNAssState.put("e", "E");
toRNAssState.put("F", "F");
toRNAssState.put("f", "F");
toRNAssState.put("G", "G");
toRNAssState.put("g", "G");
toRNAssState.put("H", "H");
toRNAssState.put("h", "H");
toRNAssState.put("I", "I");
toRNAssState.put("i", "I");
toRNAssState.put("J", "J");
toRNAssState.put("j", "J");
toRNAssState.put("K", "K");
toRNAssState.put("k", "K");
toRNAssState.put("L", "L");
toRNAssState.put("l", "L");
toRNAssState.put("M", "M");
toRNAssState.put("m", "M");
toRNAssState.put("N", "N");
toRNAssState.put("n", "N");
toRNAssState.put("O", "O");
toRNAssState.put("o", "O");
toRNAssState.put("P", "P");
toRNAssState.put("p", "P");
toRNAssState.put("Q", "Q");
toRNAssState.put("q", "Q");
toRNAssState.put("R", "R");
toRNAssState.put("r", "R");
toRNAssState.put("S", "S");
toRNAssState.put("s", "S");
toRNAssState.put("T", "T");
toRNAssState.put("t", "T");
toRNAssState.put("U", "U");
toRNAssState.put("u", "U");
toRNAssState.put("V", "V");
toRNAssState.put("v", "V");
toRNAssState.put("W", "W");
toRNAssState.put("w", "W");
toRNAssState.put("X", "X");
toRNAssState.put("x", "X");
toRNAssState.put("Y", "Y");
toRNAssState.put("y", "Y");
toRNAssState.put("Z", "Z");
toRNAssState.put("z", "Z");
for (int p = 0; p < RNAcloseParen.length; p++)
{
RNAcloseParen[p] = false;
}
for (String k : toRNAssState.keySet())
{
RNAcloseParen[k.charAt(0)] = k.charAt(0) != toRNAssState.get(k)
.charAt(0);
}
}
static
{
modifications.put("MSE", "MET"); // Selenomethionine
// the rest tbc; from
// http://sourceforge.net/p/jmol/mailman/message/12833570/
// modifications.put("CSE", "CYS"); // Selenocysteine
// modifications.put("PTR", "TYR"); // Phosphotyrosine
// modifications.put("SEP", "SER"); // Phosphoserine
// modifications.put("HYP", "PRO"); // 4-hydroxyproline
// modifications.put("5HP", "GLU"); // Pyroglutamic acid; 5-hydroxyproline
// modifications.put("PCA", "GLU"); // Pyroglutamic acid
// modifications.put("LYZ", "LYS"); // 5-hydroxylysine
// Additional protein alphabets used in the SCOP database and PDB files
// source:
// https://github.com/biopython/biopython/blob/master/Bio/Data/SCOPData.py
modifications.put("00C", "CYS");
modifications.put("01W", "XAA");
modifications.put("02K", "ALA");
modifications.put("03Y", "CYS");
modifications.put("07O", "CYS");
modifications.put("08P", "CYS");
modifications.put("0A0", "ASP");
modifications.put("0A1", "TYR");
modifications.put("0A2", "LYS");
modifications.put("0A8", "CYS");
modifications.put("0AA", "VAL");
modifications.put("0AB", "VAL");
modifications.put("0AC", "GLY");
modifications.put("0AD", "GLY");
modifications.put("0AF", "TRP");
modifications.put("0AG", "LEU");
modifications.put("0AH", "SER");
modifications.put("0AK", "ASP");
modifications.put("0AM", "ALA");
modifications.put("0AP", "CYS");
modifications.put("0AU", "UR3");
modifications.put("0AV", "ALA");
modifications.put("0AZ", "PRO");
modifications.put("0BN", "PHE");
modifications.put("0C ", "CYS");
modifications.put("0CS", "ALA");
modifications.put("0DC", "CYS");
modifications.put("0DG", "GLY");
modifications.put("0DT", "THR");
modifications.put("0FL", "ALA");
modifications.put("0G ", "GLY");
modifications.put("0NC", "ALA");
modifications.put("0SP", "ALA");
modifications.put("0U ", "UR3");
modifications.put("0YG", "YG");
modifications.put("10C", "CYS");
modifications.put("125", "UR3");
modifications.put("126", "UR3");
modifications.put("127", "UR3");
modifications.put("128", "ASN");
modifications.put("12A", "ALA");
modifications.put("143", "CYS");
modifications.put("175", "ASG");
modifications.put("193", "XAA");
modifications.put("1AP", "ALA");
modifications.put("1MA", "ALA");
modifications.put("1MG", "GLY");
modifications.put("1PA", "PHE");
modifications.put("1PI", "ALA");
modifications.put("1PR", "ASN");
modifications.put("1SC", "CYS");
modifications.put("1TQ", "TRP");
modifications.put("1TY", "TYR");
modifications.put("1X6", "SER");
modifications.put("200", "PHE");
modifications.put("23F", "PHE");
modifications.put("23S", "XAA");
modifications.put("26B", "THR");
modifications.put("2AD", "XAA");
modifications.put("2AG", "ALA");
modifications.put("2AO", "XAA");
modifications.put("2AR", "ALA");
modifications.put("2AS", "XAA");
modifications.put("2AT", "THR");
modifications.put("2AU", "UR3");
modifications.put("2BD", "ILE");
modifications.put("2BT", "THR");
modifications.put("2BU", "ALA");
modifications.put("2CO", "CYS");
modifications.put("2DA", "ALA");
modifications.put("2DF", "ASN");
modifications.put("2DM", "ASN");
modifications.put("2DO", "XAA");
modifications.put("2DT", "THR");
modifications.put("2EG", "GLY");
modifications.put("2FE", "ASN");
modifications.put("2FI", "ASN");
modifications.put("2FM", "MET");
modifications.put("2GT", "THR");
modifications.put("2HF", "HIS");
modifications.put("2LU", "LEU");
modifications.put("2MA", "ALA");
modifications.put("2MG", "GLY");
modifications.put("2ML", "LEU");
modifications.put("2MR", "ARG");
modifications.put("2MT", "PRO");
modifications.put("2MU", "UR3");
modifications.put("2NT", "THR");
modifications.put("2OM", "UR3");
modifications.put("2OT", "THR");
modifications.put("2PI", "XAA");
modifications.put("2PR", "GLY");
modifications.put("2SA", "ASN");
modifications.put("2SI", "XAA");
modifications.put("2ST", "THR");
modifications.put("2TL", "THR");
modifications.put("2TY", "TYR");
modifications.put("2VA", "VAL");
modifications.put("2XA", "CYS");
modifications.put("32S", "XAA");
modifications.put("32T", "XAA");
modifications.put("3AH", "HIS");
modifications.put("3AR", "XAA");
modifications.put("3CF", "PHE");
modifications.put("3DA", "ALA");
modifications.put("3DR", "ASN");
modifications.put("3GA", "ALA");
modifications.put("3MD", "ASP");
modifications.put("3ME", "UR3");
modifications.put("3NF", "TYR");
modifications.put("3QN", "LYS");
modifications.put("3TY", "XAA");
modifications.put("3XH", "GLY");
modifications.put("4AC", "ASN");
modifications.put("4BF", "TYR");
modifications.put("4CF", "PHE");
modifications.put("4CY", "MET");
modifications.put("4DP", "TRP");
modifications.put("4F3", "GYG");
modifications.put("4FB", "PRO");
modifications.put("4FW", "TRP");
modifications.put("4HT", "TRP");
modifications.put("4IN", "TRP");
modifications.put("4MF", "ASN");
modifications.put("4MM", "XAA");
modifications.put("4OC", "CYS");
modifications.put("4PC", "CYS");
modifications.put("4PD", "CYS");
modifications.put("4PE", "CYS");
modifications.put("4PH", "PHE");
modifications.put("4SC", "CYS");
modifications.put("4SU", "UR3");
modifications.put("4TA", "ASN");
modifications.put("4U7", "ALA");
modifications.put("56A", "HIS");
modifications.put("5AA", "ALA");
modifications.put("5AB", "ALA");
modifications.put("5AT", "THR");
modifications.put("5BU", "UR3");
modifications.put("5CG", "GLY");
modifications.put("5CM", "CYS");
modifications.put("5CS", "CYS");
modifications.put("5FA", "ALA");
modifications.put("5FC", "CYS");
modifications.put("5FU", "UR3");
modifications.put("5HP", "GLU");
modifications.put("5HT", "THR");
modifications.put("5HU", "UR3");
modifications.put("5IC", "CYS");
modifications.put("5IT", "THR");
modifications.put("5IU", "UR3");
modifications.put("5MC", "CYS");
modifications.put("5MD", "ASN");
modifications.put("5MU", "UR3");
modifications.put("5NC", "CYS");
modifications.put("5PC", "CYS");
modifications.put("5PY", "THR");
modifications.put("5SE", "UR3");
modifications.put("5ZA", "TWG");
modifications.put("64T", "THR");
modifications.put("6CL", "LYS");
modifications.put("6CT", "THR");
modifications.put("6CW", "TRP");
modifications.put("6HA", "ALA");
modifications.put("6HC", "CYS");
modifications.put("6HG", "GLY");
modifications.put("6HN", "LYS");
modifications.put("6HT", "THR");
modifications.put("6IA", "ALA");
modifications.put("6MA", "ALA");
modifications.put("6MC", "ALA");
modifications.put("6MI", "ASN");
modifications.put("6MT", "ALA");
modifications.put("6MZ", "ASN");
modifications.put("6OG", "GLY");
modifications.put("70U", "UR3");
modifications.put("7DA", "ALA");
modifications.put("7GU", "GLY");
modifications.put("7JA", "ILE");
modifications.put("7MG", "GLY");
modifications.put("8AN", "ALA");
modifications.put("8FG", "GLY");
modifications.put("8MG", "GLY");
modifications.put("8OG", "GLY");
modifications.put("9NE", "GLU");
modifications.put("9NF", "PHE");
modifications.put("9NR", "ARG");
modifications.put("9NV", "VAL");
modifications.put("A ", "ALA");
modifications.put("A1P", "ASN");
modifications.put("A23", "ALA");
modifications.put("A2L", "ALA");
modifications.put("A2M", "ALA");
modifications.put("A34", "ALA");
modifications.put("A35", "ALA");
modifications.put("A38", "ALA");
modifications.put("A39", "ALA");
modifications.put("A3A", "ALA");
modifications.put("A3P", "ALA");
modifications.put("A40", "ALA");
modifications.put("A43", "ALA");
modifications.put("A44", "ALA");
modifications.put("A47", "ALA");
modifications.put("A5L", "ALA");
modifications.put("A5M", "CYS");
modifications.put("A5N", "ASN");
modifications.put("A5O", "ALA");
modifications.put("A66", "XAA");
modifications.put("AA3", "ALA");
modifications.put("AA4", "ALA");
modifications.put("AAR", "ARG");
modifications.put("AB7", "XAA");
modifications.put("ABA", "ALA");
modifications.put("ABR", "ALA");
modifications.put("ABS", "ALA");
modifications.put("ABT", "ASN");
modifications.put("ACB", "ASP");
modifications.put("ACL", "ARG");
modifications.put("AD2", "ALA");
modifications.put("ADD", "XAA");
modifications.put("ADX", "ASN");
modifications.put("AEA", "XAA");
modifications.put("AEI", "ASP");
modifications.put("AET", "ALA");
modifications.put("AFA", "ASN");
modifications.put("AFF", "ASN");
modifications.put("AFG", "GLY");
modifications.put("AGM", "ARG");
modifications.put("AGT", "CYS");
modifications.put("AHB", "ASN");
modifications.put("AHH", "XAA");
modifications.put("AHO", "ALA");
modifications.put("AHP", "ALA");
modifications.put("AHS", "XAA");
modifications.put("AHT", "XAA");
modifications.put("AIB", "ALA");
modifications.put("AKL", "ASP");
modifications.put("AKZ", "ASP");
modifications.put("ALA", "ALA");
modifications.put("ALC", "ALA");
modifications.put("ALM", "ALA");
modifications.put("ALN", "ALA");
modifications.put("ALO", "THR");
modifications.put("ALQ", "XAA");
modifications.put("ALS", "ALA");
modifications.put("ALT", "ALA");
modifications.put("ALV", "ALA");
modifications.put("ALY", "LYS");
modifications.put("AN8", "ALA");
modifications.put("AP7", "ALA");
modifications.put("APE", "XAA");
modifications.put("APH", "ALA");
modifications.put("API", "LYS");
modifications.put("APK", "LYS");
modifications.put("APM", "XAA");
modifications.put("APP", "XAA");
modifications.put("AR2", "ARG");
modifications.put("AR4", "GLU");
modifications.put("AR7", "ARG");
modifications.put("ARG", "ARG");
modifications.put("ARM", "ARG");
modifications.put("ARO", "ARG");
modifications.put("ARV", "XAA");
modifications.put("AS ", "ALA");
modifications.put("AS2", "ASP");
modifications.put("AS9", "XAA");
modifications.put("ASA", "ASP");
modifications.put("ASB", "ASP");
modifications.put("ASI", "ASP");
modifications.put("ASK", "ASP");
modifications.put("ASL", "ASP");
modifications.put("ASM", "XAA");
modifications.put("ASN", "ASN");
modifications.put("ASP", "ASP");
modifications.put("ASQ", "ASP");
modifications.put("ASU", "ASN");
modifications.put("ASX", "ASX");
modifications.put("ATD", "THR");
modifications.put("ATL", "THR");
modifications.put("ATM", "THR");
modifications.put("AVC", "ALA");
modifications.put("AVN", "XAA");
modifications.put("AYA", "ALA");
modifications.put("AYG", "AYG");
modifications.put("AZK", "LYS");
modifications.put("AZS", "SER");
modifications.put("AZY", "TYR");
modifications.put("B1F", "PHE");
modifications.put("B1P", "ASN");
modifications.put("B2A", "ALA");
modifications.put("B2F", "PHE");
modifications.put("B2I", "ILE");
modifications.put("B2V", "VAL");
modifications.put("B3A", "ALA");
modifications.put("B3D", "ASP");
modifications.put("B3E", "GLU");
modifications.put("B3K", "LYS");
modifications.put("B3L", "XAA");
modifications.put("B3M", "XAA");
modifications.put("B3Q", "XAA");
modifications.put("B3S", "SER");
modifications.put("B3T", "XAA");
modifications.put("B3U", "HIS");
modifications.put("B3X", "ASN");
modifications.put("B3Y", "TYR");
modifications.put("BB6", "CYS");
modifications.put("BB7", "CYS");
modifications.put("BB8", "PHE");
modifications.put("BB9", "CYS");
modifications.put("BBC", "CYS");
modifications.put("BCS", "CYS");
modifications.put("BE2", "XAA");
modifications.put("BFD", "ASP");
modifications.put("BG1", "SER");
modifications.put("BGM", "GLY");
modifications.put("BH2", "ASP");
modifications.put("BHD", "ASP");
modifications.put("BIF", "PHE");
modifications.put("BIL", "XAA");
modifications.put("BIU", "ILE");
modifications.put("BJH", "XAA");
modifications.put("BLE", "LEU");
modifications.put("BLY", "LYS");
modifications.put("BMP", "ASN");
modifications.put("BMT", "THR");
modifications.put("BNN", "PHE");
modifications.put("BNO", "XAA");
modifications.put("BOE", "THR");
modifications.put("BOR", "ARG");
modifications.put("BPE", "CYS");
modifications.put("BRU", "UR3");
modifications.put("BSE", "SER");
modifications.put("BT5", "ASN");
modifications.put("BTA", "LEU");
modifications.put("BTC", "CYS");
modifications.put("BTR", "TRP");
modifications.put("BUC", "CYS");
modifications.put("BUG", "VAL");
modifications.put("BVP", "UR3");
modifications.put("BZG", "ASN");
modifications.put("C ", "CYS");
modifications.put("C12", "TYG");
modifications.put("C1X", "LYS");
modifications.put("C25", "CYS");
modifications.put("C2L", "CYS");
modifications.put("C2S", "CYS");
modifications.put("C31", "CYS");
modifications.put("C32", "CYS");
modifications.put("C34", "CYS");
modifications.put("C36", "CYS");
modifications.put("C37", "CYS");
modifications.put("C38", "CYS");
modifications.put("C3Y", "CYS");
modifications.put("C42", "CYS");
modifications.put("C43", "CYS");
modifications.put("C45", "CYS");
modifications.put("C46", "CYS");
modifications.put("C49", "CYS");
modifications.put("C4R", "CYS");
modifications.put("C4S", "CYS");
modifications.put("C5C", "CYS");
modifications.put("C66", "XAA");
modifications.put("C6C", "CYS");
modifications.put("C99", "TFG");
modifications.put("CAF", "CYS");
modifications.put("CAL", "XAA");
modifications.put("CAR", "CYS");
modifications.put("CAS", "CYS");
modifications.put("CAV", "XAA");
modifications.put("CAY", "CYS");
modifications.put("CB2", "CYS");
modifications.put("CBR", "CYS");
modifications.put("CBV", "CYS");
modifications.put("CCC", "CYS");
modifications.put("CCL", "LYS");
modifications.put("CCS", "CYS");
modifications.put("CCY", "CYG");
modifications.put("CDE", "XAA");
modifications.put("CDV", "XAA");
modifications.put("CDW", "CYS");
modifications.put("CEA", "CYS");
modifications.put("CFL", "CYS");
modifications.put("CFY", "FCYG"); // check
modifications.put("CG1", "GLY");
modifications.put("CGA", "GLU");
modifications.put("CGU", "GLU");
modifications.put("CH ", "CYS");
modifications.put("CH6", "MYG");
modifications.put("CH7", "KYG");
modifications.put("CHF", "XAA");
modifications.put("CHG", "XAA");
modifications.put("CHP", "GLY");
modifications.put("CHS", "XAA");
modifications.put("CIR", "ARG");
modifications.put("CJO", "GYG");
modifications.put("CLE", "LEU");
modifications.put("CLG", "LYS");
modifications.put("CLH", "LYS");
modifications.put("CLV", "AFG");
modifications.put("CM0", "ASN");
modifications.put("CME", "CYS");
modifications.put("CMH", "CYS");
modifications.put("CML", "CYS");
modifications.put("CMR", "CYS");
modifications.put("CMT", "CYS");
modifications.put("CNU", "UR3");
modifications.put("CP1", "CYS");
modifications.put("CPC", "XAA");
modifications.put("CPI", "XAA");
modifications.put("CQR", "GYG");
modifications.put("CR0", "TLG");
modifications.put("CR2", "GYG");
modifications.put("CR5", "GLY");
modifications.put("CR7", "KYG");
modifications.put("CR8", "HYG");
modifications.put("CRF", "TWG");
modifications.put("CRG", "THG");
modifications.put("CRK", "MYG");
modifications.put("CRO", "GYG");
modifications.put("CRQ", "QYG");
modifications.put("CRU", "EYG");
modifications.put("CRW", "ASG");
modifications.put("CRX", "ASG");
modifications.put("CS0", "CYS");
modifications.put("CS1", "CYS");
modifications.put("CS3", "CYS");
modifications.put("CS4", "CYS");
modifications.put("CS8", "ASN");
modifications.put("CSA", "CYS");
modifications.put("CSB", "CYS");
modifications.put("CSD", "CYS");
modifications.put("CSE", "CYS");
modifications.put("CSF", "CYS");
modifications.put("CSH", "SHG");
modifications.put("CSI", "GLY");
modifications.put("CSJ", "CYS");
modifications.put("CSL", "CYS");
modifications.put("CSO", "CYS");
modifications.put("CSP", "CYS");
modifications.put("CSR", "CYS");
modifications.put("CSS", "CYS");
modifications.put("CSU", "CYS");
modifications.put("CSW", "CYS");
modifications.put("CSX", "CYS");
modifications.put("CSY", "SYG");
modifications.put("CSZ", "CYS");
modifications.put("CTE", "TRP");
modifications.put("CTG", "THR");
modifications.put("CTH", "THR");
modifications.put("CUC", "XAA");
modifications.put("CWR", "SER");
modifications.put("CXM", "MET");
modifications.put("CY0", "CYS");
modifications.put("CY1", "CYS");
modifications.put("CY3", "CYS");
modifications.put("CY4", "CYS");
modifications.put("CYA", "CYS");
modifications.put("CYD", "CYS");
modifications.put("CYF", "CYS");
modifications.put("CYG", "CYS");
modifications.put("CYJ", "XAA");
modifications.put("CYM", "CYS");
modifications.put("CYQ", "CYS");
modifications.put("CYR", "CYS");
modifications.put("CYS", "CYS");
modifications.put("CZ2", "CYS");
modifications.put("CZO", "GYG");
modifications.put("CZZ", "CYS");
modifications.put("D11", "THR");
modifications.put("D1P", "ASN");
modifications.put("D3 ", "ASN");
modifications.put("D33", "ASN");
modifications.put("D3P", "GLY");
modifications.put("D3T", "THR");
modifications.put("D4M", "THR");
modifications.put("D4P", "XAA");
modifications.put("DA ", "ALA");
modifications.put("DA2", "XAA");
modifications.put("DAB", "ALA");
modifications.put("DAH", "PHE");
modifications.put("DAL", "ALA");
modifications.put("DAR", "ARG");
modifications.put("DAS", "ASP");
modifications.put("DBB", "THR");
modifications.put("DBM", "ASN");
modifications.put("DBS", "SER");
modifications.put("DBU", "THR");
modifications.put("DBY", "TYR");
modifications.put("DBZ", "ALA");
modifications.put("DC ", "CYS");
modifications.put("DC2", "CYS");
modifications.put("DCG", "GLY");
modifications.put("DCI", "XAA");
modifications.put("DCL", "XAA");
modifications.put("DCT", "CYS");
modifications.put("DCY", "CYS");
modifications.put("DDE", "HIS");
modifications.put("DDG", "GLY");
modifications.put("DDN", "UR3");
modifications.put("DDX", "ASN");
modifications.put("DFC", "CYS");
modifications.put("DFG", "GLY");
modifications.put("DFI", "XAA");
modifications.put("DFO", "XAA");
modifications.put("DFT", "ASN");
modifications.put("DG ", "GLY");
modifications.put("DGH", "GLY");
modifications.put("DGI", "GLY");
modifications.put("DGL", "GLU");
modifications.put("DGN", "GLN");
modifications.put("DHA", "SER");
modifications.put("DHI", "HIS");
modifications.put("DHL", "XAA");
modifications.put("DHN", "VAL");
modifications.put("DHP", "XAA");
modifications.put("DHU", "UR3");
modifications.put("DHV", "VAL");
modifications.put("DI ", "ILE");
modifications.put("DIL", "ILE");
modifications.put("DIR", "ARG");
modifications.put("DIV", "VAL");
modifications.put("DLE", "LEU");
modifications.put("DLS", "LYS");
modifications.put("DLY", "LYS");
modifications.put("DM0", "LYS");
modifications.put("DMH", "ASN");
modifications.put("DMK", "ASP");
modifications.put("DMT", "XAA");
modifications.put("DN ", "ASN");
modifications.put("DNE", "LEU");
modifications.put("DNG", "LEU");
modifications.put("DNL", "LYS");
modifications.put("DNM", "LEU");
modifications.put("DNP", "ALA");
modifications.put("DNR", "CYS");
modifications.put("DNS", "LYS");
modifications.put("DOA", "XAA");
modifications.put("DOC", "CYS");
modifications.put("DOH", "ASP");
modifications.put("DON", "LEU");
modifications.put("DPB", "THR");
modifications.put("DPH", "PHE");
modifications.put("DPL", "PRO");
modifications.put("DPP", "ALA");
modifications.put("DPQ", "TYR");
modifications.put("DPR", "PRO");
modifications.put("DPY", "ASN");
modifications.put("DRM", "UR3");
modifications.put("DRP", "ASN");
modifications.put("DRT", "THR");
modifications.put("DRZ", "ASN");
modifications.put("DSE", "SER");
modifications.put("DSG", "ASN");
modifications.put("DSN", "SER");
modifications.put("DSP", "ASP");
modifications.put("DT ", "THR");
modifications.put("DTH", "THR");
modifications.put("DTR", "TRP");
modifications.put("DTY", "TYR");
modifications.put("DU ", "UR3");
modifications.put("DVA", "VAL");
modifications.put("DXD", "ASN");
modifications.put("DXN", "ASN");
modifications.put("DYG", "DYG");
modifications.put("DYS", "CYS");
modifications.put("DZM", "ALA");
modifications.put("E ", "ALA");
modifications.put("E1X", "ALA");
modifications.put("ECC", "GLN");
modifications.put("EDA", "ALA");
modifications.put("EFC", "CYS");
modifications.put("EHP", "PHE");
modifications.put("EIT", "THR");
modifications.put("ENP", "ASN");
modifications.put("ESB", "TYR");
modifications.put("ESC", "MET");
modifications.put("EXB", "XAA");
modifications.put("EXY", "LEU");
modifications.put("EY5", "ASN");
modifications.put("EYS", "XAA");
modifications.put("F2F", "PHE");
modifications.put("FA2", "ALA");
modifications.put("FA5", "ASN");
modifications.put("FAG", "ASN");
modifications.put("FAI", "ASN");
modifications.put("FB5", "ALA");
modifications.put("FB6", "ALA");
modifications.put("FCL", "PHE");
modifications.put("FFD", "ASN");
modifications.put("FGA", "GLU");
modifications.put("FGL", "GLY");
modifications.put("FGP", "SER");
modifications.put("FHL", "XAA");
modifications.put("FHO", "LYS");
modifications.put("FHU", "UR3");
modifications.put("FLA", "ALA");
modifications.put("FLE", "LEU");
modifications.put("FLT", "TYR");
modifications.put("FME", "MET");
modifications.put("FMG", "GLY");
modifications.put("FMU", "ASN");
modifications.put("FOE", "CYS");
modifications.put("FOX", "GLY");
modifications.put("FP9", "PRO");
modifications.put("FPA", "PHE");
modifications.put("FRD", "XAA");
modifications.put("FT6", "TRP");
modifications.put("FTR", "TRP");
modifications.put("FTY", "TYR");
modifications.put("FVA", "VAL");
modifications.put("FZN", "LYS");
modifications.put("G ", "GLY");
modifications.put("G25", "GLY");
modifications.put("G2L", "GLY");
modifications.put("G2S", "GLY");
modifications.put("G31", "GLY");
modifications.put("G32", "GLY");
modifications.put("G33", "GLY");
modifications.put("G36", "GLY");
modifications.put("G38", "GLY");
modifications.put("G42", "GLY");
modifications.put("G46", "GLY");
modifications.put("G47", "GLY");
modifications.put("G48", "GLY");
modifications.put("G49", "GLY");
modifications.put("G4P", "ASN");
modifications.put("G7M", "GLY");
modifications.put("GAO", "GLY");
modifications.put("GAU", "GLU");
modifications.put("GCK", "CYS");
modifications.put("GCM", "XAA");
modifications.put("GDP", "GLY");
modifications.put("GDR", "GLY");
modifications.put("GFL", "GLY");
modifications.put("GGL", "GLU");
modifications.put("GH3", "GLY");
modifications.put("GHG", "GLN");
modifications.put("GHP", "GLY");
modifications.put("GL3", "GLY");
modifications.put("GLH", "GLN");
modifications.put("GLJ", "GLU");
modifications.put("GLK", "GLU");
modifications.put("GLM", "XAA");
modifications.put("GLN", "GLN");
modifications.put("GLQ", "GLU");
modifications.put("GLU", "GLU");
modifications.put("GLX", "GLX");
modifications.put("GLY", "GLY");
modifications.put("GLZ", "GLY");
modifications.put("GMA", "GLU");
modifications.put("GMS", "GLY");
modifications.put("GMU", "UR3");
modifications.put("GN7", "GLY");
modifications.put("GND", "XAA");
modifications.put("GNE", "ASN");
modifications.put("GOM", "GLY");
modifications.put("GPL", "LYS");
modifications.put("GS ", "GLY");
modifications.put("GSC", "GLY");
modifications.put("GSR", "GLY");
modifications.put("GSS", "GLY");
modifications.put("GSU", "GLU");
modifications.put("GT9", "CYS");
modifications.put("GTP", "GLY");
modifications.put("GVL", "XAA");
modifications.put("GYC", "CYG");
modifications.put("GYS", "SYG");
modifications.put("H2U", "UR3");
modifications.put("H5M", "PRO");
modifications.put("HAC", "ALA");
modifications.put("HAR", "ARG");
modifications.put("HBN", "HIS");
modifications.put("HCS", "XAA");
modifications.put("HDP", "UR3");
modifications.put("HEU", "UR3");
modifications.put("HFA", "XAA");
modifications.put("HGL", "XAA");
modifications.put("HHI", "HIS");
modifications.put("HHK", "AK"); // check
modifications.put("HIA", "HIS");
modifications.put("HIC", "HIS");
modifications.put("HIP", "HIS");
modifications.put("HIQ", "HIS");
modifications.put("HIS", "HIS");
modifications.put("HL2", "LEU");
modifications.put("HLU", "LEU");
modifications.put("HMR", "ARG");
modifications.put("HOL", "ASN");
modifications.put("HPC", "PHE");
modifications.put("HPE", "PHE");
modifications.put("HPH", "PHE");
modifications.put("HPQ", "PHE");
modifications.put("HQA", "ALA");
modifications.put("HRG", "ARG");
modifications.put("HRP", "TRP");
modifications.put("HS8", "HIS");
modifications.put("HS9", "HIS");
modifications.put("HSE", "SER");
modifications.put("HSL", "SER");
modifications.put("HSO", "HIS");
modifications.put("HTI", "CYS");
modifications.put("HTN", "ASN");
modifications.put("HTR", "TRP");
modifications.put("HV5", "ALA");
modifications.put("HVA", "VAL");
modifications.put("HY3", "PRO");
modifications.put("HYP", "PRO");
modifications.put("HZP", "PRO");
modifications.put("I ", "ILE");
modifications.put("I2M", "ILE");
modifications.put("I58", "LYS");
modifications.put("I5C", "CYS");
modifications.put("IAM", "ALA");
modifications.put("IAR", "ARG");
modifications.put("IAS", "ASP");
modifications.put("IC ", "CYS");
modifications.put("IEL", "LYS");
modifications.put("IEY", "HYG");
modifications.put("IG ", "GLY");
modifications.put("IGL", "GLY");
modifications.put("IGU", "GLY");
modifications.put("IIC", "SHG");
modifications.put("IIL", "ILE");
modifications.put("ILE", "ILE");
modifications.put("ILG", "GLU");
modifications.put("ILX", "ILE");
modifications.put("IMC", "CYS");
modifications.put("IML", "ILE");
modifications.put("IOY", "PHE");
modifications.put("IPG", "GLY");
modifications.put("IPN", "ASN");
modifications.put("IRN", "ASN");
modifications.put("IT1", "LYS");
modifications.put("IU ", "UR3");
modifications.put("IYR", "TYR");
modifications.put("IYT", "THR");
modifications.put("IZO", "MET");
modifications.put("JJJ", "CYS");
modifications.put("JJK", "CYS");
modifications.put("JJL", "CYS");
modifications.put("JW5", "ASN");
modifications.put("K1R", "CYS");
modifications.put("KAG", "GLY");
modifications.put("KCX", "LYS");
modifications.put("KGC", "LYS");
modifications.put("KNB", "ALA");
modifications.put("KOR", "MET");
modifications.put("KPI", "LYS");
modifications.put("KST", "LYS");
modifications.put("KYQ", "LYS");
modifications.put("L2A", "XAA");
modifications.put("LA2", "LYS");
modifications.put("LAA", "ASP");
modifications.put("LAL", "ALA");
modifications.put("LBY", "LYS");
modifications.put("LC ", "CYS");
modifications.put("LCA", "ALA");
modifications.put("LCC", "ASN");
modifications.put("LCG", "GLY");
modifications.put("LCH", "ASN");
modifications.put("LCK", "LYS");
modifications.put("LCX", "LYS");
modifications.put("LDH", "LYS");
modifications.put("LED", "LEU");
modifications.put("LEF", "LEU");
modifications.put("LEH", "LEU");
modifications.put("LEI", "VAL");
modifications.put("LEM", "LEU");
modifications.put("LEN", "LEU");
modifications.put("LET", "XAA");
modifications.put("LEU", "LEU");
modifications.put("LEX", "LEU");
modifications.put("LG ", "GLY");
modifications.put("LGP", "GLY");
modifications.put("LHC", "XAA");
modifications.put("LHU", "UR3");
modifications.put("LKC", "ASN");
modifications.put("LLP", "LYS");
modifications.put("LLY", "LYS");
modifications.put("LME", "GLU");
modifications.put("LMF", "LYS");
modifications.put("LMQ", "GLN");
modifications.put("LMS", "ASN");
modifications.put("LP6", "LYS");
modifications.put("LPD", "PRO");
modifications.put("LPG", "GLY");
modifications.put("LPL", "XAA");
modifications.put("LPS", "SER");
modifications.put("LSO", "XAA");
modifications.put("LTA", "XAA");
modifications.put("LTR", "TRP");
modifications.put("LVG", "GLY");
modifications.put("LVN", "VAL");
modifications.put("LYF", "LYS");
modifications.put("LYK", "LYS");
modifications.put("LYM", "LYS");
modifications.put("LYN", "LYS");
modifications.put("LYR", "LYS");
modifications.put("LYS", "LYS");
modifications.put("LYX", "LYS");
modifications.put("LYZ", "LYS");
modifications.put("M0H", "CYS");
modifications.put("M1G", "GLY");
modifications.put("M2G", "GLY");
modifications.put("M2L", "LYS");
modifications.put("M2S", "MET");
modifications.put("M30", "GLY");
modifications.put("M3L", "LYS");
modifications.put("M5M", "CYS");
modifications.put("MA ", "ALA");
modifications.put("MA6", "ALA");
modifications.put("MA7", "ALA");
modifications.put("MAA", "ALA");
modifications.put("MAD", "ALA");
modifications.put("MAI", "ARG");
modifications.put("MBQ", "TYR");
modifications.put("MBZ", "ASN");
modifications.put("MC1", "SER");
modifications.put("MCG", "XAA");
modifications.put("MCL", "LYS");
modifications.put("MCS", "CYS");
modifications.put("MCY", "CYS");
modifications.put("MD3", "CYS");
modifications.put("MD6", "GLY");
modifications.put("MDH", "XAA");
modifications.put("MDO", "ASG");
modifications.put("MDR", "ASN");
modifications.put("MEA", "PHE");
modifications.put("MED", "MET");
modifications.put("MEG", "GLU");
modifications.put("MEN", "ASN");
modifications.put("MEP", "UR3");
modifications.put("MEQ", "GLN");
modifications.put("MET", "MET");
modifications.put("MEU", "GLY");
modifications.put("MF3", "XAA");
modifications.put("MFC", "GYG");
modifications.put("MG1", "GLY");
modifications.put("MGG", "ARG");
modifications.put("MGN", "GLN");
modifications.put("MGQ", "ALA");
modifications.put("MGV", "GLY");
modifications.put("MGY", "GLY");
modifications.put("MHL", "LEU");
modifications.put("MHO", "MET");
modifications.put("MHS", "HIS");
modifications.put("MIA", "ALA");
modifications.put("MIS", "SER");
modifications.put("MK8", "LEU");
modifications.put("ML3", "LYS");
modifications.put("MLE", "LEU");
modifications.put("MLL", "LEU");
modifications.put("MLY", "LYS");
modifications.put("MLZ", "LYS");
modifications.put("MME", "MET");
modifications.put("MMO", "ARG");
modifications.put("MMT", "THR");
modifications.put("MND", "ASN");
modifications.put("MNL", "LEU");
modifications.put("MNU", "UR3");
modifications.put("MNV", "VAL");
modifications.put("MOD", "XAA");
modifications.put("MP8", "PRO");
modifications.put("MPH", "XAA");
modifications.put("MPJ", "XAA");
modifications.put("MPQ", "GLY");
modifications.put("MRG", "GLY");
modifications.put("MSA", "GLY");
modifications.put("MSE", "MET");
modifications.put("MSL", "MET");
modifications.put("MSO", "MET");
modifications.put("MSP", "XAA");
modifications.put("MT2", "MET");
modifications.put("MTR", "THR");
modifications.put("MTU", "ALA");
modifications.put("MTY", "TYR");
modifications.put("MVA", "VAL");
modifications.put("N ", "ASN");
modifications.put("N10", "SER");
modifications.put("N2C", "XAA");
modifications.put("N5I", "ASN");
modifications.put("N5M", "CYS");
modifications.put("N6G", "GLY");
modifications.put("N7P", "PRO");
modifications.put("NA8", "ALA");
modifications.put("NAL", "ALA");
modifications.put("NAM", "ALA");
modifications.put("NB8", "ASN");
modifications.put("NBQ", "TYR");
modifications.put("NC1", "SER");
modifications.put("NCB", "ALA");
modifications.put("NCX", "ASN");
modifications.put("NCY", "XAA");
modifications.put("NDF", "PHE");
modifications.put("NDN", "UR3");
modifications.put("NEM", "HIS");
modifications.put("NEP", "HIS");
modifications.put("NF2", "ASN");
modifications.put("NFA", "PHE");
modifications.put("NHL", "GLU");
modifications.put("NIT", "XAA");
modifications.put("NIY", "TYR");
modifications.put("NLE", "LEU");
modifications.put("NLN", "LEU");
modifications.put("NLO", "LEU");
modifications.put("NLP", "LEU");
modifications.put("NLQ", "GLN");
modifications.put("NMC", "GLY");
modifications.put("NMM", "ARG");
modifications.put("NMS", "THR");
modifications.put("NMT", "THR");
modifications.put("NNH", "ARG");
modifications.put("NP3", "ASN");
modifications.put("NPH", "CYS");
modifications.put("NPI", "ALA");
modifications.put("NRP", "LYG");
modifications.put("NRQ", "MYG");
modifications.put("NSK", "XAA");
modifications.put("NTY", "TYR");
modifications.put("NVA", "VAL");
modifications.put("NYC", "TWG");
modifications.put("NYG", "NYG");
modifications.put("NYM", "ASN");
modifications.put("NYS", "CYS");
modifications.put("NZH", "HIS");
modifications.put("O12", "XAA");
modifications.put("O2C", "ASN");
modifications.put("O2G", "GLY");
modifications.put("OAD", "ASN");
modifications.put("OAS", "SER");
modifications.put("OBF", "XAA");
modifications.put("OBS", "XAA");
modifications.put("OCS", "CYS");
modifications.put("OCY", "CYS");
modifications.put("ODP", "ASN");
modifications.put("OHI", "HIS");
modifications.put("OHS", "ASP");
modifications.put("OIC", "XAA");
modifications.put("OIP", "ILE");
modifications.put("OLE", "XAA");
modifications.put("OLT", "THR");
modifications.put("OLZ", "SER");
modifications.put("OMC", "CYS");
modifications.put("OMG", "GLY");
modifications.put("OMT", "MET");
modifications.put("OMU", "UR3");
modifications.put("ONE", "UR3");
modifications.put("ONH", "ALA");
modifications.put("ONL", "XAA");
modifications.put("OPR", "ARG");
modifications.put("ORN", "ALA");
modifications.put("ORQ", "ARG");
modifications.put("OSE", "SER");
modifications.put("OTB", "XAA");
modifications.put("OTH", "THR");
modifications.put("OTY", "TYR");
modifications.put("OXX", "ASP");
modifications.put("P ", "GLY");
modifications.put("P1L", "CYS");
modifications.put("P1P", "ASN");
modifications.put("P2T", "THR");
modifications.put("P2U", "UR3");
modifications.put("P2Y", "PRO");
modifications.put("P5P", "ALA");
modifications.put("PAQ", "TYR");
modifications.put("PAS", "ASP");
modifications.put("PAT", "TRP");
modifications.put("PAU", "ALA");
modifications.put("PBB", "CYS");
modifications.put("PBF", "PHE");
modifications.put("PBT", "ASN");
modifications.put("PCA", "GLU");
modifications.put("PCC", "PRO");
modifications.put("PCE", "XAA");
modifications.put("PCS", "PHE");
modifications.put("PDL", "XAA");
modifications.put("PDU", "UR3");
modifications.put("PEC", "CYS");
modifications.put("PF5", "PHE");
modifications.put("PFF", "PHE");
modifications.put("PFX", "XAA");
modifications.put("PG1", "SER");
modifications.put("PG7", "GLY");
modifications.put("PG9", "GLY");
modifications.put("PGL", "XAA");
modifications.put("PGN", "GLY");
modifications.put("PGP", "GLY");
modifications.put("PGY", "GLY");
modifications.put("PHA", "PHE");
modifications.put("PHD", "ASP");
modifications.put("PHE", "PHE");
modifications.put("PHI", "PHE");
modifications.put("PHL", "PHE");
modifications.put("PHM", "PHE");
modifications.put("PIA", "AYG");
modifications.put("PIV", "XAA");
modifications.put("PLE", "LEU");
modifications.put("PM3", "PHE");
modifications.put("PMT", "CYS");
modifications.put("POM", "PRO");
modifications.put("PPN", "PHE");
modifications.put("PPU", "ALA");
modifications.put("PPW", "GLY");
modifications.put("PQ1", "ASN");
modifications.put("PR3", "CYS");
modifications.put("PR5", "ALA");
modifications.put("PR9", "PRO");
modifications.put("PRN", "ALA");
modifications.put("PRO", "PRO");
modifications.put("PRS", "PRO");
modifications.put("PSA", "PHE");
modifications.put("PSH", "HIS");
modifications.put("PST", "THR");
modifications.put("PSU", "UR3");
modifications.put("PSW", "CYS");
modifications.put("PTA", "XAA");
modifications.put("PTH", "TYR");
modifications.put("PTM", "TYR");
modifications.put("PTR", "TYR");
modifications.put("PU ", "ALA");
modifications.put("PUY", "ASN");
modifications.put("PVH", "HIS");
modifications.put("PVL", "XAA");
modifications.put("PYA", "ALA");
modifications.put("PYO", "UR3");
modifications.put("PYX", "CYS");
modifications.put("PYY", "ASN");
modifications.put("QLG", "QLG");
modifications.put("QMM", "GLN");
modifications.put("QPA", "CYS");
modifications.put("QPH", "PHE");
modifications.put("QUO", "GLY");
modifications.put("R ", "ALA");
modifications.put("R1A", "CYS");
modifications.put("R4K", "TRP");
modifications.put("RC7", "HYG");
modifications.put("RE0", "TRP");
modifications.put("RE3", "TRP");
modifications.put("RIA", "ALA");
modifications.put("RMP", "ALA");
modifications.put("RON", "XAA");
modifications.put("RT ", "THR");
modifications.put("RTP", "ASN");
modifications.put("S1H", "SER");
modifications.put("S2C", "CYS");
modifications.put("S2D", "ALA");
modifications.put("S2M", "THR");
modifications.put("S2P", "ALA");
modifications.put("S4A", "ALA");
modifications.put("S4C", "CYS");
modifications.put("S4G", "GLY");
modifications.put("S4U", "UR3");
modifications.put("S6G", "GLY");
modifications.put("SAC", "SER");
modifications.put("SAH", "CYS");
modifications.put("SAR", "GLY");
modifications.put("SBL", "SER");
modifications.put("SC ", "CYS");
modifications.put("SCH", "CYS");
modifications.put("SCS", "CYS");
modifications.put("SCY", "CYS");
modifications.put("SD2", "XAA");
modifications.put("SDG", "GLY");
modifications.put("SDP", "SER");
modifications.put("SEB", "SER");
modifications.put("SEC", "ALA");
modifications.put("SEG", "ALA");
modifications.put("SEL", "SER");
modifications.put("SEM", "SER");
modifications.put("SEN", "SER");
modifications.put("SEP", "SER");
modifications.put("SER", "SER");
modifications.put("SET", "SER");
modifications.put("SGB", "SER");
modifications.put("SHC", "CYS");
modifications.put("SHP", "GLY");
modifications.put("SHR", "LYS");
modifications.put("SIB", "CYS");
modifications.put("SIC", "DC"); // check
modifications.put("SLA", "PRO");
modifications.put("SLR", "PRO");
modifications.put("SLZ", "LYS");
modifications.put("SMC", "CYS");
modifications.put("SME", "MET");
modifications.put("SMF", "PHE");
modifications.put("SMP", "ALA");
modifications.put("SMT", "THR");
modifications.put("SNC", "CYS");
modifications.put("SNN", "ASN");
modifications.put("SOC", "CYS");
modifications.put("SOS", "ASN");
modifications.put("SOY", "SER");
modifications.put("SPT", "THR");
modifications.put("SRA", "ALA");
modifications.put("SSU", "UR3");
modifications.put("STY", "TYR");
modifications.put("SUB", "XAA");
modifications.put("SUI", "DG");
modifications.put("SUN", "SER");
modifications.put("SUR", "UR3");
modifications.put("SVA", "SER");
modifications.put("SVV", "SER");
modifications.put("SVW", "SER");
modifications.put("SVX", "SER");
modifications.put("SVY", "SER");
modifications.put("SVZ", "XAA");
modifications.put("SWG", "SWG");
modifications.put("SYS", "CYS");
modifications.put("T ", "THR");
modifications.put("T11", "PHE");
modifications.put("T23", "THR");
modifications.put("T2S", "THR");
modifications.put("T2T", "ASN");
modifications.put("T31", "UR3");
modifications.put("T32", "THR");
modifications.put("T36", "THR");
modifications.put("T37", "THR");
modifications.put("T38", "THR");
modifications.put("T39", "THR");
modifications.put("T3P", "THR");
modifications.put("T41", "THR");
modifications.put("T48", "THR");
modifications.put("T49", "THR");
modifications.put("T4S", "THR");
modifications.put("T5O", "UR3");
modifications.put("T5S", "THR");
modifications.put("T66", "XAA");
modifications.put("T6A", "ALA");
modifications.put("TA3", "THR");
modifications.put("TA4", "XAA");
modifications.put("TAF", "THR");
modifications.put("TAL", "ASN");
modifications.put("TAV", "ASP");
modifications.put("TBG", "VAL");
modifications.put("TBM", "THR");
modifications.put("TC1", "CYS");
modifications.put("TCP", "THR");
modifications.put("TCQ", "TYR");
modifications.put("TCR", "TRP");
modifications.put("TCY", "ALA");
modifications.put("TDD", "LEU");
modifications.put("TDY", "THR");
modifications.put("TFE", "THR");
modifications.put("TFO", "ALA");
modifications.put("TFQ", "PHE");
modifications.put("TFT", "THR");
modifications.put("TGP", "GLY");
modifications.put("TH6", "THR");
modifications.put("THC", "THR");
modifications.put("THO", "XAA");
modifications.put("THR", "THR");
modifications.put("THX", "ASN");
modifications.put("THZ", "ARG");
modifications.put("TIH", "ALA");
modifications.put("TLB", "ASN");
modifications.put("TLC", "THR");
modifications.put("TLN", "UR3");
modifications.put("TMB", "THR");
modifications.put("TMD", "THR");
modifications.put("TNB", "CYS");
modifications.put("TNR", "SER");
modifications.put("TOX", "TRP");
modifications.put("TP1", "THR");
modifications.put("TPC", "CYS");
modifications.put("TPG", "GLY");
modifications.put("TPH", "XAA");
modifications.put("TPL", "TRP");
modifications.put("TPO", "THR");
modifications.put("TPQ", "TYR");
modifications.put("TQI", "TRP");
modifications.put("TQQ", "TRP");
modifications.put("TRF", "TRP");
modifications.put("TRG", "LYS");
modifications.put("TRN", "TRP");
modifications.put("TRO", "TRP");
modifications.put("TRP", "TRP");
modifications.put("TRQ", "TRP");
modifications.put("TRW", "TRP");
modifications.put("TRX", "TRP");
modifications.put("TS ", "ASN");
modifications.put("TST", "XAA");
modifications.put("TT ", "ASN");
modifications.put("TTD", "THR");
modifications.put("TTI", "UR3");
modifications.put("TTM", "THR");
modifications.put("TTQ", "TRP");
modifications.put("TTS", "TYR");
modifications.put("TY1", "TYR");
modifications.put("TY2", "TYR");
modifications.put("TY3", "TYR");
modifications.put("TY5", "TYR");
modifications.put("TYB", "TYR");
modifications.put("TYI", "TYR");
modifications.put("TYJ", "TYR");
modifications.put("TYN", "TYR");
modifications.put("TYO", "TYR");
modifications.put("TYQ", "TYR");
modifications.put("TYR", "TYR");
modifications.put("TYS", "TYR");
modifications.put("TYT", "TYR");
modifications.put("TYU", "ASN");
modifications.put("TYW", "TYR");
modifications.put("TYX", "XAA");
modifications.put("TYY", "TYR");
modifications.put("TZB", "XAA");
modifications.put("TZO", "XAA");
modifications.put("U ", "UR3");
modifications.put("U25", "UR3");
modifications.put("U2L", "UR3");
modifications.put("U2N", "UR3");
modifications.put("U2P", "UR3");
modifications.put("U31", "UR3");
modifications.put("U33", "UR3");
modifications.put("U34", "UR3");
modifications.put("U36", "UR3");
modifications.put("U37", "UR3");
modifications.put("U8U", "UR3");
modifications.put("UAR", "UR3");
modifications.put("UCL", "UR3");
modifications.put("UD5", "UR3");
modifications.put("UDP", "ASN");
modifications.put("UFP", "ASN");
modifications.put("UFR", "UR3");
modifications.put("UFT", "UR3");
modifications.put("UMA", "ALA");
modifications.put("UMP", "UR3");
modifications.put("UMS", "UR3");
modifications.put("UN1", "XAA");
modifications.put("UN2", "XAA");
modifications.put("UNK", "XAA");
modifications.put("UR3", "UR3");
modifications.put("URD", "UR3");
modifications.put("US1", "UR3");
modifications.put("US2", "UR3");
modifications.put("US3", "THR");
modifications.put("US5", "UR3");
modifications.put("USM", "UR3");
modifications.put("VAD", "VAL");
modifications.put("VAF", "VAL");
modifications.put("VAL", "VAL");
modifications.put("VB1", "LYS");
modifications.put("VDL", "XAA");
modifications.put("VLL", "XAA");
modifications.put("VLM", "XAA");
modifications.put("VMS", "XAA");
modifications.put("VOL", "XAA");
modifications.put("WCR", "GYG");
modifications.put("X ", "GLY");
modifications.put("X2W", "GLU");
modifications.put("X4A", "ASN");
modifications.put("X9Q", "AFG");
modifications.put("XAD", "ALA");
modifications.put("XAE", "ASN");
modifications.put("XAL", "ALA");
modifications.put("XAR", "ASN");
modifications.put("XCL", "CYS");
modifications.put("XCN", "CYS");
modifications.put("XCP", "XAA");
modifications.put("XCR", "CYS");
modifications.put("XCS", "ASN");
modifications.put("XCT", "CYS");
modifications.put("XCY", "CYS");
modifications.put("XGA", "ASN");
modifications.put("XGL", "GLY");
modifications.put("XGR", "GLY");
modifications.put("XGU", "GLY");
modifications.put("XPR", "PRO");
modifications.put("XSN", "ASN");
modifications.put("XTH", "THR");
modifications.put("XTL", "THR");
modifications.put("XTR", "THR");
modifications.put("XTS", "GLY");
modifications.put("XTY", "ASN");
modifications.put("XUA", "ALA");
modifications.put("XUG", "GLY");
modifications.put("XX1", "LYS");
modifications.put("XXY", "THG");
modifications.put("XYG", "DYG");
modifications.put("Y ", "ALA");
modifications.put("YCM", "CYS");
modifications.put("YG ", "GLY");
modifications.put("YOF", "TYR");
modifications.put("YRR", "ASN");
modifications.put("YYG", "GLY");
modifications.put("Z ", "CYS");
modifications.put("Z01", "ALA");
modifications.put("ZAD", "ALA");
modifications.put("ZAL", "ALA");
modifications.put("ZBC", "CYS");
modifications.put("ZBU", "UR3");
modifications.put("ZCL", "PHE");
modifications.put("ZCY", "CYS");
modifications.put("ZDU", "UR3");
modifications.put("ZFB", "XAA");
modifications.put("ZGU", "GLY");
modifications.put("ZHP", "ASN");
modifications.put("ZTH", "THR");
modifications.put("ZU0", "THR");
modifications.put("ZZJ", "ALA");
}
public static String getCanonicalAminoAcid(String aa)
{
String canonical = modifications.get(aa);
return canonical == null ? aa : canonical;
}
/**
* translate to RNA secondary structure representation
*
* @param ssstring
* @return ssstring as a RNA-state secondary structure assignment.
*/
public static String getRNASecStrucState(String ssstring)
{
if (ssstring == null)
{
return null;
}
StringBuffer ss = new StringBuffer();
for (int i = 0; i < ssstring.length(); i++)
{
String ssc = ssstring.substring(i, i + 1);
if (toRNAssState.containsKey(ssc))
{
// valid ss character - so return it
ss.append(ssc); // (String) toRNAssState.get(ssc));
}
else
{
ss.append(" ");
}
}
return ss.toString();
}
public static boolean isCloseParenRNA(char dc)
{
return RNAcloseParen[dc];
}
// main method generates perl representation of residue property hash
// / cut here
public static void main(String[] args)
{
Hashtable aa = new Hashtable();
System.out.println("my %aa = {");
// invert property hashes
Enumeration prop = propHash.keys();
while (prop.hasMoreElements())
{
String pname = (String) prop.nextElement();
Hashtable phash = (Hashtable) propHash.get(pname);
Enumeration res = phash.keys();
while (res.hasMoreElements())
{
String rname = (String) res.nextElement();
Vector aprops = (Vector) aa.get(rname);
if (aprops == null)
{
aprops = new Vector();
aa.put(rname, aprops);
}
Integer hasprop = (Integer) phash.get(rname);
if (hasprop.intValue() == 1)
{
aprops.addElement(pname);
}
}
}
Enumeration res = aa.keys();
while (res.hasMoreElements())
{
String rname = (String) res.nextElement();
System.out.print("'" + rname + "' => [");
Enumeration props = ((Vector) aa.get(rname)).elements();
while (props.hasMoreElements())
{
System.out.print("'" + (String) props.nextElement() + "'");
if (props.hasMoreElements())
{
System.out.println(", ");
}
}
System.out.println("]" + (res.hasMoreElements() ? "," : ""));
}
System.out.println("};");
}
// to here
/**
* Returns a list of residue characters for the specified inputs
*
* @param nucleotide
* @param includeAmbiguous
* @return
*/
public static List getResidues(boolean nucleotide,
boolean includeAmbiguous)
{
List result = new ArrayList();
if (nucleotide)
{
for (String nuc : nucleotideName.keySet())
{
int val = nucleotideIndex[nuc.charAt(0)];
if ((!includeAmbiguous && val > 4) || (val >= maxNucleotideIndex))
{
continue;
}
nuc = nuc.toUpperCase();
if (!result.contains(nuc))
{
result.add(nuc);
}
}
}
else
{
/*
* Peptide
*/
for (String res : aa3Hash.keySet())
{
int index = aa3Hash.get(res).intValue();
if ((!includeAmbiguous && index >= 20) || index >= maxProteinIndex)
{
continue;
}
res = res.toUpperCase();
if (!result.contains(res))
{
result.add(res);
}
}
}
return result;
}
/**
* Returns the single letter code for a three letter code, or '0' if not known
*
* @param threeLetterCode
* not case sensitive
* @return
*/
public static char getSingleCharacterCode(String threeLetterCode)
{
if (threeLetterCode == null)
{
return '0';
}
Integer index = ResidueProperties.aa3Hash.get(threeLetterCode
.toUpperCase());
return index == null ? '0' : aa[index].charAt(0);
}
}