Hi John, Michal, and everyone,
I've been following this discussion with interest and wrote a code snippet
to test out John M.'s idea to access the '_CIPCode' property of atoms. The
results of doing are opposite to the result of the original getStereoInfo()
function, and thus are in accord with Michal's reports of JChem output. So
for the simple test case of ephedrine all is well, but I'd be interested in
hearing stories about what goes wrong in more complex cases.
from rdkit import Chem
>
> # old function from Michal Nowotka
> def getStereoInfo(smiles):
> ret = []
> mol = Chem.MolFromSmiles(smiles)
> Chem.AssignStereochemistry(mol, flagPossibleStereoCenters=True,
> force=True)
> for atom in mol.GetAtoms():
> stereo = str(atom.GetChiralTag())
> atomIndex = atom.GetIdx()
> if str(atom.GetChiralTag()) != "CHI_UNSPECIFIED":
> if stereo == "CHI_TETRAHEDRAL_CW":
> chirality = "R"
> elif stereo == "CHI_TETRAHEDRAL_CCW":
> chirality = "S"
> else:
> chirality = "R/S"
> ret.append({"atomIndex":atomIndex,"chirality":chirality})
> return ret
>
> # new function as suggested by John M.
> def get_stereo_info_new(smiles):
> # import the molecule into rdkit
> mol = Chem.MolFromSmiles(smiles)
>
> # find chiral centers
> Chem.FindMolChiralCenters(mol)
>
> # recover info on chiral centers
> chiral_centers = {}
> for atom in mol.GetAtoms():
> try:
> stereo = str(atom.GetProp('_CIPCode'))
> chiral_centers[atom.GetIdx()] = stereo
> except KeyError:
> pass
> return chiral_centers
>
> # compare the functions on a chiral molecule
> ephedrine = 'O[C@H](c1ccccc1)[C@@H](NC)C'
> print getStereoInfo(ephedrine)
> print get_stereo_info_new(ephedrine)
[{'chirality': 'S', 'atomIndex': 1}, {'chirality': 'R', 'atomIndex': 8}]
{8: 'S', 1: 'R'}
On Tue, Sep 8, 2015 at 7:19 AM, John M <[email protected]> wrote:
> Yes, but the ordering is relative to some ranking. I think you're
> accessing "local parity" here, see slide 8
> http://baoilleach.blogspot.co.uk/2015/08/the-whole-of-cheminformatics-best.html
> .
>
> Try accessing the "_CIPCode" prop on the atoms. Note there are still
> problems.
>
> J
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Rdkit-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss