typing
[jalview.git] / src / jalview / schemes / ResidueProperties.java
index 4110c74..f0e319e 100755 (executable)
@@ -1,13 +1,13 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  * Jalview is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License 
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
+ *  
  * Jalview is distributed in the hope that it will be useful, but 
  * WITHOUT ANY WARRANTY; without even the implied warranty 
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
@@ -97,6 +97,16 @@ public class ResidueProperties
     // extend subt. matrices
   }
 
+  /**
+   * maximum (gap) index for matrices involving protein alphabet
+   */
+  public final static int maxProteinIndex = 23;
+
+  /**
+   * maximum (gap) index for matrices involving nucleotide alphabet
+   */
+  public final static int maxNucleotideIndex = 10;
+
   static
   {
     nucleotideIndex = new int[255];
@@ -572,18 +582,24 @@ public class ResidueProperties
    * new Color(60, 136, 238), // U Color.white, // I Color.white, // X
    * Color.white, // R Color.white, // Y Color.white, // N Color.white, // Gap
    */
+
+  // JBPNote: patch matrix for T/U equivalence when working with DNA or RNA.
+  // Will equate sequences if working with mixed nucleotide sets.
+  // treats T and U identically. R and Y weak equivalence with AG and CTU.
+  // N matches any other base weakly
+  //
   static final int[][] DNA =
   {
-  { 10, -8, -8, -8, 1, 0, 0, 0, 0, 0, 1 }, // C
-      { -8, 10, -8, -8, 1, 0, 0, 0, 0, 0, 1 }, // T
-      { -8, -8, 10, -8, 1, 0, 0, 0, 0, 0, 1 }, // A
-      { -8, -8, -8, 10, 1, 0, 0, 0, 0, 0, 1 }, // G
-      { 1, 1, 1, 1, 10, 0, 0, 0, 0, 0, 1 }, // -
-      { 1, 1, 1, 1, 1, 10, 0, 0, 0, 0, 1 }, // -
-      { 1, 1, 1, 1, 1, 0, 10, 0, 0, 0, 1 }, // -
-      { 1, 1, 1, 1, 1, 0, 0, 10, 0, 0, 1 }, // -
-      { 1, 1, 1, 1, 1, 0, 0, 0, 10, 0, 1 }, // -
-      { 1, 1, 1, 1, 1, 0, 0, 0, 0, 10, 1 }, // -
+  { 10, -8, -8, -8, -8, 1, 1, 1, -8, 1, 1 }, // A
+      { -8, 10, -8, -8, -8, 1, 1, -8, 1, 1, 1 }, // C
+      { -8, -8, 10, -8, -8, 1, 1, 1, -8, 1, 1 }, // G
+      { -8, -8, -8, 10, 10, 1, 1, -8, 1, 1, 1 }, // T
+      { -8, -8, -8, 10, 10, 1, 1, -8, 1, 1, 1 }, // U
+      { 1, 1, 1, 1, 1, 10, 0, 0, 0, 1, 1 }, // I
+      { 1, 1, 1, 1, 1, 0, 10, 0, 0, 1, 1 }, // X
+      { 1, -8, 1, -8, -8, 0, 0, 10, -8, 1, 1 }, // R
+      { -8, 1, -8, 1, 1, 0, 0, -8, 10, 1, 1 }, // Y
+      { 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 1 }, // N
       { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, // -
   };
   /**
@@ -594,6 +610,7 @@ 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 =
@@ -1323,9 +1340,68 @@ public class ResidueProperties
   public static Hashtable toRNAssState;
   static
   {
-    toRNAssState = new Hashtable();
-    toRNAssState.put(")", "S");
-    toRNAssState.put("(", "S");
+       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("1", "1");
+    toRNAssState.put("e", "1");
+    toRNAssState.put("F", "F");
+    toRNAssState.put("f", "F");
+    toRNAssState.put("G", "G");
+    toRNAssState.put("g", "G");
+    toRNAssState.put("2", "2");
+    toRNAssState.put("h", "2");
+    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");
+    
   }
 
   /**