Hi Greg,

It helped a lot ! Now it works.
A good occasion for me to learn more about while loops usage :)

Thank you so much,

LF

> On 24 Jun 2018, at 5:07 PM, Greg Landrum <[email protected]> wrote:
> 
> Hi Louis Felix,
> 
> The trick is to feed the products of the reaction back in as reactants and 
> then stop as soon as the reaction doesn't produce any products. Here's a 
> short illustration using your reaction:
> 
> In [11]: m = 
> Chem.MolFromSmiles('O=C1[C@@](C)(OC(CC)=O)[C@@]2([H])[C@]([C@H](OC(C3=CC=CC=C3)=O)C[C@@]4([H])[C@]2(C)C4(C
>     ...: 
> )C)(COC(C)=O)[C@H](OC(C)=O)[C@@]5([H])[C@@H](OC(C)=O)[C@@H](C)C[C@@]51OC(CCC)=O')
> 
> In [12]: while 1:
>     ...:     ps = rxn.RunReactants((m,))
>     ...:     if not ps:
>     ...:         break
>     ...:     m = ps[0][0]
>     ...:
> 
> In [13]: print(Chem.MolToSmiles(m))
> C[C@H]1C[C@]2(O)C(=O)[C@@](C)(O)[C@@H]3[C@]4(C)[C@H](C[C@@H](O)[C@@]3(CO)[C@H](O)[C@H]2[C@H]1O)C4(C)C
> 
> I hope this helps,
> -greg
> 
> 
> 
> On Sat, Jun 23, 2018 at 2:54 AM Louis-Félix Nothias 
> <[email protected] <mailto:[email protected]>> wrote:
> Hello,
> 
> I would need a bit of help setting a SMART reaction with RDKit.
> This is pretty basic. I just want to hydrolyse the esters of an input 
> molecules with the RunReactants function .
> So far, I have the following SMART reaction, and it works, but for only one 
> ester at a time (6 product pairs produced here).
> Could you please indicate a strategy to remove all the esters from the input 
> compound, rather than only one ?
> 
> Thank you very much for your help,
> 
> Louis Felix
> 
> ```
> from rdkit import rdBase, Chem
> from rdkit.Chem import AllChem, Draw
> 
> rxn = AllChem.ReactionFromSmarts('[C:1][O:2]C([C,c])=O>>[C:1][OH:2].O=[C][C]')
> m = 
> Chem.MolFromSmiles('O=C1[C@@](C)(OC(CC)=O)[C@@]2([H])[C@]([C@H](OC(C3=CC=CC=C3)=O)C[C@@]4([H])[C@]2(C)C4(C)C)(COC(C)=O)[C@H](OC(C)=O)[C@@]5([H])[C@@H](OC(C)=O)[C@@H](C)C[C@@]51OC(CCC)=O')
> products = rxn.RunReactants((m,))
> 
> ——
> 
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org <http://slashdot.org/>! 
> http://sdm.link/slashdot 
> <http://sdm.link/slashdot>_______________________________________________
> Rdkit-discuss mailing list
> [email protected] 
> <mailto:[email protected]>
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss 
> <https://lists.sourceforge.net/lists/listinfo/rdkit-discuss>
> <View_reaction.png><View_reaction.png>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to