all can threshold
[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 \r
20   public Color findColour(String s, int j) {\r
21 \r
22     if( threshold!=0 && !aboveThreshold(s,j))\r
23       return Color.white;\r
24 \r
25     Color     c    = Color.white;\r
26       Hashtable hash =  (Hashtable)consensus.elementAt(j);\r
27 \r
28       double sc = 0;\r
29       if ( Integer.parseInt( hash.get("maxCount").toString() ) != -1 && hash.contains(s))\r
30       {\r
31         sc = ( (Integer) hash.get(s)).intValue() * 100.0 / ((Integer)hash.get("size")).intValue() ;\r
32         // MC Should be isGap\r
33         if (!jalview.util.Comparison.isGap((s.charAt(0))))\r
34         {\r
35           for (int i = 0; i < thresholds.length; i++)\r
36           {\r
37             if (sc > thresholds[i])\r
38             {\r
39               c = pidColours[i];\r
40               break;\r
41             }\r
42           }\r
43         }\r
44 \r
45       }\r
46       return c;\r
47   }\r
48 }\r