OEAnnotateValenceProblems

OEAnnotateValenceProblems(disp: OE2DMolDisplay) -> bool

Annotates potential valence problems on the molecule. An atom is considered to have a valence problem when its bond count exceeds the maximum valence defined by the MDL valence model for its atomic number and formal charge.

Note

Aromaticity must be perceived (e.g.via OEAssignAromaticFlags) before calling this function. Without aromaticity perception, aromatic ring atoms may be incorrectly flagged as having valence problems because their bonds are treated as alternating single/double bonds.

disp

The OE2DMolDisplay object being annotated.

The following code snippet show how to use the OEAnnotateValenceProblems function. See the generated image in Figure: Example of molecule with incorrect valences.

mol = oechem.OEGraphMol()
oechem.OESmilesToMol(mol, "C[N+](=C)(C)C1CCCCl1")
oedepict.OEPrepareDepiction(mol)

width, height = 200, 200
opts = oedepict.OE2DMolDisplayOptions(width, height, oedepict.OEScale_AutoScale)
disp = oedepict.OE2DMolDisplay(mol, opts)
oedepict.OEAnnotateValenceProblems(disp)

oedepict.OERenderMolecule("OEAnnotateValenceProblems.png", disp)
../../_images/OEAnnotateValenceProblems.png

Example of molecule with incorrect valences

Note

The OEAnnotateValenceProblems function uses the MDL Valence Model.