JAL-1807 still testing
[jalviewjs.git] / bin / jalview / datamodel / AlignmentAnnotation.js
index e321a8d..0be7f1c 100644 (file)
-Clazz.declarePackage ("jalview.datamodel");
-Clazz.load (["java.util.HashMap"], "jalview.datamodel.AlignmentAnnotation", ["jalview.analysis.Rna", "jalview.datamodel.Annotation", "$.GraphLine", "jalview.schemes.ResidueProperties", "java.lang.Double", "$.Error", "$.Long", "$.StringBuffer", "$.StringBuilder", "java.util.Collections"], function () {
-c$ = Clazz.decorateAsClass (function () {
-this.autoCalculated = false;
-this.annotationId = null;
-this.sequenceRef = null;
-this.label = null;
-this.description = null;
-this.annotations = null;
-this.bps = null;
-this._rnasecstr = null;
-this.invalidrnastruc = -2;
-this.sequenceMapping = null;
-this.graphMin = 0;
-this.graphMax = 0;
-this.score = NaN;
-this.$hasScore = false;
-this.threshold = null;
-this.editable = false;
-this.hasIcons = false;
-this.hasText = false;
-this.visible = true;
-this.graphGroup = -1;
-this.height = 0;
-this.graph = 0;
-this.graphHeight = 40;
-this.padGaps = false;
-this.belowAlignment = true;
-this.groupRef = null;
-this.showAllColLabels = false;
-this.scaleColLabel = false;
-this.centreColLabels = false;
-this.isrna = false;
-if (!Clazz.isClassDefined ("jalview.datamodel.AlignmentAnnotation.AnnotCharSequence")) {
-jalview.datamodel.AlignmentAnnotation.$AlignmentAnnotation$AnnotCharSequence$ ();
-}
-this._lastrnaannot = -1;
-this.calcId = "";
-this.properties = null;
-this._linecolour = null;
-Clazz.instantialize (this, arguments);
-}, jalview.datamodel, "AlignmentAnnotation");
-Clazz.prepareFields (c$, function () {
-this.properties =  new java.util.HashMap ();
-});
-Clazz.defineMethod (c$, "_updateRnaSecStr", 
-($fz = function (RNAannot) {
-try {
-this._rnasecstr = jalview.analysis.Rna.GetBasePairs (RNAannot);
-this.bps = jalview.analysis.Rna.GetModeleBP (RNAannot);
-this.invalidrnastruc = -1;
-} catch (px) {
-if (Clazz.exceptionOf (px, jalview.analysis.WUSSParseException)) {
-this.invalidrnastruc = px.getProblemPos ();
-} else {
-throw px;
-}
-}
-if (this.invalidrnastruc > -1) {
-return;
-}jalview.analysis.Rna.HelixMap (this._rnasecstr);
-if (this._rnasecstr != null && this._rnasecstr.length > 0) {
-this.isrna = true;
-this.showAllColLabels = true;
-this.scaleColLabel = true;
-this._markRnaHelices ();
-}}, $fz.isPrivate = true, $fz), "CharSequence");
-Clazz.defineMethod (c$, "_markRnaHelices", 
-($fz = function () {
-var mxval = 0;
-for (var x = 0; x < this._rnasecstr.length; x++) {
-var val = 0;
-try {
-val = (Integer.$valueOf (this._rnasecstr[x].getFeatureGroup ())).intValue ();
-if (mxval < val) {
-mxval = val;
-}} catch (q) {
-if (Clazz.exceptionOf (q, NumberFormatException)) {
-} else {
-throw q;
-}
-}
-;this.annotations[this._rnasecstr[x].getBegin ()].value = val;
-this.annotations[this._rnasecstr[x].getEnd ()].value = val;
-}
-this.setScore (mxval);
-}, $fz.isPrivate = true, $fz));
-Clazz.defineMethod (c$, "finalize", 
-function () {
-this.sequenceRef = null;
-this.groupRef = null;
-Clazz.superCall (this, jalview.datamodel.AlignmentAnnotation, "finalize", []);
-});
-c$.getGraphValueFromString = Clazz.defineMethod (c$, "getGraphValueFromString", 
-function (string) {
-if (string.equalsIgnoreCase ("BAR_GRAPH")) {
-return 1;
-} else if (string.equalsIgnoreCase ("LINE_GRAPH")) {
-return 2;
-} else {
-return 0;
-}}, "~S");
-Clazz.defineMethod (c$, "ConcenStru", 
-function (RNAannot) {
-this.bps = jalview.analysis.Rna.GetModeleBP (RNAannot);
-}, "CharSequence");
-Clazz.makeConstructor (c$, 
-function (label, description, annotations) {
-this.setAnnotationId ();
-this.editable = true;
-this.label = label;
-this.description = description;
-this.annotations = annotations;
-this.validateRangeAndDisplay ();
-}, "~S,~S,~A");
-Clazz.defineMethod (c$, "areLabelsSecondaryStructure", 
-function () {
-var nonSSLabel = false;
-this.isrna = false;
-var rnastring =  new StringBuffer ();
-var firstChar = String.fromCharCode (0);
-for (var i = 0; i < this.annotations.length; i++) {
-if (this.annotations[i] == null) {
-continue;
-}if (this.annotations[i].secondaryStructure == 'H' || this.annotations[i].secondaryStructure == 'E') {
-this.hasIcons = new Boolean (this.hasIcons | true).valueOf ();
-} else {
-if (this.annotations[i].secondaryStructure == '(' || this.annotations[i].secondaryStructure == '[' || this.annotations[i].secondaryStructure == '<' || this.annotations[i].secondaryStructure == '{' || this.annotations[i].secondaryStructure == 'A' || this.annotations[i].secondaryStructure == 'B' || this.annotations[i].secondaryStructure == 'C' || this.annotations[i].secondaryStructure == 'D' || this.annotations[i].secondaryStructure == 'E' || this.annotations[i].secondaryStructure == 'F' || this.annotations[i].secondaryStructure == 'G' || this.annotations[i].secondaryStructure == 'H' || this.annotations[i].secondaryStructure == 'I' || this.annotations[i].secondaryStructure == 'J' || this.annotations[i].secondaryStructure == 'K' || this.annotations[i].secondaryStructure == 'L' || this.annotations[i].secondaryStructure == 'M' || this.annotations[i].secondaryStructure == 'N' || this.annotations[i].secondaryStructure == 'O' || this.annotations[i].secondaryStructure == 'P' || this.annotations[i].secondaryStructure == 'Q' || this.annotations[i].secondaryStructure == 'R' || this.annotations[i].secondaryStructure == 'S' || this.annotations[i].secondaryStructure == 'T' || this.annotations[i].secondaryStructure == 'U' || this.annotations[i].secondaryStructure == 'V' || this.annotations[i].secondaryStructure == 'W' || this.annotations[i].secondaryStructure == 'X' || this.annotations[i].secondaryStructure == 'Y' || this.annotations[i].secondaryStructure == 'Z') {
-this.hasIcons = new Boolean (this.hasIcons | true).valueOf ();
-this.isrna = new Boolean (this.isrna | true).valueOf ();
-}}if (this.annotations[i].displayCharacter == null || this.annotations[i].displayCharacter.length == 0) {
-rnastring.append ('.');
-continue;
-}if (this.annotations[i].displayCharacter.length == 1) {
-firstChar = this.annotations[i].displayCharacter.charAt (0);
-if (this.annotations[i].secondaryStructure != ' ' && !this.hasIcons && firstChar != ' ' && firstChar != '$' && firstChar.charCodeAt (0) != 0xCE && firstChar != '(' && firstChar != '[' && firstChar != '>' && firstChar != '{' && firstChar != 'A' && firstChar != 'B' && firstChar != 'C' && firstChar != 'D' && firstChar != 'E' && firstChar != 'F' && firstChar != 'G' && firstChar != 'H' && firstChar != 'I' && firstChar != 'J' && firstChar != 'K' && firstChar != 'L' && firstChar != 'M' && firstChar != 'N' && firstChar != 'O' && firstChar != 'P' && firstChar != 'Q' && firstChar != 'R' && firstChar != 'S' && firstChar != 'T' && firstChar != 'U' && firstChar != 'V' && firstChar != 'W' && firstChar != 'X' && firstChar != 'Y' && firstChar != 'Z' && firstChar != '-' && firstChar.charCodeAt (0) < jalview.schemes.ResidueProperties.aaIndex.length) {
-if (jalview.schemes.ResidueProperties.aaIndex[firstChar.charCodeAt (0)] < 23) {
-nonSSLabel = true;
-}}} else {
-rnastring.append (this.annotations[i].displayCharacter.charAt (1));
-}if (this.annotations[i].displayCharacter.length > 0) {
-this.hasText = true;
-}}
-if (nonSSLabel) {
-this.hasIcons = false;
-for (var j = 0; j < this.annotations.length; j++) {
-if (this.annotations[j] != null && this.annotations[j].secondaryStructure != ' ') {
-this.annotations[j].displayCharacter = String.valueOf (this.annotations[j].secondaryStructure);
-this.annotations[j].secondaryStructure = ' ';
-}}
-} else {
-if (this.isrna) {
-this._updateRnaSecStr (Clazz.innerTypeInstance (jalview.datamodel.AlignmentAnnotation.AnnotCharSequence, this, null));
-}}});
-Clazz.defineMethod (c$, "getRNAStruc", 
-function () {
-if (this.isrna) {
-var rnastruc = Clazz.innerTypeInstance (jalview.datamodel.AlignmentAnnotation.AnnotCharSequence, this, null).toString ();
-if (this._lastrnaannot != rnastruc.hashCode ()) {
-this._lastrnaannot = rnastruc.hashCode ();
-this._updateRnaSecStr (rnastruc);
-}return rnastruc;
-}return null;
-});
-Clazz.makeConstructor (c$, 
-function (label, description, annotations, min, max, graphType) {
-this.setAnnotationId ();
-this.editable = graphType == 0;
-this.label = label;
-this.description = description;
-this.annotations = annotations;
-this.graph = graphType;
-this.graphMin = min;
-this.graphMax = max;
-this.validateRangeAndDisplay ();
-}, "~S,~S,~A,~N,~N,~N");
-Clazz.defineMethod (c$, "validateRangeAndDisplay", 
-function () {
-if (this.annotations == null) {
-this.visible = false;
-return;
-}var graphType = this.graph;
-var min = this.graphMin;
-var max = this.graphMax;
-var drawValues = true;
-this._linecolour = null;
-if (min == max) {
-min = 999999999;
-for (var i = 0; i < this.annotations.length; i++) {
-if (this.annotations[i] == null) {
-continue;
-}if (drawValues && this.annotations[i].displayCharacter != null && this.annotations[i].displayCharacter.length > 1) {
-drawValues = false;
-}if (this.annotations[i].value > max) {
-max = this.annotations[i].value;
-}if (this.annotations[i].value < min) {
-min = this.annotations[i].value;
-}if (this._linecolour == null && this.annotations[i].colour != null) {
-this._linecolour = this.annotations[i].colour;
-}}
-if (min > 0) {
-min = 0;
-} else {
-if (max < 0) {
-max = 0;
-}}}this.graphMin = min;
-this.graphMax = max;
-this.areLabelsSecondaryStructure ();
-if (!drawValues && graphType != 0) {
-for (var i = 0; i < this.annotations.length; i++) {
-if (this.annotations[i] != null) {
-this.annotations[i].displayCharacter = "";
-}}
-}});
-Clazz.makeConstructor (c$, 
-function (annotation) {
-this.setAnnotationId ();
-this.label =  String.instantialize (annotation.label);
-if (annotation.description != null) {
-this.description =  String.instantialize (annotation.description);
-}this.graphMin = annotation.graphMin;
-this.graphMax = annotation.graphMax;
-this.graph = annotation.graph;
-this.graphHeight = annotation.graphHeight;
-this.graphGroup = annotation.graphGroup;
-this.groupRef = annotation.groupRef;
-this.editable = annotation.editable;
-this.autoCalculated = annotation.autoCalculated;
-this.hasIcons = annotation.hasIcons;
-this.hasText = annotation.hasText;
-this.height = annotation.height;
-this.label = annotation.label;
-this.padGaps = annotation.padGaps;
-this.visible = annotation.visible;
-this.centreColLabels = annotation.centreColLabels;
-this.scaleColLabel = annotation.scaleColLabel;
-this.showAllColLabels = annotation.showAllColLabels;
-this.calcId = annotation.calcId;
-if (annotation.properties != null) {
-this.properties =  new java.util.HashMap ();
-for (var val, $val = annotation.properties.entrySet ().iterator (); $val.hasNext () && ((val = $val.next ()) || true);) {
-this.properties.put (val.getKey (), val.getValue ());
-}
-}if (this.$hasScore = annotation.$hasScore) {
-this.score = annotation.score;
-}if (annotation.threshold != null) {
-this.threshold =  new jalview.datamodel.GraphLine (annotation.threshold);
-}var ann = annotation.annotations;
-if (annotation.annotations != null) {
-this.annotations =  new Array (ann.length);
-for (var i = 0; i < ann.length; i++) {
-if (ann[i] != null) {
-this.annotations[i] =  new jalview.datamodel.Annotation (ann[i]);
-if (this._linecolour != null) {
-this._linecolour = this.annotations[i].colour;
-}}}
-}if (annotation.sequenceRef != null) {
-this.sequenceRef = annotation.sequenceRef;
-if (annotation.sequenceMapping != null) {
-var p = null;
-this.sequenceMapping =  new java.util.HashMap ();
-var pos = annotation.sequenceMapping.keySet ().iterator ();
-while (pos.hasNext ()) {
-p = pos.next ();
-var a = annotation.sequenceMapping.get (p);
-if (a == null) {
-continue;
-}if (ann != null) {
-for (var i = 0; i < ann.length; i++) {
-if (ann[i] === a) {
-this.sequenceMapping.put (p, this.annotations[i]);
-}}
-}}
-} else {
-this.sequenceMapping = null;
-}}{
-}this.validateRangeAndDisplay ();
-}, "jalview.datamodel.AlignmentAnnotation");
-Clazz.defineMethod (c$, "restrict", 
-function (startRes, endRes) {
-if (this.annotations == null) {
-return;
-}if (startRes < 0) {
-startRes = 0;
-}if (startRes >= this.annotations.length) {
-startRes = this.annotations.length - 1;
-}if (endRes >= this.annotations.length) {
-endRes = this.annotations.length - 1;
-}if (this.annotations == null) {
-return;
-}var temp =  new Array (endRes - startRes + 1);
-if (startRes < this.annotations.length) {
-System.arraycopy (this.annotations, startRes, temp, 0, endRes - startRes + 1);
-}if (this.sequenceRef != null) {
-var spos = this.sequenceRef.findPosition (startRes);
-var epos = this.sequenceRef.findPosition (endRes);
-if (this.sequenceMapping != null) {
-var newmapping =  new java.util.HashMap ();
-var e = this.sequenceMapping.keySet ().iterator ();
-while (e.hasNext ()) {
-var pos = e.next ();
-if (pos.intValue () >= spos && pos.intValue () <= epos) {
-newmapping.put (pos, this.sequenceMapping.get (pos));
-}}
-this.sequenceMapping.clear ();
-this.sequenceMapping = newmapping;
-}}this.annotations = temp;
-}, "~N,~N");
-Clazz.defineMethod (c$, "padAnnotation", 
-function (length) {
-if (this.annotations == null) {
-return true;
-}if (this.annotations.length < length) {
-var na =  new Array (length);
-System.arraycopy (this.annotations, 0, na, 0, this.annotations.length);
-this.annotations = na;
-return true;
-}return this.annotations.length > length;
-}, "~N");
-Clazz.overrideMethod (c$, "toString", 
-function () {
-var buffer =  new StringBuilder (256);
-for (var i = 0; i < this.annotations.length; i++) {
-if (this.annotations[i] != null) {
-if (this.graph != 0) {
-buffer.append (this.annotations[i].value);
-} else if (this.hasIcons) {
-buffer.append (this.annotations[i].secondaryStructure);
-} else {
-buffer.append (this.annotations[i].displayCharacter);
-}}buffer.append (", ");
-}
-if (this.label.indexOf ("Consensus") == 0) {
-buffer.append ("\n");
-for (var i = 0; i < this.annotations.length; i++) {
-if (this.annotations[i] != null) {
-buffer.append (this.annotations[i].description);
-}buffer.append (", ");
-}
-}return buffer.toString ();
-});
-Clazz.defineMethod (c$, "setThreshold", 
-function (line) {
-this.threshold = line;
-}, "jalview.datamodel.GraphLine");
-Clazz.defineMethod (c$, "getThreshold", 
-function () {
-return this.threshold;
-});
-Clazz.defineMethod (c$, "createSequenceMapping", 
-function (seqRef, startRes, alreadyMapped) {
-if (seqRef == null) {
-return;
-}this.sequenceRef = seqRef;
-if (this.annotations == null) {
-return;
-}this.sequenceMapping =  new java.util.HashMap ();
-var seqPos;
-for (var i = 0; i < this.annotations.length; i++) {
-if (this.annotations[i] != null) {
-if (alreadyMapped) {
-seqPos = seqRef.findPosition (i);
-} else {
-seqPos = i + startRes;
-}this.sequenceMapping.put ( new Integer (seqPos), this.annotations[i]);
-}}
-}, "jalview.datamodel.SequenceI,~N,~B");
-Clazz.defineMethod (c$, "adjustForAlignment", 
-function () {
-if (this.sequenceRef == null) {
-return;
-}if (this.annotations == null) {
-return;
-}var a = 0;
-var aSize = this.sequenceRef.getLength ();
-if (aSize == 0) {
-return;
-}var position;
-var temp =  new Array (aSize);
-var index;
-for (a = this.sequenceRef.getStart (); a <= this.sequenceRef.getEnd (); a++) {
-index =  new Integer (a);
-if (this.sequenceMapping.containsKey (index)) {
-position = this.sequenceRef.findIndex (a) - 1;
-temp[position] = this.sequenceMapping.get (index);
-}}
-this.annotations = temp;
-});
-Clazz.defineMethod (c$, "compactAnnotationArray", 
-function () {
-var i = 0;
-var iSize = this.annotations.length;
-while (i < iSize) {
-if (this.annotations[i] == null) {
-if (i + 1 < iSize) {
-System.arraycopy (this.annotations, i + 1, this.annotations, i, iSize - i - 1);
-}iSize--;
-} else {
-i++;
-}}
-var ann = this.annotations;
-this.annotations =  new Array (i);
-System.arraycopy (ann, 0, this.annotations, 0, i);
-ann = null;
-return iSize;
-});
-Clazz.defineMethod (c$, "setSequenceRef", 
-function (sequenceI) {
-if (sequenceI != null) {
-if (this.sequenceRef != null) {
-var rIsDs = this.sequenceRef.getDatasetSequence () == null;
-var tIsDs = sequenceI.getDatasetSequence () == null;
-if (this.sequenceRef !== sequenceI && (rIsDs && !tIsDs && this.sequenceRef !== sequenceI.getDatasetSequence ()) && (!rIsDs && tIsDs && this.sequenceRef.getDatasetSequence () !== sequenceI) && (!rIsDs && !tIsDs && this.sequenceRef.getDatasetSequence () !== sequenceI.getDatasetSequence ()) && !this.sequenceRef.equals (sequenceI)) {
-this.sequenceRef = null;
-if (this.sequenceMapping != null) {
-this.sequenceMapping = null;
-}this.createSequenceMapping (sequenceI, 1, true);
-this.adjustForAlignment ();
-} else {
-this.sequenceRef = sequenceI;
-}} else {
-this.createSequenceMapping (sequenceI, 1, true);
-this.adjustForAlignment ();
-}} else {
-this.sequenceMapping = null;
-this.sequenceRef = null;
-}}, "jalview.datamodel.SequenceI");
-Clazz.defineMethod (c$, "getScore", 
-function () {
-return this.score;
-});
-Clazz.defineMethod (c$, "setScore", 
-function (score) {
-this.$hasScore = true;
-this.score = score;
-}, "~N");
-Clazz.defineMethod (c$, "hasScore", 
-function () {
-return this.$hasScore || !Double.isNaN (this.score);
-});
-Clazz.makeConstructor (c$, 
-function (label, description, score) {
-this.construct (label, description, null);
-this.setScore (score);
-}, "~S,~S,~N");
-Clazz.makeConstructor (c$, 
-function (alignmentAnnotation, colSel) {
-this.construct (alignmentAnnotation);
-if (this.annotations == null) {
-return;
-}colSel.makeVisibleAnnotation (this);
-}, "jalview.datamodel.AlignmentAnnotation,jalview.datamodel.ColumnSelection");
-Clazz.defineMethod (c$, "setPadGaps", 
-function (padgaps, gapchar) {
-this.padGaps = padgaps;
-if (padgaps) {
-this.hasText = true;
-for (var i = 0; i < this.annotations.length; i++) {
-if (this.annotations[i] == null) {
-this.annotations[i] =  new jalview.datamodel.Annotation (String.valueOf (gapchar), null, ' ', 0, null);
-} else if (this.annotations[i].displayCharacter == null || this.annotations[i].displayCharacter.equals (" ")) {
-this.annotations[i].displayCharacter = String.valueOf (gapchar);
-}}
-}}, "~B,~S");
-Clazz.defineMethod (c$, "getDescription", 
-function (seqname) {
-if (seqname && this.sequenceRef != null) {
-var i = this.description.toLowerCase ().indexOf ("<html>");
-if (i > -1) {
-return "<html>" + this.sequenceRef.getName () + " : " + this.description.substring (i + 6);
-}return this.sequenceRef.getName () + " : " + this.description;
-}return this.description;
-}, "~B");
-Clazz.defineMethod (c$, "isValidStruc", 
-function () {
-return this.invalidrnastruc == -1;
-});
-Clazz.defineMethod (c$, "getInvalidStrucPos", 
-function () {
-return this.invalidrnastruc;
-});
-Clazz.defineMethod (c$, "getCalcId", 
-function () {
-return this.calcId;
-});
-Clazz.defineMethod (c$, "setCalcId", 
-function (calcId) {
-this.calcId = calcId;
-}, "~S");
-Clazz.defineMethod (c$, "isRNA", 
-function () {
-return this.isrna;
-});
-Clazz.defineMethod (c$, "liftOver", 
-function (sq, sp2sq) {
-if (sp2sq.getMappedWidth () != sp2sq.getWidth ()) {
-throw  new Error ("liftOver currently not implemented for transfer of annotation between different types of seqeunce");
-}var mapIsTo = (sp2sq != null) ? (sp2sq.getTo () === sq || sp2sq.getTo () === sq.getDatasetSequence ()) : false;
-var mapForsq =  new java.util.HashMap ();
-if (this.sequenceMapping != null) {
-if (sp2sq != null) {
-for (var ie, $ie = this.sequenceMapping.entrySet ().iterator (); $ie.hasNext () && ((ie = $ie.next ()) || true);) {
-var mpos = Integer.$valueOf (mapIsTo ? sp2sq.getMappedPosition ((ie.getKey ()).intValue ()) : sp2sq.getPosition ((ie.getKey ()).intValue ()));
-if ((mpos).intValue () >= sq.getStart () && (mpos).intValue () <= sq.getEnd ()) {
-mapForsq.put (mpos, ie.getValue ());
-}}
-this.sequenceMapping = mapForsq;
-this.sequenceRef = sq;
-this.adjustForAlignment ();
-} else {
-}}}, "jalview.datamodel.SequenceI,jalview.datamodel.Mapping");
-Clazz.defineMethod (c$, "remap", 
-function (newref, mapping, from, to, idxoffset) {
-if (mapping != null) {
-var old = this.sequenceMapping;
-var remap =  new java.util.HashMap ();
-var index = -1;
-for (var mp, $mp = 0, $$mp = mapping; $mp < $$mp.length && ((mp = $$mp[$mp]) || true); $mp++) {
-if (index++ < 0) {
-continue;
-}var ann = null;
-if (from == -1) {
-ann = this.sequenceMapping.get (Integer.$valueOf (idxoffset + index));
-} else {
-if (mp != null && mp.length > from) {
-ann = this.sequenceMapping.get (Integer.$valueOf (mp[from]));
-}}if (ann != null) {
-if (to == -1) {
-remap.put (Integer.$valueOf (idxoffset + index), ann);
-} else {
-if (to > -1 && to < mp.length) {
-remap.put (Integer.$valueOf (mp[to]), ann);
-}}}}
-this.sequenceMapping = remap;
-old.clear ();
-if (newref != null) {
-this.sequenceRef = newref;
-}this.adjustForAlignment ();
-}}, "jalview.datamodel.SequenceI,~A,~N,~N,~N");
-Clazz.defineMethod (c$, "getProperty", 
-function (property) {
-if (this.properties == null) {
-return null;
-}return this.properties.get (property);
-}, "~S");
-Clazz.defineMethod (c$, "setProperty", 
-function (property, value) {
-if (this.properties == null) {
-this.properties =  new java.util.HashMap ();
-}this.properties.put (property, value);
-}, "~S,~S");
-Clazz.defineMethod (c$, "hasProperties", 
-function () {
-return this.properties != null && this.properties.size () > 0;
-});
-Clazz.defineMethod (c$, "getProperties", 
-function () {
-if (this.properties == null) {
-return java.util.Collections.emptyList ();
-}return this.properties.keySet ();
-});
-Clazz.defineMethod (c$, "getAnnotationForPosition", 
-function (position) {
-return this.sequenceMapping == null ? null : this.sequenceMapping.get (new Integer (position));
-}, "~N");
-Clazz.defineMethod (c$, "setAnnotationId", 
-function () {
-this.annotationId = "ann" + Long.toString (jalview.datamodel.AlignmentAnnotation.nextId ());
-});
-c$.nextId = Clazz.defineMethod (c$, "nextId", 
-function () {
-return jalview.datamodel.AlignmentAnnotation.counter++;
-});
-c$.$AlignmentAnnotation$AnnotCharSequence$ = function () {
-Clazz.pu$h ();
-c$ = Clazz.decorateAsClass (function () {
-Clazz.prepareCallback (this, arguments);
-this.offset = 0;
-this.max = 0;
-Clazz.instantialize (this, arguments);
-}, jalview.datamodel.AlignmentAnnotation, "AnnotCharSequence", null, CharSequence);
-Clazz.makeConstructor (c$, 
-function () {
-this.construct (0, this.b$["jalview.datamodel.AlignmentAnnotation"].annotations.length);
-});
-Clazz.makeConstructor (c$, 
-function (a, b) {
-this.offset = a;
-this.max = b;
-}, "~N,~N");
-Clazz.overrideMethod (c$, "subSequence", 
-function (a, b) {
-return Clazz.innerTypeInstance (jalview.datamodel.AlignmentAnnotation.AnnotCharSequence, this, null, this.offset + a, this.offset + b);
-}, "~N,~N");
-Clazz.overrideMethod (c$, "length", 
-function () {
-return this.max - this.offset;
-});
-Clazz.overrideMethod (c$, "charAt", 
-function (a) {
-return ((a + this.offset < 0) || (a + this.offset) >= this.max || this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[a + this.offset] == null || (this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[a + this.offset].secondaryStructure <= ' ') ? ' ' : this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[a + this.offset].displayCharacter == null || this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[a + this.offset].displayCharacter.length == 0 ? this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[a + this.offset].secondaryStructure : this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[a + this.offset].displayCharacter.charAt (0));
-}, "~N");
-Clazz.overrideMethod (c$, "toString", 
-function () {
-var a =  Clazz.newCharArray (this.max - this.offset, '\0');
-var b = this.b$["jalview.datamodel.AlignmentAnnotation"].annotations.length;
-for (var c = this.offset; c < b; c++) {
-a[c] = (this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[c] == null || ((this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[c].secondaryStructure).charCodeAt (0) <= 32)) ? ' ' : (this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[c].displayCharacter == null || this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[c].displayCharacter.length == 0 ? this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[c].secondaryStructure : this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[c].displayCharacter.charAt (0));
-}
-return  String.instantialize (a);
-});
-c$ = Clazz.p0p ();
-};
-Clazz.defineStatics (c$,
-"ANNOTATION_ID_PREFIX", "ann",
-"SEQUENCE_PROFILE", 0,
-"STRUCTURE_PROFILE", 1,
-"CDNA_PROFILE", 2,
-"counter", 0,
-"NO_GRAPH", 0,
-"BAR_GRAPH", 1,
-"LINE_GRAPH", 2);
-});
+Clazz.declarePackage ("jalview.datamodel");\r
+Clazz.load (["java.util.HashMap"], "jalview.datamodel.AlignmentAnnotation", ["jalview.analysis.Rna", "jalview.datamodel.Annotation", "$.GraphLine", "jalview.schemes.ResidueProperties", "java.lang.Double", "$.Error", "$.Long", "$.StringBuffer", "$.StringBuilder", "java.util.Collections"], function () {\r
+c$ = Clazz.decorateAsClass (function () {\r
+this.autoCalculated = false;\r
+this.annotationId = null;\r
+this.sequenceRef = null;\r
+this.label = null;\r
+this.description = null;\r
+this.annotations = null;\r
+this.bps = null;\r
+this._rnasecstr = null;\r
+this.invalidrnastruc = -2;\r
+this.sequenceMapping = null;\r
+this.graphMin = 0;\r
+this.graphMax = 0;\r
+this.score = NaN;\r
+this.$hasScore = false;\r
+this.threshold = null;\r
+this.editable = false;\r
+this.hasIcons = false;\r
+this.hasText = false;\r
+this.visible = true;\r
+this.graphGroup = -1;\r
+this.height = 0;\r
+this.graph = 0;\r
+this.graphHeight = 40;\r
+this.padGaps = false;\r
+this.belowAlignment = true;\r
+this.groupRef = null;\r
+this.showAllColLabels = false;\r
+this.scaleColLabel = false;\r
+this.centreColLabels = false;\r
+this.isrna = false;\r
+if (!Clazz.isClassDefined ("jalview.datamodel.AlignmentAnnotation.AnnotCharSequence")) {\r
+jalview.datamodel.AlignmentAnnotation.$AlignmentAnnotation$AnnotCharSequence$ ();\r
+}\r
+this._lastrnaannot = -1;\r
+this.calcId = "";\r
+this.properties = null;\r
+this._linecolour = null;\r
+Clazz.instantialize (this, arguments);\r
+}, jalview.datamodel, "AlignmentAnnotation");\r
+Clazz.prepareFields (c$, function () {\r
+this.properties =  new java.util.HashMap ();\r
+});\r
+Clazz.defineMethod (c$, "_updateRnaSecStr", \r
+($fz = function (RNAannot) {\r
+try {\r
+this._rnasecstr = jalview.analysis.Rna.GetBasePairs (RNAannot);\r
+this.bps = jalview.analysis.Rna.GetModeleBP (RNAannot);\r
+this.invalidrnastruc = -1;\r
+} catch (px) {\r
+if (Clazz.exceptionOf (px, jalview.analysis.WUSSParseException)) {\r
+this.invalidrnastruc = px.getProblemPos ();\r
+} else {\r
+throw px;\r
+}\r
+}\r
+if (this.invalidrnastruc > -1) {\r
+return;\r
+}jalview.analysis.Rna.HelixMap (this._rnasecstr);\r
+if (this._rnasecstr != null && this._rnasecstr.length > 0) {\r
+this.isrna = true;\r
+this.showAllColLabels = true;\r
+this.scaleColLabel = true;\r
+this._markRnaHelices ();\r
+}}, $fz.isPrivate = true, $fz), "CharSequence");\r
+Clazz.defineMethod (c$, "_markRnaHelices", \r
+($fz = function () {\r
+var mxval = 0;\r
+for (var x = 0; x < this._rnasecstr.length; x++) {\r
+var val = 0;\r
+try {\r
+val = (Integer.$valueOf (this._rnasecstr[x].getFeatureGroup ())).intValue ();\r
+if (mxval < val) {\r
+mxval = val;\r
+}} catch (q) {\r
+if (Clazz.exceptionOf (q, NumberFormatException)) {\r
+} else {\r
+throw q;\r
+}\r
+}\r
+;this.annotations[this._rnasecstr[x].getBegin ()].value = val;\r
+this.annotations[this._rnasecstr[x].getEnd ()].value = val;\r
+}\r
+this.setScore (mxval);\r
+}, $fz.isPrivate = true, $fz));\r
+Clazz.defineMethod (c$, "finalize", \r
+function () {\r
+this.sequenceRef = null;\r
+this.groupRef = null;\r
+Clazz.superCall (this, jalview.datamodel.AlignmentAnnotation, "finalize", []);\r
+});\r
+c$.getGraphValueFromString = Clazz.defineMethod (c$, "getGraphValueFromString", \r
+function (string) {\r
+if (string.equalsIgnoreCase ("BAR_GRAPH")) {\r
+return 1;\r
+} else if (string.equalsIgnoreCase ("LINE_GRAPH")) {\r
+return 2;\r
+} else {\r
+return 0;\r
+}}, "~S");\r
+Clazz.defineMethod (c$, "ConcenStru", \r
+function (RNAannot) {\r
+this.bps = jalview.analysis.Rna.GetModeleBP (RNAannot);\r
+}, "CharSequence");\r
+Clazz.makeConstructor (c$, \r
+function (label, description, annotations) {\r
+this.setAnnotationId ();\r
+this.editable = true;\r
+this.label = label;\r
+this.description = description;\r
+this.annotations = annotations;\r
+this.validateRangeAndDisplay ();\r
+}, "~S,~S,~A");\r
+Clazz.defineMethod (c$, "areLabelsSecondaryStructure", \r
+function () {\r
+var nonSSLabel = false;\r
+this.isrna = false;\r
+var rnastring =  new StringBuffer ();\r
+var firstChar = String.fromCharCode (0);\r
+for (var i = 0; i < this.annotations.length; i++) {\r
+if (this.annotations[i] == null) {\r
+continue;\r
+}if (this.annotations[i].secondaryStructure == 'H' || this.annotations[i].secondaryStructure == 'E') {\r
+this.hasIcons = new Boolean (this.hasIcons | true).valueOf ();\r
+} else {\r
+if (this.annotations[i].secondaryStructure == '(' || this.annotations[i].secondaryStructure == '[' || this.annotations[i].secondaryStructure == '<' || this.annotations[i].secondaryStructure == '{' || this.annotations[i].secondaryStructure == 'A' || this.annotations[i].secondaryStructure == 'B' || this.annotations[i].secondaryStructure == 'C' || this.annotations[i].secondaryStructure == 'D' || this.annotations[i].secondaryStructure == 'E' || this.annotations[i].secondaryStructure == 'F' || this.annotations[i].secondaryStructure == 'G' || this.annotations[i].secondaryStructure == 'H' || this.annotations[i].secondaryStructure == 'I' || this.annotations[i].secondaryStructure == 'J' || this.annotations[i].secondaryStructure == 'K' || this.annotations[i].secondaryStructure == 'L' || this.annotations[i].secondaryStructure == 'M' || this.annotations[i].secondaryStructure == 'N' || this.annotations[i].secondaryStructure == 'O' || this.annotations[i].secondaryStructure == 'P' || this.annotations[i].secondaryStructure == 'Q' || this.annotations[i].secondaryStructure == 'R' || this.annotations[i].secondaryStructure == 'S' || this.annotations[i].secondaryStructure == 'T' || this.annotations[i].secondaryStructure == 'U' || this.annotations[i].secondaryStructure == 'V' || this.annotations[i].secondaryStructure == 'W' || this.annotations[i].secondaryStructure == 'X' || this.annotations[i].secondaryStructure == 'Y' || this.annotations[i].secondaryStructure == 'Z') {\r
+this.hasIcons = new Boolean (this.hasIcons | true).valueOf ();\r
+this.isrna = new Boolean (this.isrna | true).valueOf ();\r
+}}if (this.annotations[i].displayCharacter == null || this.annotations[i].displayCharacter.length == 0) {\r
+rnastring.append ('.');\r
+continue;\r
+}if (this.annotations[i].displayCharacter.length == 1) {\r
+firstChar = this.annotations[i].displayCharacter.charAt (0);\r
+if (this.annotations[i].secondaryStructure != ' ' && !this.hasIcons && firstChar != ' ' && firstChar != '$' && firstChar.charCodeAt (0) != 0xCE && firstChar != '(' && firstChar != '[' && firstChar != '>' && firstChar != '{' && firstChar != 'A' && firstChar != 'B' && firstChar != 'C' && firstChar != 'D' && firstChar != 'E' && firstChar != 'F' && firstChar != 'G' && firstChar != 'H' && firstChar != 'I' && firstChar != 'J' && firstChar != 'K' && firstChar != 'L' && firstChar != 'M' && firstChar != 'N' && firstChar != 'O' && firstChar != 'P' && firstChar != 'Q' && firstChar != 'R' && firstChar != 'S' && firstChar != 'T' && firstChar != 'U' && firstChar != 'V' && firstChar != 'W' && firstChar != 'X' && firstChar != 'Y' && firstChar != 'Z' && firstChar != '-' && firstChar.charCodeAt (0) < jalview.schemes.ResidueProperties.aaIndex.length) {\r
+if (jalview.schemes.ResidueProperties.aaIndex[firstChar.charCodeAt (0)] < 23) {\r
+nonSSLabel = true;\r
+}}} else {\r
+rnastring.append (this.annotations[i].displayCharacter.charAt (1));\r
+}if (this.annotations[i].displayCharacter.length > 0) {\r
+this.hasText = true;\r
+}}\r
+if (nonSSLabel) {\r
+this.hasIcons = false;\r
+for (var j = 0; j < this.annotations.length; j++) {\r
+if (this.annotations[j] != null && this.annotations[j].secondaryStructure != ' ') {\r
+this.annotations[j].displayCharacter = String.valueOf (this.annotations[j].secondaryStructure);\r
+this.annotations[j].secondaryStructure = ' ';\r
+}}\r
+} else {\r
+if (this.isrna) {\r
+this._updateRnaSecStr (Clazz.innerTypeInstance (jalview.datamodel.AlignmentAnnotation.AnnotCharSequence, this, null));\r
+}}});\r
+Clazz.defineMethod (c$, "getRNAStruc", \r
+function () {\r
+if (this.isrna) {\r
+var rnastruc = Clazz.innerTypeInstance (jalview.datamodel.AlignmentAnnotation.AnnotCharSequence, this, null).toString ();\r
+if (this._lastrnaannot != rnastruc.hashCode ()) {\r
+this._lastrnaannot = rnastruc.hashCode ();\r
+this._updateRnaSecStr (rnastruc);\r
+}return rnastruc;\r
+}return null;\r
+});\r
+Clazz.makeConstructor (c$, \r
+function (label, description, annotations, min, max, graphType) {\r
+this.setAnnotationId ();\r
+this.editable = graphType == 0;\r
+this.label = label;\r
+this.description = description;\r
+this.annotations = annotations;\r
+this.graph = graphType;\r
+this.graphMin = min;\r
+this.graphMax = max;\r
+this.validateRangeAndDisplay ();\r
+}, "~S,~S,~A,~N,~N,~N");\r
+Clazz.defineMethod (c$, "validateRangeAndDisplay", \r
+function () {\r
+if (this.annotations == null) {\r
+this.visible = false;\r
+return;\r
+}var graphType = this.graph;\r
+var min = this.graphMin;\r
+var max = this.graphMax;\r
+var drawValues = true;\r
+this._linecolour = null;\r
+if (min == max) {\r
+min = 999999999;\r
+for (var i = 0; i < this.annotations.length; i++) {\r
+if (this.annotations[i] == null) {\r
+continue;\r
+}if (drawValues && this.annotations[i].displayCharacter != null && this.annotations[i].displayCharacter.length > 1) {\r
+drawValues = false;\r
+}if (this.annotations[i].value > max) {\r
+max = this.annotations[i].value;\r
+}if (this.annotations[i].value < min) {\r
+min = this.annotations[i].value;\r
+}if (this._linecolour == null && this.annotations[i].colour != null) {\r
+this._linecolour = this.annotations[i].colour;\r
+}}\r
+if (min > 0) {\r
+min = 0;\r
+} else {\r
+if (max < 0) {\r
+max = 0;\r
+}}}this.graphMin = min;\r
+this.graphMax = max;\r
+this.areLabelsSecondaryStructure ();\r
+if (!drawValues && graphType != 0) {\r
+for (var i = 0; i < this.annotations.length; i++) {\r
+if (this.annotations[i] != null) {\r
+this.annotations[i].displayCharacter = "";\r
+}}\r
+}});\r
+Clazz.makeConstructor (c$, \r
+function (annotation) {\r
+this.setAnnotationId ();\r
+this.label =  String.instantialize (annotation.label);\r
+if (annotation.description != null) {\r
+this.description =  String.instantialize (annotation.description);\r
+}this.graphMin = annotation.graphMin;\r
+this.graphMax = annotation.graphMax;\r
+this.graph = annotation.graph;\r
+this.graphHeight = annotation.graphHeight;\r
+this.graphGroup = annotation.graphGroup;\r
+this.groupRef = annotation.groupRef;\r
+this.editable = annotation.editable;\r
+this.autoCalculated = annotation.autoCalculated;\r
+this.hasIcons = annotation.hasIcons;\r
+this.hasText = annotation.hasText;\r
+this.height = annotation.height;\r
+this.label = annotation.label;\r
+this.padGaps = annotation.padGaps;\r
+this.visible = annotation.visible;\r
+this.centreColLabels = annotation.centreColLabels;\r
+this.scaleColLabel = annotation.scaleColLabel;\r
+this.showAllColLabels = annotation.showAllColLabels;\r
+this.calcId = annotation.calcId;\r
+if (annotation.properties != null) {\r
+this.properties =  new java.util.HashMap ();\r
+for (var val, $val = annotation.properties.entrySet ().iterator (); $val.hasNext () && ((val = $val.next ()) || true);) {\r
+this.properties.put (val.getKey (), val.getValue ());\r
+}\r
+}if (this.$hasScore = annotation.$hasScore) {\r
+this.score = annotation.score;\r
+}if (annotation.threshold != null) {\r
+this.threshold =  new jalview.datamodel.GraphLine (annotation.threshold);\r
+}var ann = annotation.annotations;\r
+if (annotation.annotations != null) {\r
+this.annotations =  new Array (ann.length);\r
+for (var i = 0; i < ann.length; i++) {\r
+if (ann[i] != null) {\r
+this.annotations[i] =  new jalview.datamodel.Annotation (ann[i]);\r
+if (this._linecolour != null) {\r
+this._linecolour = this.annotations[i].colour;\r
+}}}\r
+}if (annotation.sequenceRef != null) {\r
+this.sequenceRef = annotation.sequenceRef;\r
+if (annotation.sequenceMapping != null) {\r
+var p = null;\r
+this.sequenceMapping =  new java.util.HashMap ();\r
+var pos = annotation.sequenceMapping.keySet ().iterator ();\r
+while (pos.hasNext ()) {\r
+p = pos.next ();\r
+var a = annotation.sequenceMapping.get (p);\r
+if (a == null) {\r
+continue;\r
+}if (ann != null) {\r
+for (var i = 0; i < ann.length; i++) {\r
+if (ann[i] === a) {\r
+this.sequenceMapping.put (p, this.annotations[i]);\r
+}}\r
+}}\r
+} else {\r
+this.sequenceMapping = null;\r
+}}{\r
+}this.validateRangeAndDisplay ();\r
+}, "jalview.datamodel.AlignmentAnnotation");\r
+Clazz.defineMethod (c$, "restrict", \r
+function (startRes, endRes) {\r
+if (this.annotations == null) {\r
+return;\r
+}if (startRes < 0) {\r
+startRes = 0;\r
+}if (startRes >= this.annotations.length) {\r
+startRes = this.annotations.length - 1;\r
+}if (endRes >= this.annotations.length) {\r
+endRes = this.annotations.length - 1;\r
+}if (this.annotations == null) {\r
+return;\r
+}var temp =  new Array (endRes - startRes + 1);\r
+if (startRes < this.annotations.length) {\r
+System.arraycopy (this.annotations, startRes, temp, 0, endRes - startRes + 1);\r
+}if (this.sequenceRef != null) {\r
+var spos = this.sequenceRef.findPosition (startRes);\r
+var epos = this.sequenceRef.findPosition (endRes);\r
+if (this.sequenceMapping != null) {\r
+var newmapping =  new java.util.HashMap ();\r
+var e = this.sequenceMapping.keySet ().iterator ();\r
+while (e.hasNext ()) {\r
+var pos = e.next ();\r
+if (pos.intValue () >= spos && pos.intValue () <= epos) {\r
+newmapping.put (pos, this.sequenceMapping.get (pos));\r
+}}\r
+this.sequenceMapping.clear ();\r
+this.sequenceMapping = newmapping;\r
+}}this.annotations = temp;\r
+}, "~N,~N");\r
+Clazz.defineMethod (c$, "padAnnotation", \r
+function (length) {\r
+if (this.annotations == null) {\r
+return true;\r
+}if (this.annotations.length < length) {\r
+var na =  new Array (length);\r
+System.arraycopy (this.annotations, 0, na, 0, this.annotations.length);\r
+this.annotations = na;\r
+return true;\r
+}return this.annotations.length > length;\r
+}, "~N");\r
+Clazz.overrideMethod (c$, "toString", \r
+function () {\r
+var buffer =  new StringBuilder (256);\r
+for (var i = 0; i < this.annotations.length; i++) {\r
+if (this.annotations[i] != null) {\r
+if (this.graph != 0) {\r
+buffer.append (this.annotations[i].value);\r
+} else if (this.hasIcons) {\r
+buffer.append (this.annotations[i].secondaryStructure);\r
+} else {\r
+buffer.append (this.annotations[i].displayCharacter);\r
+}}buffer.append (", ");\r
+}\r
+if (this.label.indexOf ("Consensus") == 0) {\r
+buffer.append ("\n");\r
+for (var i = 0; i < this.annotations.length; i++) {\r
+if (this.annotations[i] != null) {\r
+buffer.append (this.annotations[i].description);\r
+}buffer.append (", ");\r
+}\r
+}return buffer.toString ();\r
+});\r
+Clazz.defineMethod (c$, "setThreshold", \r
+function (line) {\r
+this.threshold = line;\r
+}, "jalview.datamodel.GraphLine");\r
+Clazz.defineMethod (c$, "getThreshold", \r
+function () {\r
+return this.threshold;\r
+});\r
+Clazz.defineMethod (c$, "createSequenceMapping", \r
+function (seqRef, startRes, alreadyMapped) {\r
+if (seqRef == null) {\r
+return;\r
+}this.sequenceRef = seqRef;\r
+if (this.annotations == null) {\r
+return;\r
+}this.sequenceMapping =  new java.util.HashMap ();\r
+var seqPos;\r
+for (var i = 0; i < this.annotations.length; i++) {\r
+if (this.annotations[i] != null) {\r
+if (alreadyMapped) {\r
+seqPos = seqRef.findPosition (i);\r
+} else {\r
+seqPos = i + startRes;\r
+}this.sequenceMapping.put ( new Integer (seqPos), this.annotations[i]);\r
+}}\r
+}, "jalview.datamodel.SequenceI,~N,~B");\r
+Clazz.defineMethod (c$, "adjustForAlignment", \r
+function () {\r
+if (this.sequenceRef == null) {\r
+return;\r
+}if (this.annotations == null) {\r
+return;\r
+}var a = 0;\r
+var aSize = this.sequenceRef.getLength ();\r
+if (aSize == 0) {\r
+return;\r
+}var position;\r
+var temp =  new Array (aSize);\r
+var index;\r
+for (a = this.sequenceRef.getStart (); a <= this.sequenceRef.getEnd (); a++) {\r
+index =  new Integer (a);\r
+if (this.sequenceMapping.containsKey (index)) {\r
+position = this.sequenceRef.findIndex (a) - 1;\r
+temp[position] = this.sequenceMapping.get (index);\r
+}}\r
+this.annotations = temp;\r
+});\r
+Clazz.defineMethod (c$, "compactAnnotationArray", \r
+function () {\r
+var i = 0;\r
+var iSize = this.annotations.length;\r
+while (i < iSize) {\r
+if (this.annotations[i] == null) {\r
+if (i + 1 < iSize) {\r
+System.arraycopy (this.annotations, i + 1, this.annotations, i, iSize - i - 1);\r
+}iSize--;\r
+} else {\r
+i++;\r
+}}\r
+var ann = this.annotations;\r
+this.annotations =  new Array (i);\r
+System.arraycopy (ann, 0, this.annotations, 0, i);\r
+ann = null;\r
+return iSize;\r
+});\r
+Clazz.defineMethod (c$, "setSequenceRef", \r
+function (sequenceI) {\r
+if (sequenceI != null) {\r
+if (this.sequenceRef != null) {\r
+var rIsDs = this.sequenceRef.getDatasetSequence () == null;\r
+var tIsDs = sequenceI.getDatasetSequence () == null;\r
+if (this.sequenceRef !== sequenceI && (rIsDs && !tIsDs && this.sequenceRef !== sequenceI.getDatasetSequence ()) && (!rIsDs && tIsDs && this.sequenceRef.getDatasetSequence () !== sequenceI) && (!rIsDs && !tIsDs && this.sequenceRef.getDatasetSequence () !== sequenceI.getDatasetSequence ()) && !this.sequenceRef.equals (sequenceI)) {\r
+this.sequenceRef = null;\r
+if (this.sequenceMapping != null) {\r
+this.sequenceMapping = null;\r
+}this.createSequenceMapping (sequenceI, 1, true);\r
+this.adjustForAlignment ();\r
+} else {\r
+this.sequenceRef = sequenceI;\r
+}} else {\r
+this.createSequenceMapping (sequenceI, 1, true);\r
+this.adjustForAlignment ();\r
+}} else {\r
+this.sequenceMapping = null;\r
+this.sequenceRef = null;\r
+}}, "jalview.datamodel.SequenceI");\r
+Clazz.defineMethod (c$, "getScore", \r
+function () {\r
+return this.score;\r
+});\r
+Clazz.defineMethod (c$, "setScore", \r
+function (score) {\r
+this.$hasScore = true;\r
+this.score = score;\r
+}, "~N");\r
+Clazz.defineMethod (c$, "hasScore", \r
+function () {\r
+return this.$hasScore || !Double.isNaN (this.score);\r
+});\r
+Clazz.makeConstructor (c$, \r
+function (label, description, score) {\r
+this.construct (label, description, null);\r
+this.setScore (score);\r
+}, "~S,~S,~N");\r
+Clazz.makeConstructor (c$, \r
+function (alignmentAnnotation, colSel) {\r
+this.construct (alignmentAnnotation);\r
+if (this.annotations == null) {\r
+return;\r
+}colSel.makeVisibleAnnotation (this);\r
+}, "jalview.datamodel.AlignmentAnnotation,jalview.datamodel.ColumnSelection");\r
+Clazz.defineMethod (c$, "setPadGaps", \r
+function (padgaps, gapchar) {\r
+this.padGaps = padgaps;\r
+if (padgaps) {\r
+this.hasText = true;\r
+for (var i = 0; i < this.annotations.length; i++) {\r
+if (this.annotations[i] == null) {\r
+this.annotations[i] =  new jalview.datamodel.Annotation (String.valueOf (gapchar), null, ' ', 0, null);\r
+} else if (this.annotations[i].displayCharacter == null || this.annotations[i].displayCharacter.equals (" ")) {\r
+this.annotations[i].displayCharacter = String.valueOf (gapchar);\r
+}}\r
+}}, "~B,~S");\r
+Clazz.defineMethod (c$, "getDescription", \r
+function (seqname) {\r
+if (seqname && this.sequenceRef != null) {\r
+var i = this.description.toLowerCase ().indexOf ("<html>");\r
+if (i > -1) {\r
+return "<html>" + this.sequenceRef.getName () + " : " + this.description.substring (i + 6);\r
+}return this.sequenceRef.getName () + " : " + this.description;\r
+}return this.description;\r
+}, "~B");\r
+Clazz.defineMethod (c$, "isValidStruc", \r
+function () {\r
+return this.invalidrnastruc == -1;\r
+});\r
+Clazz.defineMethod (c$, "getInvalidStrucPos", \r
+function () {\r
+return this.invalidrnastruc;\r
+});\r
+Clazz.defineMethod (c$, "getCalcId", \r
+function () {\r
+return this.calcId;\r
+});\r
+Clazz.defineMethod (c$, "setCalcId", \r
+function (calcId) {\r
+this.calcId = calcId;\r
+}, "~S");\r
+Clazz.defineMethod (c$, "isRNA", \r
+function () {\r
+return this.isrna;\r
+});\r
+Clazz.defineMethod (c$, "liftOver", \r
+function (sq, sp2sq) {\r
+if (sp2sq.getMappedWidth () != sp2sq.getWidth ()) {\r
+throw  new Error ("liftOver currently not implemented for transfer of annotation between different types of seqeunce");\r
+}var mapIsTo = (sp2sq != null) ? (sp2sq.getTo () === sq || sp2sq.getTo () === sq.getDatasetSequence ()) : false;\r
+var mapForsq =  new java.util.HashMap ();\r
+if (this.sequenceMapping != null) {\r
+if (sp2sq != null) {\r
+for (var ie, $ie = this.sequenceMapping.entrySet ().iterator (); $ie.hasNext () && ((ie = $ie.next ()) || true);) {\r
+var mpos = Integer.$valueOf (mapIsTo ? sp2sq.getMappedPosition ((ie.getKey ()).intValue ()) : sp2sq.getPosition ((ie.getKey ()).intValue ()));\r
+if ((mpos).intValue () >= sq.getStart () && (mpos).intValue () <= sq.getEnd ()) {\r
+mapForsq.put (mpos, ie.getValue ());\r
+}}\r
+this.sequenceMapping = mapForsq;\r
+this.sequenceRef = sq;\r
+this.adjustForAlignment ();\r
+} else {\r
+}}}, "jalview.datamodel.SequenceI,jalview.datamodel.Mapping");\r
+Clazz.defineMethod (c$, "remap", \r
+function (newref, mapping, from, to, idxoffset) {\r
+if (mapping != null) {\r
+var old = this.sequenceMapping;\r
+var remap =  new java.util.HashMap ();\r
+var index = -1;\r
+for (var mp, $mp = 0, $$mp = mapping; $mp < $$mp.length && ((mp = $$mp[$mp]) || true); $mp++) {\r
+if (index++ < 0) {\r
+continue;\r
+}var ann = null;\r
+if (from == -1) {\r
+ann = this.sequenceMapping.get (Integer.$valueOf (idxoffset + index));\r
+} else {\r
+if (mp != null && mp.length > from) {\r
+ann = this.sequenceMapping.get (Integer.$valueOf (mp[from]));\r
+}}if (ann != null) {\r
+if (to == -1) {\r
+remap.put (Integer.$valueOf (idxoffset + index), ann);\r
+} else {\r
+if (to > -1 && to < mp.length) {\r
+remap.put (Integer.$valueOf (mp[to]), ann);\r
+}}}}\r
+this.sequenceMapping = remap;\r
+old.clear ();\r
+if (newref != null) {\r
+this.sequenceRef = newref;\r
+}this.adjustForAlignment ();\r
+}}, "jalview.datamodel.SequenceI,~A,~N,~N,~N");\r
+Clazz.defineMethod (c$, "getProperty", \r
+function (property) {\r
+if (this.properties == null) {\r
+return null;\r
+}return this.properties.get (property);\r
+}, "~S");\r
+Clazz.defineMethod (c$, "setProperty", \r
+function (property, value) {\r
+if (this.properties == null) {\r
+this.properties =  new java.util.HashMap ();\r
+}this.properties.put (property, value);\r
+}, "~S,~S");\r
+Clazz.defineMethod (c$, "hasProperties", \r
+function () {\r
+return this.properties != null && this.properties.size () > 0;\r
+});\r
+Clazz.defineMethod (c$, "getProperties", \r
+function () {\r
+if (this.properties == null) {\r
+return java.util.Collections.emptyList ();\r
+}return this.properties.keySet ();\r
+});\r
+Clazz.defineMethod (c$, "getAnnotationForPosition", \r
+function (position) {\r
+return this.sequenceMapping == null ? null : this.sequenceMapping.get (new Integer (position));\r
+}, "~N");\r
+Clazz.defineMethod (c$, "setAnnotationId", \r
+function () {\r
+this.annotationId = "ann" + Long.toString (jalview.datamodel.AlignmentAnnotation.nextId ());\r
+});\r
+c$.nextId = Clazz.defineMethod (c$, "nextId", \r
+function () {\r
+return jalview.datamodel.AlignmentAnnotation.counter++;\r
+});\r
+c$.$AlignmentAnnotation$AnnotCharSequence$ = function () {\r
+Clazz.pu$h ();\r
+c$ = Clazz.decorateAsClass (function () {\r
+Clazz.prepareCallback (this, arguments);\r
+this.offset = 0;\r
+this.max = 0;\r
+Clazz.instantialize (this, arguments);\r
+}, jalview.datamodel.AlignmentAnnotation, "AnnotCharSequence", null, CharSequence);\r
+Clazz.makeConstructor (c$, \r
+function () {\r
+this.construct (0, this.b$["jalview.datamodel.AlignmentAnnotation"].annotations.length);\r
+});\r
+Clazz.makeConstructor (c$, \r
+function (a, b) {\r
+this.offset = a;\r
+this.max = b;\r
+}, "~N,~N");\r
+Clazz.overrideMethod (c$, "subSequence", \r
+function (a, b) {\r
+return Clazz.innerTypeInstance (jalview.datamodel.AlignmentAnnotation.AnnotCharSequence, this, null, this.offset + a, this.offset + b);\r
+}, "~N,~N");\r
+Clazz.overrideMethod (c$, "length", \r
+function () {\r
+return this.max - this.offset;\r
+});\r
+Clazz.overrideMethod (c$, "charAt", \r
+function (a) {\r
+return ((a + this.offset < 0) || (a + this.offset) >= this.max || this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[a + this.offset] == null || (this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[a + this.offset].secondaryStructure <= ' ') ? ' ' : this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[a + this.offset].displayCharacter == null || this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[a + this.offset].displayCharacter.length == 0 ? this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[a + this.offset].secondaryStructure : this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[a + this.offset].displayCharacter.charAt (0));\r
+}, "~N");\r
+Clazz.overrideMethod (c$, "toString", \r
+function () {\r
+var a =  Clazz.newCharArray (this.max - this.offset, '\0');\r
+var b = this.b$["jalview.datamodel.AlignmentAnnotation"].annotations.length;\r
+for (var c = this.offset; c < b; c++) {\r
+a[c] = (this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[c] == null || ((this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[c].secondaryStructure).charCodeAt (0) <= 32)) ? ' ' : (this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[c].displayCharacter == null || this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[c].displayCharacter.length == 0 ? this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[c].secondaryStructure : this.b$["jalview.datamodel.AlignmentAnnotation"].annotations[c].displayCharacter.charAt (0));\r
+}\r
+return  String.instantialize (a);\r
+});\r
+c$ = Clazz.p0p ();\r
+};\r
+Clazz.defineStatics (c$,\r
+"ANNOTATION_ID_PREFIX", "ann",\r
+"SEQUENCE_PROFILE", 0,\r
+"STRUCTURE_PROFILE", 1,\r
+"CDNA_PROFILE", 2,\r
+"counter", 0,\r
+"NO_GRAPH", 0,\r
+"BAR_GRAPH", 1,\r
+"LINE_GRAPH", 2);\r
+});\r