JAL-1807 still testing
[jalviewjs.git] / bin / jalview / schemes / AnnotationColourGradient.js
index 0f29e11..40ed8eb 100644 (file)
-Clazz.declarePackage ("jalview.schemes");
-Clazz.load (["jalview.schemes.FollowerColourScheme"], "jalview.schemes.AnnotationColourGradient", ["jalview.datamodel.AlignmentI", "$.GraphLine", "jalview.renderer.AnnotationRenderer", "jalview.schemes.ColourSchemeProperty", "jalview.util.Comparison", "java.awt.Color", "java.util.IdentityHashMap"], function () {
-c$ = Clazz.decorateAsClass (function () {
-this.annotation = null;
-this.aboveAnnotationThreshold = -1;
-this.thresholdIsMinMax = false;
-this.annotationThreshold = null;
-this.r1 = 0;
-this.g1 = 0;
-this.b1 = 0;
-this.rr = 0;
-this.gg = 0;
-this.bb = 0;
-this.predefinedColours = false;
-this.seqAssociated = false;
-this.noGradient = false;
-this.seqannot = null;
-this.aamin = 0;
-this.aamax = 0;
-Clazz.instantialize (this, arguments);
-}, jalview.schemes, "AnnotationColourGradient", jalview.schemes.FollowerColourScheme);
-Clazz.overrideMethod (c$, "applyTo", 
-function (sg, hiddenRepSequences) {
-var acg =  new jalview.schemes.AnnotationColourGradient (this.annotation, this.colourScheme, this.aboveAnnotationThreshold);
-acg.thresholdIsMinMax = this.thresholdIsMinMax;
-acg.annotationThreshold = (this.annotationThreshold == null) ? null :  new jalview.datamodel.GraphLine (this.annotationThreshold);
-acg.r1 = this.r1;
-acg.g1 = this.g1;
-acg.b1 = this.b1;
-acg.rr = this.rr;
-acg.gg = this.gg;
-acg.bb = this.bb;
-acg.predefinedColours = this.predefinedColours;
-acg.seqAssociated = this.seqAssociated;
-acg.noGradient = this.noGradient;
-return acg;
-}, "jalview.datamodel.AnnotatedCollectionI,java.util.Map");
-Clazz.makeConstructor (c$, 
-function (annotation, originalColour, aboveThreshold) {
-Clazz.superConstructor (this, jalview.schemes.AnnotationColourGradient, []);
-if (Clazz.instanceOf (originalColour, jalview.schemes.AnnotationColourGradient)) {
-this.colourScheme = (originalColour).colourScheme;
-} else {
-this.colourScheme = originalColour;
-}this.annotation = annotation;
-this.aboveAnnotationThreshold = aboveThreshold;
-if (aboveThreshold != -1 && annotation.threshold != null) {
-this.annotationThreshold = annotation.threshold;
-}this.r1 = 254;
-this.g1 = 254;
-this.b1 = 254;
-this.rr = 0;
-this.gg = 0;
-this.bb = 0;
-this.noGradient = true;
-}, "jalview.datamodel.AlignmentAnnotation,jalview.schemes.ColourSchemeI,~N");
-Clazz.makeConstructor (c$, 
-function (annotation, minColour, maxColour, aboveThreshold) {
-Clazz.superConstructor (this, jalview.schemes.AnnotationColourGradient, []);
-this.annotation = annotation;
-this.aboveAnnotationThreshold = aboveThreshold;
-if (aboveThreshold != -1 && annotation.threshold != null) {
-this.annotationThreshold = annotation.threshold;
-}this.r1 = minColour.getRed ();
-this.g1 = minColour.getGreen ();
-this.b1 = minColour.getBlue ();
-this.rr = maxColour.getRed () - this.r1;
-this.gg = maxColour.getGreen () - this.g1;
-this.bb = maxColour.getBlue () - this.b1;
-this.noGradient = false;
-this.aamax = annotation.graphMax;
-this.aamin = annotation.graphMin;
-if (annotation.isRNA ()) {
-jalview.schemes.ColourSchemeProperty.initRnaHelicesShading (1 + Clazz.floatToInt (this.aamax));
-}}, "jalview.datamodel.AlignmentAnnotation,java.awt.Color,java.awt.Color,~N");
-Clazz.defineMethod (c$, "alignmentChanged", 
-function (alignment, hiddenReps) {
-Clazz.superCall (this, jalview.schemes.AnnotationColourGradient, "alignmentChanged", [alignment, hiddenReps]);
-if (this.seqAssociated && this.annotation.getCalcId () != null) {
-if (this.seqannot != null) {
-this.seqannot.clear ();
-} else {
-this.seqannot =  new java.util.IdentityHashMap ();
-}var alcontext = Clazz.instanceOf (alignment, jalview.datamodel.AlignmentI) ? alignment : alignment.getContext ();
-var f = true;
-var rna = false;
-for (var alan, $alan = alcontext.findAnnotation (this.annotation.getCalcId ()).iterator (); $alan.hasNext () && ((alan = $alan.next ()) || true);) {
-if (alan.sequenceRef != null && (alan.label != null && this.annotation != null && alan.label.equals (this.annotation.label))) {
-if (!rna && alan.isRNA ()) {
-rna = true;
-}this.seqannot.put (alan.sequenceRef, alan);
-if (f || alan.graphMax > this.aamax) {
-this.aamax = alan.graphMax;
-}if (f || alan.graphMin < this.aamin) {
-this.aamin = alan.graphMin;
-}f = false;
-}}
-if (rna) {
-jalview.schemes.ColourSchemeProperty.initRnaHelicesShading (1 + Clazz.floatToInt (this.aamax));
-}}}, "jalview.datamodel.AnnotatedCollectionI,java.util.Map");
-Clazz.defineMethod (c$, "getAnnotation", 
-function () {
-return this.annotation.label;
-});
-Clazz.defineMethod (c$, "getAboveThreshold", 
-function () {
-return this.aboveAnnotationThreshold;
-});
-Clazz.defineMethod (c$, "getAnnotationThreshold", 
-function () {
-if (this.annotationThreshold == null) {
-return 0;
-} else {
-return this.annotationThreshold.value;
-}});
-Clazz.defineMethod (c$, "getMinColour", 
-function () {
-return  new java.awt.Color (Clazz.floatToInt (this.r1), Clazz.floatToInt (this.g1), Clazz.floatToInt (this.b1));
-});
-Clazz.defineMethod (c$, "getMaxColour", 
-function () {
-return  new java.awt.Color (Clazz.floatToInt (this.r1 + this.rr), Clazz.floatToInt (this.g1 + this.gg), Clazz.floatToInt (this.b1 + this.bb));
-});
-Clazz.defineMethod (c$, "findColour", 
-function (c) {
-return java.awt.Color.red;
-}, "~S");
-Clazz.defineMethod (c$, "findColour", 
-function (c, j, seq) {
-var currentColour = java.awt.Color.white;
-var annotation = (this.seqAssociated && this.seqannot != null ? this.seqannot.get (seq) : this.annotation);
-if (annotation == null) {
-return currentColour;
-}if ((this.threshold == 0) || this.aboveThreshold (c, j)) {
-if (annotation.annotations != null && j < annotation.annotations.length && annotation.annotations[j] != null && !jalview.util.Comparison.isGap (c)) {
-var aj = annotation.annotations[j];
-if (this.aboveAnnotationThreshold == -1 || (this.annotationThreshold != null && (this.aboveAnnotationThreshold == 1 ? aj.value >= this.annotationThreshold.value : aj.value <= this.annotationThreshold.value))) {
-if (this.predefinedColours && aj.colour != null && !aj.colour.equals (java.awt.Color.black)) {
-currentColour = aj.colour;
-} else if (annotation.hasIcons && annotation.graph == 0) {
-if (aj.secondaryStructure > ' ' && aj.secondaryStructure != '.' && aj.secondaryStructure != '-') {
-if (this.colourScheme != null) {
-currentColour = this.colourScheme.findColour (c, j, seq);
-} else {
-if (annotation.isRNA ()) {
-currentColour = jalview.schemes.ColourSchemeProperty.rnaHelices[Clazz.floatToInt (aj.value)];
-} else {
-currentColour = annotation.annotations[j].secondaryStructure == 'H' ? jalview.renderer.AnnotationRenderer.HELIX_COLOUR : annotation.annotations[j].secondaryStructure == 'E' ? jalview.renderer.AnnotationRenderer.SHEET_COLOUR : jalview.renderer.AnnotationRenderer.STEM_COLOUR;
-}}} else {
-return java.awt.Color.white;
-}} else if (this.noGradient) {
-if (this.colourScheme != null) {
-currentColour = this.colourScheme.findColour (c, j, seq);
-} else {
-if (aj.colour != null) {
-currentColour = aj.colour;
-}}} else {
-currentColour = this.shadeCalculation (annotation, j);
-}}if (this.conservationColouring) {
-currentColour = this.applyConservation (currentColour, j);
-}}}return currentColour;
-}, "~S,~N,jalview.datamodel.SequenceI");
-Clazz.defineMethod (c$, "shadeCalculation", 
-($fz = function (annotation, j) {
-var range = 1;
-if (this.thresholdIsMinMax && annotation.threshold != null && this.aboveAnnotationThreshold == 1 && annotation.annotations[j].value >= annotation.threshold.value) {
-range = (annotation.annotations[j].value - annotation.threshold.value) / (annotation.graphMax - annotation.threshold.value);
-} else if (this.thresholdIsMinMax && annotation.threshold != null && this.aboveAnnotationThreshold == 0 && annotation.annotations[j].value >= annotation.graphMin) {
-range = (annotation.annotations[j].value - annotation.graphMin) / (annotation.threshold.value - annotation.graphMin);
-} else {
-if (annotation.graphMax != annotation.graphMin) {
-range = (annotation.annotations[j].value - annotation.graphMin) / (annotation.graphMax - annotation.graphMin);
-} else {
-range = 0;
-}}var dr = Clazz.floatToInt (this.rr * range + this.r1);
-var dg = Clazz.floatToInt (this.gg * range + this.g1);
-var db = Clazz.floatToInt (this.bb * range + this.b1);
-return  new java.awt.Color (dr, dg, db);
-}, $fz.isPrivate = true, $fz), "jalview.datamodel.AlignmentAnnotation,~N");
-Clazz.defineMethod (c$, "isPredefinedColours", 
-function () {
-return this.predefinedColours;
-});
-Clazz.defineMethod (c$, "setPredefinedColours", 
-function (predefinedColours) {
-this.predefinedColours = predefinedColours;
-}, "~B");
-Clazz.defineMethod (c$, "isSeqAssociated", 
-function () {
-return this.seqAssociated;
-});
-Clazz.defineMethod (c$, "setSeqAssociated", 
-function (sassoc) {
-this.seqAssociated = sassoc;
-}, "~B");
-Clazz.defineStatics (c$,
-"NO_THRESHOLD", -1,
-"BELOW_THRESHOLD", 0,
-"ABOVE_THRESHOLD", 1);
-});
+Clazz.declarePackage ("jalview.schemes");\r
+Clazz.load (["jalview.schemes.FollowerColourScheme"], "jalview.schemes.AnnotationColourGradient", ["jalview.datamodel.AlignmentI", "$.GraphLine", "jalview.renderer.AnnotationRenderer", "jalview.schemes.ColourSchemeProperty", "jalview.util.Comparison", "java.awt.Color", "java.util.IdentityHashMap"], function () {\r
+c$ = Clazz.decorateAsClass (function () {\r
+this.annotation = null;\r
+this.aboveAnnotationThreshold = -1;\r
+this.thresholdIsMinMax = false;\r
+this.annotationThreshold = null;\r
+this.r1 = 0;\r
+this.g1 = 0;\r
+this.b1 = 0;\r
+this.rr = 0;\r
+this.gg = 0;\r
+this.bb = 0;\r
+this.predefinedColours = false;\r
+this.seqAssociated = false;\r
+this.noGradient = false;\r
+this.seqannot = null;\r
+this.aamin = 0;\r
+this.aamax = 0;\r
+Clazz.instantialize (this, arguments);\r
+}, jalview.schemes, "AnnotationColourGradient", jalview.schemes.FollowerColourScheme);\r
+Clazz.overrideMethod (c$, "applyTo", \r
+function (sg, hiddenRepSequences) {\r
+var acg =  new jalview.schemes.AnnotationColourGradient (this.annotation, this.colourScheme, this.aboveAnnotationThreshold);\r
+acg.thresholdIsMinMax = this.thresholdIsMinMax;\r
+acg.annotationThreshold = (this.annotationThreshold == null) ? null :  new jalview.datamodel.GraphLine (this.annotationThreshold);\r
+acg.r1 = this.r1;\r
+acg.g1 = this.g1;\r
+acg.b1 = this.b1;\r
+acg.rr = this.rr;\r
+acg.gg = this.gg;\r
+acg.bb = this.bb;\r
+acg.predefinedColours = this.predefinedColours;\r
+acg.seqAssociated = this.seqAssociated;\r
+acg.noGradient = this.noGradient;\r
+return acg;\r
+}, "jalview.datamodel.AnnotatedCollectionI,java.util.Map");\r
+Clazz.makeConstructor (c$, \r
+function (annotation, originalColour, aboveThreshold) {\r
+Clazz.superConstructor (this, jalview.schemes.AnnotationColourGradient, []);\r
+if (Clazz.instanceOf (originalColour, jalview.schemes.AnnotationColourGradient)) {\r
+this.colourScheme = (originalColour).colourScheme;\r
+} else {\r
+this.colourScheme = originalColour;\r
+}this.annotation = annotation;\r
+this.aboveAnnotationThreshold = aboveThreshold;\r
+if (aboveThreshold != -1 && annotation.threshold != null) {\r
+this.annotationThreshold = annotation.threshold;\r
+}this.r1 = 254;\r
+this.g1 = 254;\r
+this.b1 = 254;\r
+this.rr = 0;\r
+this.gg = 0;\r
+this.bb = 0;\r
+this.noGradient = true;\r
+}, "jalview.datamodel.AlignmentAnnotation,jalview.schemes.ColourSchemeI,~N");\r
+Clazz.makeConstructor (c$, \r
+function (annotation, minColour, maxColour, aboveThreshold) {\r
+Clazz.superConstructor (this, jalview.schemes.AnnotationColourGradient, []);\r
+this.annotation = annotation;\r
+this.aboveAnnotationThreshold = aboveThreshold;\r
+if (aboveThreshold != -1 && annotation.threshold != null) {\r
+this.annotationThreshold = annotation.threshold;\r
+}this.r1 = minColour.getRed ();\r
+this.g1 = minColour.getGreen ();\r
+this.b1 = minColour.getBlue ();\r
+this.rr = maxColour.getRed () - this.r1;\r
+this.gg = maxColour.getGreen () - this.g1;\r
+this.bb = maxColour.getBlue () - this.b1;\r
+this.noGradient = false;\r
+this.aamax = annotation.graphMax;\r
+this.aamin = annotation.graphMin;\r
+if (annotation.isRNA ()) {\r
+jalview.schemes.ColourSchemeProperty.initRnaHelicesShading (1 + Clazz.floatToInt (this.aamax));\r
+}}, "jalview.datamodel.AlignmentAnnotation,java.awt.Color,java.awt.Color,~N");\r
+Clazz.defineMethod (c$, "alignmentChanged", \r
+function (alignment, hiddenReps) {\r
+Clazz.superCall (this, jalview.schemes.AnnotationColourGradient, "alignmentChanged", [alignment, hiddenReps]);\r
+if (this.seqAssociated && this.annotation.getCalcId () != null) {\r
+if (this.seqannot != null) {\r
+this.seqannot.clear ();\r
+} else {\r
+this.seqannot =  new java.util.IdentityHashMap ();\r
+}var alcontext = Clazz.instanceOf (alignment, jalview.datamodel.AlignmentI) ? alignment : alignment.getContext ();\r
+var f = true;\r
+var rna = false;\r
+for (var alan, $alan = alcontext.findAnnotation (this.annotation.getCalcId ()).iterator (); $alan.hasNext () && ((alan = $alan.next ()) || true);) {\r
+if (alan.sequenceRef != null && (alan.label != null && this.annotation != null && alan.label.equals (this.annotation.label))) {\r
+if (!rna && alan.isRNA ()) {\r
+rna = true;\r
+}this.seqannot.put (alan.sequenceRef, alan);\r
+if (f || alan.graphMax > this.aamax) {\r
+this.aamax = alan.graphMax;\r
+}if (f || alan.graphMin < this.aamin) {\r
+this.aamin = alan.graphMin;\r
+}f = false;\r
+}}\r
+if (rna) {\r
+jalview.schemes.ColourSchemeProperty.initRnaHelicesShading (1 + Clazz.floatToInt (this.aamax));\r
+}}}, "jalview.datamodel.AnnotatedCollectionI,java.util.Map");\r
+Clazz.defineMethod (c$, "getAnnotation", \r
+function () {\r
+return this.annotation.label;\r
+});\r
+Clazz.defineMethod (c$, "getAboveThreshold", \r
+function () {\r
+return this.aboveAnnotationThreshold;\r
+});\r
+Clazz.defineMethod (c$, "getAnnotationThreshold", \r
+function () {\r
+if (this.annotationThreshold == null) {\r
+return 0;\r
+} else {\r
+return this.annotationThreshold.value;\r
+}});\r
+Clazz.defineMethod (c$, "getMinColour", \r
+function () {\r
+return  new java.awt.Color (Clazz.floatToInt (this.r1), Clazz.floatToInt (this.g1), Clazz.floatToInt (this.b1));\r
+});\r
+Clazz.defineMethod (c$, "getMaxColour", \r
+function () {\r
+return  new java.awt.Color (Clazz.floatToInt (this.r1 + this.rr), Clazz.floatToInt (this.g1 + this.gg), Clazz.floatToInt (this.b1 + this.bb));\r
+});\r
+Clazz.defineMethod (c$, "findColour", \r
+function (c) {\r
+return java.awt.Color.red;\r
+}, "~S");\r
+Clazz.defineMethod (c$, "findColour", \r
+function (c, j, seq) {\r
+var currentColour = java.awt.Color.white;\r
+var annotation = (this.seqAssociated && this.seqannot != null ? this.seqannot.get (seq) : this.annotation);\r
+if (annotation == null) {\r
+return currentColour;\r
+}if ((this.threshold == 0) || this.aboveThreshold (c, j)) {\r
+if (annotation.annotations != null && j < annotation.annotations.length && annotation.annotations[j] != null && !jalview.util.Comparison.isGap (c)) {\r
+var aj = annotation.annotations[j];\r
+if (this.aboveAnnotationThreshold == -1 || (this.annotationThreshold != null && (this.aboveAnnotationThreshold == 1 ? aj.value >= this.annotationThreshold.value : aj.value <= this.annotationThreshold.value))) {\r
+if (this.predefinedColours && aj.colour != null && !aj.colour.equals (java.awt.Color.black)) {\r
+currentColour = aj.colour;\r
+} else if (annotation.hasIcons && annotation.graph == 0) {\r
+if (aj.secondaryStructure > ' ' && aj.secondaryStructure != '.' && aj.secondaryStructure != '-') {\r
+if (this.colourScheme != null) {\r
+currentColour = this.colourScheme.findColour (c, j, seq);\r
+} else {\r
+if (annotation.isRNA ()) {\r
+currentColour = jalview.schemes.ColourSchemeProperty.rnaHelices[Clazz.floatToInt (aj.value)];\r
+} else {\r
+currentColour = annotation.annotations[j].secondaryStructure == 'H' ? jalview.renderer.AnnotationRenderer.HELIX_COLOUR : annotation.annotations[j].secondaryStructure == 'E' ? jalview.renderer.AnnotationRenderer.SHEET_COLOUR : jalview.renderer.AnnotationRenderer.STEM_COLOUR;\r
+}}} else {\r
+return java.awt.Color.white;\r
+}} else if (this.noGradient) {\r
+if (this.colourScheme != null) {\r
+currentColour = this.colourScheme.findColour (c, j, seq);\r
+} else {\r
+if (aj.colour != null) {\r
+currentColour = aj.colour;\r
+}}} else {\r
+currentColour = this.shadeCalculation (annotation, j);\r
+}}if (this.conservationColouring) {\r
+currentColour = this.applyConservation (currentColour, j);\r
+}}}return currentColour;\r
+}, "~S,~N,jalview.datamodel.SequenceI");\r
+Clazz.defineMethod (c$, "shadeCalculation", \r
+($fz = function (annotation, j) {\r
+var range = 1;\r
+if (this.thresholdIsMinMax && annotation.threshold != null && this.aboveAnnotationThreshold == 1 && annotation.annotations[j].value >= annotation.threshold.value) {\r
+range = (annotation.annotations[j].value - annotation.threshold.value) / (annotation.graphMax - annotation.threshold.value);\r
+} else if (this.thresholdIsMinMax && annotation.threshold != null && this.aboveAnnotationThreshold == 0 && annotation.annotations[j].value >= annotation.graphMin) {\r
+range = (annotation.annotations[j].value - annotation.graphMin) / (annotation.threshold.value - annotation.graphMin);\r
+} else {\r
+if (annotation.graphMax != annotation.graphMin) {\r
+range = (annotation.annotations[j].value - annotation.graphMin) / (annotation.graphMax - annotation.graphMin);\r
+} else {\r
+range = 0;\r
+}}var dr = Clazz.floatToInt (this.rr * range + this.r1);\r
+var dg = Clazz.floatToInt (this.gg * range + this.g1);\r
+var db = Clazz.floatToInt (this.bb * range + this.b1);\r
+return  new java.awt.Color (dr, dg, db);\r
+}, $fz.isPrivate = true, $fz), "jalview.datamodel.AlignmentAnnotation,~N");\r
+Clazz.defineMethod (c$, "isPredefinedColours", \r
+function () {\r
+return this.predefinedColours;\r
+});\r
+Clazz.defineMethod (c$, "setPredefinedColours", \r
+function (predefinedColours) {\r
+this.predefinedColours = predefinedColours;\r
+}, "~B");\r
+Clazz.defineMethod (c$, "isSeqAssociated", \r
+function () {\r
+return this.seqAssociated;\r
+});\r
+Clazz.defineMethod (c$, "setSeqAssociated", \r
+function (sassoc) {\r
+this.seqAssociated = sassoc;\r
+}, "~B");\r
+Clazz.defineStatics (c$,\r
+"NO_THRESHOLD", -1,\r
+"BELOW_THRESHOLD", 0,\r
+"ABOVE_THRESHOLD", 1);\r
+});\r