X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=bin%2Fjalview%2Fdatamodel%2FAlignmentAnnotation.js;h=e321a8df68e337651bb25b4d9c38279e07f83dd0;hp=0be7f1c6d384cc1353c96e44a568c31870e63be7;hb=8ffd05b3abe52c0b6b79b011c0966361f82d5fe6;hpb=6154cb57a6eac3bb1344b8342495f5bb701ee921 diff --git a/bin/jalview/datamodel/AlignmentAnnotation.js b/bin/jalview/datamodel/AlignmentAnnotation.js index 0be7f1c..e321a8d 100644 --- a/bin/jalview/datamodel/AlignmentAnnotation.js +++ b/bin/jalview/datamodel/AlignmentAnnotation.js @@ -1,623 +1,623 @@ -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 (""); -if (i > -1) { -return "" + 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"); +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 (""); +if (i > -1) { +return "" + 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); +});