Percentage precalculated in aafrequency
authoramwaterhouse <Andrew Waterhouse>
Mon, 15 Aug 2005 12:13:33 +0000 (12:13 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 15 Aug 2005 12:13:33 +0000 (12:13 +0000)
src/jalview/schemes/PIDColourScheme.java
src/jalview/schemes/ResidueColourScheme.java
src/jalview/schemes/ResidueProperties.java

index cfc9f94..8cea507 100755 (executable)
@@ -18,8 +18,6 @@
  */\r
 package jalview.schemes;\r
 \r
-import java.util.*;\r
-\r
 import java.awt.*;\r
 \r
 import jalview.datamodel.*;\r
@@ -45,18 +43,14 @@ public class PIDColourScheme
     }\r
 \r
     Color c = Color.white;\r
-    Hashtable hash = (Hashtable) consensus.elementAt(j);\r
 \r
     double sc = 0;\r
 \r
-    if ( (Integer.parseInt(hash.get("maxCount").toString()) != -1) &&\r
-        hash.contains(s))\r
+    if ( (Integer.parseInt(consensus[j].get("maxCount").toString()) != -1) &&\r
+        consensus[j].contains(s))\r
     {\r
-      sc = ( ( (Integer) hash.get(s)).intValue() * 100.0) /\r
-          ( (Integer) hash.get(\r
-              "size")).intValue();\r
+      sc = ((Float)consensus[j].get(ignoreGaps)).floatValue();\r
 \r
-      // MC Should be isGap\r
       if (!jalview.util.Comparison.isGap( (s.charAt(0))))\r
       {\r
         for (int i = 0; i < thresholds.length; i++)\r
index 9c10e7d..3181cf4 100755 (executable)
@@ -34,8 +34,11 @@ public class ResidueColourScheme implements ColourSchemeI
     Color[] colors;\r
     int threshold = 0;\r
 \r
+    /* Set when threshold colouring to either pid_gaps or pid_nogaps*/\r
+    protected String ignoreGaps = "pid_gaps";\r
+\r
     /** DOCUMENT ME!! */\r
-    public Vector consensus;\r
+    public Hashtable [] consensus;\r
 \r
     /**\r
      * Creates a new ResidueColourScheme object.\r
@@ -61,9 +64,12 @@ public class ResidueColourScheme implements ColourSchemeI
      *\r
      * @param consensus DOCUMENT ME!\r
      */\r
-    public void setConsensus(Vector consensus)\r
+    public void setConsensus(Vector vconsensus)\r
     {\r
-        this.consensus = consensus;\r
+       int i, iSize=vconsensus.size();\r
+       consensus = new Hashtable[iSize];\r
+       for(i=0; i<iSize; i++)\r
+        consensus[i] = (Hashtable)vconsensus.elementAt(i);\r
     }\r
 \r
     /**\r
@@ -113,9 +119,13 @@ public class ResidueColourScheme implements ColourSchemeI
      *\r
      * @param ct DOCUMENT ME!\r
      */\r
-    public void setThreshold(int ct)\r
+    public void setThreshold(int ct, boolean ignoreGaps)\r
     {\r
         threshold = ct;\r
+        if(ignoreGaps)\r
+          this.ignoreGaps = "pid_nogaps";\r
+        else\r
+          this.ignoreGaps = "pid_gaps";\r
     }\r
 \r
     /**\r
@@ -128,16 +138,14 @@ public class ResidueColourScheme implements ColourSchemeI
      */\r
     public boolean aboveThreshold(String s, int j)\r
     {\r
-        Hashtable hash = (Hashtable) consensus.elementAt(j);\r
-\r
-        if ((((Integer) hash.get("maxCount")).intValue() != -1) &&\r
-                hash.contains(s))\r
+      if(consensus==null)\r
+        System.out.println("its null");\r
+        if ((((Integer) consensus[j].get("maxCount")).intValue() != -1) &&\r
+                consensus[j].contains(s))\r
         {\r
-            ////  resCount////////////////////                  ///////////////seq count////////////\r
-            double sc = (((Integer) hash.get(s)).intValue() * 100.0) / ((Integer) hash.get(\r
-                    "size")).intValue();\r
+            float ratio =  ((Float)consensus[j].get(ignoreGaps)).floatValue();\r
 \r
-            if (sc >= threshold)\r
+            if (ratio >= threshold)\r
             {\r
                 return true;\r
             }\r
index 14479a7..0b71381 100755 (executable)
@@ -138,25 +138,45 @@ public class ResidueProperties
   static\r
   {\r
     aa2Triplet.put("A", "ALA");\r
+    aa2Triplet.put("a", "ALA");\r
     aa2Triplet.put("R", "ARG");\r
+    aa2Triplet.put("r", "ARG");\r
     aa2Triplet.put("N", "ASN");\r
+    aa2Triplet.put("n", "ASN");\r
     aa2Triplet.put("D", "ASP");\r
+    aa2Triplet.put("d", "ASP");\r
     aa2Triplet.put("C", "CYS");\r
+    aa2Triplet.put("c", "CYS");\r
     aa2Triplet.put("Q", "GLN");\r
+    aa2Triplet.put("q", "GLN");\r
     aa2Triplet.put("E", "GLU");\r
+    aa2Triplet.put("e", "GLU");\r
     aa2Triplet.put("G", "GLY");\r
+    aa2Triplet.put("g", "GLY");\r
     aa2Triplet.put("H", "HIS");\r
+    aa2Triplet.put("h", "HIS");\r
     aa2Triplet.put("I", "ILE");\r
+    aa2Triplet.put("i", "ILE");\r
     aa2Triplet.put("L", "LEU");\r
+    aa2Triplet.put("l", "LEU");\r
     aa2Triplet.put("K", "LYS");\r
+    aa2Triplet.put("k", "LYS");\r
     aa2Triplet.put("M", "MET");\r
+    aa2Triplet.put("m", "MET");\r
     aa2Triplet.put("F", "PHE");\r
+    aa2Triplet.put("f", "PHE");\r
     aa2Triplet.put("P", "PRO");\r
+    aa2Triplet.put("p", "PRO");\r
     aa2Triplet.put("S", "SER");\r
+    aa2Triplet.put("s", "SER");\r
     aa2Triplet.put("T", "THR");\r
+    aa2Triplet.put("t", "THR");\r
     aa2Triplet.put("W", "TRP");\r
+    aa2Triplet.put("w", "TRP");\r
     aa2Triplet.put("Y", "TYR");\r
+    aa2Triplet.put("y", "TYR");\r
     aa2Triplet.put("V", "VAL");\r
+    aa2Triplet.put("v", "VAL");\r
   }\r
 \r
   public static String[] aa =\r