maintain original threshold value
[jalview.git] / src / jalview / schemes / ConservationColourScheme.java
index cef65c2..6394124 100755 (executable)
 \r
 package jalview.schemes;\r
 import java.awt.*;\r
-import jalview.gui.*;\r
-import jalview.datamodel.*;\r
 import jalview.analysis.*;\r
+import java.util.Vector;\r
 \r
 public class ConservationColourScheme extends ResidueColourScheme {\r
   public Conservation conserve;\r
   public ColourSchemeI cs;\r
   public int inc = 30;\r
-  int colourThreshold =  7;\r
 \r
   public ConservationColourScheme(Conservation cons, ColourSchemeI oldcs)\r
   {\r
     super();\r
     conserve = cons;\r
     cs = oldcs;\r
-\r
   }\r
 \r
+  public void setConsensus(Vector consensus)\r
+  {\r
+    this.consensus = consensus;\r
+    if(cs!=null)\r
+      cs.setConsensus(consensus);\r
+  }\r
 \r
-   public Color findColour(String s, int i, java.util.Vector v)\r
+   public Color findColour(String s, int i)\r
    {\r
      Color c = Color.white;\r
-     if(cs == null)\r
+     if (cs == null)\r
        return c;\r
 \r
-     if (colourThreshold > 0 && conserve.getConsSequence() != null)\r
+     char ch = conserve.getConsSequence().getSequence().charAt(i);\r
+     if (ch == '*' || ch == '+')\r
+     {\r
+       c = cs.findColour(s, i);\r
+     }\r
+     else\r
      {\r
-       if (conserve.getConsSequence().getSequence().charAt(i) == '*'\r
-           || conserve.getConsSequence().getSequence().charAt(i) == '+')\r
+       int tmp = 10;\r
+       int t = 0;\r
+       if (!jalview.util.Comparison.isGap(ch))\r
+         t = Integer.parseInt(ch + "");\r
+\r
+       c = cs.findColour(s, i);\r
+\r
+       while (tmp >= t)\r
        {\r
-           c = cs.findColour(s, i, v);\r
+         c = lighter(c, inc);\r
+         tmp--;\r
        }\r
-       else\r
-       {\r
-           int tmp = 10;\r
-           int t = 0;\r
-           if (!jalview.util.Comparison.isGap(conserve.getConsSequence().\r
-                                              getSequence().charAt(i)))\r
-             t = Integer.parseInt(conserve.getConsSequence().getSequence().\r
-                                  substring(i, i + 1));\r
 \r
-           c = cs.findColour(s, i, v);\r
-           while (tmp >= t)\r
-           {\r
-             c = lighter(c, inc);\r
-             tmp--;\r
-           }\r
-       }\r
      }\r
-     return c;\r
+\r
+   return c;\r
    }\r
 \r
 \r