HI Rafal,
On Wed, Jun 5, 2019 at 6:25 PM Rafal Roszak <rmrmg.c...@gmail.com> wrote: > > Is it possible to get stereochemical atom order around chiral center? > It is. > To be more verbose: > in smiles/smarts chirality (@ or @@) is determined by atom order which is > not exactly the same as atom idxes in mol. > The difference may appear in ring-containing compounds, according to > https://www.daylight.com/dayhtml/doc/theory/theory.smiles.html: > """The chiral order of the ring closure bond is implied by the lexical > order that the ring closure digit > appears on the chiral atom (not in the lexical order of the "substituent" > atom).""" > For example all smileses below represent the same molecule: > C1CN[C@@H](C)OC1 --chiralOrder-> N,C,O --smiOrder-> N,C,O > O1CCCN[C@H]1C --chiralOrder-> N,O,C --smiOrder-> O,N,C > C[C@@H]1NCCCO1 --chiralOrder-> C,O,N --smiOrder-> C,N,O > only in first example chiral order is the same as atom order in mol object. > So is it possible to get chiral order? In the RDKit the chiral order is determined by the order of the atom's bonds. Here's a bit of code showing how to get the neighboring atoms in the correct order: In [14]: ms = [Chem.MolFromSmiles(smi) for smi in 'C1CN[C@@H](C)OC1 O1CCCN[C@H]1C C[C@@H]1NCCCO1'.split()] In [15]: for m in ms: ...: for atom in m.GetAtoms(): ...: if atom.GetChiralTag() not in (Chem.CHI_TETRAHEDRAL_CCW,Chem.CHI_TETRAHEDRAL_CW): ...: continue ...: nbrs = [] ...: for bnd in atom.GetBonds(): ...: nbrs.append(bnd.GetOtherAtomIdx(atom.GetIdx())) ...: print(f'{atom.GetSymbol()}({atom.GetIdx()}) {atom.GetChiralTag()}: {" ".join(str(x) for x in nbrs)}') ...: print("------") ...: ...: ...: C(3) CHI_TETRAHEDRAL_CW: 2 4 5 ------ C(5) CHI_TETRAHEDRAL_CW: 4 6 0 ------ C(1) CHI_TETRAHEDRAL_CCW: 0 2 6 ------ Note that because the ordering of the bonds in the final molecule does not always correspond to the ordering in the SMILES, the atom's chiral tag in the molecule may not match what it was in the SMILES. The stereochemistry is still correct though. Best, -greg
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss