Created
December 8, 2010 10:26
Identify inter-chiralcenter stereobonds in 2D MOL files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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