1 Clazz.declarePackage ("jalview.schemes");
2 Clazz.load (["jalview.schemes.ResidueColourScheme", "java.util.Hashtable"], "jalview.schemes.RNAHelicesColour", ["jalview.schemes.ResidueProperties", "jalview.util.ColorUtils", "java.awt.Color"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.helixcolorhash = null;
5 this.positionsToHelix = null;
7 this.annotation = null;
9 Clazz.instantialize (this, arguments);
10 }, jalview.schemes, "RNAHelicesColour", jalview.schemes.ResidueColourScheme);
11 Clazz.prepareFields (c$, function () {
12 this.helixcolorhash = new java.util.Hashtable ();
13 this.positionsToHelix = new java.util.Hashtable ();
15 Clazz.makeConstructor (c$,
16 function (annotation) {
17 Clazz.superConstructor (this, jalview.schemes.RNAHelicesColour, [jalview.schemes.ResidueProperties.nucleotideIndex]);
18 this.annotation = annotation;
20 }, "jalview.datamodel.AlignmentAnnotation");
21 Clazz.makeConstructor (c$,
22 function (alignment) {
23 Clazz.superConstructor (this, jalview.schemes.RNAHelicesColour, [jalview.schemes.ResidueProperties.nucleotideIndex]);
24 this.alignmentChanged (alignment, null);
25 }, "jalview.datamodel.AnnotatedCollectionI");
26 Clazz.overrideMethod (c$, "alignmentChanged",
27 function (alignment, hiddenReps) {
28 var annotations = alignment.getAlignmentAnnotation ();
29 for (var i = 0; i < annotations.length; i++) {
30 if (annotations[i].getRNAStruc () != null) {
31 this.annotation = annotations[i];
35 }, "jalview.datamodel.AnnotatedCollectionI,java.util.Map");
36 Clazz.defineMethod (c$, "refresh",
38 if (this.annotation != null && ((this.annotation._rnasecstr == null || this.lastrefresh != this.annotation._rnasecstr.hashCode ()) && this.annotation.isValidStruc ())) {
39 this.annotation.getRNAStruc ();
40 this.lastrefresh = this.annotation._rnasecstr.hashCode ();
42 this.positionsToHelix = new java.util.Hashtable ();
43 for (var x = 0; x < this.annotation._rnasecstr.length; x++) {
44 this.positionsToHelix.put (new Integer (this.annotation._rnasecstr[x].getBegin ()), this.annotation._rnasecstr[x].getFeatureGroup ());
45 this.positionsToHelix.put (new Integer (this.annotation._rnasecstr[x].getEnd ()), this.annotation._rnasecstr[x].getFeatureGroup ());
46 if (Integer.parseInt (this.annotation._rnasecstr[x].getFeatureGroup ()) > this.numHelix) {
47 this.numHelix = Integer.parseInt (this.annotation._rnasecstr[x].getFeatureGroup ());
49 for (var j = 0; j <= this.numHelix; j++) {
50 if (!this.helixcolorhash.containsKey (Integer.toString (j))) {
51 this.helixcolorhash.put (Integer.toString (j), jalview.util.ColorUtils.generateRandomColor (java.awt.Color.white));
54 Clazz.defineMethod (c$, "findColour",
56 return jalview.schemes.ResidueProperties.purinepyrimidine[jalview.schemes.ResidueProperties.purinepyrimidineIndex[c.charCodeAt (0)]];
58 Clazz.defineMethod (c$, "findColour",
59 function (c, j, seq) {
61 var currentColour = java.awt.Color.white;
62 var currentHelix = null;
63 currentHelix = this.positionsToHelix.get (new Integer (j));
64 if (currentHelix != null) {
65 currentColour = this.helixcolorhash.get (currentHelix);
66 }return currentColour;
67 }, "~S,~N,jalview.datamodel.SequenceI");