On Mon, Apr 6, 2009 at 9:26 PM, George Oakman <[email protected]> wrote:
> I see, matching without specifying chirality and then filtering results
> manually, using the atom getChiralTag() function.
>
> Is that what you had in mind?
More or less. To make life a bit more straightforward, if you are
searching with molecules (not SMARTS, I'll explain why below) I would
suggest using the CIP chirality of chiral atoms:
[2]>>> from rdkit import Chem
[3]>>> m = Chem.MolFromSmiles('c...@h](Br)I')
[4]>>> Chem.AssignStereochemistry(m)
[5]>>> m.GetAtomWithIdx(1).GetProp('_CIPCode')
Out[5] 'R'
Because that would also mean you'd recognize that this arrangement of
atoms and bonds is the same:
[6]>>> m2 = Chem.MolFromSmiles('Cl[C@@H](I)Br')
[7]>>> Chem.AssignStereochemistry(m2)
[8]>>> m2.GetAtomWithIdx(1).GetProp('_CIPCode')
Out[8] 'R'
Getting this right without using the CIP codes is not going to be fun.
Similarly, using GetStereo() on matched double bonds will help avoid
complications:
[9]>>> m = Chem.MolFromSmiles('C/C=C/C')
[10]>>> Chem.AssignStereochemistry(m)
[12]>>> m.GetBondWithIdx(1).GetStereo()
Out[12] rdkit.Chem.rdchem.BondStereo.STEREOE
[13]>>> m2 = Chem.MolFromSmiles('C\\C=C\\C')
[14]>>> Chem.AssignStereochemistry(m2)
[15]>>> m2.GetBondWithIdx(1).GetStereo()
Out[15] rdkit.Chem.rdchem.BondStereo.STEREOE
Note that that my proposed approach doesn't work at all if you don't
include sufficient information around your query atom. For example, if
you search for the SMARTS 'c...@h](C)Cl', this will substructure match
'c...@h](CC)Cl' and, 'c...@h](C)Cl'. These two molecules have different
chirality (the first is R, the second S). The fact that the SMARTS I
provide should match both of them is one of the reasons I've stayed
away from this whole mess.
The situation is even worse because within the RDKit you can't, in
general, call Chem.AssignStereochemistry() on a molecule constructed
from SMARTS (that function requires information about H counts and
implicit valence that is not by default available for the results of
Chem.MolFromSmarts()).
> That sounds like a good solution - thanks.
Change your mind about that yet? :-)
-greg