Skip to content
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

Is bond order available via pdbfixer? #231

Closed
ljmartin opened this issue Sep 27, 2021 · 3 comments
Closed

Is bond order available via pdbfixer? #231

ljmartin opened this issue Sep 27, 2021 · 3 comments

Comments

@ljmartin
Copy link

Hi,
Is it possible to access bond orders from a protein structure via a pdb file, as interpreted by pdbfixer? Do topology objects from a pdb file (without any other input files) infer bond order at all?

Here's a minimal example of what I'm missing:

import requests
from io import BytesIO
import pdbfixer

def getPDB(code):
    out = requests.get(f'https://files.rcsb.org/download/{code}.pdb')
    f = open(f'{code}.pdb', 'w')
    f.write(out.content.decode('utf8'))

code='3udn'
pdb_string = getPDB('code')

fixer = PDBFixer(filename=f'{code}.pdb')
fixer.findMissingResidues()
fixer.findNonstandardResidues()
fixer.replaceNonstandardResidues()
fixer.removeHeterogens(True)
fixer.findMissingAtoms()
fixer.addMissingAtoms()
fixer.addMissingHydrogens(7.0)

for bond in fixer.topology.bonds():
    print(bond.order)

This prints None for every bond.

The end goal here is to use pdbfixer to read a PDB, generate atom and bonding information, and then port the bonding information into an RDKit RWMol object. RDKit assumes single bonds when creating a molecule bond-by-bond, but it can of course make double bonds - if I knew when to specify them, that is!

Thanks
lew

@peastman
Copy link
Member

PDB files don't contain any information about bond order. RDKit can load a PDB file directly, and it will attempt to infer bond order. But be aware that it doesn't always get everything right! You can also use Open Babel to load a PDB file and infer bond orders, but it too makes mistakes. I recently encountered this exact problem, and I didn't come up with any entirely satisfactory general solution.

@ljmartin
Copy link
Author

Thanks @peastman. I asked a similar question on the rdkit mailing list, and Maceij from ODDT pointed out he tried something similar, and ended up writing an rdkit tool to assign bond orders (assuming correct connectivity) using templates: https://github.com/oddt/oddt/blob/master/oddt/toolkits/extras/rdkit/fixer.py#L623-L669 . That gets most of the way there. Cheers

@peastman
Copy link
Member

That's good to know about. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants