JAL-2089 patch broken merge to master for Release 2.10.0b1
[jalview.git] / src / jalview / schemes / ResidueProperties.java
index 8acf1f2..90a7952 100755 (executable)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
  */
 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.Arrays;
 import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
@@ -33,7 +36,7 @@ import java.util.Vector;
 
 public class ResidueProperties
 {
-  public static Hashtable<String, ScoreModelI> scoreMatrices = new Hashtable();
+  public static Hashtable<String, ScoreModelI> scoreMatrices = new Hashtable<String, ScoreModelI>();
 
   // Stores residue codes/names and colours and other things
   public static final int[] aaIndex; // aaHash version 2.1.1 and below
@@ -42,11 +45,14 @@ public class ResidueProperties
 
   public static final int[] purinepyrimidineIndex;
 
-  public static final Hashtable aa3Hash = new Hashtable();
+  public static final Map<String, Integer> aa3Hash = new HashMap<String, Integer>();
 
-  public static final Hashtable aa2Triplet = new Hashtable();
+  public static final Map<String, String> aa2Triplet = new HashMap<String, String>();
 
-  public static final Hashtable nucleotideName = new Hashtable();
+  public static final Map<String, String> nucleotideName = new HashMap<String, String>();
+
+  // lookup from modified amino acid (e.g. MSE) to canonical form (e.g. MET)
+  public static final Map<String, String> modifications = new HashMap<String, String>();
 
   static
   {
@@ -218,35 +224,36 @@ public class ResidueProperties
 
   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));
+    aa3Hash.put("ALA", Integer.valueOf(0));
+    aa3Hash.put("ARG", Integer.valueOf(1));
+    aa3Hash.put("ASN", Integer.valueOf(2));
+    aa3Hash.put("ASP", Integer.valueOf(3)); // D
+    aa3Hash.put("CYS", Integer.valueOf(4));
+    aa3Hash.put("GLN", Integer.valueOf(5)); // Q
+    aa3Hash.put("GLU", Integer.valueOf(6)); // E
+    aa3Hash.put("GLY", Integer.valueOf(7));
+    aa3Hash.put("HIS", Integer.valueOf(8));
+    aa3Hash.put("ILE", Integer.valueOf(9));
+    aa3Hash.put("LEU", Integer.valueOf(10));
+    aa3Hash.put("LYS", Integer.valueOf(11));
+    aa3Hash.put("MET", Integer.valueOf(12));
+    aa3Hash.put("PHE", Integer.valueOf(13));
+    aa3Hash.put("PRO", Integer.valueOf(14));
+    aa3Hash.put("SER", Integer.valueOf(15));
+    aa3Hash.put("THR", Integer.valueOf(16));
+    aa3Hash.put("TRP", Integer.valueOf(17));
+    aa3Hash.put("TYR", Integer.valueOf(18));
+    aa3Hash.put("VAL", Integer.valueOf(19));
     // IUB Nomenclature for ambiguous peptides
-    aa3Hash.put("ASX", new Integer(20)); // "B";
-    aa3Hash.put("GLX", new Integer(21)); // X
-    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("ASX", Integer.valueOf(20)); // "B";
+    aa3Hash.put("GLX", Integer.valueOf(21)); // Z
+    aa3Hash.put("XAA", Integer.valueOf(22)); // X unknown
+    aa3Hash.put("-", Integer.valueOf(23));
+    aa3Hash.put("*", Integer.valueOf(23));
+    aa3Hash.put(".", Integer.valueOf(23));
+    aa3Hash.put(" ", Integer.valueOf(23));
+    aa3Hash.put("Gap", Integer.valueOf(23));
+    aa3Hash.put("UR3", Integer.valueOf(24));
   }
 
   static
@@ -293,30 +300,30 @@ public class ResidueProperties
     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", "_", "*", ".", " " };
+  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
+  // not currently in use
+  // public static final Vector<Color> scaleColours = new Vector<Color>();
+  // 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
@@ -344,8 +351,7 @@ public class ResidueProperties
       Color.white // .
   };
 
-  public static final Color[] nucleotide =
-  { new Color(100, 247, 63), // A
+  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
@@ -359,16 +365,15 @@ public class ResidueProperties
   };
 
   // Added for PurinePyrimidineColourScheme
-  public static final Color[] purinepyrimidine =
-  { new Color(255, 131, 250), // A, G, R purines purplish/orchid
+  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
+  public static final Color[] zappo = { Color.pink, // A
       midBlue, // R
       Color.green, // N
       Color.red, // D
@@ -398,8 +403,7 @@ public class ResidueProperties
   };
 
   // Dunno where I got these numbers from
-  public static final double[] hyd2 =
-  { 0.62, // A
+  public static final double[] hyd2 = { 0.62, // A
       0.29, // R
       -0.90, // N
       -0.74, // D
@@ -424,34 +428,33 @@ public class ResidueProperties
       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[] 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[] 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[] 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[] 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;
 
@@ -460,9 +463,9 @@ public class ResidueProperties
   // 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[] 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;
 
@@ -470,8 +473,7 @@ public class ResidueProperties
 
   // public static final double hydmax = 1.38;
   // public static final double hydmin = -2.53;
-  private static final int[][] BLOSUM62 =
-  {
+  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,
@@ -521,8 +523,7 @@ public class ResidueProperties
       { -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 =
-  {
+  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,
@@ -572,21 +573,21 @@ public class ResidueProperties
       { -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);
-  }
+  // not currently used
+  // public static final Map<String, Color> ssHash = new Hashtable<String,
+  // Color>();
+  // 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
@@ -598,9 +599,7 @@ public class ResidueProperties
   // 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
+  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
@@ -620,90 +619,23 @@ public class ResidueProperties
     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),
+  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 Hashtable codonHash = new Hashtable();
-
-  public static Vector Lys = new Vector();
-
-  public static Vector Asn = new Vector();
-
-  public static Vector Gln = new Vector();
-
-  public static Vector His = new Vector();
-
-  public static Vector Glu = new Vector();
-
-  public static Vector Asp = new Vector();
-
-  public static Vector Tyr = new Vector();
-
-  public static Vector Thr = new Vector();
-
-  public static Vector Pro = new Vector();
-
-  public static Vector Ala = new Vector();
-
-  public static Vector Ser = new Vector();
-
-  public static Vector Arg = new Vector();
-
-  public static Vector Gly = new Vector();
-
-  public static Vector Trp = new Vector();
-
-  public static Vector Cys = new Vector();
-
-  public static Vector Ile = new Vector();
-
-  public static Vector Met = new Vector();
-
-  public static Vector Leu = new Vector();
-
-  public static Vector Val = new Vector();
+  public static final float[] pidThresholds = { 80, 60, 40, };
 
-  public static Vector Phe = new Vector();
+  public static List<String> STOP = Arrays.asList("TGA", "TAA", "TAG");
 
-  public static Vector STOP = new Vector();
-
-  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);
-  }
+  public static String START = "ATG";
 
   /**
    * Nucleotide Ambiguity Codes
    */
-  public static final Hashtable<String, String[]> ambiguityCodes = new Hashtable<String, String[]>();
+  public static final Map<String, String[]> ambiguityCodes = new Hashtable<String, String[]>();
 
   /**
    * Codon triplets with additional symbols for unambiguous codons that include
@@ -718,105 +650,21 @@ public class ResidueProperties
 
   static
   {
-    /**
-     * 3.2. Purine (adenine or guanine): R
-     * 
-     * R is the symbol previously recommended [1].
+    /*
+     * Ambiguity codes as per http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html
      */
-    ambiguityCodes.put("R", new String[]
-    { "A", "G" });
+    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" });
 
-    /**
-     * 3.3. Pyrimidine (thymine or cytosine): Y
-     * 
-     * Y is the symbol previously recommended [1].
-     */
-    ambiguityCodes.put("Y", new String[]
-    { "T", "C" });
-    /**
-     * 3.4. Adenine or thymine: W
-     * 
-     * Although several diverse symbols have been used for this pair, (and for
-     * the reciprocal pair G+C), only two symbols have a rational basis, L and
-     * W: L derives from DNA density (light; G+C - heavy - would thus be H); W
-     * derives from the strength of the hydrogen bonding interaction between the
-     * base pairs (weak for A+T: G +C - strong - would thus be S). However, the
-     * system recommended for the three-base series (not-A = B, etc., see below,
-     * section 3.8) rules out H as this would be not-G. W is thus recommended.
-     */
-    ambiguityCodes.put("W", new String[]
-    { "A", "T" });
-    /**
-     * 3.5. Guanine or cytosine: S
-     * 
-     * The choice of this symbol is discussed above in section 3.4.
-     */
-    ambiguityCodes.put("S", new String[]
-    { "G", "C" });
-    /**
-     * 3.6. Adenine or cytosine: M
-     * 
-     * There are few common features between A and C. The presence of an NH2
-     * group in similar positions on both bases (Fig. 1) makes possible a
-     * logically derived symbol. A and N being ruled out, M (from aMino) is
-     * recommended.
-     * 
-     * 
-     * Fig. 1. Origin of the symbols M and K The four bases are drawn so as to
-     * show the relationship between adenine and cytosine on the one hand, which
-     * both have aMino groups at the ring position most distant from the point
-     * of attachment to the sugar, and between guanine and thymine on the other,
-     * which both have Keto groups at the corresponding position. The ring atoms
-     * are numbered as recommended [24-26], although for the present purpose
-     * this has the disadvantage of giving discordant numbers to the
-     * corresponding positions.
-     */
-    ambiguityCodes.put("M", new String[]
-    { "A", "C" });
-    /**
-     * 3.7. Guanine or thymine: K By analogy with A and C (section 3.6), both G
-     * and T have Keto groups in similar positions (Fig. 1).
-     */
-    ambiguityCodes.put("K", new String[]
-    { "G", "T" });
-    /**
-     * 3.8. Adenine or thymine or cytosine: H
-     * 
-     * Not-G is the most simple means of memorising this combination and symbols
-     * logically related to G were examined. F and H would both be suitable, as
-     * the letters before and after G in the alphabet, but A would have no
-     * equivalent to F. The use of H has historical precedence [2].
-     */
-    ambiguityCodes.put("H", new String[]
-    { "A", "T", "C" });
-    /**
-     * 3.9. Guanine or cytosine or thymine: B
-     * 
-     * Not-A as above (section 3.8).
-     */
-    ambiguityCodes.put("B", new String[]
-    { "G", "T", "C" });
-    /**
-     * 3.10. Guanine or adenine or cytosine: V
-     * 
-     * Not-T by analogy with not-G (section 3.8) would be U but this is ruled
-     * out to eliminate confusion with uracil. V is the next logical choice.
-     * Note that T and U may in some cases be considered to be synonyms.
-     */
-    ambiguityCodes.put("V", new String[]
-    { "G", "A", "C" });
-    /**
-     * 3.11. Guanine or adenine or thymine: D
-     * 
-     * Not-C as above (section 3.8).
-     */
-    ambiguityCodes.put("D", new String[]
-    { "G", "A", "T" });
-    /**
-     * 3.12. Guanine or adenine or thymine or cytosine: N
-     */
-    ambiguityCodes.put("R", new String[]
-    { "G", "A", "T", "C" });
     // Now build codon translation table
     codonHash2.put("AAA", "K");
     codonHash2.put("AAG", "K");
@@ -954,8 +802,7 @@ public class ResidueProperties
         }
         else
         {
-          acodon[i] = new String[]
-          {};
+          acodon[i] = new String[] {};
         }
       }
       // enumerate all combinations and test for veracity of translation
@@ -971,14 +818,12 @@ public class ResidueProperties
         // 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) };
+            allres[ipos] = new char[] { codon.charAt(ipos) };
           }
           else
           {
@@ -1038,379 +883,294 @@ public class ResidueProperties
         }
       }
     }
-
-  }
-
-  static
-  {
-    Lys.addElement("AAA");
-    Lys.addElement("AAG");
-    Asn.addElement("AAC");
-    Asn.addElement("AAT");
-
-    Gln.addElement("CAA");
-    Gln.addElement("CAG");
-    His.addElement("CAC");
-    His.addElement("CAT");
-
-    Glu.addElement("GAA");
-    Glu.addElement("GAG");
-    Asp.addElement("GAC");
-    Asp.addElement("GAT");
-
-    Tyr.addElement("TAC");
-    Tyr.addElement("TAT");
-
-    Thr.addElement("ACA");
-    Thr.addElement("ACG");
-    Thr.addElement("ACC");
-    Thr.addElement("ACT");
-
-    Pro.addElement("CCA");
-    Pro.addElement("CCG");
-    Pro.addElement("CCC");
-    Pro.addElement("CCT");
-
-    Ala.addElement("GCA");
-    Ala.addElement("GCG");
-    Ala.addElement("GCC");
-    Ala.addElement("GCT");
-
-    Ser.addElement("TCA");
-    Ser.addElement("TCG");
-    Ser.addElement("TCC");
-    Ser.addElement("TCT");
-    Ser.addElement("AGC");
-    Ser.addElement("AGT");
-
-    Arg.addElement("AGA");
-    Arg.addElement("AGG");
-    Arg.addElement("CGA");
-    Arg.addElement("CGG");
-    Arg.addElement("CGC");
-    Arg.addElement("CGT");
-
-    Gly.addElement("GGA");
-    Gly.addElement("GGG");
-    Gly.addElement("GGC");
-    Gly.addElement("GGT");
-
-    STOP.addElement("TGA");
-    STOP.addElement("TAA");
-    STOP.addElement("TAG");
-
-    Trp.addElement("TGG");
-
-    Cys.addElement("TGC");
-    Cys.addElement("TGT");
-
-    Ile.addElement("ATA");
-    Ile.addElement("ATC");
-    Ile.addElement("ATT");
-
-    Met.addElement("ATG");
-
-    Leu.addElement("CTA");
-    Leu.addElement("CTG");
-    Leu.addElement("CTC");
-    Leu.addElement("CTT");
-    Leu.addElement("TTA");
-    Leu.addElement("TTG");
-
-    Val.addElement("GTA");
-    Val.addElement("GTG");
-    Val.addElement("GTC");
-    Val.addElement("GTT");
-
-    Phe.addElement("TTC");
-    Phe.addElement("TTT");
   }
 
   // Stores residue codes/names and colours and other things
-  public static Hashtable propHash = new Hashtable();
+  public static Map<String, Map<String, Integer>> propHash = new Hashtable<String, Map<String, Integer>>();
 
-  public static Hashtable hydrophobic = new Hashtable();
+  public static Map<String, Integer> hydrophobic = new Hashtable<String, Integer>();
 
-  public static Hashtable polar = new Hashtable();
+  public static Map<String, Integer> polar = new Hashtable<String, Integer>();
 
-  public static Hashtable small = new Hashtable();
+  public static Map<String, Integer> small = new Hashtable<String, Integer>();
 
-  public static Hashtable positive = new Hashtable();
+  public static Map<String, Integer> positive = new Hashtable<String, Integer>();
 
-  public static Hashtable negative = new Hashtable();
+  public static Map<String, Integer> negative = new Hashtable<String, Integer>();
 
-  public static Hashtable charged = new Hashtable();
+  public static Map<String, Integer> charged = new Hashtable<String, Integer>();
 
-  public static Hashtable aromatic = new Hashtable();
+  public static Map<String, Integer> aromatic = new Hashtable<String, Integer>();
 
-  public static Hashtable aliphatic = new Hashtable();
+  public static Map<String, Integer> aliphatic = new Hashtable<String, Integer>();
 
-  public static Hashtable tiny = new Hashtable();
+  public static Map<String, Integer> tiny = new Hashtable<String, Integer>();
 
-  public static Hashtable proline = new Hashtable();
+  public static Map<String, Integer> proline = new Hashtable<String, Integer>();
 
   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));
+    hydrophobic.put("I", Integer.valueOf(1));
+    hydrophobic.put("L", Integer.valueOf(1));
+    hydrophobic.put("V", Integer.valueOf(1));
+    hydrophobic.put("C", Integer.valueOf(1));
+    hydrophobic.put("A", Integer.valueOf(1));
+    hydrophobic.put("G", Integer.valueOf(1));
+    hydrophobic.put("M", Integer.valueOf(1));
+    hydrophobic.put("F", Integer.valueOf(1));
+    hydrophobic.put("Y", Integer.valueOf(1));
+    hydrophobic.put("W", Integer.valueOf(1));
+    hydrophobic.put("H", Integer.valueOf(1));
+    hydrophobic.put("K", Integer.valueOf(1));
+    hydrophobic.put("X", Integer.valueOf(1));
+    hydrophobic.put("-", Integer.valueOf(1));
+    hydrophobic.put("*", Integer.valueOf(1));
+    hydrophobic.put("R", Integer.valueOf(0));
+    hydrophobic.put("E", Integer.valueOf(0));
+    hydrophobic.put("Q", Integer.valueOf(0));
+    hydrophobic.put("D", Integer.valueOf(0));
+    hydrophobic.put("N", Integer.valueOf(0));
+    hydrophobic.put("S", Integer.valueOf(0));
+    hydrophobic.put("T", Integer.valueOf(0));
+    hydrophobic.put("P", Integer.valueOf(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));
+    polar.put("Y", Integer.valueOf(1));
+    polar.put("W", Integer.valueOf(1));
+    polar.put("H", Integer.valueOf(1));
+    polar.put("K", Integer.valueOf(1));
+    polar.put("R", Integer.valueOf(1));
+    polar.put("E", Integer.valueOf(1));
+    polar.put("Q", Integer.valueOf(1));
+    polar.put("D", Integer.valueOf(1));
+    polar.put("N", Integer.valueOf(1));
+    polar.put("S", Integer.valueOf(1));
+    polar.put("T", Integer.valueOf(1));
+    polar.put("X", Integer.valueOf(1));
+    polar.put("-", Integer.valueOf(1));
+    polar.put("*", Integer.valueOf(1));
+    polar.put("I", Integer.valueOf(0));
+    polar.put("L", Integer.valueOf(0));
+    polar.put("V", Integer.valueOf(0));
+    polar.put("C", Integer.valueOf(0));
+    polar.put("A", Integer.valueOf(0));
+    polar.put("G", Integer.valueOf(0));
+    polar.put("M", Integer.valueOf(0));
+    polar.put("F", Integer.valueOf(0));
+    polar.put("P", Integer.valueOf(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));
+    small.put("I", Integer.valueOf(0));
+    small.put("L", Integer.valueOf(0));
+    small.put("V", Integer.valueOf(1));
+    small.put("C", Integer.valueOf(1));
+    small.put("A", Integer.valueOf(1));
+    small.put("G", Integer.valueOf(1));
+    small.put("M", Integer.valueOf(0));
+    small.put("F", Integer.valueOf(0));
+    small.put("Y", Integer.valueOf(0));
+    small.put("W", Integer.valueOf(0));
+    small.put("H", Integer.valueOf(0));
+    small.put("K", Integer.valueOf(0));
+    small.put("R", Integer.valueOf(0));
+    small.put("E", Integer.valueOf(0));
+    small.put("Q", Integer.valueOf(0));
+    small.put("D", Integer.valueOf(1));
+    small.put("N", Integer.valueOf(1));
+    small.put("S", Integer.valueOf(1));
+    small.put("T", Integer.valueOf(1));
+    small.put("P", Integer.valueOf(1));
+    small.put("-", Integer.valueOf(1));
+    small.put("*", Integer.valueOf(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));
+    positive.put("I", Integer.valueOf(0));
+    positive.put("L", Integer.valueOf(0));
+    positive.put("V", Integer.valueOf(0));
+    positive.put("C", Integer.valueOf(0));
+    positive.put("A", Integer.valueOf(0));
+    positive.put("G", Integer.valueOf(0));
+    positive.put("M", Integer.valueOf(0));
+    positive.put("F", Integer.valueOf(0));
+    positive.put("Y", Integer.valueOf(0));
+    positive.put("W", Integer.valueOf(0));
+    positive.put("H", Integer.valueOf(1));
+    positive.put("K", Integer.valueOf(1));
+    positive.put("R", Integer.valueOf(1));
+    positive.put("E", Integer.valueOf(0));
+    positive.put("Q", Integer.valueOf(0));
+    positive.put("D", Integer.valueOf(0));
+    positive.put("N", Integer.valueOf(0));
+    positive.put("S", Integer.valueOf(0));
+    positive.put("T", Integer.valueOf(0));
+    positive.put("P", Integer.valueOf(0));
+    positive.put("-", Integer.valueOf(1));
+    positive.put("*", Integer.valueOf(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));
+    negative.put("I", Integer.valueOf(0));
+    negative.put("L", Integer.valueOf(0));
+    negative.put("V", Integer.valueOf(0));
+    negative.put("C", Integer.valueOf(0));
+    negative.put("A", Integer.valueOf(0));
+    negative.put("G", Integer.valueOf(0));
+    negative.put("M", Integer.valueOf(0));
+    negative.put("F", Integer.valueOf(0));
+    negative.put("Y", Integer.valueOf(0));
+    negative.put("W", Integer.valueOf(0));
+    negative.put("H", Integer.valueOf(0));
+    negative.put("K", Integer.valueOf(0));
+    negative.put("R", Integer.valueOf(0));
+    negative.put("E", Integer.valueOf(1));
+    negative.put("Q", Integer.valueOf(0));
+    negative.put("D", Integer.valueOf(1));
+    negative.put("N", Integer.valueOf(0));
+    negative.put("S", Integer.valueOf(0));
+    negative.put("T", Integer.valueOf(0));
+    negative.put("P", Integer.valueOf(0));
+    negative.put("-", Integer.valueOf(1));
+    negative.put("*", Integer.valueOf(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));
+    charged.put("I", Integer.valueOf(0));
+    charged.put("L", Integer.valueOf(0));
+    charged.put("V", Integer.valueOf(0));
+    charged.put("C", Integer.valueOf(0));
+    charged.put("A", Integer.valueOf(0));
+    charged.put("G", Integer.valueOf(0));
+    charged.put("M", Integer.valueOf(0));
+    charged.put("F", Integer.valueOf(0));
+    charged.put("Y", Integer.valueOf(0));
+    charged.put("W", Integer.valueOf(0));
+    charged.put("H", Integer.valueOf(1));
+    charged.put("K", Integer.valueOf(1));
+    charged.put("R", Integer.valueOf(1));
+    charged.put("E", Integer.valueOf(1));
+    charged.put("Q", Integer.valueOf(0));
+    charged.put("D", Integer.valueOf(1));
+    charged.put("N", Integer.valueOf(0)); // Asparagine is polar but not
+                                          // charged.
+    // Alternative would be charged and
+    // negative (in basic form)?
+    charged.put("S", Integer.valueOf(0));
+    charged.put("T", Integer.valueOf(0));
+    charged.put("P", Integer.valueOf(0));
+    charged.put("-", Integer.valueOf(1));
+    charged.put("*", Integer.valueOf(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));
+    aromatic.put("I", Integer.valueOf(0));
+    aromatic.put("L", Integer.valueOf(0));
+    aromatic.put("V", Integer.valueOf(0));
+    aromatic.put("C", Integer.valueOf(0));
+    aromatic.put("A", Integer.valueOf(0));
+    aromatic.put("G", Integer.valueOf(0));
+    aromatic.put("M", Integer.valueOf(0));
+    aromatic.put("F", Integer.valueOf(1));
+    aromatic.put("Y", Integer.valueOf(1));
+    aromatic.put("W", Integer.valueOf(1));
+    aromatic.put("H", Integer.valueOf(1));
+    aromatic.put("K", Integer.valueOf(0));
+    aromatic.put("R", Integer.valueOf(0));
+    aromatic.put("E", Integer.valueOf(0));
+    aromatic.put("Q", Integer.valueOf(0));
+    aromatic.put("D", Integer.valueOf(0));
+    aromatic.put("N", Integer.valueOf(0));
+    aromatic.put("S", Integer.valueOf(0));
+    aromatic.put("T", Integer.valueOf(0));
+    aromatic.put("P", Integer.valueOf(0));
+    aromatic.put("-", Integer.valueOf(1));
+    aromatic.put("*", Integer.valueOf(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));
+    aliphatic.put("I", Integer.valueOf(1));
+    aliphatic.put("L", Integer.valueOf(1));
+    aliphatic.put("V", Integer.valueOf(1));
+    aliphatic.put("C", Integer.valueOf(0));
+    aliphatic.put("A", Integer.valueOf(0));
+    aliphatic.put("G", Integer.valueOf(0));
+    aliphatic.put("M", Integer.valueOf(0));
+    aliphatic.put("F", Integer.valueOf(0));
+    aliphatic.put("Y", Integer.valueOf(0));
+    aliphatic.put("W", Integer.valueOf(0));
+    aliphatic.put("H", Integer.valueOf(0));
+    aliphatic.put("K", Integer.valueOf(0));
+    aliphatic.put("R", Integer.valueOf(0));
+    aliphatic.put("E", Integer.valueOf(0));
+    aliphatic.put("Q", Integer.valueOf(0));
+    aliphatic.put("D", Integer.valueOf(0));
+    aliphatic.put("N", Integer.valueOf(0));
+    aliphatic.put("S", Integer.valueOf(0));
+    aliphatic.put("T", Integer.valueOf(0));
+    aliphatic.put("P", Integer.valueOf(0));
+    aliphatic.put("-", Integer.valueOf(1));
+    aliphatic.put("*", Integer.valueOf(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));
+    tiny.put("I", Integer.valueOf(0));
+    tiny.put("L", Integer.valueOf(0));
+    tiny.put("V", Integer.valueOf(0));
+    tiny.put("C", Integer.valueOf(0));
+    tiny.put("A", Integer.valueOf(1));
+    tiny.put("G", Integer.valueOf(1));
+    tiny.put("M", Integer.valueOf(0));
+    tiny.put("F", Integer.valueOf(0));
+    tiny.put("Y", Integer.valueOf(0));
+    tiny.put("W", Integer.valueOf(0));
+    tiny.put("H", Integer.valueOf(0));
+    tiny.put("K", Integer.valueOf(0));
+    tiny.put("R", Integer.valueOf(0));
+    tiny.put("E", Integer.valueOf(0));
+    tiny.put("Q", Integer.valueOf(0));
+    tiny.put("D", Integer.valueOf(0));
+    tiny.put("N", Integer.valueOf(0));
+    tiny.put("S", Integer.valueOf(1));
+    tiny.put("T", Integer.valueOf(0));
+    tiny.put("P", Integer.valueOf(0));
+    tiny.put("-", Integer.valueOf(1));
+    tiny.put("*", Integer.valueOf(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));
+    proline.put("I", Integer.valueOf(0));
+    proline.put("L", Integer.valueOf(0));
+    proline.put("V", Integer.valueOf(0));
+    proline.put("C", Integer.valueOf(0));
+    proline.put("A", Integer.valueOf(0));
+    proline.put("G", Integer.valueOf(0));
+    proline.put("M", Integer.valueOf(0));
+    proline.put("F", Integer.valueOf(0));
+    proline.put("Y", Integer.valueOf(0));
+    proline.put("W", Integer.valueOf(0));
+    proline.put("H", Integer.valueOf(0));
+    proline.put("K", Integer.valueOf(0));
+    proline.put("R", Integer.valueOf(0));
+    proline.put("E", Integer.valueOf(0));
+    proline.put("Q", Integer.valueOf(0));
+    proline.put("D", Integer.valueOf(0));
+    proline.put("N", Integer.valueOf(0));
+    proline.put("S", Integer.valueOf(0));
+    proline.put("T", Integer.valueOf(0));
+    proline.put("P", Integer.valueOf(1));
+    proline.put("-", Integer.valueOf(1));
+    proline.put("*", Integer.valueOf(1));
   }
 
   static
@@ -1455,12 +1215,9 @@ public class ResidueProperties
         propMatrixF[i][j] = 0;
         propMatrixPos[i][j] = 0;
         propMatrixEpos[i][j] = 0;
-        for (Enumeration<String> en = propHash.keys(); en
-                .hasMoreElements();)
+        for (String ph : propHash.keySet())
         {
-          String ph = en.nextElement();
-          Map<String, Integer> pph = (Map<String, Integer>) propHash
-                  .get(ph);
+          Map<String, Integer> pph = propHash.get(ph);
           if (pph.get(ic) != null && pph.get(jc) != null)
           {
             int icp = pph.get(ic).intValue(), jcp = pph.get(jc).intValue();
@@ -1498,6 +1255,7 @@ public class ResidueProperties
     // scoreMatrices.put("Conservation EnhPos", new
     // ScoreMatrix("Conservation EnhPos",propMatrixEpos,0));
     scoreMatrices.put("PID", new PIDScoreModel());
+    scoreMatrices.put("Displayed Features", new FeatureScoreModel());
   }
 
   private ResidueProperties()
@@ -1519,7 +1277,7 @@ public class ResidueProperties
     return hyd;
   }
 
-  public static Hashtable getAA3Hash()
+  public static Map<String, Integer> getAA3Hash()
   {
     return aa3Hash;
   }
@@ -1557,54 +1315,16 @@ public class ResidueProperties
     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 (cdn != null && cdn.equals("*"))
+    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";
-    }
-    Enumeration e = codonHash.keys();
-
-    while (e.hasMoreElements())
-    {
-      String key = (String) e.nextElement();
-      Vector tmp = (Vector) codonHash.get(key);
-
-      if (tmp.contains(codon))
-      {
-        return key;
-      }
-    }
-
-    return null;
-  }
-
   public static int[][] getDefaultPeptideMatrix()
   {
     return ResidueProperties.getBLOSUM62();
@@ -1652,10 +1372,10 @@ public class ResidueProperties
     return pog;
   }
 
-  public static Hashtable toDssp3State;
+  public static Hashtable<String, String> toDssp3State;
   static
   {
-    toDssp3State = new Hashtable();
+    toDssp3State = new Hashtable<String, String>();
     toDssp3State.put("H", "H");
     toDssp3State.put("E", "E");
     toDssp3State.put("C", " ");
@@ -1685,7 +1405,7 @@ public class ResidueProperties
       String ssc = ssstring.substring(i, i + 1);
       if (toDssp3State.containsKey(ssc))
       {
-        ss.append((String) toDssp3State.get(ssc));
+        ss.append(toDssp3State.get(ssc));
       }
       else
       {
@@ -1695,160 +1415,1365 @@ public class ResidueProperties
     return ss.toString();
   }
 
-  /**
-   * Used by getRNASecStrucState
-   * 
-   */
-  public static Hashtable<String, String> toRNAssState;
-
-  public static boolean RNAcloseParen[] = new boolean[255];
   static
   {
-    toRNAssState = new Hashtable<String, String>();
-    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);
-    }
-  }
+    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");
 
-  /**
-   * 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)
+  public static String getCanonicalAminoAcid(String aA)
   {
-    return RNAcloseParen[dc];
+    String canonical = modifications.get(aA);
+    return canonical == null ? aA : canonical;
   }
 
   // main method generates perl representation of residue property hash
   // / cut here
   public static void main(String[] args)
   {
-    Hashtable aa = new Hashtable();
+    Hashtable<String, Vector<String>> aaProps = new Hashtable<String, Vector<String>>();
     System.out.println("my %aa = {");
     // invert property hashes
-    Enumeration prop = propHash.keys();
-    while (prop.hasMoreElements())
+    for (String pname : propHash.keySet())
     {
-      String pname = (String) prop.nextElement();
-      Hashtable phash = (Hashtable) propHash.get(pname);
-      Enumeration res = phash.keys();
-      while (res.hasMoreElements())
+      Map<String, Integer> phash = propHash.get(pname);
+      for (String rname : phash.keySet())
       {
-        String rname = (String) res.nextElement();
-        Vector aprops = (Vector) aa.get(rname);
+        Vector<String> aprops = aaProps.get(rname);
         if (aprops == null)
         {
-          aprops = new Vector();
-          aa.put(rname, aprops);
+          aprops = new Vector<String>();
+          aaProps.put(rname, aprops);
         }
-        Integer hasprop = (Integer) phash.get(rname);
+        Integer hasprop = phash.get(rname);
         if (hasprop.intValue() == 1)
         {
           aprops.addElement(pname);
         }
       }
     }
-    Enumeration res = aa.keys();
+    Enumeration<String> res = aaProps.keys();
     while (res.hasMoreElements())
     {
-      String rname = (String) res.nextElement();
+      String rname = res.nextElement();
 
       System.out.print("'" + rname + "' => [");
-      Enumeration props = ((Vector) aa.get(rname)).elements();
+      Enumeration<String> props = aaProps.get(rname).elements();
       while (props.hasMoreElements())
       {
-        System.out.print("'" + (String) props.nextElement() + "'");
+        System.out.print("'" + props.nextElement() + "'");
         if (props.hasMoreElements())
         {
           System.out.println(", ");
@@ -1858,6 +2783,74 @@ public class ResidueProperties
     }
     System.out.println("};");
   }
+
   // to here
 
+  /**
+   * Returns a list of residue characters for the specified inputs
+   * 
+   * @param forNucleotide
+   * @param includeAmbiguous
+   * @return
+   */
+  public static List<String> getResidues(boolean forNucleotide,
+          boolean includeAmbiguous)
+  {
+    List<String> result = new ArrayList<String>();
+    if (forNucleotide)
+    {
+      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);
+  }
 }