header updated
[jalview.git] / src / jalview / schemes / ResidueProperties.java
index 0b71381..8cffae5 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
  *\r
  * This program is free software; you can redistribute it and/or\r
  * modify it under the terms of the GNU General Public License\r
@@ -25,10 +25,11 @@ import java.awt.*;
 public class ResidueProperties\r
 {\r
   //Stores residue codes/names and colours and other things\r
-  public static Hashtable aaHash = new Hashtable(); // stores the number value of the aa\r
-  public static Hashtable aa3Hash = new Hashtable();\r
-  public static Hashtable aa2Triplet = new Hashtable();\r
-  public static Hashtable nucleotideHash = new Hashtable();\r
+  public static final Hashtable aaHash = new Hashtable(); // stores the number value of the aa\r
+  public static final Hashtable aa3Hash = new Hashtable();\r
+  public static final Hashtable aa2Triplet = new Hashtable();\r
+  public static final Hashtable nucleotideHash = new Hashtable();\r
+  public static final Hashtable nucleotideName = new Hashtable();\r
 \r
   static\r
   {\r
@@ -55,6 +56,7 @@ public class ResidueProperties
     aaHash.put("B", new Integer(20));\r
     aaHash.put("Z", new Integer(21));\r
     aaHash.put("X", new Integer(22));\r
+    aaHash.put("U", new Integer(22));\r
     aaHash.put("a", new Integer(0));\r
     aaHash.put("r", new Integer(1));\r
     aaHash.put("n", new Integer(2));\r
@@ -78,6 +80,7 @@ public class ResidueProperties
     aaHash.put("b", new Integer(20));\r
     aaHash.put("z", new Integer(21));\r
     aaHash.put("x", new Integer(22));\r
+    aaHash.put("u", new Integer(22));\r
     aaHash.put("-", new Integer(23));\r
     aaHash.put("*", new Integer(23));\r
     aaHash.put(".", new Integer(23));\r
@@ -87,22 +90,49 @@ public class ResidueProperties
   static\r
   {\r
     nucleotideHash.put("A", new Integer(0));\r
+    nucleotideHash.put("a", new Integer(0));\r
     nucleotideHash.put("C", new Integer(1));\r
+    nucleotideHash.put("c", new Integer(1));\r
     nucleotideHash.put("G", new Integer(2));\r
+    nucleotideHash.put("g", new Integer(2));\r
     nucleotideHash.put("T", new Integer(3));\r
+    nucleotideHash.put("t", new Integer(3));\r
     nucleotideHash.put("U", new Integer(4));\r
+    nucleotideHash.put("u", new Integer(4));\r
+    nucleotideHash.put("I", new Integer(5));\r
+    nucleotideHash.put("i", new Integer(5));\r
+    nucleotideHash.put("X", new Integer(6));\r
+    nucleotideHash.put("x", new Integer(6));\r
+    nucleotideHash.put("R", new Integer(7));\r
+    nucleotideHash.put("r", new Integer(7));\r
+    nucleotideHash.put("Y", new Integer(8));\r
+    nucleotideHash.put("y", new Integer(8));\r
+    nucleotideHash.put("N", new Integer(9));\r
+    nucleotideHash.put("n", new Integer(9));\r
+\r
+\r
+    nucleotideName.put("A", "Adenine");\r
+    nucleotideName.put("a", "Adenine");\r
+    nucleotideName.put("G", "Guanine");\r
+    nucleotideName.put("g", "Guanine");\r
+    nucleotideName.put("C", "Cytosine");\r
+    nucleotideName.put("c", "Cytosine");\r
+    nucleotideName.put("T", "Thymine");\r
+    nucleotideName.put("t", "Thymine");\r
+    nucleotideName.put("U", "Uracil");\r
+    nucleotideName.put("u", "Uracil");\r
+    nucleotideName.put("I", "Inosine");\r
+    nucleotideName.put("i", "Inosine");\r
+    nucleotideName.put("X", "Xanthine");\r
+    nucleotideName.put("x", "Xanthine");\r
+    nucleotideName.put("R", "Unknown Purine");\r
+    nucleotideName.put("r", "Unknown Purine");\r
+    nucleotideName.put("Y", "Unknown Pyrimidine");\r
+    nucleotideName.put("y", "Unknown Pyrimidine");\r
+    nucleotideName.put("N", "Unknown");\r
+    nucleotideName.put("n", "Unknown");\r
   }\r
 \r
-  // These numbers should correspond to the indices in the Color hashes\r
-  public static Hashtable aaSpecialsHash = new Hashtable();\r
-\r
-  static\r
-  {\r
-    aaSpecialsHash.put("-", new Integer(23));\r
-    aaSpecialsHash.put("*", new Integer(24));\r
-    aaSpecialsHash.put(".", new Integer(25));\r
-    aaSpecialsHash.put(" ", new Integer(26));\r
-  }\r
 \r
   static\r
   {\r
@@ -126,9 +156,10 @@ public class ResidueProperties
     aa3Hash.put("TRP", new Integer(17));\r
     aa3Hash.put("TYR", new Integer(18));\r
     aa3Hash.put("VAL", new Integer(19));\r
-    aa3Hash.put("B", new Integer(20));\r
-    aa3Hash.put("Z", new Integer(21));\r
-    aa3Hash.put("X", new Integer(22));\r
+    // IUB Nomenclature for ambiguous peptides\r
+    aa3Hash.put("ASX", new Integer(20)); // "B";\r
+    aa3Hash.put("GLX", new Integer(21)); // X\r
+    aa3Hash.put("XAA", new Integer(22));// X unknown\r
     aa3Hash.put("-", new Integer(23));\r
     aa3Hash.put("*", new Integer(23));\r
     aa3Hash.put(".", new Integer(23));\r
@@ -179,13 +210,13 @@ public class ResidueProperties
     aa2Triplet.put("v", "VAL");\r
   }\r
 \r
-  public static String[] aa =\r
+  public static final String[] aa =\r
       {\r
       "A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F",\r
       "P", "S", "T", "W", "Y", "V", "B", "Z", "X", "_", "*", ".", " "\r
   };\r
-  public static Color midBlue = new Color(100, 100, 255);\r
-  public static Vector scaleColours = new Vector();\r
+  public static final Color midBlue = new Color(100, 100, 255);\r
+  public static final Vector scaleColours = new Vector();\r
 \r
   static\r
   {\r
@@ -201,7 +232,7 @@ public class ResidueProperties
     scaleColours.addElement(Color.white);\r
   }\r
 \r
-  public static Color[] taylor =\r
+  public static final Color[] taylor =\r
       {\r
       new Color(204, 255, 0), // A  Greenish-yellowy-yellow\r
       new Color(0, 0, 255), // R  Blueish-bluey-blue\r
@@ -230,7 +261,7 @@ public class ResidueProperties
       Color.white, // *\r
       Color.white // .\r
   };\r
-  public static Color[] nucleotide =\r
+  public static final Color[] nucleotide =\r
       {\r
       new Color(100, 247, 63), // A\r
       new Color(255, 179, 64), // C\r
@@ -238,7 +269,7 @@ public class ResidueProperties
       new Color(60, 136, 238), // T\r
       new Color(60, 136, 238) // U\r
   };\r
-  public static Color[] color =\r
+  public static final Color[] color =\r
       {\r
       Color.pink, // A\r
       midBlue, // R\r
@@ -270,7 +301,7 @@ public class ResidueProperties
   };\r
 \r
   // Dunno where I got these numbers from\r
-  public static double[] hyd2 =\r
+  public static final double[] hyd2 =\r
       {\r
       0.62, //A\r
       0.29, //R\r
@@ -296,39 +327,39 @@ public class ResidueProperties
       0.0, //Z\r
       0.0 //X\r
   };\r
-  public static double[] helix =\r
+  public static final double[] helix =\r
       {\r
       1.42, 0.98, 0.67, 1.01, 0.70, 1.11, 1.51, 0.57, 1.00, 1.08, 1.21, 1.16,\r
       1.45, 1.13, 0.57, 0.77, 0.83, 1.08, 0.69, 1.06, 0.84, 1.31, 1.00, 0.0\r
   };\r
-  public static double helixmin = 0.57;\r
-  public static double helixmax = 1.51;\r
-  public static double[] strand =\r
+  public static final double helixmin = 0.57;\r
+  public static final double helixmax = 1.51;\r
+  public static final double[] strand =\r
       {\r
       0.83, 0.93, 0.89, 0.54, 1.19, 1.10, 0.37, 0.75, 0.87, 1.60, 1.30, 0.74,\r
       1.05, 1.38, 0.55, 0.75, 1.19, 1.37, 1.47, 1.70, 0.72, 0.74, 1.0, 0.0\r
   };\r
-  public static double strandmin = 0.37;\r
-  public static double strandmax = 1.7;\r
-  public static double[] turn =\r
+  public static final double strandmin = 0.37;\r
+  public static final double strandmax = 1.7;\r
+  public static final double[] turn =\r
       {\r
       0.66, 0.95, 1.56, 1.46, 1.19, 0.98, 0.74, 1.56, 0.95, 0.47, 0.59, 1.01,\r
       0.60, 0.60, 1.52, 1.43, 0.96, 0.96, 1.14, 0.50, 1.51, 0.86, 1.00, 0, 0\r
   };\r
-  public static double turnmin = 0.47;\r
-  public static double turnmax = 1.56;\r
-  public static double[] buried =\r
+  public static final double turnmin = 0.47;\r
+  public static final double turnmax = 1.56;\r
+  public static final double[] buried =\r
       {\r
       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,\r
       0.6, 0.8, 0.7, 1.6, 0.5, 2.9, 0.4, 0.3, 1.358, 0.00\r
   };\r
-  public static double buriedmin = 0.05;\r
-  public static double buriedmax = 4.6;\r
+  public static final double buriedmin = 0.05;\r
+  public static final double buriedmax = 4.6;\r
 \r
   // This is hydropathy index\r
   // Kyte, J., and Doolittle, R.F., J. Mol. Biol.\r
   // 1157, 105-132, 1982\r
-  public static double[] hyd =\r
+  public static final double[] hyd =\r
       {\r
       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,\r
       2.8, -1.6, -0.8, -0.7, -0.9, -1.3, 4.2, -3.5, -3.5, -0.49, 0.0\r
@@ -536,7 +567,7 @@ public class ResidueProperties
       -8, -8, -8, -8, -8, -8, 1\r
   },\r
   };\r
-  public static Hashtable ssHash = new Hashtable(); // stores the number value of the aa\r
+  public static final Hashtable ssHash = new Hashtable(); // stores the number value of the aa\r
 \r
   static\r
   {\r
@@ -564,13 +595,13 @@ public class ResidueProperties
       {\r
       1, 1, 1, 1, 1}, // -\r
   };\r
-  public static Color[] pidColours =\r
+  public static final Color[] pidColours =\r
       {\r
       midBlue, new Color(153, 153, 255),\r
       //    Color.lightGray,\r
       new Color(204, 204, 255),\r
   };\r
-  public static float[] pidThresholds =\r
+  public static final float[] pidThresholds =\r
       {\r
       80, 60, 40, };\r
   public static Hashtable codonHash = new Hashtable();\r
@@ -793,27 +824,6 @@ public class ResidueProperties
     Phe.addElement("TTT");\r
   }\r
 \r
-  public static Color[][] groupColors =\r
-      {\r
-      {\r
-      Color.red, Color.red.brighter(), Color.red.brighter().brighter()},\r
-      {\r
-      Color.orange, Color.orange.brighter(),\r
-      Color.orange.brighter().brighter()\r
-  },\r
-      {\r
-      Color.green, Color.green.brighter(), Color.green.brighter().brighter()},\r
-      {\r
-      Color.blue, Color.blue.brighter(), Color.blue.brighter().brighter()},\r
-      {\r
-      Color.magenta, Color.magenta.brighter(),\r
-      Color.magenta.brighter().brighter()\r
-  },\r
-      {\r
-      Color.cyan, Color.cyan.brighter(), Color.cyan.brighter().brighter()},\r
-      {\r
-      Color.pink, Color.pink.brighter(), Color.pink.brighter().brighter()},\r
-  };\r
 \r
   //Stores residue codes/names and colours and other things\r
   public static Hashtable propHash = new Hashtable();\r
@@ -1104,20 +1114,6 @@ public class ResidueProperties
     propHash.put("polar", polar);\r
   }\r
 \r
-  public static Hashtable chainColours = new Hashtable();\r
-\r
-  static\r
-  {\r
-    chainColours.put("A", Color.red);\r
-    chainColours.put("B", Color.orange);\r
-    chainColours.put("C", Color.yellow);\r
-    chainColours.put("D", Color.green);\r
-    chainColours.put("E", Color.cyan);\r
-    chainColours.put("F", Color.blue);\r
-    chainColours.put("G", Color.magenta);\r
-    chainColours.put("H", Color.pink);\r
-  }\r
-\r
   private ResidueProperties()\r
   {\r
   }\r
@@ -1203,7 +1199,7 @@ public class ResidueProperties
       String key = (String) e.nextElement();\r
       Vector tmp = (Vector) codonHash.get(key);\r
 \r
-      if (tmp.contains(codon))\r
+      if (tmp.contains(codon.toUpperCase()))\r
       {\r
         return key;\r
       }\r
@@ -1211,9 +1207,4 @@ public class ResidueProperties
 \r
     return null;\r
   }\r
-\r
-  public static Hashtable getChainColours()\r
-  {\r
-    return chainColours;\r
-  }\r
 }\r