Skip to content

Instantly share code, notes, and snippets.

@baoilleach
Created December 8, 2010 10:26
Identify inter-chiralcenter stereobonds in 2D MOL files
import pybel
def dodgywedge(sdffile):
tot = probs = potential_probs = 0
for mol in pybel.readfile("sdf", sdffile):
tot += 1
facade = pybel.ob.OBStereoFacade(mol.OBMol)
tetcenters = [atom.OBAtom for atom in mol
if facade.HasTetrahedralStereo(atom.OBAtom.GetId())]
for idx, atom_a in enumerate(tetcenters[:-1]):
for atom_b in tetcenters[idx+1:]:
if atom_a.IsConnected(atom_b):
potential_probs += 1
bond = atom_a.GetBond(atom_b)
if bond.IsWedge() or bond.IsHash():
probs += 1
print "Total number of molecules", tot
print "Potential problems:", potential_probs
print "Actual problems:", probs
if __name__ == "__main__":
dodgywedge("chembl_08.sdf")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment