JAL-1807 test
[jalviewjs.git] / bin / jalview / schemes / Blosum62ColourScheme.js
1 Clazz.declarePackage ("jalview.schemes");
2 Clazz.load (["jalview.schemes.ResidueColourScheme"], "jalview.schemes.Blosum62ColourScheme", ["jalview.schemes.ResidueProperties", "jalview.util.Comparison", "java.awt.Color"], function () {
3 c$ = Clazz.declareType (jalview.schemes, "Blosum62ColourScheme", jalview.schemes.ResidueColourScheme);
4 Clazz.defineMethod (c$, "findColour", 
5 function (res, j, seq) {
6 if ('a' <= res && res <= 'z') {
7 res = String.fromCharCode (res.charCodeAt (0) - (32));
8 }if (this.consensus == null || j >= this.consensus.length || this.consensus[j] == null || (this.threshold != 0 && !this.aboveThreshold (res, j))) {
9 return java.awt.Color.white;
10 }var currentColour;
11 if (!jalview.util.Comparison.isGap (res)) {
12 var max = this.consensus[j].get ("R");
13 if (max.indexOf (res) > -1) {
14 currentColour =  new java.awt.Color (154, 154, 255);
15 } else {
16 var c = 0;
17 var max_aa = 0;
18 var n = max.length;
19 do {
20 c += jalview.schemes.ResidueProperties.getBLOSUM62 (max.charAt (max_aa), res);
21 } while (++max_aa < n);
22 if (c > 0) {
23 currentColour =  new java.awt.Color (204, 204, 255);
24 } else {
25 currentColour = java.awt.Color.white;
26 }}if (this.conservationColouring) {
27 currentColour = this.applyConservation (currentColour, j);
28 }} else {
29 return java.awt.Color.white;
30 }return currentColour;
31 }, "~S,~N,jalview.datamodel.SequenceI");
32 Clazz.defineMethod (c$, "applyTo", 
33 function (sg, hiddenRepSequences) {
34 var newcs = Clazz.superCall (this, jalview.schemes.Blosum62ColourScheme, "applyTo", [sg, hiddenRepSequences]);
35 return newcs;
36 }, "jalview.datamodel.AnnotatedCollectionI,java.util.Map");
37 });