X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=bin%2FMCview%2FPDBfile.js;h=c6af5ca169c6cb115a15f3915a42e1178dbf0cf6;hp=dfc40ccab47d2f30ec4fb4239c21df37b0b26c7f;hb=7301a2415adab88038b291fc54caeeb3a5a47a44;hpb=6154cb57a6eac3bb1344b8342495f5bb701ee921 diff --git a/bin/MCview/PDBfile.js b/bin/MCview/PDBfile.js index dfc40cc..c6af5ca 100644 --- a/bin/MCview/PDBfile.js +++ b/bin/MCview/PDBfile.js @@ -1,320 +1,320 @@ -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"); -}); +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"); +});