Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / MCview / PDBChain.js
index b58d3dd..727e98e 100644 (file)
-Clazz.declarePackage ("MCview");\r
-Clazz.load (["java.util.Vector"], "MCview.PDBChain", ["MCview.Bond", "$.Residue", "jalview.datamodel.AlignmentAnnotation", "$.Annotation", "$.Sequence", "$.SequenceFeature", "jalview.schemes.ResidueProperties", "java.awt.Color", "java.lang.StringBuilder"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.id = null;\r
-this.bonds = null;\r
-this.atoms = null;\r
-this.residues = null;\r
-this.offset = 0;\r
-this.sequence = null;\r
-this.shadow = null;\r
-this.isNa = false;\r
-this.isVisible = true;\r
-this.pdbstart = 0;\r
-this.pdbend = 0;\r
-this.seqstart = 0;\r
-this.seqend = 0;\r
-this.pdbid = "";\r
-this.newline = null;\r
-this.shadowMap = null;\r
-Clazz.instantialize (this, arguments);\r
-}, MCview, "PDBChain");\r
-Clazz.prepareFields (c$, function () {\r
-this.bonds =  new java.util.Vector ();\r
-this.atoms =  new java.util.Vector ();\r
-this.residues =  new java.util.Vector ();\r
-this.newline = System.getProperty ("line.separator");\r
-});\r
-Clazz.makeConstructor (c$, \r
-function (pdbid, id) {\r
-this.pdbid = pdbid.toLowerCase ();\r
-this.id = id;\r
-}, "~S,~S");\r
-Clazz.defineMethod (c$, "setNewlineString", \r
-function (nl) {\r
-this.newline = nl;\r
-}, "~S");\r
-Clazz.defineMethod (c$, "getNewlineString", \r
-function () {\r
-return this.newline;\r
-});\r
-Clazz.defineMethod (c$, "print", \r
-function () {\r
-var tmp =  new StringBuilder (256);\r
-for (var b, $b = this.bonds.iterator (); $b.hasNext () && ((b = $b.next ()) || true);) {\r
-tmp.append (b.at1.resName).append (" ").append (b.at1.resNumber).append (" ").append (this.offset).append (this.newline);\r
-}\r
-return tmp.toString ();\r
-});\r
-Clazz.defineMethod (c$, "makeExactMapping", \r
-function (as, s1) {\r
-var pdbpos = as.getSeq2Start () - 2;\r
-var alignpos = s1.getStart () + as.getSeq1Start () - 3;\r
-for (var atom, $atom = this.atoms.iterator (); $atom.hasNext () && ((atom = $atom.next ()) || true);) {\r
-atom.alignmentMapping = -1;\r
-}\r
-for (var i = 0; i < as.astr1.length; i++) {\r
-if (as.astr1.charAt (i) != '-') {\r
-alignpos++;\r
-}if (as.astr2.charAt (i) != '-') {\r
-pdbpos++;\r
-}if (as.astr1.charAt (i) == as.astr2.charAt (i)) {\r
-var res = this.residues.elementAt (pdbpos);\r
-for (var atom, $atom = res.atoms.iterator (); $atom.hasNext () && ((atom = $atom.next ()) || true);) {\r
-atom.alignmentMapping = alignpos;\r
-}\r
-}}\r
-}, "jalview.analysis.AlignSeq,jalview.datamodel.SequenceI");\r
-Clazz.defineMethod (c$, "transferRESNUMFeatures", \r
-function (seq, status) {\r
-var sq = seq;\r
-while (sq != null && sq.getDatasetSequence () != null) {\r
-sq = sq.getDatasetSequence ();\r
-if (sq === this.sequence) {\r
-return null;\r
-}}\r
-if (status == null) {\r
-status = "IEA:jalview";\r
-}var features = this.sequence.getSequenceFeatures ();\r
-for (var i = 0; i < features.length; i++) {\r
-if (features[i].getFeatureGroup ().equals (this.pdbid)) {\r
-var tx =  new jalview.datamodel.SequenceFeature (features[i]);\r
-tx.setBegin (1 + this.residues.elementAt (tx.getBegin () - this.offset).atoms.elementAt (0).alignmentMapping);\r
-tx.setEnd (1 + this.residues.elementAt (tx.getEnd () - this.offset).atoms.elementAt (0).alignmentMapping);\r
-tx.setStatus (status + ((tx.getStatus () == null || tx.getStatus ().length == 0) ? "" : ":" + tx.getStatus ()));\r
-if (tx.begin != 0 && tx.end != 0) {\r
-sq.addSequenceFeature (tx);\r
-}}}\r
-return features;\r
-}, "jalview.datamodel.SequenceI,~S");\r
-Clazz.defineMethod (c$, "makeCaBondList", \r
-function () {\r
-var na = false;\r
-var numNa = 0;\r
-for (var i = 0; i < (this.residues.size () - 1); i++) {\r
-var tmpres = this.residues.elementAt (i);\r
-var tmpres2 = this.residues.elementAt (i + 1);\r
-var at1 = tmpres.findAtom ("CA");\r
-var at2 = tmpres2.findAtom ("CA");\r
-na = false;\r
-if ((at1 == null) && (at2 == null)) {\r
-na = true;\r
-at1 = tmpres.findAtom ("P");\r
-at2 = tmpres2.findAtom ("P");\r
-}if ((at1 != null) && (at2 != null)) {\r
-if (at1.chain.equals (at2.chain)) {\r
-if (na) {\r
-numNa++;\r
-}this.makeBond (at1, at2);\r
-}} else {\r
-System.out.println ("not found " + i);\r
-}}\r
-if (this.residues.size () > 0 && (Clazz.doubleToInt (numNa / (this.residues.size () - 1)) > 0.99)) {\r
-this.isNa = true;\r
-}});\r
-Clazz.defineMethod (c$, "makeBond", \r
-function (at1, at2) {\r
-this.bonds.addElement ( new MCview.Bond (at1, at2));\r
-}, "MCview.Atom,MCview.Atom");\r
-Clazz.defineMethod (c$, "makeResidueList", \r
-function (visibleChainAnnotation) {\r
-var count = 0;\r
-var symbol;\r
-var deoxyn = false;\r
-var nucleotide = false;\r
-var seq =  new StringBuilder (256);\r
-var resFeatures =  new java.util.Vector ();\r
-var resAnnotation =  new java.util.Vector ();\r
-var i;\r
-var iSize = this.atoms.size () - 1;\r
-var resNumber = -1;\r
-for (i = 0; i <= iSize; i++) {\r
-var tmp = this.atoms.elementAt (i);\r
-resNumber = tmp.resNumber;\r
-var res = resNumber;\r
-if (i == 0) {\r
-this.offset = resNumber;\r
-}var resAtoms =  new java.util.Vector ();\r
-while ((resNumber == res) && (i < this.atoms.size ())) {\r
-resAtoms.add (this.atoms.elementAt (i));\r
-i++;\r
-if (i < this.atoms.size ()) {\r
-resNumber = this.atoms.elementAt (i).resNumber;\r
-} else {\r
-resNumber++;\r
-}}\r
-i--;\r
-this.residues.addElement ( new MCview.Residue (resAtoms, resNumber - 1, count));\r
-var tmpres = this.residues.lastElement ();\r
-var tmpat = tmpres.atoms.get (0);\r
-var sf =  new jalview.datamodel.SequenceFeature ("RESNUM", tmpat.resName + ":" + tmpat.resNumIns + " " + this.pdbid + this.id, "", this.offset + count, this.offset + count, this.pdbid);\r
-resFeatures.addElement (sf);\r
-resAnnotation.addElement ( new jalview.datamodel.Annotation (tmpat.tfactor));\r
-if ((symbol = jalview.schemes.ResidueProperties.getAA3Hash ().get (tmpat.resName)) == null) {\r
-var nucname = tmpat.resName.trim ();\r
-deoxyn = nucname.length == 2 && jalview.schemes.ResidueProperties.aaIndex[nucname.charCodeAt (0)] == jalview.schemes.ResidueProperties.aaIndex['D'.charCodeAt (0)];\r
-if (tmpat.name.equalsIgnoreCase ("CA") || jalview.schemes.ResidueProperties.nucleotideIndex[nucname.charCodeAt ((deoxyn ? 1 : 0))] == -1) {\r
-seq.append ("X");\r
-} else {\r
-nucleotide = true;\r
-seq.append (nucname.charAt ((deoxyn ? 1 : 0)));\r
-}} else {\r
-if (nucleotide) {\r
-System.err.println ("Warning: mixed nucleotide and amino acid chain.. its gonna do bad things to you!");\r
-}seq.append (jalview.schemes.ResidueProperties.aa[(symbol).intValue ()]);\r
-}count++;\r
-}\r
-if (this.id.length < 1) {\r
-this.id = " ";\r
-}this.isNa = nucleotide;\r
-this.sequence =  new jalview.datamodel.Sequence (this.id, seq.toString (), this.offset, resNumber - 1);\r
-for (i = 0, iSize = resFeatures.size (); i < iSize; i++) {\r
-this.sequence.addSequenceFeature (resFeatures.elementAt (i));\r
-resFeatures.setElementAt (null, i);\r
-}\r
-if (visibleChainAnnotation) {\r
-var annots =  new Array (resAnnotation.size ());\r
-var max = 0;\r
-for (i = 0, iSize = annots.length; i < iSize; i++) {\r
-annots[i] = resAnnotation.elementAt (i);\r
-if (annots[i].value > max) {\r
-max = annots[i].value;\r
-}resAnnotation.setElementAt (null, i);\r
-}\r
-var tfactorann =  new jalview.datamodel.AlignmentAnnotation ("Temperature Factor", "Temperature Factor for " + this.pdbid + this.id, annots, 0, max, 2);\r
-tfactorann.setSequenceRef (this.sequence);\r
-this.sequence.addAlignmentAnnotation (tfactorann);\r
-}}, "~B");\r
-Clazz.defineMethod (c$, "setChargeColours", \r
-function () {\r
-for (var b, $b = this.bonds.iterator (); $b.hasNext () && ((b = $b.next ()) || true);) {\r
-if (b.at1 != null && b.at2 != null) {\r
-b.startCol = MCview.PDBChain.getChargeColour (b.at1.resName);\r
-b.endCol = MCview.PDBChain.getChargeColour (b.at2.resName);\r
-} else {\r
-b.startCol = java.awt.Color.gray;\r
-b.endCol = java.awt.Color.gray;\r
-}}\r
-});\r
-c$.getChargeColour = Clazz.defineMethod (c$, "getChargeColour", \r
-function (resName) {\r
-var result = java.awt.Color.lightGray;\r
-if ("ASP".equals (resName) || "GLU".equals (resName)) {\r
-result = java.awt.Color.red;\r
-} else if ("LYS".equals (resName) || "ARG".equals (resName)) {\r
-result = java.awt.Color.blue;\r
-} else if ("CYS".equals (resName)) {\r
-result = java.awt.Color.yellow;\r
-}return result;\r
-}, "~S");\r
-Clazz.defineMethod (c$, "setChainColours", \r
-function (cs) {\r
-var index;\r
-for (var b, $b = this.bonds.iterator (); $b.hasNext () && ((b = $b.next ()) || true);) {\r
-try {\r
-index = jalview.schemes.ResidueProperties.aa3Hash.get (b.at1.resName).intValue ();\r
-b.startCol = cs.findColour (jalview.schemes.ResidueProperties.aa[index].charAt (0));\r
-index = jalview.schemes.ResidueProperties.aa3Hash.get (b.at2.resName).intValue ();\r
-b.endCol = cs.findColour (jalview.schemes.ResidueProperties.aa[index].charAt (0));\r
-} catch (e) {\r
-if (Clazz.exceptionOf (e, Exception)) {\r
-b.startCol = java.awt.Color.gray;\r
-b.endCol = java.awt.Color.gray;\r
-} else {\r
-throw e;\r
-}\r
-}\r
-}\r
-}, "jalview.schemes.ColourSchemeI");\r
-Clazz.defineMethod (c$, "setChainColours", \r
-function (col) {\r
-for (var b, $b = this.bonds.iterator (); $b.hasNext () && ((b = $b.next ()) || true);) {\r
-b.startCol = col;\r
-b.endCol = col;\r
-}\r
-}, "java.awt.Color");\r
-Clazz.defineMethod (c$, "transferResidueAnnotation", \r
-function (mapping, sqmpping) {\r
-var sq = mapping.getSequence ();\r
-var dsq = sq;\r
-if (sq != null) {\r
-while (dsq.getDatasetSequence () != null) {\r
-dsq = dsq.getDatasetSequence ();\r
-}\r
-if (this.shadow != null && this.shadow.getAnnotation () != null) {\r
-for (var ana, $ana = 0, $$ana = this.shadow.getAnnotation (); $ana < $$ana.length && ((ana = $$ana[$ana]) || true); $ana++) {\r
-var transfer = sq.getAlignmentAnnotations (ana.getCalcId (), ana.label);\r
-if (transfer == null || transfer.size () == 0) {\r
-ana =  new jalview.datamodel.AlignmentAnnotation (ana);\r
-ana.liftOver (this.sequence, this.shadowMap);\r
-ana.liftOver (dsq, sqmpping);\r
-dsq.addAlignmentAnnotation (ana);\r
-} else {\r
-continue;\r
-}}\r
-} else {\r
-if (this.sequence != null && this.sequence.getAnnotation () != null) {\r
-for (var ana, $ana = 0, $$ana = this.sequence.getAnnotation (); $ana < $$ana.length && ((ana = $$ana[$ana]) || true); $ana++) {\r
-var transfer = sq.getAlignmentAnnotations (ana.getCalcId (), ana.label);\r
-if (transfer == null || transfer.size () == 0) {\r
-ana =  new jalview.datamodel.AlignmentAnnotation (ana);\r
-ana.liftOver (dsq, sqmpping);\r
-} else {\r
-continue;\r
-}}\r
-}}if (false) {\r
-var min = -1;\r
-var max = 0;\r
-var an =  new Array (sq.getEnd () - sq.getStart () + 1);\r
-for (var i = sq.getStart (), j = sq.getEnd (), k = 0; i <= j; i++, k++) {\r
-var prn = mapping.getPDBResNum (k + 1);\r
-an[k] =  new jalview.datamodel.Annotation (prn);\r
-if (min == -1) {\r
-min = k;\r
-max = k;\r
-} else {\r
-if (min > k) {\r
-min = k;\r
-} else if (max < k) {\r
-max = k;\r
-}}}\r
-sq.addAlignmentAnnotation ( new jalview.datamodel.AlignmentAnnotation ("PDB.RESNUM", "PDB Residue Numbering for " + this.pdbid + ":" + this.id, an, min, max, 2));\r
-}}}, "jalview.structure.StructureMapping,jalview.datamodel.Mapping");\r
-Clazz.defineStatics (c$,\r
-"PDBFILEFEATURE", "PDBFile",\r
-"IEASTATUS", "IEA:jalview");\r
-});\r
+Clazz.declarePackage ("MCview");
+Clazz.load (["java.util.Vector"], "MCview.PDBChain", ["MCview.Bond", "$.Residue", "jalview.datamodel.AlignmentAnnotation", "$.Annotation", "$.Sequence", "$.SequenceFeature", "jalview.schemes.ResidueProperties", "java.awt.Color", "java.lang.StringBuilder"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.id = null;
+this.bonds = null;
+this.atoms = null;
+this.residues = null;
+this.offset = 0;
+this.sequence = null;
+this.shadow = null;
+this.isNa = false;
+this.isVisible = true;
+this.pdbstart = 0;
+this.pdbend = 0;
+this.seqstart = 0;
+this.seqend = 0;
+this.pdbid = "";
+this.newline = null;
+this.shadowMap = null;
+Clazz.instantialize (this, arguments);
+}, MCview, "PDBChain");
+Clazz.prepareFields (c$, function () {
+this.bonds =  new java.util.Vector ();
+this.atoms =  new java.util.Vector ();
+this.residues =  new java.util.Vector ();
+this.newline = System.getProperty ("line.separator");
+});
+Clazz.makeConstructor (c$, 
+function (pdbid, id) {
+this.pdbid = pdbid.toLowerCase ();
+this.id = id;
+}, "~S,~S");
+Clazz.defineMethod (c$, "setNewlineString", 
+function (nl) {
+this.newline = nl;
+}, "~S");
+Clazz.defineMethod (c$, "getNewlineString", 
+function () {
+return this.newline;
+});
+Clazz.defineMethod (c$, "print", 
+function () {
+var tmp =  new StringBuilder (256);
+for (var b, $b = this.bonds.iterator (); $b.hasNext () && ((b = $b.next ()) || true);) {
+tmp.append (b.at1.resName).append (" ").append (b.at1.resNumber).append (" ").append (this.offset).append (this.newline);
+}
+return tmp.toString ();
+});
+Clazz.defineMethod (c$, "makeExactMapping", 
+function (as, s1) {
+var pdbpos = as.getSeq2Start () - 2;
+var alignpos = s1.getStart () + as.getSeq1Start () - 3;
+for (var atom, $atom = this.atoms.iterator (); $atom.hasNext () && ((atom = $atom.next ()) || true);) {
+atom.alignmentMapping = -1;
+}
+for (var i = 0; i < as.astr1.length; i++) {
+if (as.astr1.charAt (i) != '-') {
+alignpos++;
+}if (as.astr2.charAt (i) != '-') {
+pdbpos++;
+}if (as.astr1.charAt (i) == as.astr2.charAt (i)) {
+var res = this.residues.elementAt (pdbpos);
+for (var atom, $atom = res.atoms.iterator (); $atom.hasNext () && ((atom = $atom.next ()) || true);) {
+atom.alignmentMapping = alignpos;
+}
+}}
+}, "jalview.analysis.AlignSeq,jalview.datamodel.SequenceI");
+Clazz.defineMethod (c$, "transferRESNUMFeatures", 
+function (seq, status) {
+var sq = seq;
+while (sq != null && sq.getDatasetSequence () != null) {
+sq = sq.getDatasetSequence ();
+if (sq === this.sequence) {
+return null;
+}}
+if (status == null) {
+status = "IEA:jalview";
+}var features = this.sequence.getSequenceFeatures ();
+for (var i = 0; i < features.length; i++) {
+if (features[i].getFeatureGroup ().equals (this.pdbid)) {
+var tx =  new jalview.datamodel.SequenceFeature (features[i]);
+tx.setBegin (1 + this.residues.elementAt (tx.getBegin () - this.offset).atoms.elementAt (0).alignmentMapping);
+tx.setEnd (1 + this.residues.elementAt (tx.getEnd () - this.offset).atoms.elementAt (0).alignmentMapping);
+tx.setStatus (status + ((tx.getStatus () == null || tx.getStatus ().length == 0) ? "" : ":" + tx.getStatus ()));
+if (tx.begin != 0 && tx.end != 0) {
+sq.addSequenceFeature (tx);
+}}}
+return features;
+}, "jalview.datamodel.SequenceI,~S");
+Clazz.defineMethod (c$, "makeCaBondList", 
+function () {
+var na = false;
+var numNa = 0;
+for (var i = 0; i < (this.residues.size () - 1); i++) {
+var tmpres = this.residues.elementAt (i);
+var tmpres2 = this.residues.elementAt (i + 1);
+var at1 = tmpres.findAtom ("CA");
+var at2 = tmpres2.findAtom ("CA");
+na = false;
+if ((at1 == null) && (at2 == null)) {
+na = true;
+at1 = tmpres.findAtom ("P");
+at2 = tmpres2.findAtom ("P");
+}if ((at1 != null) && (at2 != null)) {
+if (at1.chain.equals (at2.chain)) {
+if (na) {
+numNa++;
+}this.makeBond (at1, at2);
+}} else {
+System.out.println ("not found " + i);
+}}
+if (this.residues.size () > 0 && (Clazz.doubleToInt (numNa / (this.residues.size () - 1)) > 0.99)) {
+this.isNa = true;
+}});
+Clazz.defineMethod (c$, "makeBond", 
+function (at1, at2) {
+this.bonds.addElement ( new MCview.Bond (at1, at2));
+}, "MCview.Atom,MCview.Atom");
+Clazz.defineMethod (c$, "makeResidueList", 
+function (visibleChainAnnotation) {
+var count = 0;
+var symbol;
+var deoxyn = false;
+var nucleotide = false;
+var seq =  new StringBuilder (256);
+var resFeatures =  new java.util.Vector ();
+var resAnnotation =  new java.util.Vector ();
+var i;
+var iSize = this.atoms.size () - 1;
+var resNumber = -1;
+for (i = 0; i <= iSize; i++) {
+var tmp = this.atoms.elementAt (i);
+resNumber = tmp.resNumber;
+var res = resNumber;
+if (i == 0) {
+this.offset = resNumber;
+}var resAtoms =  new java.util.Vector ();
+while ((resNumber == res) && (i < this.atoms.size ())) {
+resAtoms.add (this.atoms.elementAt (i));
+i++;
+if (i < this.atoms.size ()) {
+resNumber = this.atoms.elementAt (i).resNumber;
+} else {
+resNumber++;
+}}
+i--;
+this.residues.addElement ( new MCview.Residue (resAtoms, resNumber - 1, count));
+var tmpres = this.residues.lastElement ();
+var tmpat = tmpres.atoms.get (0);
+var sf =  new jalview.datamodel.SequenceFeature ("RESNUM", tmpat.resName + ":" + tmpat.resNumIns + " " + this.pdbid + this.id, "", this.offset + count, this.offset + count, this.pdbid);
+resFeatures.addElement (sf);
+resAnnotation.addElement ( new jalview.datamodel.Annotation (tmpat.tfactor));
+if ((symbol = jalview.schemes.ResidueProperties.getAA3Hash ().get (tmpat.resName)) == null) {
+var nucname = tmpat.resName.trim ();
+deoxyn = nucname.length == 2 && jalview.schemes.ResidueProperties.aaIndex[nucname.charCodeAt (0)] == jalview.schemes.ResidueProperties.aaIndex['D'.charCodeAt (0)];
+if (tmpat.name.equalsIgnoreCase ("CA") || jalview.schemes.ResidueProperties.nucleotideIndex[nucname.charCodeAt ((deoxyn ? 1 : 0))] == -1) {
+seq.append ("X");
+} else {
+nucleotide = true;
+seq.append (nucname.charAt ((deoxyn ? 1 : 0)));
+}} else {
+if (nucleotide) {
+System.err.println ("Warning: mixed nucleotide and amino acid chain.. its gonna do bad things to you!");
+}seq.append (jalview.schemes.ResidueProperties.aa[(symbol).intValue ()]);
+}count++;
+}
+if (this.id.length < 1) {
+this.id = " ";
+}this.isNa = nucleotide;
+this.sequence =  new jalview.datamodel.Sequence (this.id, seq.toString (), this.offset, resNumber - 1);
+for (i = 0, iSize = resFeatures.size (); i < iSize; i++) {
+this.sequence.addSequenceFeature (resFeatures.elementAt (i));
+resFeatures.setElementAt (null, i);
+}
+if (visibleChainAnnotation) {
+var annots =  new Array (resAnnotation.size ());
+var max = 0;
+for (i = 0, iSize = annots.length; i < iSize; i++) {
+annots[i] = resAnnotation.elementAt (i);
+if (annots[i].value > max) {
+max = annots[i].value;
+}resAnnotation.setElementAt (null, i);
+}
+var tfactorann =  new jalview.datamodel.AlignmentAnnotation ("Temperature Factor", "Temperature Factor for " + this.pdbid + this.id, annots, 0, max, 2);
+tfactorann.setSequenceRef (this.sequence);
+this.sequence.addAlignmentAnnotation (tfactorann);
+}}, "~B");
+Clazz.defineMethod (c$, "setChargeColours", 
+function () {
+for (var b, $b = this.bonds.iterator (); $b.hasNext () && ((b = $b.next ()) || true);) {
+if (b.at1 != null && b.at2 != null) {
+b.startCol = MCview.PDBChain.getChargeColour (b.at1.resName);
+b.endCol = MCview.PDBChain.getChargeColour (b.at2.resName);
+} else {
+b.startCol = java.awt.Color.gray;
+b.endCol = java.awt.Color.gray;
+}}
+});
+c$.getChargeColour = Clazz.defineMethod (c$, "getChargeColour", 
+function (resName) {
+var result = java.awt.Color.lightGray;
+if ("ASP".equals (resName) || "GLU".equals (resName)) {
+result = java.awt.Color.red;
+} else if ("LYS".equals (resName) || "ARG".equals (resName)) {
+result = java.awt.Color.blue;
+} else if ("CYS".equals (resName)) {
+result = java.awt.Color.yellow;
+}return result;
+}, "~S");
+Clazz.defineMethod (c$, "setChainColours", 
+function (cs) {
+var index;
+for (var b, $b = this.bonds.iterator (); $b.hasNext () && ((b = $b.next ()) || true);) {
+try {
+index = jalview.schemes.ResidueProperties.aa3Hash.get (b.at1.resName).intValue ();
+b.startCol = cs.findColour (jalview.schemes.ResidueProperties.aa[index].charAt (0));
+index = jalview.schemes.ResidueProperties.aa3Hash.get (b.at2.resName).intValue ();
+b.endCol = cs.findColour (jalview.schemes.ResidueProperties.aa[index].charAt (0));
+} catch (e) {
+if (Clazz.exceptionOf (e, Exception)) {
+b.startCol = java.awt.Color.gray;
+b.endCol = java.awt.Color.gray;
+} else {
+throw e;
+}
+}
+}
+}, "jalview.schemes.ColourSchemeI");
+Clazz.defineMethod (c$, "setChainColours", 
+function (col) {
+for (var b, $b = this.bonds.iterator (); $b.hasNext () && ((b = $b.next ()) || true);) {
+b.startCol = col;
+b.endCol = col;
+}
+}, "java.awt.Color");
+Clazz.defineMethod (c$, "transferResidueAnnotation", 
+function (mapping, sqmpping) {
+var sq = mapping.getSequence ();
+var dsq = sq;
+if (sq != null) {
+while (dsq.getDatasetSequence () != null) {
+dsq = dsq.getDatasetSequence ();
+}
+if (this.shadow != null && this.shadow.getAnnotation () != null) {
+for (var ana, $ana = 0, $$ana = this.shadow.getAnnotation (); $ana < $$ana.length && ((ana = $$ana[$ana]) || true); $ana++) {
+var transfer = sq.getAlignmentAnnotations (ana.getCalcId (), ana.label);
+if (transfer == null || transfer.size () == 0) {
+ana =  new jalview.datamodel.AlignmentAnnotation (ana);
+ana.liftOver (this.sequence, this.shadowMap);
+ana.liftOver (dsq, sqmpping);
+dsq.addAlignmentAnnotation (ana);
+} else {
+continue;
+}}
+} else {
+if (this.sequence != null && this.sequence.getAnnotation () != null) {
+for (var ana, $ana = 0, $$ana = this.sequence.getAnnotation (); $ana < $$ana.length && ((ana = $$ana[$ana]) || true); $ana++) {
+var transfer = sq.getAlignmentAnnotations (ana.getCalcId (), ana.label);
+if (transfer == null || transfer.size () == 0) {
+ana =  new jalview.datamodel.AlignmentAnnotation (ana);
+ana.liftOver (dsq, sqmpping);
+} else {
+continue;
+}}
+}}if (false) {
+var min = -1;
+var max = 0;
+var an =  new Array (sq.getEnd () - sq.getStart () + 1);
+for (var i = sq.getStart (), j = sq.getEnd (), k = 0; i <= j; i++, k++) {
+var prn = mapping.getPDBResNum (k + 1);
+an[k] =  new jalview.datamodel.Annotation (prn);
+if (min == -1) {
+min = k;
+max = k;
+} else {
+if (min > k) {
+min = k;
+} else if (max < k) {
+max = k;
+}}}
+sq.addAlignmentAnnotation ( new jalview.datamodel.AlignmentAnnotation ("PDB.RESNUM", "PDB Residue Numbering for " + this.pdbid + ":" + this.id, an, min, max, 2));
+}}}, "jalview.structure.StructureMapping,jalview.datamodel.Mapping");
+Clazz.defineStatics (c$,
+"PDBFILEFEATURE", "PDBFile",
+"IEASTATUS", "IEA:jalview");
+});