-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDBs written without coordinates with OpenEye, sometimes #1967
Comments
I've reproduced the issue and it looks like there's something with the residue/metadata info that affects how the PDB is written out. If I clear the hierarchy metadata before writing the PDB the coordinates are written as usual: from openff.toolkit import Molecule
import MDAnalysis as mda
mol = Molecule.from_smiles("CC")
mol.generate_conformers()
mol.to_file("test.pdb", "PDB")
u = mda.Universe("test.pdb")
u.add_TopologyAttr("elements", u.atoms.types)
rdmol = u.atoms.convert_to("RDKIT")
mol2 = Molecule.from_rdkit(rdmol)
assert len(mol2.conformers)
for atom in mol2.atoms:
keys = [*atom.metadata.keys()]
for key in keys:
del atom.metadata[key]
mol2.to_file("test2.pdb", "PDB")
!cat test2.pdb returns
I'll keep looking into this. |
I can reproduce without MDA - Basically if either from openff.toolkit import Molecule, OpenEyeToolkitWrapper, RDKitToolkitWrapper
mol_no_mda = Molecule.from_smiles("CC")
mol_no_mda.generate_conformers()
for atom in mol_no_mda.atoms[:3]:
atom.metadata.update({
#'residue_name': 'UNL',
#'residue_number': 1,
'insertion_code': '',
#'chain_id': ''
})
OpenEyeToolkitWrapper().to_file(mol_no_mda, "test_oe.pdb", file_format='pdb')
!cat test_oe.pdb yields
|
Can be fixed by replacing from openff.toolkit import Molecule, OpenEyeToolkitWrapper, RDKitToolkitWrapper
mol_no_mda = Molecule.from_smiles("CC")
mol_no_mda.generate_conformers()
for atom in mol_no_mda.atoms[:3]:
atom.metadata.update({
#'residue_name': '',
#'residue_number': 1,
'insertion_code': ' ',
#'chain_id': ' '
})
OpenEyeToolkitWrapper().to_file(mol_no_mda, "test_oe.pdb", file_format='pdb')
!cat test_oe.pdb returns
|
Thanks for looking into this Jeff, what an odd bug. |
Describe the bug
Sometimes PDB files are written without coordinates with OpenEye. Both times I observed this was from creating a molecule from RDKit.
To Reproduce
(uses MDAnalysis to read and parse the PDB)
Output
test.pdb
contains coordinates:test2.pdb
does not:If I write it using the RDKitToolkitWrapper though:
Computing environment (please complete the following information):
conda list
Additional context
The text was updated successfully, but these errors were encountered: