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