X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=bin%2Fjalview%2Fschemes%2FRNAHelicesColour.js;h=c7d3af2e5563b2b9cc1e79d25c60ef8bdb58e48e;hp=5023c9085c22cbcc7769f17d337d65b19c39ca12;hb=8ffd05b3abe52c0b6b79b011c0966361f82d5fe6;hpb=6154cb57a6eac3bb1344b8342495f5bb701ee921 diff --git a/bin/jalview/schemes/RNAHelicesColour.js b/bin/jalview/schemes/RNAHelicesColour.js index 5023c90..c7d3af2 100644 --- a/bin/jalview/schemes/RNAHelicesColour.js +++ b/bin/jalview/schemes/RNAHelicesColour.js @@ -1,68 +1,68 @@ -Clazz.declarePackage ("jalview.schemes"); -Clazz.load (["jalview.schemes.ResidueColourScheme", "java.util.Hashtable"], "jalview.schemes.RNAHelicesColour", ["jalview.schemes.ResidueProperties", "jalview.util.ColorUtils", "java.awt.Color"], function () { -c$ = Clazz.decorateAsClass (function () { -this.helixcolorhash = null; -this.positionsToHelix = null; -this.numHelix = 0; -this.annotation = null; -this.lastrefresh = -1; -Clazz.instantialize (this, arguments); -}, jalview.schemes, "RNAHelicesColour", jalview.schemes.ResidueColourScheme); -Clazz.prepareFields (c$, function () { -this.helixcolorhash = new java.util.Hashtable (); -this.positionsToHelix = new java.util.Hashtable (); -}); -Clazz.makeConstructor (c$, -function (annotation) { -Clazz.superConstructor (this, jalview.schemes.RNAHelicesColour, [jalview.schemes.ResidueProperties.nucleotideIndex]); -this.annotation = annotation; -this.refresh (); -}, "jalview.datamodel.AlignmentAnnotation"); -Clazz.makeConstructor (c$, -function (alignment) { -Clazz.superConstructor (this, jalview.schemes.RNAHelicesColour, [jalview.schemes.ResidueProperties.nucleotideIndex]); -this.alignmentChanged (alignment, null); -}, "jalview.datamodel.AnnotatedCollectionI"); -Clazz.overrideMethod (c$, "alignmentChanged", -function (alignment, hiddenReps) { -var annotations = alignment.getAlignmentAnnotation (); -for (var i = 0; i < annotations.length; i++) { -if (annotations[i].getRNAStruc () != null) { -this.annotation = annotations[i]; -break; -}} -this.refresh (); -}, "jalview.datamodel.AnnotatedCollectionI,java.util.Map"); -Clazz.defineMethod (c$, "refresh", -function () { -if (this.annotation != null && ((this.annotation._rnasecstr == null || this.lastrefresh != this.annotation._rnasecstr.hashCode ()) && this.annotation.isValidStruc ())) { -this.annotation.getRNAStruc (); -this.lastrefresh = this.annotation._rnasecstr.hashCode (); -this.numHelix = 0; -this.positionsToHelix = new java.util.Hashtable (); -for (var x = 0; x < this.annotation._rnasecstr.length; x++) { -this.positionsToHelix.put (new Integer (this.annotation._rnasecstr[x].getBegin ()), this.annotation._rnasecstr[x].getFeatureGroup ()); -this.positionsToHelix.put (new Integer (this.annotation._rnasecstr[x].getEnd ()), this.annotation._rnasecstr[x].getFeatureGroup ()); -if (Integer.parseInt (this.annotation._rnasecstr[x].getFeatureGroup ()) > this.numHelix) { -this.numHelix = Integer.parseInt (this.annotation._rnasecstr[x].getFeatureGroup ()); -}} -for (var j = 0; j <= this.numHelix; j++) { -if (!this.helixcolorhash.containsKey (Integer.toString (j))) { -this.helixcolorhash.put (Integer.toString (j), jalview.util.ColorUtils.generateRandomColor (java.awt.Color.white)); -}} -}}); -Clazz.defineMethod (c$, "findColour", -function (c) { -return jalview.schemes.ResidueProperties.purinepyrimidine[jalview.schemes.ResidueProperties.purinepyrimidineIndex[c.charCodeAt (0)]]; -}, "~S"); -Clazz.defineMethod (c$, "findColour", -function (c, j, seq) { -this.refresh (); -var currentColour = java.awt.Color.white; -var currentHelix = null; -currentHelix = this.positionsToHelix.get (new Integer (j)); -if (currentHelix != null) { -currentColour = this.helixcolorhash.get (currentHelix); -}return currentColour; -}, "~S,~N,jalview.datamodel.SequenceI"); -}); +Clazz.declarePackage ("jalview.schemes"); +Clazz.load (["jalview.schemes.ResidueColourScheme", "java.util.Hashtable"], "jalview.schemes.RNAHelicesColour", ["jalview.schemes.ResidueProperties", "jalview.util.ColorUtils", "java.awt.Color"], function () { +c$ = Clazz.decorateAsClass (function () { +this.helixcolorhash = null; +this.positionsToHelix = null; +this.numHelix = 0; +this.annotation = null; +this.lastrefresh = -1; +Clazz.instantialize (this, arguments); +}, jalview.schemes, "RNAHelicesColour", jalview.schemes.ResidueColourScheme); +Clazz.prepareFields (c$, function () { +this.helixcolorhash = new java.util.Hashtable (); +this.positionsToHelix = new java.util.Hashtable (); +}); +Clazz.makeConstructor (c$, +function (annotation) { +Clazz.superConstructor (this, jalview.schemes.RNAHelicesColour, [jalview.schemes.ResidueProperties.nucleotideIndex]); +this.annotation = annotation; +this.refresh (); +}, "jalview.datamodel.AlignmentAnnotation"); +Clazz.makeConstructor (c$, +function (alignment) { +Clazz.superConstructor (this, jalview.schemes.RNAHelicesColour, [jalview.schemes.ResidueProperties.nucleotideIndex]); +this.alignmentChanged (alignment, null); +}, "jalview.datamodel.AnnotatedCollectionI"); +Clazz.overrideMethod (c$, "alignmentChanged", +function (alignment, hiddenReps) { +var annotations = alignment.getAlignmentAnnotation (); +for (var i = 0; i < annotations.length; i++) { +if (annotations[i].getRNAStruc () != null) { +this.annotation = annotations[i]; +break; +}} +this.refresh (); +}, "jalview.datamodel.AnnotatedCollectionI,java.util.Map"); +Clazz.defineMethod (c$, "refresh", +function () { +if (this.annotation != null && ((this.annotation._rnasecstr == null || this.lastrefresh != this.annotation._rnasecstr.hashCode ()) && this.annotation.isValidStruc ())) { +this.annotation.getRNAStruc (); +this.lastrefresh = this.annotation._rnasecstr.hashCode (); +this.numHelix = 0; +this.positionsToHelix = new java.util.Hashtable (); +for (var x = 0; x < this.annotation._rnasecstr.length; x++) { +this.positionsToHelix.put (new Integer (this.annotation._rnasecstr[x].getBegin ()), this.annotation._rnasecstr[x].getFeatureGroup ()); +this.positionsToHelix.put (new Integer (this.annotation._rnasecstr[x].getEnd ()), this.annotation._rnasecstr[x].getFeatureGroup ()); +if (Integer.parseInt (this.annotation._rnasecstr[x].getFeatureGroup ()) > this.numHelix) { +this.numHelix = Integer.parseInt (this.annotation._rnasecstr[x].getFeatureGroup ()); +}} +for (var j = 0; j <= this.numHelix; j++) { +if (!this.helixcolorhash.containsKey (Integer.toString (j))) { +this.helixcolorhash.put (Integer.toString (j), jalview.util.ColorUtils.generateRandomColor (java.awt.Color.white)); +}} +}}); +Clazz.defineMethod (c$, "findColour", +function (c) { +return jalview.schemes.ResidueProperties.purinepyrimidine[jalview.schemes.ResidueProperties.purinepyrimidineIndex[c.charCodeAt (0)]]; +}, "~S"); +Clazz.defineMethod (c$, "findColour", +function (c, j, seq) { +this.refresh (); +var currentColour = java.awt.Color.white; +var currentHelix = null; +currentHelix = this.positionsToHelix.get (new Integer (j)); +if (currentHelix != null) { +currentColour = this.helixcolorhash.get (currentHelix); +}return currentColour; +}, "~S,~N,jalview.datamodel.SequenceI"); +});