consensus held in residueColour
[jalview.git] / src / jalview / schemes / PIDColourScheme.java
1 package jalview.schemes;\r
2 \r
3 import jalview.datamodel.*;\r
4 import java.util.*;\r
5 import java.awt.*;\r
6 \r
7 public class PIDColourScheme extends ResidueColourScheme {\r
8     public Color[] pidColours;\r
9     public float[] thresholds;\r
10 \r
11     SequenceGroup group;\r
12 \r
13     public PIDColourScheme() {\r
14         this.pidColours = ResidueProperties.pidColours;\r
15         this.thresholds = ResidueProperties.pidThresholds;\r
16     }\r
17 \r
18 \r
19   public Color findColour(String s, int j) {\r
20       Color     c    = Color.white;\r
21       Hashtable hash =  (Hashtable)consensus.elementAt(j);\r
22 \r
23       double sc = 0;\r
24       if ( Integer.parseInt( hash.get("maxCount").toString() ) != -1 && hash.contains(s))\r
25       {\r
26         sc = ( (Integer) hash.get(s)).intValue() * 100.0 / ((Integer)hash.get("size")).intValue() ;\r
27         // MC Should be isGap\r
28         if (!jalview.util.Comparison.isGap((s.charAt(0))))\r
29         {\r
30           for (int i = 0; i < thresholds.length; i++)\r
31           {\r
32             if (sc > thresholds[i])\r
33             {\r
34               c = pidColours[i];\r
35               break;\r
36             }\r
37           }\r
38         }\r
39 \r
40       }\r
41       return c;\r
42   }\r
43 }\r