JAL-1807 includes ?j2sdebug flag and DebugJS._(msg)
[jalviewjs.git] / bin / jalview / datamodel / Sequence.js
index 6a15091..06c8329 100644 (file)
-Clazz.declarePackage ("jalview.datamodel");\r
-Clazz.load (["jalview.datamodel.ASequence", "$.SequenceI", "jalview.jsdev.RegExp"], "jalview.datamodel.Sequence", ["jalview.analysis.AlignSeq", "jalview.datamodel.AlignmentAnnotation", "$.DBRefEntry", "$.DBRefSource", "$.PDBEntry", "$.SequenceFeature", "jalview.schemes.ResidueProperties", "jalview.util.Comparison", "$.StringUtils", "java.lang.StringBuffer", "java.util.ArrayList", "$.Vector"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.datasetSequence = null;\r
-this.name = null;\r
-this.sequence = null;\r
-this.description = null;\r
-this.start = 0;\r
-this.end = 0;\r
-this.pdbIds = null;\r
-this.vamsasId = null;\r
-this.dbrefs = null;\r
-this.rna = null;\r
-this.annotation = null;\r
-this.index = -1;\r
-this.sequenceFeatures = null;\r
-this.limitrx = null;\r
-this.endrx = null;\r
-Clazz.instantialize (this, arguments);\r
-}, jalview.datamodel, "Sequence", jalview.datamodel.ASequence, jalview.datamodel.SequenceI);\r
-Clazz.prepareFields (c$, function () {\r
-this.limitrx = jalview.jsdev.RegExp.newRegex (["[/][0-9]{1,}[-][0-9]{1,}$"]);\r
-this.endrx = jalview.jsdev.RegExp.newRegex (["[0-9]{1,}$"]);\r
-});\r
-Clazz.makeConstructor (c$, \r
-function (name, sequence, start, end) {\r
-Clazz.superConstructor (this, jalview.datamodel.Sequence, []);\r
-this.initSeqAndName (name, sequence.toCharArray (), start, end);\r
-}, "~S,~S,~N,~N");\r
-Clazz.makeConstructor (c$, \r
-function (name, sequence, start, end) {\r
-Clazz.superConstructor (this, jalview.datamodel.Sequence, []);\r
-this.initSeqAndName (name, sequence, start, end);\r
-}, "~S,~A,~N,~N");\r
-Clazz.defineMethod (c$, "initSeqAndName", \r
-function (name2, sequence2, start2, end2) {\r
-this.name = name2;\r
-this.sequence = sequence2;\r
-this.start = start2;\r
-this.end = end2;\r
-this.parseId ();\r
-this.checkValidRange ();\r
-}, "~S,~A,~N,~N");\r
-Clazz.defineMethod (c$, "parseId", \r
-function () {\r
-if (this.name == null) {\r
-System.err.println ("POSSIBLE IMPLEMENTATION ERROR: null sequence name passed to constructor.");\r
-this.name = "";\r
-}if (this.limitrx.search (this.name)) {\r
-this.name = this.limitrx.left ();\r
-this.endrx.search (this.limitrx.stringMatched ());\r
-this.setStart (Integer.parseInt (this.limitrx.stringMatched ().substring (1, this.endrx.matchedFrom () - 1)));\r
-this.setEnd (Integer.parseInt (this.endrx.stringMatched ()));\r
-}});\r
-Clazz.defineMethod (c$, "checkValidRange", \r
-function () {\r
-{\r
-var endRes = 0;\r
-for (var j = 0; j < this.sequence.length; j++) {\r
-if (!jalview.util.Comparison.isGap (this.sequence[j])) {\r
-endRes++;\r
-}}\r
-if (endRes > 0) {\r
-endRes += this.start - 1;\r
-}if (this.end < endRes) {\r
-this.end = endRes;\r
-}}});\r
-Clazz.makeConstructor (c$, \r
-function (name, sequence) {\r
-this.construct (name, sequence, 1, -1);\r
-}, "~S,~S");\r
-Clazz.makeConstructor (c$, \r
-function (seq) {\r
-this.construct (seq, seq.getAnnotation ());\r
-}, "jalview.datamodel.SequenceI");\r
-Clazz.makeConstructor (c$, \r
-function (seq, alAnnotation) {\r
-Clazz.superConstructor (this, jalview.datamodel.Sequence, []);\r
-this.initSeqFrom (seq, alAnnotation);\r
-}, "jalview.datamodel.SequenceI,~A");\r
-Clazz.defineMethod (c$, "initSeqFrom", \r
-function (seq, alAnnotation) {\r
-this.initSeqAndName (seq.getName (), seq.getSequence (), seq.getStart (), seq.getEnd ());\r
-this.description = seq.getDescription ();\r
-if (seq.getSequenceFeatures () != null) {\r
-var sf = seq.getSequenceFeatures ();\r
-for (var i = 0; i < sf.length; i++) {\r
-this.addSequenceFeature ( new jalview.datamodel.SequenceFeature (sf[i]));\r
-}\r
-}this.setDatasetSequence (seq.getDatasetSequence ());\r
-if (this.datasetSequence == null && seq.getDBRef () != null) {\r
-var dbr = seq.getDBRef ();\r
-for (var i = 0; i < dbr.length; i++) {\r
-this.addDBRef ( new jalview.datamodel.DBRefEntry (dbr[i]));\r
-}\r
-}if (seq.getAnnotation () != null) {\r
-var sqann = seq.getAnnotation ();\r
-for (var i = 0; i < sqann.length; i++) {\r
-if (sqann[i] == null) {\r
-continue;\r
-}var found = (alAnnotation == null);\r
-if (!found) {\r
-for (var apos = 0; !found && apos < alAnnotation.length; apos++) {\r
-found = (alAnnotation[apos] === sqann[i]);\r
-}\r
-}if (found) {\r
-var newann =  new jalview.datamodel.AlignmentAnnotation (sqann[i]);\r
-this.addAlignmentAnnotation (newann);\r
-}}\r
-}if (seq.getPDBId () != null) {\r
-var ids = seq.getPDBId ();\r
-var e = ids.elements ();\r
-while (e.hasMoreElements ()) {\r
-this.addPDBId ( new jalview.datamodel.PDBEntry (e.nextElement ()));\r
-}\r
-}}, "jalview.datamodel.SequenceI,~A");\r
-Clazz.defineMethod (c$, "setSequenceFeatures", \r
-function (features) {\r
-this.sequenceFeatures = features;\r
-}, "~A");\r
-Clazz.overrideMethod (c$, "addSequenceFeature", \r
-function (sf) {\r
-if (this.sequenceFeatures == null) {\r
-this.sequenceFeatures =  new Array (0);\r
-}for (var i = 0; i < this.sequenceFeatures.length; i++) {\r
-if (this.sequenceFeatures[i].equals (sf)) {\r
-return;\r
-}}\r
-var temp =  new Array (this.sequenceFeatures.length + 1);\r
-System.arraycopy (this.sequenceFeatures, 0, temp, 0, this.sequenceFeatures.length);\r
-temp[this.sequenceFeatures.length] = sf;\r
-this.sequenceFeatures = temp;\r
-}, "jalview.datamodel.SequenceFeature");\r
-Clazz.overrideMethod (c$, "deleteFeature", \r
-function (sf) {\r
-if (this.sequenceFeatures == null) {\r
-return;\r
-}var index = 0;\r
-for (index = 0; index < this.sequenceFeatures.length; index++) {\r
-if (this.sequenceFeatures[index].equals (sf)) {\r
-break;\r
-}}\r
-if (index == this.sequenceFeatures.length) {\r
-return;\r
-}var sfLength = this.sequenceFeatures.length;\r
-if (sfLength < 2) {\r
-this.sequenceFeatures = null;\r
-} else {\r
-var temp =  new Array (sfLength - 1);\r
-System.arraycopy (this.sequenceFeatures, 0, temp, 0, index);\r
-if (index < sfLength) {\r
-System.arraycopy (this.sequenceFeatures, index + 1, temp, index, this.sequenceFeatures.length - index - 1);\r
-}this.sequenceFeatures = temp;\r
-}}, "jalview.datamodel.SequenceFeature");\r
-Clazz.defineMethod (c$, "getSequenceFeatures", \r
-function () {\r
-var features = this.sequenceFeatures;\r
-var seq = this;\r
-var count = 0;\r
-while (features == null && seq.getDatasetSequence () != null && count++ < 10) {\r
-seq = seq.getDatasetSequence ();\r
-features = (seq).sequenceFeatures;\r
-}\r
-return features;\r
-});\r
-Clazz.overrideMethod (c$, "addPDBId", \r
-function (entry) {\r
-if (this.pdbIds == null) {\r
-this.pdbIds =  new java.util.Vector ();\r
-}if (this.pdbIds.contains (entry)) {\r
-jalview.datamodel.Sequence.updatePDBEntry (this.pdbIds.get (this.pdbIds.indexOf (entry)), entry);\r
-} else {\r
-this.pdbIds.addElement (entry);\r
-}}, "jalview.datamodel.PDBEntry");\r
-c$.updatePDBEntry = Clazz.defineMethod (c$, "updatePDBEntry", \r
-($fz = function (oldEntry, newEntry) {\r
-if (newEntry.getFile () != null) {\r
-oldEntry.setFile (newEntry.getFile ());\r
-}}, $fz.isPrivate = true, $fz), "jalview.datamodel.PDBEntry,jalview.datamodel.PDBEntry");\r
-Clazz.defineMethod (c$, "setPDBId", \r
-function (id) {\r
-this.pdbIds = id;\r
-}, "java.util.Vector");\r
-Clazz.defineMethod (c$, "getPDBId", \r
-function () {\r
-return this.pdbIds;\r
-});\r
-Clazz.overrideMethod (c$, "getDisplayId", \r
-function (jvsuffix) {\r
-var result =  new StringBuffer (this.name);\r
-if (jvsuffix) {\r
-result.append ("/" + this.start + "-" + this.end);\r
-}return result.toString ();\r
-}, "~B");\r
-Clazz.overrideMethod (c$, "setName", \r
-function (name) {\r
-this.name = name;\r
-this.parseId ();\r
-}, "~S");\r
-Clazz.defineMethod (c$, "getName", \r
-function () {\r
-return this.name;\r
-});\r
-Clazz.overrideMethod (c$, "setStart", \r
-function (start) {\r
-this.start = start;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "getStart", \r
-function () {\r
-return this.start;\r
-});\r
-Clazz.overrideMethod (c$, "setEnd", \r
-function (end) {\r
-this.end = end;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "getEnd", \r
-function () {\r
-return this.end;\r
-});\r
-Clazz.overrideMethod (c$, "getLength", \r
-function () {\r
-return this.sequence.length;\r
-});\r
-Clazz.defineMethod (c$, "setSequence", \r
-function (seq) {\r
-this.sequence = seq.toCharArray ();\r
-this.checkValidRange ();\r
-}, "~S");\r
-Clazz.defineMethod (c$, "getSequenceAsString", \r
-function () {\r
-return  String.instantialize (this.sequence);\r
-});\r
-Clazz.defineMethod (c$, "getSequenceAsString", \r
-function (start, end) {\r
-return  String.instantialize (this.getSequence (start, end));\r
-}, "~N,~N");\r
-Clazz.defineMethod (c$, "getSequence", \r
-function () {\r
-return this.sequence;\r
-});\r
-Clazz.defineMethod (c$, "getSequence", \r
-function (start, end) {\r
-if (start < 0) {\r
-start = 0;\r
-}if (start >= this.sequence.length) {\r
-return  Clazz.newCharArray (0, '\0');\r
-}if (end >= this.sequence.length) {\r
-end = this.sequence.length;\r
-}var reply =  Clazz.newCharArray (end - start, '\0');\r
-System.arraycopy (this.sequence, start, reply, 0, end - start);\r
-return reply;\r
-}, "~N,~N");\r
-Clazz.overrideMethod (c$, "getSubSequence", \r
-function (start, end) {\r
-if (start < 0) {\r
-start = 0;\r
-}var seq = this.getSequence (start, end);\r
-if (seq.length == 0) {\r
-return null;\r
-}var nstart = this.findPosition (start);\r
-var nend = this.findPosition (end) - 1;\r
-var nseq =  new jalview.datamodel.Sequence (this.getName (), seq, nstart, nend);\r
-nseq.setDescription (this.description);\r
-if (this.datasetSequence != null) {\r
-nseq.setDatasetSequence (this.datasetSequence);\r
-} else {\r
-nseq.setDatasetSequence (this);\r
-}return nseq;\r
-}, "~N,~N");\r
-Clazz.overrideMethod (c$, "getCharAt", \r
-function (i) {\r
-if (i < this.sequence.length) {\r
-return this.sequence[i];\r
-} else {\r
-return ' ';\r
-}}, "~N");\r
-Clazz.defineMethod (c$, "setDescription", \r
-function (desc) {\r
-this.description = desc;\r
-}, "~S");\r
-Clazz.defineMethod (c$, "getDescription", \r
-function () {\r
-return this.description;\r
-});\r
-Clazz.overrideMethod (c$, "findIndex", \r
-function (pos) {\r
-var j = this.start;\r
-var i = 0;\r
-while ((i < this.sequence.length) && (j <= this.end) && (j <= pos)) {\r
-if (!jalview.util.Comparison.isGap (this.sequence[i])) {\r
-j++;\r
-}i++;\r
-}\r
-if ((j == this.end) && (j < pos)) {\r
-return this.end + 1;\r
-} else {\r
-return i;\r
-}}, "~N");\r
-Clazz.overrideMethod (c$, "findPosition", \r
-function (i) {\r
-var j = 0;\r
-var pos = this.start;\r
-var seqlen = this.sequence.length;\r
-while ((j < i) && (j < seqlen)) {\r
-if (!jalview.util.Comparison.isGap (this.sequence[j])) {\r
-pos++;\r
-}j++;\r
-}\r
-return pos;\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "gapMap", \r
-function () {\r
-var seq = jalview.analysis.AlignSeq.extractGaps (jalview.util.Comparison.GapChars,  String.instantialize (this.sequence));\r
-var map =  Clazz.newIntArray (seq.length, 0);\r
-var j = 0;\r
-var p = 0;\r
-while (j < this.sequence.length) {\r
-if (!jalview.util.Comparison.isGap (this.sequence[j])) {\r
-map[p++] = j;\r
-}j++;\r
-}\r
-return map;\r
-});\r
-Clazz.overrideMethod (c$, "findPositionMap", \r
-function () {\r
-var map =  Clazz.newIntArray (this.sequence.length, 0);\r
-var j = 0;\r
-var pos = this.start;\r
-var seqlen = this.sequence.length;\r
-while ((j < seqlen)) {\r
-map[j] = pos;\r
-if (!jalview.util.Comparison.isGap (this.sequence[j])) {\r
-pos++;\r
-}j++;\r
-}\r
-return map;\r
-});\r
-Clazz.overrideMethod (c$, "getInsertions", \r
-function () {\r
-var map =  new java.util.ArrayList ();\r
-var lastj = -1;\r
-var j = 0;\r
-var pos = this.start;\r
-var seqlen = this.sequence.length;\r
-while ((j < seqlen)) {\r
-if (jalview.util.Comparison.isGap (this.sequence[j])) {\r
-if (lastj == -1) {\r
-lastj = j;\r
-}} else {\r
-if (lastj != -1) {\r
-map.add ( Clazz.newIntArray (-1, [lastj, j - 1]));\r
-lastj = -1;\r
-}}j++;\r
-}\r
-if (lastj != -1) {\r
-map.add ( Clazz.newIntArray (-1, [lastj, j - 1]));\r
-lastj = -1;\r
-}return map;\r
-});\r
-Clazz.overrideMethod (c$, "deleteChars", \r
-function (i, j) {\r
-var newstart = this.start;\r
-var newend = this.end;\r
-if (i >= this.sequence.length || i < 0) {\r
-return;\r
-}var tmp = jalview.util.StringUtils.deleteChars (this.sequence, i, j);\r
-var createNewDs = false;\r
-var eindex = -1;\r
-var sindex = -1;\r
-var ecalc = false;\r
-var scalc = false;\r
-for (var s = i; s < j; s++) {\r
-if (jalview.schemes.ResidueProperties.aaIndex[this.sequence[s].charCodeAt (0)] != 23) {\r
-if (createNewDs) {\r
-newend--;\r
-} else {\r
-if (!scalc) {\r
-sindex = this.findIndex (this.start) - 1;\r
-scalc = true;\r
-}if (sindex == s) {\r
-newstart = this.findPosition (j);\r
-break;\r
-} else {\r
-if (!ecalc) {\r
-eindex = this.findIndex (this.end) - 1;\r
-ecalc = true;\r
-}if (eindex < j) {\r
-newend = this.findPosition (i - 1);\r
-break;\r
-} else {\r
-createNewDs = true;\r
-newend--;\r
-}}}}}\r
-if (createNewDs && this.datasetSequence != null) {\r
-var ds =  new jalview.datamodel.Sequence (this.datasetSequence);\r
-ds.deleteChars (i, j);\r
-this.datasetSequence = ds;\r
-}this.start = newstart;\r
-this.end = newend;\r
-this.sequence = tmp;\r
-}, "~N,~N");\r
-Clazz.defineMethod (c$, "insertCharAt", \r
-function (i, length, c) {\r
-var tmp =  Clazz.newCharArray (this.sequence.length + length, '\0');\r
-if (i >= this.sequence.length) {\r
-System.arraycopy (this.sequence, 0, tmp, 0, this.sequence.length);\r
-i = this.sequence.length;\r
-} else {\r
-System.arraycopy (this.sequence, 0, tmp, 0, i);\r
-}var index = i;\r
-while (length > 0) {\r
-tmp[index++] = c;\r
-length--;\r
-}\r
-if (i < this.sequence.length) {\r
-System.arraycopy (this.sequence, i, tmp, index, this.sequence.length - i);\r
-}this.sequence = tmp;\r
-}, "~N,~N,~S");\r
-Clazz.defineMethod (c$, "insertCharAt", \r
-function (i, c) {\r
-this.insertCharAt (i, 1, c);\r
-}, "~N,~S");\r
-Clazz.overrideMethod (c$, "getVamsasId", \r
-function () {\r
-return this.vamsasId;\r
-});\r
-Clazz.overrideMethod (c$, "setVamsasId", \r
-function (id) {\r
-this.vamsasId = id;\r
-}, "~S");\r
-Clazz.defineMethod (c$, "setDBRef", \r
-function (dbref) {\r
-this.dbrefs = dbref;\r
-}, "~A");\r
-Clazz.defineMethod (c$, "getDBRef", \r
-function () {\r
-if (this.dbrefs == null && this.datasetSequence != null && this !== this.datasetSequence) {\r
-return this.datasetSequence.getDBRef ();\r
-}return this.dbrefs;\r
-});\r
-Clazz.overrideMethod (c$, "addDBRef", \r
-function (entry) {\r
-if (this.dbrefs == null) {\r
-this.dbrefs =  new Array (0);\r
-}var i;\r
-var iSize = this.dbrefs.length;\r
-for (i = 0; i < iSize; i++) {\r
-if (this.dbrefs[i].equalRef (entry)) {\r
-if (entry.getMap () != null) {\r
-if (this.dbrefs[i].getMap () == null) {\r
-this.dbrefs[i] = entry;\r
-}}return;\r
-}}\r
-var temp =  new Array (iSize + 1);\r
-System.arraycopy (this.dbrefs, 0, temp, 0, iSize);\r
-temp[temp.length - 1] = entry;\r
-this.dbrefs = temp;\r
-}, "jalview.datamodel.DBRefEntry");\r
-Clazz.defineMethod (c$, "setDatasetSequence", \r
-function (seq) {\r
-this.datasetSequence = seq;\r
-}, "jalview.datamodel.SequenceI");\r
-Clazz.defineMethod (c$, "getDatasetSequence", \r
-function () {\r
-return this.datasetSequence;\r
-});\r
-Clazz.defineMethod (c$, "getAnnotation", \r
-function () {\r
-return this.annotation == null ? null : this.annotation.toArray ( new Array (this.annotation.size ()));\r
-});\r
-Clazz.overrideMethod (c$, "hasAnnotation", \r
-function (ann) {\r
-return this.annotation == null ? false : this.annotation.contains (ann);\r
-}, "jalview.datamodel.AlignmentAnnotation");\r
-Clazz.defineMethod (c$, "addAlignmentAnnotation", \r
-function (annotation) {\r
-if (this.annotation == null) {\r
-this.annotation =  new java.util.Vector ();\r
-}if (!this.annotation.contains (annotation)) {\r
-this.annotation.addElement (annotation);\r
-}annotation.setSequenceRef (this);\r
-}, "jalview.datamodel.AlignmentAnnotation");\r
-Clazz.overrideMethod (c$, "removeAlignmentAnnotation", \r
-function (annotation) {\r
-if (this.annotation != null) {\r
-this.annotation.removeElement (annotation);\r
-if (this.annotation.size () == 0) {\r
-this.annotation = null;\r
-}}}, "jalview.datamodel.AlignmentAnnotation");\r
-Clazz.defineMethod (c$, "isValidDatasetSequence", \r
-($fz = function () {\r
-if (this.datasetSequence != null) {\r
-return false;\r
-}for (var i = 0; i < this.sequence.length; i++) {\r
-if (jalview.util.Comparison.isGap (this.sequence[i])) {\r
-return false;\r
-}}\r
-return true;\r
-}, $fz.isPrivate = true, $fz));\r
-Clazz.overrideMethod (c$, "deriveSequence", \r
-function () {\r
-var seq =  new jalview.datamodel.Sequence (this);\r
-if (this.datasetSequence != null) {\r
-seq.setDatasetSequence (this.datasetSequence);\r
-} else {\r
-if (this.isValidDatasetSequence ()) {\r
-seq.setDatasetSequence (this);\r
-} else {\r
-var ds = seq;\r
-ds.setSequence (jalview.analysis.AlignSeq.extractGaps (jalview.util.Comparison.GapChars,  String.instantialize (this.sequence)));\r
-this.setDatasetSequence (ds);\r
-ds.setSequenceFeatures (this.getSequenceFeatures ());\r
-seq = this;\r
-}}return seq;\r
-});\r
-Clazz.overrideMethod (c$, "createDatasetSequence", \r
-function () {\r
-if (this.datasetSequence == null) {\r
-this.datasetSequence =  new jalview.datamodel.Sequence (this.getName (), jalview.analysis.AlignSeq.extractGaps (jalview.util.Comparison.GapChars, this.getSequenceAsString ()), this.getStart (), this.getEnd ());\r
-this.datasetSequence.setSequenceFeatures (this.getSequenceFeatures ());\r
-this.datasetSequence.setDescription (this.getDescription ());\r
-this.setSequenceFeatures (null);\r
-this.datasetSequence.setDBRef (this.getDBRef ());\r
-this.setDBRef (null);\r
-this.datasetSequence.setPDBId (this.getPDBId ());\r
-this.setPDBId (null);\r
-this.datasetSequence.updatePDBIds ();\r
-if (this.annotation != null) {\r
-for (var aa, $aa = this.annotation.iterator (); $aa.hasNext () && ((aa = $aa.next ()) || true);) {\r
-var _aa =  new jalview.datamodel.AlignmentAnnotation (aa);\r
-_aa.sequenceRef = this.datasetSequence;\r
-_aa.adjustForAlignment ();\r
-this.datasetSequence.addAlignmentAnnotation (_aa);\r
-}\r
-}}return this.datasetSequence;\r
-});\r
-Clazz.overrideMethod (c$, "setAlignmentAnnotation", \r
-function (annotations) {\r
-if (this.annotation != null) {\r
-this.annotation.removeAllElements ();\r
-}if (annotations != null) {\r
-for (var i = 0; i < annotations.length; i++) {\r
-if (annotations[i] != null) {\r
-this.addAlignmentAnnotation (annotations[i]);\r
-}}\r
-}}, "~A");\r
-Clazz.defineMethod (c$, "getAnnotation", \r
-function (label) {\r
-if (this.annotation == null || this.annotation.size () == 0) {\r
-return null;\r
-}var subset =  new java.util.Vector ();\r
-var e = this.annotation.elements ();\r
-while (e.hasMoreElements ()) {\r
-var ann = e.nextElement ();\r
-if (ann.label != null && ann.label.equals (label)) {\r
-subset.addElement (ann);\r
-}}\r
-if (subset.size () == 0) {\r
-return null;\r
-}var anns =  new Array (subset.size ());\r
-var i = 0;\r
-e = subset.elements ();\r
-while (e.hasMoreElements ()) {\r
-anns[i++] = e.nextElement ();\r
-}\r
-subset.removeAllElements ();\r
-return anns;\r
-}, "~S");\r
-Clazz.defineMethod (c$, "updatePDBIds", \r
-function () {\r
-if (this.datasetSequence != null) {\r
-return this.datasetSequence.updatePDBIds ();\r
-}if (this.dbrefs == null || this.dbrefs.length == 0) {\r
-return false;\r
-}var newpdb =  new java.util.Vector ();\r
-for (var i = 0; i < this.dbrefs.length; i++) {\r
-if (jalview.datamodel.DBRefSource.PDB.equals (this.dbrefs[i].getSource ())) {\r
-var pdbe =  new jalview.datamodel.PDBEntry ();\r
-pdbe.setId (this.dbrefs[i].getAccessionId ());\r
-if (this.pdbIds == null || this.pdbIds.size () == 0) {\r
-newpdb.addElement (pdbe);\r
-} else {\r
-var en = this.pdbIds.elements ();\r
-var matched = false;\r
-while (!matched && en.hasMoreElements ()) {\r
-var anentry = en.nextElement ();\r
-if (anentry.getId ().equals (pdbe.getId ())) {\r
-matched = true;\r
-}}\r
-if (!matched) {\r
-newpdb.addElement (pdbe);\r
-}}}}\r
-if (newpdb.size () > 0) {\r
-var en = newpdb.elements ();\r
-while (en.hasMoreElements ()) {\r
-this.addPDBId (en.nextElement ());\r
-}\r
-return true;\r
-}return false;\r
-});\r
-Clazz.defineMethod (c$, "transferAnnotation", \r
-function (entry, mp) {\r
-if (this.datasetSequence != null) {\r
-this.datasetSequence.transferAnnotation (entry, mp);\r
-return;\r
-}if (entry.getDatasetSequence () != null) {\r
-this.transferAnnotation (entry.getDatasetSequence (), mp);\r
-return;\r
-}if (entry.getSequenceFeatures () != null) {\r
-var sfs = entry.getSequenceFeatures ();\r
-for (var si = 0; si < sfs.length; si++) {\r
-var sf = (mp != null) ? mp.locateFeature (sfs[si]) :  Clazz.newArray (-1, [ new jalview.datamodel.SequenceFeature (sfs[si])]);\r
-if (sf != null && sf.length > 0) {\r
-for (var sfi = 0; sfi < sf.length; sfi++) {\r
-this.addSequenceFeature (sf[sfi]);\r
-}\r
-}}\r
-}if (entry.getPDBId () != null) {\r
-var e = entry.getPDBId ().elements ();\r
-while (e.hasMoreElements ()) {\r
-var pdb = e.nextElement ();\r
-this.addPDBId (pdb);\r
-}\r
-}var entryRefs = entry.getDBRef ();\r
-if (entryRefs != null) {\r
-for (var r = 0; r < entryRefs.length; r++) {\r
-var newref =  new jalview.datamodel.DBRefEntry (entryRefs[r]);\r
-if (newref.getMap () != null && mp != null) {\r
-}this.addDBRef (newref);\r
-}\r
-}}, "jalview.datamodel.SequenceI,jalview.datamodel.Mapping");\r
-Clazz.overrideMethod (c$, "getIndex", \r
-function () {\r
-return this.index;\r
-});\r
-Clazz.overrideMethod (c$, "setIndex", \r
-function (value) {\r
-this.index = value;\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "setRNA", \r
-function (r) {\r
-this.rna = r;\r
-}, "jalview.jsdev.api.VarnaRNA");\r
-Clazz.overrideMethod (c$, "getRNA", \r
-function () {\r
-return this.rna;\r
-});\r
-Clazz.overrideMethod (c$, "getAlignmentAnnotations", \r
-function (calcId, label) {\r
-var result =  new java.util.ArrayList ();\r
-if (this.annotation != null) {\r
-for (var ann, $ann = this.annotation.iterator (); $ann.hasNext () && ((ann = $ann.next ()) || true);) {\r
-if (ann.calcId != null && ann.calcId.equals (calcId) && ann.label != null && ann.label.equals (label)) {\r
-result.add (ann);\r
-}}\r
-}return result;\r
-}, "~S,~S");\r
-});\r
+Clazz.declarePackage ("jalview.datamodel");
+Clazz.load (["jalview.datamodel.ASequence", "$.SequenceI", "jalview.jsdev.RegExp"], "jalview.datamodel.Sequence", ["jalview.analysis.AlignSeq", "jalview.datamodel.AlignmentAnnotation", "$.DBRefEntry", "$.DBRefSource", "$.PDBEntry", "$.SequenceFeature", "jalview.schemes.ResidueProperties", "jalview.util.Comparison", "$.StringUtils", "java.lang.StringBuffer", "java.util.ArrayList", "$.Vector"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.datasetSequence = null;
+this.name = null;
+this.sequence = null;
+this.description = null;
+this.start = 0;
+this.end = 0;
+this.pdbIds = null;
+this.vamsasId = null;
+this.dbrefs = null;
+this.rna = null;
+this.annotation = null;
+this.index = -1;
+this.sequenceFeatures = null;
+this.limitrx = null;
+this.endrx = null;
+Clazz.instantialize (this, arguments);
+}, jalview.datamodel, "Sequence", jalview.datamodel.ASequence, jalview.datamodel.SequenceI);
+Clazz.prepareFields (c$, function () {
+this.limitrx = jalview.jsdev.RegExp.newRegex (["[/][0-9]{1,}[-][0-9]{1,}$"]);
+this.endrx = jalview.jsdev.RegExp.newRegex (["[0-9]{1,}$"]);
+});
+Clazz.makeConstructor (c$, 
+function (name, sequence, start, end) {
+Clazz.superConstructor (this, jalview.datamodel.Sequence, []);
+this.initSeqAndName (name, sequence.toCharArray (), start, end);
+}, "~S,~S,~N,~N");
+Clazz.makeConstructor (c$, 
+function (name, sequence, start, end) {
+Clazz.superConstructor (this, jalview.datamodel.Sequence, []);
+this.initSeqAndName (name, sequence, start, end);
+}, "~S,~A,~N,~N");
+Clazz.defineMethod (c$, "initSeqAndName", 
+function (name2, sequence2, start2, end2) {
+this.name = name2;
+this.sequence = sequence2;
+this.start = start2;
+this.end = end2;
+this.parseId ();
+this.checkValidRange ();
+}, "~S,~A,~N,~N");
+Clazz.defineMethod (c$, "parseId", 
+function () {
+if (this.name == null) {
+System.err.println ("POSSIBLE IMPLEMENTATION ERROR: null sequence name passed to constructor.");
+this.name = "";
+}if (this.limitrx.search (this.name)) {
+this.name = this.limitrx.left ();
+this.endrx.search (this.limitrx.stringMatched ());
+this.setStart (Integer.parseInt (this.limitrx.stringMatched ().substring (1, this.endrx.matchedFrom () - 1)));
+this.setEnd (Integer.parseInt (this.endrx.stringMatched ()));
+}});
+Clazz.defineMethod (c$, "checkValidRange", 
+function () {
+{
+var endRes = 0;
+for (var j = 0; j < this.sequence.length; j++) {
+if (!jalview.util.Comparison.isGap (this.sequence[j])) {
+endRes++;
+}}
+if (endRes > 0) {
+endRes += this.start - 1;
+}if (this.end < endRes) {
+this.end = endRes;
+}}});
+Clazz.makeConstructor (c$, 
+function (name, sequence) {
+this.construct (name, sequence, 1, -1);
+}, "~S,~S");
+Clazz.makeConstructor (c$, 
+function (seq) {
+this.construct (seq, seq.getAnnotation ());
+}, "jalview.datamodel.SequenceI");
+Clazz.makeConstructor (c$, 
+function (seq, alAnnotation) {
+Clazz.superConstructor (this, jalview.datamodel.Sequence, []);
+this.initSeqFrom (seq, alAnnotation);
+}, "jalview.datamodel.SequenceI,~A");
+Clazz.defineMethod (c$, "initSeqFrom", 
+function (seq, alAnnotation) {
+this.initSeqAndName (seq.getName (), seq.getSequence (), seq.getStart (), seq.getEnd ());
+this.description = seq.getDescription ();
+if (seq.getSequenceFeatures () != null) {
+var sf = seq.getSequenceFeatures ();
+for (var i = 0; i < sf.length; i++) {
+this.addSequenceFeature ( new jalview.datamodel.SequenceFeature (sf[i]));
+}
+}this.setDatasetSequence (seq.getDatasetSequence ());
+if (this.datasetSequence == null && seq.getDBRef () != null) {
+var dbr = seq.getDBRef ();
+for (var i = 0; i < dbr.length; i++) {
+this.addDBRef ( new jalview.datamodel.DBRefEntry (dbr[i]));
+}
+}if (seq.getAnnotation () != null) {
+var sqann = seq.getAnnotation ();
+for (var i = 0; i < sqann.length; i++) {
+if (sqann[i] == null) {
+continue;
+}var found = (alAnnotation == null);
+if (!found) {
+for (var apos = 0; !found && apos < alAnnotation.length; apos++) {
+found = (alAnnotation[apos] === sqann[i]);
+}
+}if (found) {
+var newann =  new jalview.datamodel.AlignmentAnnotation (sqann[i]);
+this.addAlignmentAnnotation (newann);
+}}
+}if (seq.getPDBId () != null) {
+var ids = seq.getPDBId ();
+var e = ids.elements ();
+while (e.hasMoreElements ()) {
+this.addPDBId ( new jalview.datamodel.PDBEntry (e.nextElement ()));
+}
+}}, "jalview.datamodel.SequenceI,~A");
+Clazz.defineMethod (c$, "setSequenceFeatures", 
+function (features) {
+this.sequenceFeatures = features;
+}, "~A");
+Clazz.overrideMethod (c$, "addSequenceFeature", 
+function (sf) {
+if (this.sequenceFeatures == null) {
+this.sequenceFeatures =  new Array (0);
+}for (var i = 0; i < this.sequenceFeatures.length; i++) {
+if (this.sequenceFeatures[i].equals (sf)) {
+return;
+}}
+var temp =  new Array (this.sequenceFeatures.length + 1);
+System.arraycopy (this.sequenceFeatures, 0, temp, 0, this.sequenceFeatures.length);
+temp[this.sequenceFeatures.length] = sf;
+this.sequenceFeatures = temp;
+}, "jalview.datamodel.SequenceFeature");
+Clazz.overrideMethod (c$, "deleteFeature", 
+function (sf) {
+if (this.sequenceFeatures == null) {
+return;
+}var index = 0;
+for (index = 0; index < this.sequenceFeatures.length; index++) {
+if (this.sequenceFeatures[index].equals (sf)) {
+break;
+}}
+if (index == this.sequenceFeatures.length) {
+return;
+}var sfLength = this.sequenceFeatures.length;
+if (sfLength < 2) {
+this.sequenceFeatures = null;
+} else {
+var temp =  new Array (sfLength - 1);
+System.arraycopy (this.sequenceFeatures, 0, temp, 0, index);
+if (index < sfLength) {
+System.arraycopy (this.sequenceFeatures, index + 1, temp, index, this.sequenceFeatures.length - index - 1);
+}this.sequenceFeatures = temp;
+}}, "jalview.datamodel.SequenceFeature");
+Clazz.defineMethod (c$, "getSequenceFeatures", 
+function () {
+var features = this.sequenceFeatures;
+var seq = this;
+var count = 0;
+while (features == null && seq.getDatasetSequence () != null && count++ < 10) {
+seq = seq.getDatasetSequence ();
+features = (seq).sequenceFeatures;
+}
+return features;
+});
+Clazz.overrideMethod (c$, "addPDBId", 
+function (entry) {
+if (this.pdbIds == null) {
+this.pdbIds =  new java.util.Vector ();
+}if (this.pdbIds.contains (entry)) {
+jalview.datamodel.Sequence.updatePDBEntry (this.pdbIds.get (this.pdbIds.indexOf (entry)), entry);
+} else {
+this.pdbIds.addElement (entry);
+}}, "jalview.datamodel.PDBEntry");
+c$.updatePDBEntry = Clazz.defineMethod (c$, "updatePDBEntry", 
+($fz = function (oldEntry, newEntry) {
+if (newEntry.getFile () != null) {
+oldEntry.setFile (newEntry.getFile ());
+}}, $fz.isPrivate = true, $fz), "jalview.datamodel.PDBEntry,jalview.datamodel.PDBEntry");
+Clazz.defineMethod (c$, "setPDBId", 
+function (id) {
+this.pdbIds = id;
+}, "java.util.Vector");
+Clazz.defineMethod (c$, "getPDBId", 
+function () {
+return this.pdbIds;
+});
+Clazz.overrideMethod (c$, "getDisplayId", 
+function (jvsuffix) {
+var result =  new StringBuffer (this.name);
+if (jvsuffix) {
+result.append ("/" + this.start + "-" + this.end);
+}return result.toString ();
+}, "~B");
+Clazz.overrideMethod (c$, "setName", 
+function (name) {
+this.name = name;
+this.parseId ();
+}, "~S");
+Clazz.defineMethod (c$, "getName", 
+function () {
+return this.name;
+});
+Clazz.overrideMethod (c$, "setStart", 
+function (start) {
+this.start = start;
+}, "~N");
+Clazz.defineMethod (c$, "getStart", 
+function () {
+return this.start;
+});
+Clazz.overrideMethod (c$, "setEnd", 
+function (end) {
+this.end = end;
+}, "~N");
+Clazz.defineMethod (c$, "getEnd", 
+function () {
+return this.end;
+});
+Clazz.overrideMethod (c$, "getLength", 
+function () {
+return this.sequence.length;
+});
+Clazz.defineMethod (c$, "setSequence", 
+function (seq) {
+this.sequence = seq.toCharArray ();
+this.checkValidRange ();
+}, "~S");
+Clazz.defineMethod (c$, "getSequenceAsString", 
+function () {
+return  String.instantialize (this.sequence);
+});
+Clazz.defineMethod (c$, "getSequenceAsString", 
+function (start, end) {
+return  String.instantialize (this.getSequence (start, end));
+}, "~N,~N");
+Clazz.defineMethod (c$, "getSequence", 
+function () {
+return this.sequence;
+});
+Clazz.defineMethod (c$, "getSequence", 
+function (start, end) {
+if (start < 0) {
+start = 0;
+}if (start >= this.sequence.length) {
+return  Clazz.newCharArray (0, '\0');
+}if (end >= this.sequence.length) {
+end = this.sequence.length;
+}var reply =  Clazz.newCharArray (end - start, '\0');
+System.arraycopy (this.sequence, start, reply, 0, end - start);
+return reply;
+}, "~N,~N");
+Clazz.overrideMethod (c$, "getSubSequence", 
+function (start, end) {
+if (start < 0) {
+start = 0;
+}var seq = this.getSequence (start, end);
+if (seq.length == 0) {
+return null;
+}var nstart = this.findPosition (start);
+var nend = this.findPosition (end) - 1;
+var nseq =  new jalview.datamodel.Sequence (this.getName (), seq, nstart, nend);
+nseq.setDescription (this.description);
+if (this.datasetSequence != null) {
+nseq.setDatasetSequence (this.datasetSequence);
+} else {
+nseq.setDatasetSequence (this);
+}return nseq;
+}, "~N,~N");
+Clazz.overrideMethod (c$, "getCharAt", 
+function (i) {
+if (i < this.sequence.length) {
+return this.sequence[i];
+} else {
+return ' ';
+}}, "~N");
+Clazz.defineMethod (c$, "setDescription", 
+function (desc) {
+this.description = desc;
+}, "~S");
+Clazz.defineMethod (c$, "getDescription", 
+function () {
+return this.description;
+});
+Clazz.overrideMethod (c$, "findIndex", 
+function (pos) {
+var j = this.start;
+var i = 0;
+while ((i < this.sequence.length) && (j <= this.end) && (j <= pos)) {
+if (!jalview.util.Comparison.isGap (this.sequence[i])) {
+j++;
+}i++;
+}
+if ((j == this.end) && (j < pos)) {
+return this.end + 1;
+} else {
+return i;
+}}, "~N");
+Clazz.overrideMethod (c$, "findPosition", 
+function (i) {
+var j = 0;
+var pos = this.start;
+var seqlen = this.sequence.length;
+while ((j < i) && (j < seqlen)) {
+if (!jalview.util.Comparison.isGap (this.sequence[j])) {
+pos++;
+}j++;
+}
+return pos;
+}, "~N");
+Clazz.overrideMethod (c$, "gapMap", 
+function () {
+var seq = jalview.analysis.AlignSeq.extractGaps (jalview.util.Comparison.GapChars,  String.instantialize (this.sequence));
+var map =  Clazz.newIntArray (seq.length, 0);
+var j = 0;
+var p = 0;
+while (j < this.sequence.length) {
+if (!jalview.util.Comparison.isGap (this.sequence[j])) {
+map[p++] = j;
+}j++;
+}
+return map;
+});
+Clazz.overrideMethod (c$, "findPositionMap", 
+function () {
+var map =  Clazz.newIntArray (this.sequence.length, 0);
+var j = 0;
+var pos = this.start;
+var seqlen = this.sequence.length;
+while ((j < seqlen)) {
+map[j] = pos;
+if (!jalview.util.Comparison.isGap (this.sequence[j])) {
+pos++;
+}j++;
+}
+return map;
+});
+Clazz.overrideMethod (c$, "getInsertions", 
+function () {
+var map =  new java.util.ArrayList ();
+var lastj = -1;
+var j = 0;
+var pos = this.start;
+var seqlen = this.sequence.length;
+while ((j < seqlen)) {
+if (jalview.util.Comparison.isGap (this.sequence[j])) {
+if (lastj == -1) {
+lastj = j;
+}} else {
+if (lastj != -1) {
+map.add ( Clazz.newIntArray (-1, [lastj, j - 1]));
+lastj = -1;
+}}j++;
+}
+if (lastj != -1) {
+map.add ( Clazz.newIntArray (-1, [lastj, j - 1]));
+lastj = -1;
+}return map;
+});
+Clazz.overrideMethod (c$, "deleteChars", 
+function (i, j) {
+var newstart = this.start;
+var newend = this.end;
+if (i >= this.sequence.length || i < 0) {
+return;
+}var tmp = jalview.util.StringUtils.deleteChars (this.sequence, i, j);
+var createNewDs = false;
+var eindex = -1;
+var sindex = -1;
+var ecalc = false;
+var scalc = false;
+for (var s = i; s < j; s++) {
+if (jalview.schemes.ResidueProperties.aaIndex[this.sequence[s].charCodeAt (0)] != 23) {
+if (createNewDs) {
+newend--;
+} else {
+if (!scalc) {
+sindex = this.findIndex (this.start) - 1;
+scalc = true;
+}if (sindex == s) {
+newstart = this.findPosition (j);
+break;
+} else {
+if (!ecalc) {
+eindex = this.findIndex (this.end) - 1;
+ecalc = true;
+}if (eindex < j) {
+newend = this.findPosition (i - 1);
+break;
+} else {
+createNewDs = true;
+newend--;
+}}}}}
+if (createNewDs && this.datasetSequence != null) {
+var ds =  new jalview.datamodel.Sequence (this.datasetSequence);
+ds.deleteChars (i, j);
+this.datasetSequence = ds;
+}this.start = newstart;
+this.end = newend;
+this.sequence = tmp;
+}, "~N,~N");
+Clazz.defineMethod (c$, "insertCharAt", 
+function (i, length, c) {
+var tmp =  Clazz.newCharArray (this.sequence.length + length, '\0');
+if (i >= this.sequence.length) {
+System.arraycopy (this.sequence, 0, tmp, 0, this.sequence.length);
+i = this.sequence.length;
+} else {
+System.arraycopy (this.sequence, 0, tmp, 0, i);
+}var index = i;
+while (length > 0) {
+tmp[index++] = c;
+length--;
+}
+if (i < this.sequence.length) {
+System.arraycopy (this.sequence, i, tmp, index, this.sequence.length - i);
+}this.sequence = tmp;
+}, "~N,~N,~S");
+Clazz.defineMethod (c$, "insertCharAt", 
+function (i, c) {
+this.insertCharAt (i, 1, c);
+}, "~N,~S");
+Clazz.overrideMethod (c$, "getVamsasId", 
+function () {
+return this.vamsasId;
+});
+Clazz.overrideMethod (c$, "setVamsasId", 
+function (id) {
+this.vamsasId = id;
+}, "~S");
+Clazz.defineMethod (c$, "setDBRef", 
+function (dbref) {
+this.dbrefs = dbref;
+}, "~A");
+Clazz.defineMethod (c$, "getDBRef", 
+function () {
+if (this.dbrefs == null && this.datasetSequence != null && this !== this.datasetSequence) {
+return this.datasetSequence.getDBRef ();
+}return this.dbrefs;
+});
+Clazz.overrideMethod (c$, "addDBRef", 
+function (entry) {
+if (this.dbrefs == null) {
+this.dbrefs =  new Array (0);
+}var i;
+var iSize = this.dbrefs.length;
+for (i = 0; i < iSize; i++) {
+if (this.dbrefs[i].equalRef (entry)) {
+if (entry.getMap () != null) {
+if (this.dbrefs[i].getMap () == null) {
+this.dbrefs[i] = entry;
+}}return;
+}}
+var temp =  new Array (iSize + 1);
+System.arraycopy (this.dbrefs, 0, temp, 0, iSize);
+temp[temp.length - 1] = entry;
+this.dbrefs = temp;
+}, "jalview.datamodel.DBRefEntry");
+Clazz.defineMethod (c$, "setDatasetSequence", 
+function (seq) {
+this.datasetSequence = seq;
+}, "jalview.datamodel.SequenceI");
+Clazz.defineMethod (c$, "getDatasetSequence", 
+function () {
+return this.datasetSequence;
+});
+Clazz.defineMethod (c$, "getAnnotation", 
+function () {
+return this.annotation == null ? null : this.annotation.toArray ( new Array (this.annotation.size ()));
+});
+Clazz.overrideMethod (c$, "hasAnnotation", 
+function (ann) {
+return this.annotation == null ? false : this.annotation.contains (ann);
+}, "jalview.datamodel.AlignmentAnnotation");
+Clazz.defineMethod (c$, "addAlignmentAnnotation", 
+function (annotation) {
+if (this.annotation == null) {
+this.annotation =  new java.util.Vector ();
+}if (!this.annotation.contains (annotation)) {
+this.annotation.addElement (annotation);
+}annotation.setSequenceRef (this);
+}, "jalview.datamodel.AlignmentAnnotation");
+Clazz.overrideMethod (c$, "removeAlignmentAnnotation", 
+function (annotation) {
+if (this.annotation != null) {
+this.annotation.removeElement (annotation);
+if (this.annotation.size () == 0) {
+this.annotation = null;
+}}}, "jalview.datamodel.AlignmentAnnotation");
+Clazz.defineMethod (c$, "isValidDatasetSequence", 
+($fz = function () {
+if (this.datasetSequence != null) {
+return false;
+}for (var i = 0; i < this.sequence.length; i++) {
+if (jalview.util.Comparison.isGap (this.sequence[i])) {
+return false;
+}}
+return true;
+}, $fz.isPrivate = true, $fz));
+Clazz.overrideMethod (c$, "deriveSequence", 
+function () {
+var seq =  new jalview.datamodel.Sequence (this);
+if (this.datasetSequence != null) {
+seq.setDatasetSequence (this.datasetSequence);
+} else {
+if (this.isValidDatasetSequence ()) {
+seq.setDatasetSequence (this);
+} else {
+var ds = seq;
+ds.setSequence (jalview.analysis.AlignSeq.extractGaps (jalview.util.Comparison.GapChars,  String.instantialize (this.sequence)));
+this.setDatasetSequence (ds);
+ds.setSequenceFeatures (this.getSequenceFeatures ());
+seq = this;
+}}return seq;
+});
+Clazz.overrideMethod (c$, "createDatasetSequence", 
+function () {
+if (this.datasetSequence == null) {
+this.datasetSequence =  new jalview.datamodel.Sequence (this.getName (), jalview.analysis.AlignSeq.extractGaps (jalview.util.Comparison.GapChars, this.getSequenceAsString ()), this.getStart (), this.getEnd ());
+this.datasetSequence.setSequenceFeatures (this.getSequenceFeatures ());
+this.datasetSequence.setDescription (this.getDescription ());
+this.setSequenceFeatures (null);
+this.datasetSequence.setDBRef (this.getDBRef ());
+this.setDBRef (null);
+this.datasetSequence.setPDBId (this.getPDBId ());
+this.setPDBId (null);
+this.datasetSequence.updatePDBIds ();
+if (this.annotation != null) {
+for (var aa, $aa = this.annotation.iterator (); $aa.hasNext () && ((aa = $aa.next ()) || true);) {
+var _aa =  new jalview.datamodel.AlignmentAnnotation (aa);
+_aa.sequenceRef = this.datasetSequence;
+_aa.adjustForAlignment ();
+this.datasetSequence.addAlignmentAnnotation (_aa);
+}
+}}return this.datasetSequence;
+});
+Clazz.overrideMethod (c$, "setAlignmentAnnotation", 
+function (annotations) {
+if (this.annotation != null) {
+this.annotation.removeAllElements ();
+}if (annotations != null) {
+for (var i = 0; i < annotations.length; i++) {
+if (annotations[i] != null) {
+this.addAlignmentAnnotation (annotations[i]);
+}}
+}}, "~A");
+Clazz.defineMethod (c$, "getAnnotation", 
+function (label) {
+if (this.annotation == null || this.annotation.size () == 0) {
+return null;
+}var subset =  new java.util.Vector ();
+var e = this.annotation.elements ();
+while (e.hasMoreElements ()) {
+var ann = e.nextElement ();
+if (ann.label != null && ann.label.equals (label)) {
+subset.addElement (ann);
+}}
+if (subset.size () == 0) {
+return null;
+}var anns =  new Array (subset.size ());
+var i = 0;
+e = subset.elements ();
+while (e.hasMoreElements ()) {
+anns[i++] = e.nextElement ();
+}
+subset.removeAllElements ();
+return anns;
+}, "~S");
+Clazz.defineMethod (c$, "updatePDBIds", 
+function () {
+if (this.datasetSequence != null) {
+return this.datasetSequence.updatePDBIds ();
+}if (this.dbrefs == null || this.dbrefs.length == 0) {
+return false;
+}var newpdb =  new java.util.Vector ();
+for (var i = 0; i < this.dbrefs.length; i++) {
+if (jalview.datamodel.DBRefSource.PDB.equals (this.dbrefs[i].getSource ())) {
+var pdbe =  new jalview.datamodel.PDBEntry ();
+pdbe.setId (this.dbrefs[i].getAccessionId ());
+if (this.pdbIds == null || this.pdbIds.size () == 0) {
+newpdb.addElement (pdbe);
+} else {
+var en = this.pdbIds.elements ();
+var matched = false;
+while (!matched && en.hasMoreElements ()) {
+var anentry = en.nextElement ();
+if (anentry.getId ().equals (pdbe.getId ())) {
+matched = true;
+}}
+if (!matched) {
+newpdb.addElement (pdbe);
+}}}}
+if (newpdb.size () > 0) {
+var en = newpdb.elements ();
+while (en.hasMoreElements ()) {
+this.addPDBId (en.nextElement ());
+}
+return true;
+}return false;
+});
+Clazz.defineMethod (c$, "transferAnnotation", 
+function (entry, mp) {
+if (this.datasetSequence != null) {
+this.datasetSequence.transferAnnotation (entry, mp);
+return;
+}if (entry.getDatasetSequence () != null) {
+this.transferAnnotation (entry.getDatasetSequence (), mp);
+return;
+}if (entry.getSequenceFeatures () != null) {
+var sfs = entry.getSequenceFeatures ();
+for (var si = 0; si < sfs.length; si++) {
+var sf = (mp != null) ? mp.locateFeature (sfs[si]) :  Clazz.newArray (-1, [ new jalview.datamodel.SequenceFeature (sfs[si])]);
+if (sf != null && sf.length > 0) {
+for (var sfi = 0; sfi < sf.length; sfi++) {
+this.addSequenceFeature (sf[sfi]);
+}
+}}
+}if (entry.getPDBId () != null) {
+var e = entry.getPDBId ().elements ();
+while (e.hasMoreElements ()) {
+var pdb = e.nextElement ();
+this.addPDBId (pdb);
+}
+}var entryRefs = entry.getDBRef ();
+if (entryRefs != null) {
+for (var r = 0; r < entryRefs.length; r++) {
+var newref =  new jalview.datamodel.DBRefEntry (entryRefs[r]);
+if (newref.getMap () != null && mp != null) {
+}this.addDBRef (newref);
+}
+}}, "jalview.datamodel.SequenceI,jalview.datamodel.Mapping");
+Clazz.overrideMethod (c$, "getIndex", 
+function () {
+return this.index;
+});
+Clazz.overrideMethod (c$, "setIndex", 
+function (value) {
+this.index = value;
+}, "~N");
+Clazz.overrideMethod (c$, "setRNA", 
+function (r) {
+this.rna = r;
+}, "jalview.jsdev.api.VarnaRNA");
+Clazz.overrideMethod (c$, "getRNA", 
+function () {
+return this.rna;
+});
+Clazz.overrideMethod (c$, "getAlignmentAnnotations", 
+function (calcId, label) {
+var result =  new java.util.ArrayList ();
+if (this.annotation != null) {
+for (var ann, $ann = this.annotation.iterator (); $ann.hasNext () && ((ann = $ann.next ()) || true);) {
+if (ann.calcId != null && ann.calcId.equals (calcId) && ann.label != null && ann.label.equals (label)) {
+result.add (ann);
+}}
+}return result;
+}, "~S,~S");
+});