Revision: 20378 http://sourceforge.net/p/jmol/code/20378 Author: hansonr Date: 2015-03-11 23:56:53 +0000 (Wed, 11 Mar 2015) Log Message: ----------- Jmol.___JmolVersion="14.2.13_2015.03.11"
bug fix; pdb and mmcif readers not doing biomolecule 2 properly bug fix: load filter "bychain" broken Modified Paths: -------------- branches/v14_2/Jmol/src/org/jmol/adapter/readers/cif/MMCifReader.java branches/v14_2/Jmol/src/org/jmol/adapter/readers/pdb/PdbReader.java branches/v14_2/Jmol/src/org/jmol/adapter/smarter/XtalSymmetry.java branches/v14_2/Jmol/src/org/jmol/modelset/ModelSet.java branches/v14_2/Jmol/src/org/jmol/modelsetbio/Resolver.java branches/v14_2/Jmol/src/org/jmol/viewer/Jmol.properties Modified: branches/v14_2/Jmol/src/org/jmol/adapter/readers/cif/MMCifReader.java =================================================================== --- branches/v14_2/Jmol/src/org/jmol/adapter/readers/cif/MMCifReader.java 2015-03-11 23:56:34 UTC (rev 20377) +++ branches/v14_2/Jmol/src/org/jmol/adapter/readers/cif/MMCifReader.java 2015-03-11 23:56:53 UTC (rev 20378) @@ -83,6 +83,8 @@ if (checkFilterKey("BIOMOLECULE")) // PDB format filter = PT.rep(filter, "BIOMOLECULE", "ASSEMBLY"); isBiomolecule = checkFilterKey("ASSEMBLY"); + if (isBiomolecule) + filter = filter.replace(':', ' '); // no chain selection for biomolecules // When this reader was split off from CifReader, a bug was introduced // into the Resolver that made it so that ligand files were read by @@ -102,13 +104,14 @@ asc.removeCurrentAtomSet(); } else { if ((validation != null || addedData != null) && !isCourseGrained) { - MMCifValidationParser vs = ((MMCifValidationParser) getInterface("org.jmol.adapter.readers.cif.MMCifValidationParser")).set(this); - String note = null; + MMCifValidationParser vs = ((MMCifValidationParser) getInterface("org.jmol.adapter.readers.cif.MMCifValidationParser")) + .set(this); + String note = null; if (addedData == null) { note = vs.finalizeValidations(modelMap); } else if (addedDataKey.equals("_rna3d")) { - note = vs.finalizeRna3d(modelMap); - } else { + note = vs.finalizeRna3d(modelMap); + } else { reader = Rdr.getBR(addedData); processDSSR(this, htGroup1); } @@ -118,18 +121,18 @@ if (!isCourseGrained) applySymmetryAndSetTrajectory(); } - + if (htSites != null) addSites(htSites); - if (vBiomolecules != null && vBiomolecules.size() == 1 + if (vBiomolecules != null && vBiomolecules.size() > 0 && (isCourseGrained || asc.ac > 0)) { asc.setCurrentModelInfo("biomolecules", vBiomolecules); Map<String, Object> ht = vBiomolecules.get(0); appendLoadNote("Constructing " + ht.get("name")); setBiomolecules(ht); if (thisBiomolecule != null) { - asc.getXSymmetry().applySymmetryBio(thisBiomolecule, - unitCellParams, applySymmetryToBonds, filter); + asc.getXSymmetry().applySymmetryBio(ht, unitCellParams, + applySymmetryToBonds, filter); asc.xtalSymmetry = null; } } @@ -322,7 +325,8 @@ info.put("assemblies", "$" + list.replace(',', '$')); info.put("operators", decodeAssemblyOperators(assem[ASSEM_OPERS])); info.put("biomts", new Lst<M4>()); - thisBiomolecule = info; + if (thisBiomolecule == null) + thisBiomolecule = info; Logger.info("assembly " + id + " operators " + assem[ASSEM_OPERS] + " ASYM_IDs " + assem[ASSEM_LIST]); vBiomolecules.addLast(info); @@ -797,24 +801,37 @@ private void setBiomolecules(Map<String, Object> biomolecule) { if (!isBiomolecule || assemblyIdAtoms == null && chainAtomCounts == null) return; + Lst<M4> biomts = new Lst<M4>(); + Lst<String> biomtchains = new Lst<String>(); + biomolecule.put("biomts", biomts); + biomolecule.put("chains", biomtchains); + int nBio = vBiomolecules.size(); + BS bsAll = new BS(); + int nAtoms = setBiomolecule(biomolecule, biomts, biomtchains, bsAll); + for (int i = 1; i < nBio; i++) + nAtoms += setBiomolecule(vBiomolecules.get(i), biomts, biomtchains, bsAll); + if (bsAll.cardinality() < asc.ac) { + if (asc.bsAtoms == null) + asc.bsAtoms = bsAll; + else + asc.bsAtoms.and(bsAll); + } + biomolecule.put("atomCount", Integer.valueOf(nAtoms)); + } + + private int setBiomolecule(Map<String, Object> biomolecule, Lst<M4> biomts, + Lst<String> biomtchains, BS bsAll) { M4 mident = M4.newM4(null); String[] ops = PT.split((String) biomolecule.get("operators"), ","); String assemblies = (String) biomolecule.get("assemblies"); - Lst<M4> biomts = new Lst<M4>(); - biomolecule.put("biomts", biomts); - biomts.addLast(mident); - for (int j = 0; j < ops.length; j++) { - M4 m = getOpMatrix(ops[j]); - if (m != null && !m.equals(mident)) - biomts.addLast(m); - } - BS bsAll = new BS(); P3 sum = new P3(); int count = 0; int nAtoms = 0; String[] ids = PT.split(assemblies, "$"); + String chainlist = ""; for (int j = 1; j < ids.length; j++) { String id = ids[j]; + chainlist += ":" + id + ";"; if (assemblyIdAtoms != null) { BS bs = assemblyIdAtoms.get(id); if (bs != null) { @@ -835,6 +852,18 @@ } } } + for (int j = 0; j < ops.length; j++) { + M4 m = getOpMatrix(ops[j]); + if (m == null) + return 0; + if (m.equals(mident)) { + biomts.add(0, mident); + biomtchains.add(0, chainlist); + } else { + biomts.addLast(m); + biomtchains.addLast(chainlist); + } + } if (isCourseGrained) { if (bySymop) { nAtoms = 1; @@ -846,10 +875,9 @@ } } else { nAtoms = bsAll.cardinality(); - if (nAtoms < asc.ac) - asc.bsAtoms = bsAll; } - biomolecule.put("atomCount", Integer.valueOf(nAtoms * ops.length)); + return nAtoms * ops.length; + } private void createParticle(String id) { Modified: branches/v14_2/Jmol/src/org/jmol/adapter/readers/pdb/PdbReader.java =================================================================== --- branches/v14_2/Jmol/src/org/jmol/adapter/readers/pdb/PdbReader.java 2015-03-11 23:56:34 UTC (rev 20377) +++ branches/v14_2/Jmol/src/org/jmol/adapter/readers/pdb/PdbReader.java 2015-03-11 23:56:53 UTC (rev 20378) @@ -196,6 +196,8 @@ if (checkFilterKey("ASSEMBLY")) // CIF syntax filter = PT.rep(filter, "ASSEMBLY", "BIOMOLECULE"); isbiomol = checkFilterKey("BIOMOLECULE"); + if (isbiomol) + filter = filter.replace(':', ' '); // no chain choices if biomolecule boolean byChain = isbiomol && checkFilterKey("BYCHAIN"); boolean bySymop = isbiomol && checkFilterKey("BYSYMOP"); isCourseGrained = byChain || bySymop; @@ -600,53 +602,58 @@ private void setBiomoleculeAtomCounts() { for (int i = vBiomolecules.size(); --i >= 0;) { Map<String, Object> biomolecule = vBiomolecules.get(i); - String chains = (String) biomolecule.get("chains"); - int nTransforms = ((Lst<M4>) biomolecule.get("biomts")).size(); + Lst<M4> biomts = (Lst<M4>) biomolecule.get("biomts"); + Lst<String> biomtchains = (Lst<String>) biomolecule.get("chains"); + int nTransforms = biomts.size(); int nAtoms = 0; - for (int j = chains.length() - 1; --j >= 0;) - if (chains.charAt(j) == ':') - nAtoms += biomtChainAtomCounts[0 + chains.charAt(j + 1)]; - biomolecule.put("atomCount", Integer.valueOf(nAtoms * nTransforms)); + for (int k = nTransforms; --k >= 0;) { + String chains = biomtchains.get(k); + for (int j = chains.length() - 1; --j >= 0;) + if (chains.charAt(j) == ':') + nAtoms += biomtChainAtomCounts[0 + chains.charAt(j + 1)]; + } + biomolecule.put("atomCount", Integer.valueOf(nAtoms)); } } -/* - REMARK 350 BIOMOLECULE: 1 - REMARK 350 APPLY THE FOLLOWING TO CHAINS: 1, 2, 3, 4, 5, 6, - REMARK 350 A, B, C - REMARK 350 BIOMT1 1 1.000000 0.000000 0.000000 0.00000 - REMARK 350 BIOMT2 1 0.000000 1.000000 0.000000 0.00000 - REMARK 350 BIOMT3 1 0.000000 0.000000 1.000000 0.00000 - REMARK 350 BIOMT1 2 0.309017 -0.809017 0.500000 0.00000 - REMARK 350 BIOMT2 2 0.809017 0.500000 0.309017 0.00000 - REMARK 350 BIOMT3 2 -0.500000 0.309017 0.809017 0.00000 - - - or, as fount in http://www.ebi.ac.uk/msd-srv/pqs/pqs-doc/macmol/1k28.mmol - -REMARK 350 AN OLIGOMER OF TYPE :HEXAMERIC : CAN BE ASSEMBLED BY -REMARK 350 APPLYING THE FOLLOWING TO CHAINS: -REMARK 350 A, D -REMARK 350 BIOMT1 1 1.000000 0.000000 0.000000 0.00000 -REMARK 350 BIOMT2 1 0.000000 1.000000 0.000000 0.00000 -REMARK 350 BIOMT3 1 0.000000 0.000000 1.000000 0.00000 -REMARK 350 IN ADDITION APPLY THE FOLLOWING TO CHAINS: -REMARK 350 A, D -REMARK 350 BIOMT1 2 0.000000 -1.000000 0.000000 0.00000 -REMARK 350 BIOMT2 2 1.000000 -1.000000 0.000000 0.00000 -REMARK 350 BIOMT3 2 0.000000 0.000000 1.000000 0.00000 -REMARK 350 IN ADDITION APPLY THE FOLLOWING TO CHAINS: -REMARK 350 A, D -REMARK 350 BIOMT1 3 -1.000000 1.000000 0.000000 0.00000 -REMARK 350 BIOMT2 3 -1.000000 0.000000 0.000000 0.00000 -REMARK 350 BIOMT3 3 0.000000 0.000000 1.000000 0.00000 + /* + REMARK 350 BIOMOLECULE: 1 + REMARK 350 APPLY THE FOLLOWING TO CHAINS: 1, 2, 3, 4, 5, 6, + REMARK 350 A, B, C + REMARK 350 BIOMT1 1 1.000000 0.000000 0.000000 0.00000 + REMARK 350 BIOMT2 1 0.000000 1.000000 0.000000 0.00000 + REMARK 350 BIOMT3 1 0.000000 0.000000 1.000000 0.00000 + REMARK 350 BIOMT1 2 0.309017 -0.809017 0.500000 0.00000 + REMARK 350 BIOMT2 2 0.809017 0.500000 0.309017 0.00000 + REMARK 350 BIOMT3 2 -0.500000 0.309017 0.809017 0.00000 + + + or, as fount in http://www.ebi.ac.uk/msd-srv/pqs/pqs-doc/macmol/1k28.mmol + + REMARK 350 AN OLIGOMER OF TYPE :HEXAMERIC : CAN BE ASSEMBLED BY + REMARK 350 APPLYING THE FOLLOWING TO CHAINS: + REMARK 350 A, D + REMARK 350 BIOMT1 1 1.000000 0.000000 0.000000 0.00000 + REMARK 350 BIOMT2 1 0.000000 1.000000 0.000000 0.00000 + REMARK 350 BIOMT3 1 0.000000 0.000000 1.000000 0.00000 + REMARK 350 IN ADDITION APPLY THE FOLLOWING TO CHAINS: + REMARK 350 A, D + REMARK 350 BIOMT1 2 0.000000 -1.000000 0.000000 0.00000 + REMARK 350 BIOMT2 2 1.000000 -1.000000 0.000000 0.00000 + REMARK 350 BIOMT3 2 0.000000 0.000000 1.000000 0.00000 + REMARK 350 IN ADDITION APPLY THE FOLLOWING TO CHAINS: + REMARK 350 A, D + REMARK 350 BIOMT1 3 -1.000000 1.000000 0.000000 0.00000 + REMARK 350 BIOMT2 3 -1.000000 0.000000 0.000000 0.00000 + REMARK 350 BIOMT3 3 0.000000 0.000000 1.000000 0.00000 -*/ - - + */ + + @SuppressWarnings("unchecked") private void remark350() throws Exception { - Lst<M4> biomts = null; - vBiomolecules = new Lst<Map<String,Object>>(); + Lst<M4> biomts = null; + Lst<String> biomtchains = null; + vBiomolecules = new Lst<Map<String, Object>>(); biomtChainAtomCounts = new int[255]; String title = ""; String chainlist = ""; @@ -668,15 +675,14 @@ Logger.info("biomolecule " + id + ": number of transforms: " + nBiomt); info = new Hashtable<String, Object>(); - biomts = new Lst<M4>(); id = line.substring(line.indexOf(":") + 1).trim(); - title = line.trim(); info.put("name", "biomolecule " + id); - info.put("molecule", id.length() == 3 ? id : Integer.valueOf(parseIntStr(id))); + info.put("molecule", + id.length() == 3 ? id : Integer.valueOf(parseIntStr(id))); info.put("title", title); - info.put("chains", ""); - info.put("biomts", biomts); + info.put("chains", biomtchains = new Lst<String>()); + info.put("biomts", biomts = new Lst<M4>()); vBiomolecules.addLast(info); nBiomt = 0; //continue; need to allow for next IF, in case this is a reconstruction @@ -693,14 +699,16 @@ appendLoadNote("found biomolecule " + id + ": " + list); chainlist = ":" + list.replace(' ', ':'); needLine = false; - while (readHeader(true) != null && line.indexOf("BIOMT") < 0 && line.indexOf("350") == 7) + while (readHeader(true) != null && line.indexOf("BIOMT") < 0 + && line.indexOf("350") == 7) chainlist += ":" + line.substring(11).trim().replace(' ', ':'); - if (checkFilterKey("BIOMOLECULE " + id + ";") || checkFilterKey("BIOMOLECULE=" + id + ";")) { - setFilter(filter.replace(':', '_') + chainlist); + chainlist += ";"; + if (checkFilterKey("BIOMOLECULE " + id + ";") + || checkFilterKey("BIOMOLECULE=" + id + ";")) { + setFilter(filter + chainlist); Logger.info("filter set to \"" + filter + "\""); thisBiomolecule = info; } - info.put("chains", chainlist); continue; } /* @@ -723,10 +731,13 @@ mat[15] = 1; M4 m4 = new M4(); m4.setA(mat); - if (m4.equals(mIdent)) + if (m4.equals(mIdent)) { biomts.add(0, m4); - else + biomtchains.add(0, chainlist); + } else { biomts.addLast(m4); + biomtchains.addLast(chainlist); + } continue; } } catch (Exception e) { @@ -737,8 +748,7 @@ } } if (nBiomt > 0) - Logger.info("biomolecule " + id + ": number of transforms: " - + nBiomt); + Logger.info("biomolecule " + id + ": number of transforms: " + nBiomt); } /* Modified: branches/v14_2/Jmol/src/org/jmol/adapter/smarter/XtalSymmetry.java =================================================================== --- branches/v14_2/Jmol/src/org/jmol/adapter/smarter/XtalSymmetry.java 2015-03-11 23:56:34 UTC (rev 20377) +++ branches/v14_2/Jmol/src/org/jmol/adapter/smarter/XtalSymmetry.java 2015-03-11 23:56:53 UTC (rev 20378) @@ -983,8 +983,11 @@ doNormalize = false; Lst<M4> biomts = (Lst<M4>) thisBiomolecule.get("biomts"); + Lst<String> biomtchains = (Lst<String>) thisBiomolecule.get("chains"); if (biomts.size() < 2) return; + if (biomtchains.get(0).equals(biomtchains.get(1))) + biomtchains = null; symmetry = null; // it's not clear to me why you would do this: if (!Float.isNaN(unitCellParams[0])) // PDB can do this; @@ -1057,7 +1060,7 @@ } for (int iAtom = firstSymmetryAtom; iAtom < atomMax; iAtom++) atoms[iAtom].bsSymmetry = BSUtil.newAndSetBit(0); - for (int i = 1; i < len; i++) { + for (int i = (biomtchains == null ? 1 : 0); i < len; i++) { if (filter.indexOf("!#") >= 0) { if (filter.indexOf("!#" + (i + 1) + ";") >= 0) continue; @@ -1066,10 +1069,15 @@ continue; } M4 mat = biomts.get(i); - //Vector3f trans = new Vector3f(); + String chains = (biomtchains == null ? null : biomtchains.get(i)); + for (int iAtom = firstSymmetryAtom; iAtom < atomMax; iAtom++) { if (asc.bsAtoms != null && !asc.bsAtoms.get(iAtom)) continue; + if (chains != null + && chains.indexOf(":" + acr.vwr.getChainIDStr(atoms[iAtom].chainID) + + ";") < 0) + continue; try { int atomSite = atoms[iAtom].atomSite; Atom atom1; @@ -1098,6 +1106,13 @@ if (i > 0) symmetry.addBioMoleculeOperation(mat, false); } + if (biomtchains != null) { + if (asc.bsAtoms == null) + asc.bsAtoms = BSUtil.newBitSet2(0, asc.ac); + for (int iAtom = firstSymmetryAtom; iAtom < atomMax; iAtom++) + asc.bsAtoms.clear(iAtom); + } + noSymmetryCount = atomMax - firstSymmetryAtom; asc.setCurrentModelInfo("presymmetryAtomIndex", Integer.valueOf(firstSymmetryAtom)); Modified: branches/v14_2/Jmol/src/org/jmol/modelset/ModelSet.java =================================================================== --- branches/v14_2/Jmol/src/org/jmol/modelset/ModelSet.java 2015-03-11 23:56:34 UTC (rev 20377) +++ branches/v14_2/Jmol/src/org/jmol/modelset/ModelSet.java 2015-03-11 23:56:53 UTC (rev 20378) @@ -3873,7 +3873,7 @@ protected void calculatePolymers(Group[] groups, int groupCount, int baseGroupIndex, BS modelsExcluded) { - if (haveBioModels) + if (bioModelset != null) // not using haveBioModels because not frozen yet bioModelset.calculateAllPolymers(groups, groupCount, baseGroupIndex, modelsExcluded); } Modified: branches/v14_2/Jmol/src/org/jmol/modelsetbio/Resolver.java =================================================================== --- branches/v14_2/Jmol/src/org/jmol/modelsetbio/Resolver.java 2015-03-11 23:56:34 UTC (rev 20377) +++ branches/v14_2/Jmol/src/org/jmol/modelsetbio/Resolver.java 2015-03-11 23:56:53 UTC (rev 20378) @@ -1254,7 +1254,8 @@ } static short getGroupIdFor(String group3) { - group3 = group3.trim(); + if (group3 != null) + group3 = group3.trim(); short groupID = knownGroupID(group3); return (groupID == -1 ? addGroup3Name(group3) : groupID); } Modified: branches/v14_2/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- branches/v14_2/Jmol/src/org/jmol/viewer/Jmol.properties 2015-03-11 23:56:34 UTC (rev 20377) +++ branches/v14_2/Jmol/src/org/jmol/viewer/Jmol.properties 2015-03-11 23:56:53 UTC (rev 20378) @@ -4,8 +4,13 @@ # THIS IS THE RELEASE BRANCH # BUG FIXES ONLY, PLEASE -Jmol.___JmolVersion="14.2.13_2015.03.09" +Jmol.___JmolVersion="14.2.13_2015.03.11" +bug fix; pdb and mmcif readers not doing biomolecule 2 properly +bug fix: load filter "bychain" broken + +JmolVersion="14.2.13_2015.03.09" + bug fix: show state/xxxx does not work JmolVersion="14.2.13_2015.03.07" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits