[including the mailing list on the reply, because it is perhaps generally useful]
Dear Malous On Sat, Feb 9, 2013 at 10:16 PM, Malous Kossarian <[email protected]> wrote: > > I'm a student working with RDKit and I've recently stumbled across an > interesting dilemma which I believe you are aware of (I've included a thread > from the website in this email, because I believe I'm dealing with the same > problem). It's a related, but more difficult one. Still, thanks for reporting it. > This is easiest for me to explain through an example, so I'll show you with > a retro version of the Aldol Addition: > > aldol = > AllChem.ReactionFromSmarts('[C:1](=[O:2])[C:3][C:4]([OH:5])[#6:6]>>[C:1](=[O:2])[C:3].[C:4](=[O:5])[#6:6]') > ps = aldol.RunReactants((Chem.MolFromSmiles('CC(=O)CC(O)C[C@@](C)(N)F'),)) > > Chem.MolToSmiles(ps[0][0]) >>> 'CC(C)=O' > > Chem.MolToSmiles(ps[0][1],isomericSmiles=True) >>> 'C[C@](N)(F)CC=O' > > #This is fine for this example, but we run into problems if the > stereochemistry is on an atom in the reaction transform--such as: > > ps = aldol.RunReactants((Chem.MolFromSmiles('CC(O)[C@](N)(F)C(C)=O'),)) > > Chem.MolToSmiles(ps[0][0],isomericSmiles=True) >>>'CC(=O)C(N)F' > > Chem.MolToSmiles(ps[0][1],isomericSmiles=True) >>>'CC=O' > > As you can see, we lose stereochemistry in this example. > > It seems like this issue has been brought to your attention and you may have > already figured out a potential fix. I was wondering if you could direct us > to the source code we could look at to fix this problem, or if we could > potentially start testing a version of RDKit with the fix you have already > made. I did check a fix in yesterday, but it won't work for your example, which is more complex. Here's the test case for Robert's bug: In [12]: rxn = AllChem.ReactionFromSmarts('[C:2][C:1]=O>>[C:2][C:1]=S') In [13]: ps = rxn.RunReactants((Chem.MolFromSmiles('[Cl][C@H](C=O)F'),)) In [14]: Chem.MolToSmiles( ps[0][0], isomericSmiles=True ) Out[14]: 'F[C@H](Cl)C=S' Notice that the chiral atom here (mapped as number 2) has the same number of bonds in both the products and reactants. That's a necessary condition for the fix I added. Another requirement is that the atoms around the chiral center be mapped. In your example you lose a bond from the chiral center (it's replaced by an implicit H). This won't work with the logic I added yesterday. I'll think about this one a bit, but I'm not really optimistic about finding a reasonable answer; I think you just lose too much information. It seems like something like this ought to work: In [27]: aldol = AllChem.ReactionFromSmarts('[C:1](=[O:2])[C:3][C:4]([OH:5])[#6:6]>>[C:1](=[O:2])[C:3][H].[C:4](=[O:5])[#6:6]') In [28]: ps = aldol.RunReactants((Chem.MolFromSmiles('CC(O)[C@](N)(F)C(C)=O'),)) In [29]: Chem.MolToSmiles(ps[0][0],True) Out[29]: '[H]C(N)(F)C(C)=O' But, as you can see, it doesn't. This seems more likely to be fixable in a reasonable amount of time. You asked about where this code is. The logic for dealing with these cases starts at line 442 in the svn version of $RDBASE/Code/GraphMol/ChemReactions/Reaction.cpp The diff from yesterday's commit shows the changes: https://github.com/rdkit/rdkit/commit/aa443062acf2760aaf86286f3de3bf66d8734045 -greg ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ Rdkit-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

