JAL-1807 test
[jalviewjs.git] / bin / jalview / schemes / CovariationColourScheme.js
1 Clazz.declarePackage ("jalview.schemes");
2 Clazz.load (["jalview.schemes.ResidueColourScheme", "java.util.Hashtable"], "jalview.schemes.CovariationColourScheme", ["jalview.schemes.ResidueProperties", "jalview.util.ColorUtils", "java.awt.Color"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.helixcolorhash = null;
5 this.positionsToHelix = null;
6 this.numHelix = 0;
7 this.annotation = null;
8 Clazz.instantialize (this, arguments);
9 }, jalview.schemes, "CovariationColourScheme", jalview.schemes.ResidueColourScheme);
10 Clazz.prepareFields (c$, function () {
11 this.helixcolorhash =  new java.util.Hashtable ();
12 this.positionsToHelix =  new java.util.Hashtable ();
13 });
14 Clazz.makeConstructor (c$, 
15 function (annotation) {
16 Clazz.superConstructor (this, jalview.schemes.CovariationColourScheme, []);
17 this.annotation = annotation;
18 for (var x = 0; x < this.annotation._rnasecstr.length; x++) {
19 this.positionsToHelix.put (new Integer (this.annotation._rnasecstr[x].getBegin ()), this.annotation._rnasecstr[x].getFeatureGroup ());
20 this.positionsToHelix.put (new Integer (this.annotation._rnasecstr[x].getEnd ()), this.annotation._rnasecstr[x].getFeatureGroup ());
21 if (Integer.parseInt (this.annotation._rnasecstr[x].getFeatureGroup ()) > this.numHelix) {
22 this.numHelix = Integer.parseInt (this.annotation._rnasecstr[x].getFeatureGroup ());
23 }}
24 for (var j = 0; j <= this.numHelix; j++) {
25 this.helixcolorhash.put (Integer.toString (j), jalview.util.ColorUtils.generateRandomColor (java.awt.Color.white));
26 }
27 }, "jalview.datamodel.AlignmentAnnotation");
28 Clazz.defineMethod (c$, "findColour", 
29 function (c) {
30 return jalview.schemes.ResidueProperties.purinepyrimidine[jalview.schemes.ResidueProperties.purinepyrimidineIndex[c.charCodeAt (0)]];
31 }, "~S");
32 Clazz.defineMethod (c$, "findColour", 
33 function (c, j) {
34 var currentColour = java.awt.Color.white;
35 var currentHelix = null;
36 currentHelix = this.positionsToHelix.get (new Integer (j));
37 if (currentHelix != null) {
38 currentColour = this.helixcolorhash.get (currentHelix);
39 }return currentColour;
40 }, "~S,~N");
41 });