JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / jalview / schemes / PIDColourScheme.js
1 Clazz.declarePackage ("jalview.schemes");\r
2 Clazz.load (["jalview.schemes.ResidueColourScheme"], "jalview.schemes.PIDColourScheme", ["jalview.schemes.ResidueProperties", "jalview.util.Comparison", "java.awt.Color"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.pidColours = null;\r
5 this.thresholds = null;\r
6 this.group = null;\r
7 Clazz.instantialize (this, arguments);\r
8 }, jalview.schemes, "PIDColourScheme", jalview.schemes.ResidueColourScheme);\r
9 Clazz.makeConstructor (c$, \r
10 function () {\r
11 Clazz.superConstructor (this, jalview.schemes.PIDColourScheme, []);\r
12 this.pidColours = jalview.schemes.ResidueProperties.pidColours;\r
13 this.thresholds = jalview.schemes.ResidueProperties.pidThresholds;\r
14 });\r
15 Clazz.defineMethod (c$, "findColour", \r
16 function (c, j, seq) {\r
17 if ('a' <= c && c <= 'z') {\r
18 c = String.fromCharCode (c.charCodeAt (0) - (32));\r
19 }if (this.consensus == null || j >= this.consensus.length || this.consensus[j] == null) {\r
20 return java.awt.Color.white;\r
21 }if ((this.threshold != 0) && !this.aboveThreshold (c, j)) {\r
22 return java.awt.Color.white;\r
23 }var currentColour = java.awt.Color.white;\r
24 var sc = 0;\r
25 if (this.consensus.length <= j) {\r
26 return java.awt.Color.white;\r
27 }if ((Integer.parseInt (this.consensus[j].get ("C").toString ()) != -1) && this.consensus[j].contains (String.valueOf (c))) {\r
28 sc = (this.consensus[j].get (this.ignoreGaps)).floatValue ();\r
29 if (!jalview.util.Comparison.isGap (c)) {\r
30 for (var i = 0; i < this.thresholds.length; i++) {\r
31 if (sc > this.thresholds[i]) {\r
32 currentColour = this.pidColours[i];\r
33 break;\r
34 }}\r
35 }}if (this.conservationColouring) {\r
36 currentColour = this.applyConservation (currentColour, j);\r
37 }return currentColour;\r
38 }, "~S,~N,jalview.datamodel.SequenceI");\r
39 });\r