JAL-1807 still testing
[jalviewjs.git] / bin / jalview / schemes / ResidueColourScheme.js
index 9b2382f..aaf6ef5 100644 (file)
-Clazz.declarePackage ("jalview.schemes");
-Clazz.load (["jalview.schemes.ColourSchemeI"], "jalview.schemes.ResidueColourScheme", ["jalview.util.Comparison", "$.MessageManager", "java.awt.Color", "java.lang.Error"], function () {
-c$ = Clazz.decorateAsClass (function () {
-this.symbolIndex = null;
-this.conservationColouring = false;
-this.colors = null;
-this.threshold = 0;
-this.ignoreGaps = "G";
-this.consensus = null;
-this.conservation = null;
-this.conservationLength = 0;
-this.inc = 30;
-Clazz.instantialize (this, arguments);
-}, jalview.schemes, "ResidueColourScheme", null, jalview.schemes.ColourSchemeI);
-Clazz.makeConstructor (c$, 
-function (aaOrnaIndex, colours, threshold) {
-this.symbolIndex = aaOrnaIndex;
-this.colors = colours;
-this.threshold = threshold;
-}, "~A,~A,~N");
-Clazz.makeConstructor (c$, 
-function (aaOrNaIndex) {
-this.symbolIndex = aaOrNaIndex;
-}, "~A");
-Clazz.makeConstructor (c$, 
-function () {
-this.symbolIndex = null;
-});
-Clazz.defineMethod (c$, "findColour", 
-function (c) {
-return this.colors == null ? java.awt.Color.white : this.colors[this.symbolIndex[c.charCodeAt (0)]];
-}, "~S");
-Clazz.defineMethod (c$, "findColour", 
-function (c, j, seq) {
-var currentColour;
-if (this.colors != null && this.symbolIndex != null && (this.threshold == 0) || this.aboveThreshold (c, j)) {
-currentColour = this.colors[this.symbolIndex[c.charCodeAt (0)]];
-} else {
-currentColour = java.awt.Color.white;
-}if (this.conservationColouring) {
-currentColour = this.applyConservation (currentColour, j);
-}return currentColour;
-}, "~S,~N,jalview.datamodel.SequenceI");
-Clazz.overrideMethod (c$, "getThreshold", 
-function () {
-return this.threshold;
-});
-Clazz.overrideMethod (c$, "setThreshold", 
-function (ct, ignoreGaps) {
-this.threshold = ct;
-if (ignoreGaps) {
-this.ignoreGaps = "N";
-} else {
-this.ignoreGaps = "G";
-}}, "~N,~B");
-Clazz.defineMethod (c$, "aboveThreshold", 
-function (c, j) {
-if ('a' <= c && c <= 'z') {
-c = String.fromCharCode (c.charCodeAt (0) - (32));
-}if (this.consensus == null || this.consensus.length < j || this.consensus[j] == null) {
-return false;
-}if (((this.consensus[j].get ("C")).intValue () != -1) && this.consensus[j].contains (String.valueOf (c))) {
-if ((this.consensus[j].get (this.ignoreGaps)).floatValue () >= this.threshold) {
-return true;
-}}return false;
-}, "~S,~N");
-Clazz.overrideMethod (c$, "conservationApplied", 
-function () {
-return this.conservationColouring;
-});
-Clazz.overrideMethod (c$, "setConservationApplied", 
-function (conservationApplied) {
-this.conservationColouring = conservationApplied;
-}, "~B");
-Clazz.overrideMethod (c$, "setConservationInc", 
-function (i) {
-this.inc = i;
-}, "~N");
-Clazz.overrideMethod (c$, "getConservationInc", 
-function () {
-return this.inc;
-});
-Clazz.overrideMethod (c$, "setConsensus", 
-function (consensus) {
-if (consensus == null) {
-return;
-}this.consensus = consensus;
-}, "~A");
-Clazz.overrideMethod (c$, "setConservation", 
-function (cons) {
-if (cons == null) {
-this.conservationColouring = false;
-this.conservation = null;
-} else {
-this.conservationColouring = true;
-var i;
-var iSize = cons.getConsSequence ().getLength ();
-this.conservation =  Clazz.newCharArray (iSize, '\0');
-for (i = 0; i < iSize; i++) {
-this.conservation[i] = cons.getConsSequence ().getCharAt (i);
-}
-this.conservationLength = this.conservation.length;
-}}, "jalview.analysis.Conservation");
-Clazz.defineMethod (c$, "applyConservation", 
-function (currentColour, i) {
-if ((this.conservationLength > i) && (this.conservation[i] != '*') && (this.conservation[i] != '+')) {
-if (jalview.util.Comparison.isGap (this.conservation[i])) {
-currentColour = java.awt.Color.white;
-} else {
-var t = 11 - ((this.conservation[i]).charCodeAt (0) - 48);
-if (t == 0) {
-return java.awt.Color.white;
-}var red = currentColour.getRed ();
-var green = currentColour.getGreen ();
-var blue = currentColour.getBlue ();
-var dr = 255 - red;
-var dg = 255 - green;
-var db = 255 - blue;
-dr *= t / 10;
-dg *= t / 10;
-db *= t / 10;
-red += (this.inc / 20) * dr;
-green += (this.inc / 20) * dg;
-blue += (this.inc / 20) * db;
-if (red > 255 || green > 255 || blue > 255) {
-currentColour = java.awt.Color.white;
-} else {
-currentColour =  new java.awt.Color (red, green, blue);
-}}}return currentColour;
-}, "java.awt.Color,~N");
-Clazz.overrideMethod (c$, "alignmentChanged", 
-function (alignment, hiddenReps) {
-}, "jalview.datamodel.AnnotatedCollectionI,java.util.Map");
-Clazz.overrideMethod (c$, "applyTo", 
-function (sg, hiddenRepSequences) {
-try {
-return this.getClass ().newInstance ();
-} catch (q) {
-if (Clazz.exceptionOf (q, Exception)) {
-throw  new Error (jalview.util.MessageManager.formatMessage ("error.implementation_error_cannot_duplicate_colour_scheme",  Clazz.newArray (-1, [this.getClass ().getName ()])), q);
-} else {
-throw q;
-}
-}
-}, "jalview.datamodel.AnnotatedCollectionI,java.util.Map");
-});
+Clazz.declarePackage ("jalview.schemes");\r
+Clazz.load (["jalview.schemes.ColourSchemeI"], "jalview.schemes.ResidueColourScheme", ["jalview.util.Comparison", "$.MessageManager", "java.awt.Color", "java.lang.Error"], function () {\r
+c$ = Clazz.decorateAsClass (function () {\r
+this.symbolIndex = null;\r
+this.conservationColouring = false;\r
+this.colors = null;\r
+this.threshold = 0;\r
+this.ignoreGaps = "G";\r
+this.consensus = null;\r
+this.conservation = null;\r
+this.conservationLength = 0;\r
+this.inc = 30;\r
+Clazz.instantialize (this, arguments);\r
+}, jalview.schemes, "ResidueColourScheme", null, jalview.schemes.ColourSchemeI);\r
+Clazz.makeConstructor (c$, \r
+function (aaOrnaIndex, colours, threshold) {\r
+this.symbolIndex = aaOrnaIndex;\r
+this.colors = colours;\r
+this.threshold = threshold;\r
+}, "~A,~A,~N");\r
+Clazz.makeConstructor (c$, \r
+function (aaOrNaIndex) {\r
+this.symbolIndex = aaOrNaIndex;\r
+}, "~A");\r
+Clazz.makeConstructor (c$, \r
+function () {\r
+this.symbolIndex = null;\r
+});\r
+Clazz.defineMethod (c$, "findColour", \r
+function (c) {\r
+return this.colors == null ? java.awt.Color.white : this.colors[this.symbolIndex[c.charCodeAt (0)]];\r
+}, "~S");\r
+Clazz.defineMethod (c$, "findColour", \r
+function (c, j, seq) {\r
+var currentColour;\r
+if (this.colors != null && this.symbolIndex != null && (this.threshold == 0) || this.aboveThreshold (c, j)) {\r
+currentColour = this.colors[this.symbolIndex[c.charCodeAt (0)]];\r
+} else {\r
+currentColour = java.awt.Color.white;\r
+}if (this.conservationColouring) {\r
+currentColour = this.applyConservation (currentColour, j);\r
+}return currentColour;\r
+}, "~S,~N,jalview.datamodel.SequenceI");\r
+Clazz.overrideMethod (c$, "getThreshold", \r
+function () {\r
+return this.threshold;\r
+});\r
+Clazz.overrideMethod (c$, "setThreshold", \r
+function (ct, ignoreGaps) {\r
+this.threshold = ct;\r
+if (ignoreGaps) {\r
+this.ignoreGaps = "N";\r
+} else {\r
+this.ignoreGaps = "G";\r
+}}, "~N,~B");\r
+Clazz.defineMethod (c$, "aboveThreshold", \r
+function (c, j) {\r
+if ('a' <= c && c <= 'z') {\r
+c = String.fromCharCode (c.charCodeAt (0) - (32));\r
+}if (this.consensus == null || this.consensus.length < j || this.consensus[j] == null) {\r
+return false;\r
+}if (((this.consensus[j].get ("C")).intValue () != -1) && this.consensus[j].contains (String.valueOf (c))) {\r
+if ((this.consensus[j].get (this.ignoreGaps)).floatValue () >= this.threshold) {\r
+return true;\r
+}}return false;\r
+}, "~S,~N");\r
+Clazz.overrideMethod (c$, "conservationApplied", \r
+function () {\r
+return this.conservationColouring;\r
+});\r
+Clazz.overrideMethod (c$, "setConservationApplied", \r
+function (conservationApplied) {\r
+this.conservationColouring = conservationApplied;\r
+}, "~B");\r
+Clazz.overrideMethod (c$, "setConservationInc", \r
+function (i) {\r
+this.inc = i;\r
+}, "~N");\r
+Clazz.overrideMethod (c$, "getConservationInc", \r
+function () {\r
+return this.inc;\r
+});\r
+Clazz.overrideMethod (c$, "setConsensus", \r
+function (consensus) {\r
+if (consensus == null) {\r
+return;\r
+}this.consensus = consensus;\r
+}, "~A");\r
+Clazz.overrideMethod (c$, "setConservation", \r
+function (cons) {\r
+if (cons == null) {\r
+this.conservationColouring = false;\r
+this.conservation = null;\r
+} else {\r
+this.conservationColouring = true;\r
+var i;\r
+var iSize = cons.getConsSequence ().getLength ();\r
+this.conservation =  Clazz.newCharArray (iSize, '\0');\r
+for (i = 0; i < iSize; i++) {\r
+this.conservation[i] = cons.getConsSequence ().getCharAt (i);\r
+}\r
+this.conservationLength = this.conservation.length;\r
+}}, "jalview.analysis.Conservation");\r
+Clazz.defineMethod (c$, "applyConservation", \r
+function (currentColour, i) {\r
+if ((this.conservationLength > i) && (this.conservation[i] != '*') && (this.conservation[i] != '+')) {\r
+if (jalview.util.Comparison.isGap (this.conservation[i])) {\r
+currentColour = java.awt.Color.white;\r
+} else {\r
+var t = 11 - ((this.conservation[i]).charCodeAt (0) - 48);\r
+if (t == 0) {\r
+return java.awt.Color.white;\r
+}var red = currentColour.getRed ();\r
+var green = currentColour.getGreen ();\r
+var blue = currentColour.getBlue ();\r
+var dr = 255 - red;\r
+var dg = 255 - green;\r
+var db = 255 - blue;\r
+dr *= t / 10;\r
+dg *= t / 10;\r
+db *= t / 10;\r
+red += (this.inc / 20) * dr;\r
+green += (this.inc / 20) * dg;\r
+blue += (this.inc / 20) * db;\r
+if (red > 255 || green > 255 || blue > 255) {\r
+currentColour = java.awt.Color.white;\r
+} else {\r
+currentColour =  new java.awt.Color (red, green, blue);\r
+}}}return currentColour;\r
+}, "java.awt.Color,~N");\r
+Clazz.overrideMethod (c$, "alignmentChanged", \r
+function (alignment, hiddenReps) {\r
+}, "jalview.datamodel.AnnotatedCollectionI,java.util.Map");\r
+Clazz.overrideMethod (c$, "applyTo", \r
+function (sg, hiddenRepSequences) {\r
+try {\r
+return this.getClass ().newInstance ();\r
+} catch (q) {\r
+if (Clazz.exceptionOf (q, Exception)) {\r
+throw  new Error (jalview.util.MessageManager.formatMessage ("error.implementation_error_cannot_duplicate_colour_scheme",  Clazz.newArray (-1, [this.getClass ().getName ()])), q);\r
+} else {\r
+throw q;\r
+}\r
+}\r
+}, "jalview.datamodel.AnnotatedCollectionI,java.util.Map");\r
+});\r