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