JAL-1807 includes ?j2sdebug flag and DebugJS._(msg)
[jalviewjs.git] / bin / MCview / PDBfile.js
index dfc40cc..c6af5ca 100644 (file)
-Clazz.declarePackage ("MCview");\r
-Clazz.load (["jalview.io.AlignFile"], "MCview.PDBfile", ["MCview.Atom", "$.PDBChain", "jalview.analysis.AlignSeq", "jalview.datamodel.Alignment", "$.AlignmentI", "$.PDBEntry", "jalview.io.FileParse", "jalview.util.MessageManager", "java.awt.Color", "java.io.IOException", "java.util.ArrayList", "$.Hashtable", "$.Vector"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.chains = null;\r
-this.id = null;\r
-this.visibleChainAnnotation = false;\r
-this.$predictSecondaryStructure = true;\r
-this.externalSecondaryStructure = false;\r
-Clazz.instantialize (this, arguments);\r
-}, MCview, "PDBfile", jalview.io.AlignFile);\r
-Clazz.makeConstructor (c$, \r
-function (addAlignmentAnnotations, predictSecondaryStructure, externalSecStr) {\r
-Clazz.superConstructor (this, MCview.PDBfile);\r
-this.visibleChainAnnotation = addAlignmentAnnotations;\r
-this.$predictSecondaryStructure = predictSecondaryStructure;\r
-this.externalSecondaryStructure = externalSecStr;\r
-}, "~B,~B,~B");\r
-Clazz.makeConstructor (c$, \r
-function (addAlignmentAnnotations, predictSecondaryStructure, externalSecStr, file, protocol) {\r
-Clazz.superConstructor (this, MCview.PDBfile, [false, file, protocol]);\r
-this.visibleChainAnnotation = addAlignmentAnnotations;\r
-this.$predictSecondaryStructure = predictSecondaryStructure;\r
-this.externalSecondaryStructure = externalSecStr;\r
-this.doParse ();\r
-}, "~B,~B,~B,~S,~S");\r
-Clazz.makeConstructor (c$, \r
-function (addAlignmentAnnotations, predictSecondaryStructure, externalSecStr, source) {\r
-Clazz.superConstructor (this, MCview.PDBfile, [false, source]);\r
-this.visibleChainAnnotation = addAlignmentAnnotations;\r
-this.$predictSecondaryStructure = predictSecondaryStructure;\r
-this.externalSecondaryStructure = externalSecStr;\r
-this.doParse ();\r
-}, "~B,~B,~B,jalview.io.FileParse");\r
-Clazz.overrideMethod (c$, "print", \r
-function () {\r
-return null;\r
-});\r
-Clazz.overrideMethod (c$, "parse", \r
-function () {\r
-this.id = this.safeName (this.getDataName ());\r
-this.chains =  new java.util.Vector ();\r
-var rna =  new java.util.ArrayList ();\r
-var prot =  new java.util.ArrayList ();\r
-var tmpchain;\r
-var line = null;\r
-var modelFlag = false;\r
-var terFlag = false;\r
-var lastID = "";\r
-var indexx = 0;\r
-var atomnam = null;\r
-try {\r
-while ((line = this.nextLine ()) != null) {\r
-if (line.indexOf ("HEADER") == 0) {\r
-if (line.length > 62) {\r
-var tid;\r
-if (line.length > 67) {\r
-tid = line.substring (62, 67).trim ();\r
-} else {\r
-tid = line.substring (62).trim ();\r
-}if (tid.length > 0) {\r
-this.id = tid;\r
-}continue;\r
-}}if (line.indexOf ("SEQRES") == 0) {\r
-}if (line.indexOf ("MODEL") == 0) {\r
-modelFlag = true;\r
-}if (line.indexOf ("TER") == 0) {\r
-terFlag = true;\r
-}if (modelFlag && line.indexOf ("ENDMDL") == 0) {\r
-break;\r
-}if (line.indexOf ("ATOM") == 0 || (line.indexOf ("HETATM") == 0 && !terFlag)) {\r
-terFlag = false;\r
-atomnam = line.substring (12, 15).trim ();\r
-if (!atomnam.equals ("CA") && !atomnam.equals ("P")) {\r
-continue;\r
-}var tmpatom =  new MCview.Atom (line);\r
-tmpchain = this.findChain (tmpatom.chain);\r
-if (tmpchain != null) {\r
-if (tmpatom.resNumIns.trim ().equals (lastID)) {\r
-continue;\r
-}tmpchain.atoms.addElement (tmpatom);\r
-} else {\r
-tmpchain =  new MCview.PDBChain (this.id, tmpatom.chain);\r
-this.chains.addElement (tmpchain);\r
-tmpchain.atoms.addElement (tmpatom);\r
-}lastID = tmpatom.resNumIns.trim ();\r
-}this.index++;\r
-}\r
-this.makeResidueList ();\r
-this.makeCaBondList ();\r
-if (this.id == null) {\r
-this.id = this.inFile.getName ();\r
-}for (var chain, $chain = this.chains.iterator (); $chain.hasNext () && ((chain = $chain.next ()) || true);) {\r
-var chainseq = this.postProcessChain (chain);\r
-if (MCview.PDBfile.isRNA (chainseq)) {\r
-rna.add (chainseq);\r
-} else {\r
-prot.add (chainseq);\r
-}}\r
-if (this.$predictSecondaryStructure) {\r
-this.predictSecondaryStructure (rna, prot);\r
-}} catch (e$$) {\r
-if (Clazz.exceptionOf (e$$, OutOfMemoryError)) {\r
-var er = e$$;\r
-{\r
-System.out.println ("OUT OF MEMORY LOADING PDB FILE");\r
-throw  new java.io.IOException (jalview.util.MessageManager.getString ("exception.outofmemory_loading_pdb_file"));\r
-}\r
-} else if (Clazz.exceptionOf (e$$, NumberFormatException)) {\r
-var ex = e$$;\r
-{\r
-if (line != null) {\r
-System.err.println ("Couldn't read number from line:");\r
-System.err.println (line);\r
-}}\r
-} else {\r
-throw e$$;\r
-}\r
-}\r
-this.markCalcIds ();\r
-});\r
-Clazz.defineMethod (c$, "predictSecondaryStructure", \r
-function (rnaSequences, proteinSequences) {\r
-if (this.externalSecondaryStructure && rnaSequences.size () > 0) {\r
-try {\r
-this.processPdbFileWithAnnotate3d (rnaSequences);\r
-} catch (x) {\r
-if (Clazz.exceptionOf (x, Exception)) {\r
-System.err.println ("Exceptions when dealing with RNA in pdb file");\r
-x.printStackTrace ();\r
-} else {\r
-throw x;\r
-}\r
-}\r
-}if (proteinSequences.size () > 0) {\r
-try {\r
-this.processPdbFileWithJmol (proteinSequences);\r
-} catch (x) {\r
-if (Clazz.exceptionOf (x, Exception)) {\r
-System.err.println ("Exceptions from Jmol when processing data in pdb file");\r
-x.printStackTrace ();\r
-} else {\r
-throw x;\r
-}\r
-}\r
-}}, "java.util.List,java.util.List");\r
-Clazz.defineMethod (c$, "postProcessChain", \r
-function (chain) {\r
-var dataset = chain.sequence;\r
-dataset.setName (this.id + "|" + dataset.getName ());\r
-var entry =  new jalview.datamodel.PDBEntry ();\r
-entry.setId (this.id);\r
-entry.setType (jalview.datamodel.PDBEntry.Type.PDB);\r
-entry.setProperty ( new java.util.Hashtable ());\r
-if (chain.id != null) {\r
-entry.setChainCode (String.valueOf (chain.id));\r
-}if (this.inFile != null) {\r
-entry.setFile (this.inFile.getAbsolutePath ());\r
-} else {\r
-entry.setFile (this.getDataName ());\r
-}dataset.addPDBId (entry);\r
-var chainseq = dataset.deriveSequence ();\r
-this.seqs.addElement (chainseq);\r
-var chainannot = chainseq.getAnnotation ();\r
-if (chainannot != null && this.visibleChainAnnotation) {\r
-for (var ai = 0; ai < chainannot.length; ai++) {\r
-chainannot[ai].visible = this.visibleChainAnnotation;\r
-this.annotations.addElement (chainannot[ai]);\r
-}\r
-}return chainseq;\r
-}, "MCview.PDBChain");\r
-c$.isCalcIdHandled = Clazz.defineMethod (c$, "isCalcIdHandled", \r
-function (calcId) {\r
-return calcId != null && (MCview.PDBfile.CALC_ID_PREFIX.equals (calcId));\r
-}, "~S");\r
-c$.isCalcIdForFile = Clazz.defineMethod (c$, "isCalcIdForFile", \r
-function (alan, pdbFile) {\r
-return alan.getCalcId () != null && MCview.PDBfile.CALC_ID_PREFIX.equals (alan.getCalcId ()) && pdbFile.equals (alan.getProperty ("PDBID"));\r
-}, "jalview.datamodel.AlignmentAnnotation,~S");\r
-c$.relocateCalcId = Clazz.defineMethod (c$, "relocateCalcId", \r
-function (calcId, alreadyLoadedPDB) {\r
-var s = MCview.PDBfile.CALC_ID_PREFIX.length;\r
-var end = calcId.indexOf (MCview.PDBfile.CALC_ID_PREFIX, s);\r
-var between = calcId.substring (s, end - 1);\r
-return MCview.PDBfile.CALC_ID_PREFIX + alreadyLoadedPDB.get (between) + ":" + calcId.substring (end);\r
-}, "~S,java.util.Hashtable");\r
-Clazz.defineMethod (c$, "markCalcIds", \r
-($fz = function () {\r
-for (var sq, $sq = this.seqs.iterator (); $sq.hasNext () && ((sq = $sq.next ()) || true);) {\r
-if (sq.getAnnotation () != null) {\r
-for (var aa, $aa = 0, $$aa = sq.getAnnotation (); $aa < $$aa.length && ((aa = $$aa[$aa]) || true); $aa++) {\r
-var oldId = aa.getCalcId ();\r
-if (oldId == null) {\r
-oldId = "";\r
-}aa.setCalcId (MCview.PDBfile.CALC_ID_PREFIX);\r
-aa.setProperty ("PDBID", this.id);\r
-aa.setProperty ("oldCalcId", oldId);\r
-}\r
-}}\r
-}, $fz.isPrivate = true, $fz));\r
-Clazz.defineMethod (c$, "processPdbFileWithJmol", \r
-($fz = function (prot) {\r
-try {\r
-var cl = Class.forName ("jalview.ext.jmol.PDBFileWithJmol");\r
-if (cl != null) {\r
-var constructor = cl.getConstructor ( Clazz.newArray (-1, [jalview.io.FileParse]));\r
-var args =  Clazz.newArray (-1, [ new jalview.io.FileParse (this.getDataName (), this.type)]);\r
-var jmf = constructor.newInstance (args);\r
-var al =  new jalview.datamodel.Alignment (cl.getMethod ("getSeqsAsArray",  Clazz.newArray (-1, [])).invoke (jmf, []));\r
-cl.getMethod ("addAnnotations",  Clazz.newArray (-1, [jalview.datamodel.AlignmentI])).invoke (jmf, [al]);\r
-for (var sq, $sq = al.getSequences ().iterator (); $sq.hasNext () && ((sq = $sq.next ()) || true);) {\r
-if (sq.getDatasetSequence () != null) {\r
-sq.getDatasetSequence ().getPDBId ().clear ();\r
-} else {\r
-sq.getPDBId ().clear ();\r
-}}\r
-this.replaceAndUpdateChains (prot, al, "pep", false);\r
-}} catch (q) {\r
-if (Clazz.exceptionOf (q, ClassNotFoundException)) {\r
-} else {\r
-throw q;\r
-}\r
-}\r
-}, $fz.isPrivate = true, $fz), "java.util.List");\r
-Clazz.defineMethod (c$, "replaceAndUpdateChains", \r
-($fz = function (prot, al, pep, b) {\r
-var replaced = jalview.analysis.AlignSeq.replaceMatchingSeqsWith (this.seqs, this.annotations, prot, al, pep, false);\r
-for (var ch, $ch = this.chains.iterator (); $ch.hasNext () && ((ch = $ch.next ()) || true);) {\r
-var p = 0;\r
-for (var sq, $sq = replaced.get (0).iterator (); $sq.hasNext () && ((sq = $sq.next ()) || true);) {\r
-p++;\r
-if (sq === ch.sequence || sq.getDatasetSequence () === ch.sequence) {\r
-p = -p;\r
-break;\r
-}}\r
-if (p < 0) {\r
-p = -p - 1;\r
-ch.shadow = replaced.get (1).get (p);\r
-ch.shadowMap = (replaced.get (2).get (p)).getMappingFromS1 (false);\r
-}}\r
-}, $fz.isPrivate = true, $fz), "java.util.List,jalview.datamodel.AlignmentI,~S,~B");\r
-Clazz.defineMethod (c$, "processPdbFileWithAnnotate3d", \r
-($fz = function (rna) {\r
-try {\r
-var cl = Class.forName ("jalview.ws.jws1.Annotate3D");\r
-if (cl != null) {\r
-var annotate3d = cl.getConstructor ( Clazz.newArray (-1, [])).newInstance ( Clazz.newArray (-1, []));\r
-var al = (cl.getMethod ("getRNAMLFor",  Clazz.newArray (-1, [jalview.io.FileParse])).invoke (annotate3d,  Clazz.newArray (-1, [ new jalview.io.FileParse (this.getDataName (), this.type)])));\r
-for (var sq, $sq = al.getSequences ().iterator (); $sq.hasNext () && ((sq = $sq.next ()) || true);) {\r
-if (sq.getDatasetSequence () != null) {\r
-if (sq.getDatasetSequence ().getPDBId () != null) {\r
-sq.getDatasetSequence ().getPDBId ().clear ();\r
-}} else {\r
-if (sq.getPDBId () != null) {\r
-sq.getPDBId ().clear ();\r
-}}}\r
-this.replaceAndUpdateChains (rna, al, "dna", false);\r
-}} catch (x) {\r
-if (Clazz.exceptionOf (x, ClassNotFoundException)) {\r
-} else {\r
-throw x;\r
-}\r
-}\r
-;}, $fz.isPrivate = true, $fz), "java.util.List");\r
-Clazz.defineMethod (c$, "safeName", \r
-($fz = function (dataName) {\r
-var p = 0;\r
-while ((p = dataName.indexOf ("/")) > -1 && p < dataName.length) {\r
-dataName = dataName.substring (p + 1);\r
-}\r
-return dataName;\r
-}, $fz.isPrivate = true, $fz), "~S");\r
-Clazz.defineMethod (c$, "makeResidueList", \r
-function () {\r
-for (var i = 0; i < this.chains.size (); i++) {\r
-this.chains.elementAt (i).makeResidueList (this.visibleChainAnnotation);\r
-}\r
-});\r
-Clazz.defineMethod (c$, "makeCaBondList", \r
-function () {\r
-for (var i = 0; i < this.chains.size (); i++) {\r
-this.chains.elementAt (i).makeCaBondList ();\r
-}\r
-});\r
-Clazz.defineMethod (c$, "findChain", \r
-function (id) {\r
-for (var i = 0; i < this.chains.size (); i++) {\r
-if (this.chains.elementAt (i).id.equals (id)) {\r
-return this.chains.elementAt (i);\r
-}}\r
-return null;\r
-}, "~S");\r
-Clazz.defineMethod (c$, "setChargeColours", \r
-function () {\r
-for (var i = 0; i < this.chains.size (); i++) {\r
-this.chains.elementAt (i).setChargeColours ();\r
-}\r
-});\r
-Clazz.defineMethod (c$, "setColours", \r
-function (cs) {\r
-for (var i = 0; i < this.chains.size (); i++) {\r
-this.chains.elementAt (i).setChainColours (cs);\r
-}\r
-}, "jalview.schemes.ColourSchemeI");\r
-Clazz.defineMethod (c$, "setChainColours", \r
-function () {\r
-for (var i = 0; i < this.chains.size (); i++) {\r
-this.chains.elementAt (i).setChainColours (java.awt.Color.getHSBColor (1.0 / i, .4, 1.0));\r
-}\r
-});\r
-c$.isRNA = Clazz.defineMethod (c$, "isRNA", \r
-function (seq) {\r
-for (var c, $c = 0, $$c = seq.getSequence (); $c < $$c.length && ((c = $$c[$c]) || true); $c++) {\r
-if ((c != 'A') && (c != 'C') && (c != 'G') && (c != 'U')) {\r
-return false;\r
-}}\r
-return true;\r
-}, "jalview.datamodel.SequenceI");\r
-Clazz.defineStatics (c$,\r
-"CALC_ID_PREFIX", "JalviewPDB");\r
-});\r
+Clazz.declarePackage ("MCview");
+Clazz.load (["jalview.io.AlignFile"], "MCview.PDBfile", ["MCview.Atom", "$.PDBChain", "jalview.analysis.AlignSeq", "jalview.datamodel.Alignment", "$.AlignmentI", "$.PDBEntry", "jalview.io.FileParse", "jalview.util.MessageManager", "java.awt.Color", "java.io.IOException", "java.util.ArrayList", "$.Hashtable", "$.Vector"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.chains = null;
+this.id = null;
+this.visibleChainAnnotation = false;
+this.$predictSecondaryStructure = true;
+this.externalSecondaryStructure = false;
+Clazz.instantialize (this, arguments);
+}, MCview, "PDBfile", jalview.io.AlignFile);
+Clazz.makeConstructor (c$, 
+function (addAlignmentAnnotations, predictSecondaryStructure, externalSecStr) {
+Clazz.superConstructor (this, MCview.PDBfile);
+this.visibleChainAnnotation = addAlignmentAnnotations;
+this.$predictSecondaryStructure = predictSecondaryStructure;
+this.externalSecondaryStructure = externalSecStr;
+}, "~B,~B,~B");
+Clazz.makeConstructor (c$, 
+function (addAlignmentAnnotations, predictSecondaryStructure, externalSecStr, file, protocol) {
+Clazz.superConstructor (this, MCview.PDBfile, [false, file, protocol]);
+this.visibleChainAnnotation = addAlignmentAnnotations;
+this.$predictSecondaryStructure = predictSecondaryStructure;
+this.externalSecondaryStructure = externalSecStr;
+this.doParse ();
+}, "~B,~B,~B,~S,~S");
+Clazz.makeConstructor (c$, 
+function (addAlignmentAnnotations, predictSecondaryStructure, externalSecStr, source) {
+Clazz.superConstructor (this, MCview.PDBfile, [false, source]);
+this.visibleChainAnnotation = addAlignmentAnnotations;
+this.$predictSecondaryStructure = predictSecondaryStructure;
+this.externalSecondaryStructure = externalSecStr;
+this.doParse ();
+}, "~B,~B,~B,jalview.io.FileParse");
+Clazz.overrideMethod (c$, "print", 
+function () {
+return null;
+});
+Clazz.overrideMethod (c$, "parse", 
+function () {
+this.id = this.safeName (this.getDataName ());
+this.chains =  new java.util.Vector ();
+var rna =  new java.util.ArrayList ();
+var prot =  new java.util.ArrayList ();
+var tmpchain;
+var line = null;
+var modelFlag = false;
+var terFlag = false;
+var lastID = "";
+var indexx = 0;
+var atomnam = null;
+try {
+while ((line = this.nextLine ()) != null) {
+if (line.indexOf ("HEADER") == 0) {
+if (line.length > 62) {
+var tid;
+if (line.length > 67) {
+tid = line.substring (62, 67).trim ();
+} else {
+tid = line.substring (62).trim ();
+}if (tid.length > 0) {
+this.id = tid;
+}continue;
+}}if (line.indexOf ("SEQRES") == 0) {
+}if (line.indexOf ("MODEL") == 0) {
+modelFlag = true;
+}if (line.indexOf ("TER") == 0) {
+terFlag = true;
+}if (modelFlag && line.indexOf ("ENDMDL") == 0) {
+break;
+}if (line.indexOf ("ATOM") == 0 || (line.indexOf ("HETATM") == 0 && !terFlag)) {
+terFlag = false;
+atomnam = line.substring (12, 15).trim ();
+if (!atomnam.equals ("CA") && !atomnam.equals ("P")) {
+continue;
+}var tmpatom =  new MCview.Atom (line);
+tmpchain = this.findChain (tmpatom.chain);
+if (tmpchain != null) {
+if (tmpatom.resNumIns.trim ().equals (lastID)) {
+continue;
+}tmpchain.atoms.addElement (tmpatom);
+} else {
+tmpchain =  new MCview.PDBChain (this.id, tmpatom.chain);
+this.chains.addElement (tmpchain);
+tmpchain.atoms.addElement (tmpatom);
+}lastID = tmpatom.resNumIns.trim ();
+}this.index++;
+}
+this.makeResidueList ();
+this.makeCaBondList ();
+if (this.id == null) {
+this.id = this.inFile.getName ();
+}for (var chain, $chain = this.chains.iterator (); $chain.hasNext () && ((chain = $chain.next ()) || true);) {
+var chainseq = this.postProcessChain (chain);
+if (MCview.PDBfile.isRNA (chainseq)) {
+rna.add (chainseq);
+} else {
+prot.add (chainseq);
+}}
+if (this.$predictSecondaryStructure) {
+this.predictSecondaryStructure (rna, prot);
+}} catch (e$$) {
+if (Clazz.exceptionOf (e$$, OutOfMemoryError)) {
+var er = e$$;
+{
+System.out.println ("OUT OF MEMORY LOADING PDB FILE");
+throw  new java.io.IOException (jalview.util.MessageManager.getString ("exception.outofmemory_loading_pdb_file"));
+}
+} else if (Clazz.exceptionOf (e$$, NumberFormatException)) {
+var ex = e$$;
+{
+if (line != null) {
+System.err.println ("Couldn't read number from line:");
+System.err.println (line);
+}}
+} else {
+throw e$$;
+}
+}
+this.markCalcIds ();
+});
+Clazz.defineMethod (c$, "predictSecondaryStructure", 
+function (rnaSequences, proteinSequences) {
+if (this.externalSecondaryStructure && rnaSequences.size () > 0) {
+try {
+this.processPdbFileWithAnnotate3d (rnaSequences);
+} catch (x) {
+if (Clazz.exceptionOf (x, Exception)) {
+System.err.println ("Exceptions when dealing with RNA in pdb file");
+x.printStackTrace ();
+} else {
+throw x;
+}
+}
+}if (proteinSequences.size () > 0) {
+try {
+this.processPdbFileWithJmol (proteinSequences);
+} catch (x) {
+if (Clazz.exceptionOf (x, Exception)) {
+System.err.println ("Exceptions from Jmol when processing data in pdb file");
+x.printStackTrace ();
+} else {
+throw x;
+}
+}
+}}, "java.util.List,java.util.List");
+Clazz.defineMethod (c$, "postProcessChain", 
+function (chain) {
+var dataset = chain.sequence;
+dataset.setName (this.id + "|" + dataset.getName ());
+var entry =  new jalview.datamodel.PDBEntry ();
+entry.setId (this.id);
+entry.setType (jalview.datamodel.PDBEntry.Type.PDB);
+entry.setProperty ( new java.util.Hashtable ());
+if (chain.id != null) {
+entry.setChainCode (String.valueOf (chain.id));
+}if (this.inFile != null) {
+entry.setFile (this.inFile.getAbsolutePath ());
+} else {
+entry.setFile (this.getDataName ());
+}dataset.addPDBId (entry);
+var chainseq = dataset.deriveSequence ();
+this.seqs.addElement (chainseq);
+var chainannot = chainseq.getAnnotation ();
+if (chainannot != null && this.visibleChainAnnotation) {
+for (var ai = 0; ai < chainannot.length; ai++) {
+chainannot[ai].visible = this.visibleChainAnnotation;
+this.annotations.addElement (chainannot[ai]);
+}
+}return chainseq;
+}, "MCview.PDBChain");
+c$.isCalcIdHandled = Clazz.defineMethod (c$, "isCalcIdHandled", 
+function (calcId) {
+return calcId != null && (MCview.PDBfile.CALC_ID_PREFIX.equals (calcId));
+}, "~S");
+c$.isCalcIdForFile = Clazz.defineMethod (c$, "isCalcIdForFile", 
+function (alan, pdbFile) {
+return alan.getCalcId () != null && MCview.PDBfile.CALC_ID_PREFIX.equals (alan.getCalcId ()) && pdbFile.equals (alan.getProperty ("PDBID"));
+}, "jalview.datamodel.AlignmentAnnotation,~S");
+c$.relocateCalcId = Clazz.defineMethod (c$, "relocateCalcId", 
+function (calcId, alreadyLoadedPDB) {
+var s = MCview.PDBfile.CALC_ID_PREFIX.length;
+var end = calcId.indexOf (MCview.PDBfile.CALC_ID_PREFIX, s);
+var between = calcId.substring (s, end - 1);
+return MCview.PDBfile.CALC_ID_PREFIX + alreadyLoadedPDB.get (between) + ":" + calcId.substring (end);
+}, "~S,java.util.Hashtable");
+Clazz.defineMethod (c$, "markCalcIds", 
+($fz = function () {
+for (var sq, $sq = this.seqs.iterator (); $sq.hasNext () && ((sq = $sq.next ()) || true);) {
+if (sq.getAnnotation () != null) {
+for (var aa, $aa = 0, $$aa = sq.getAnnotation (); $aa < $$aa.length && ((aa = $$aa[$aa]) || true); $aa++) {
+var oldId = aa.getCalcId ();
+if (oldId == null) {
+oldId = "";
+}aa.setCalcId (MCview.PDBfile.CALC_ID_PREFIX);
+aa.setProperty ("PDBID", this.id);
+aa.setProperty ("oldCalcId", oldId);
+}
+}}
+}, $fz.isPrivate = true, $fz));
+Clazz.defineMethod (c$, "processPdbFileWithJmol", 
+($fz = function (prot) {
+try {
+var cl = Class.forName ("jalview.ext.jmol.PDBFileWithJmol");
+if (cl != null) {
+var constructor = cl.getConstructor ( Clazz.newArray (-1, [jalview.io.FileParse]));
+var args =  Clazz.newArray (-1, [ new jalview.io.FileParse (this.getDataName (), this.type)]);
+var jmf = constructor.newInstance (args);
+var al =  new jalview.datamodel.Alignment (cl.getMethod ("getSeqsAsArray",  Clazz.newArray (-1, [])).invoke (jmf, []));
+cl.getMethod ("addAnnotations",  Clazz.newArray (-1, [jalview.datamodel.AlignmentI])).invoke (jmf, [al]);
+for (var sq, $sq = al.getSequences ().iterator (); $sq.hasNext () && ((sq = $sq.next ()) || true);) {
+if (sq.getDatasetSequence () != null) {
+sq.getDatasetSequence ().getPDBId ().clear ();
+} else {
+sq.getPDBId ().clear ();
+}}
+this.replaceAndUpdateChains (prot, al, "pep", false);
+}} catch (q) {
+if (Clazz.exceptionOf (q, ClassNotFoundException)) {
+} else {
+throw q;
+}
+}
+}, $fz.isPrivate = true, $fz), "java.util.List");
+Clazz.defineMethod (c$, "replaceAndUpdateChains", 
+($fz = function (prot, al, pep, b) {
+var replaced = jalview.analysis.AlignSeq.replaceMatchingSeqsWith (this.seqs, this.annotations, prot, al, pep, false);
+for (var ch, $ch = this.chains.iterator (); $ch.hasNext () && ((ch = $ch.next ()) || true);) {
+var p = 0;
+for (var sq, $sq = replaced.get (0).iterator (); $sq.hasNext () && ((sq = $sq.next ()) || true);) {
+p++;
+if (sq === ch.sequence || sq.getDatasetSequence () === ch.sequence) {
+p = -p;
+break;
+}}
+if (p < 0) {
+p = -p - 1;
+ch.shadow = replaced.get (1).get (p);
+ch.shadowMap = (replaced.get (2).get (p)).getMappingFromS1 (false);
+}}
+}, $fz.isPrivate = true, $fz), "java.util.List,jalview.datamodel.AlignmentI,~S,~B");
+Clazz.defineMethod (c$, "processPdbFileWithAnnotate3d", 
+($fz = function (rna) {
+try {
+var cl = Class.forName ("jalview.ws.jws1.Annotate3D");
+if (cl != null) {
+var annotate3d = cl.getConstructor ( Clazz.newArray (-1, [])).newInstance ( Clazz.newArray (-1, []));
+var al = (cl.getMethod ("getRNAMLFor",  Clazz.newArray (-1, [jalview.io.FileParse])).invoke (annotate3d,  Clazz.newArray (-1, [ new jalview.io.FileParse (this.getDataName (), this.type)])));
+for (var sq, $sq = al.getSequences ().iterator (); $sq.hasNext () && ((sq = $sq.next ()) || true);) {
+if (sq.getDatasetSequence () != null) {
+if (sq.getDatasetSequence ().getPDBId () != null) {
+sq.getDatasetSequence ().getPDBId ().clear ();
+}} else {
+if (sq.getPDBId () != null) {
+sq.getPDBId ().clear ();
+}}}
+this.replaceAndUpdateChains (rna, al, "dna", false);
+}} catch (x) {
+if (Clazz.exceptionOf (x, ClassNotFoundException)) {
+} else {
+throw x;
+}
+}
+;}, $fz.isPrivate = true, $fz), "java.util.List");
+Clazz.defineMethod (c$, "safeName", 
+($fz = function (dataName) {
+var p = 0;
+while ((p = dataName.indexOf ("/")) > -1 && p < dataName.length) {
+dataName = dataName.substring (p + 1);
+}
+return dataName;
+}, $fz.isPrivate = true, $fz), "~S");
+Clazz.defineMethod (c$, "makeResidueList", 
+function () {
+for (var i = 0; i < this.chains.size (); i++) {
+this.chains.elementAt (i).makeResidueList (this.visibleChainAnnotation);
+}
+});
+Clazz.defineMethod (c$, "makeCaBondList", 
+function () {
+for (var i = 0; i < this.chains.size (); i++) {
+this.chains.elementAt (i).makeCaBondList ();
+}
+});
+Clazz.defineMethod (c$, "findChain", 
+function (id) {
+for (var i = 0; i < this.chains.size (); i++) {
+if (this.chains.elementAt (i).id.equals (id)) {
+return this.chains.elementAt (i);
+}}
+return null;
+}, "~S");
+Clazz.defineMethod (c$, "setChargeColours", 
+function () {
+for (var i = 0; i < this.chains.size (); i++) {
+this.chains.elementAt (i).setChargeColours ();
+}
+});
+Clazz.defineMethod (c$, "setColours", 
+function (cs) {
+for (var i = 0; i < this.chains.size (); i++) {
+this.chains.elementAt (i).setChainColours (cs);
+}
+}, "jalview.schemes.ColourSchemeI");
+Clazz.defineMethod (c$, "setChainColours", 
+function () {
+for (var i = 0; i < this.chains.size (); i++) {
+this.chains.elementAt (i).setChainColours (java.awt.Color.getHSBColor (1.0 / i, .4, 1.0));
+}
+});
+c$.isRNA = Clazz.defineMethod (c$, "isRNA", 
+function (seq) {
+for (var c, $c = 0, $$c = seq.getSequence (); $c < $$c.length && ((c = $$c[$c]) || true); $c++) {
+if ((c != 'A') && (c != 'C') && (c != 'G') && (c != 'U')) {
+return false;
+}}
+return true;
+}, "jalview.datamodel.SequenceI");
+Clazz.defineStatics (c$,
+"CALC_ID_PREFIX", "JalviewPDB");
+});