Skip to main content

canonical_enantiomer()

gra or its enantiomer, whichever has the smaller canonical JSON.

Usage

Source

canonical_enantiomer(gra: G) -> G
 
canonical_enantiomer(gra: ReactionGraph | StereoReactionGraph) -> ReactionGraph | StereoReactionGraph
 
canonical_enantiomer(gra: AnyGraph) -> AnyGraph

A reproducible choice of one of two mirror images (like InChI’s /m0); a tie (an achiral graph) keeps gra. Atom indices are kept. On a reaction graph the choice doesn’t depend on its direction (P60): each of the two is compared in its canonical direction, canonical_json(canonical_direction(x)[0]), and the winner is returned in gra’s direction.

>>> from protomol import from_smiles
>>> r, s = from_smiles("C[C@H](O)CC"), from_smiles("C[C@@H](O)CC")
>>> canonical_json(canonical_enantiomer(r)) == canonical_json(s)

True

>>> canonical_enantiomer(s) == s

True