Re: [Rdkit-discuss] Question about Run Reaction
Hi Taka, Yes, you need to sanitize every product molecule, after each step. Best wishes, Michal On 7 February 2016 at 01:58, Taka Seri wrote: > Hi Michal, > > Thank you for your quick and kind response. > I tried to sanitize mol according to your advice. > And my code worked fine ! > Thanks you. ;-) > By the way, If I want to run several reaction steps. Do I need to > sanitize each molecules? > > > # reactiontest.py > from rdkit import Chem > from rdkit.Chem import AllChem > > from rdkit import Chem > from rdkit.Chem import AllChem > mol = Chem.MolFromSmiles("c1c1") > rxn = AllChem.ReactionFromSmarts( "[cH&$(c(c)c):2]>>[c:2][F]" ) > ps1= rxn.RunReactants( (mol,) ) > ps1 > mol2 = ps1[0][0] > Chem.SanitizeMol( mol2 ) > ps2= rxn.RunReactants( (mol2,) ) > uniq = set( [ Chem.MolToSmiles(x[0], isomericSmiles=True ) for x in ps2 ] > ) > print( uniq ) > --- > from shell > > $ python reactiontest.py > > {'Fc1ccc(F)cc1', 'Fc1(F)c1', 'Fc1c1F'} > > - > Best regards, > Takayuki > > 2016年2月6日(土) 23:01 Michal Krompiec : > >> Hi Taka, >> You have to call SanitizeMol() on the product(s) explicitely. The error >> is caused by the reactants not being 'sanitized'. >> Best wishes, >> Michal >> >> >> On Saturday, 6 February 2016, Taka Seri wrote: >> >>> Dear RDKitters, >>> >>> I have question about rdkit reaction function. >>> I want to generate molecules using several reaction steps. >>> I referred rdkit blog post, and wrote following code. >>> But second step of reaction caused error. >>> I could not difference about mol and mol2 object. >>> I wonder if anyone could help me. >>> Best regards, >>> >>> Takayuki >>> >>> >>> In [1]: from rdkit import Chem >>> >>> In [2]: from rdkit.Chem import AllChem >>> >>> In [3]: mol = Chem.MolFromSmiles("c1ccc(F)cc1") >>> >>> In [6]: rxn = AllChem.ReactionFromSmarts('[cH&$(c(c)c):2]>>[c:2][F]') >>> >>> #first step works fine. >>> >>> In [7]: ps = rxn.RunReactants((mol,)) >>> >>> #Bud second step did not work... >>> >>> In [9]: mol2 = ps[0][0] >>> >>> In [11]: ps = rxn.RunReactants((mol2,)) >>> >>> [22:23:10] >>> >>> >>> >>> >>> Pre-condition Violation >>> >>> getNumImplicitHs() called without preceding call to calcImplicitValence() >>> >>> Violation occurred on line 166 in file >>> /Users/landrgr1/anaconda3/anaconda/conda-bld/work/Code/GraphMol/Atom.cpp >>> >>> Failed Expression: d_implicitValence>-1 >>> >>> >>> >>> >>> >>> --- >>> >>> RuntimeError Traceback (most recent call >>> last) >>> >>> in () >>> >>> > 1 ps = rxn.RunReactants((mol2,)) >>> >>> >>> RuntimeError: Pre-condition Violation >>> >>> >>> -- Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Re: [Rdkit-discuss] Question about Run Reaction
Hi Michal, Thank you for your quick and kind response. I tried to sanitize mol according to your advice. And my code worked fine ! Thanks you. ;-) By the way, If I want to run several reaction steps. Do I need to sanitize each molecules? # reactiontest.py from rdkit import Chem from rdkit.Chem import AllChem from rdkit import Chem from rdkit.Chem import AllChem mol = Chem.MolFromSmiles("c1c1") rxn = AllChem.ReactionFromSmarts( "[cH&$(c(c)c):2]>>[c:2][F]" ) ps1= rxn.RunReactants( (mol,) ) ps1 mol2 = ps1[0][0] Chem.SanitizeMol( mol2 ) ps2= rxn.RunReactants( (mol2,) ) uniq = set( [ Chem.MolToSmiles(x[0], isomericSmiles=True ) for x in ps2 ] ) print( uniq ) --- from shell $ python reactiontest.py {'Fc1ccc(F)cc1', 'Fc1(F)c1', 'Fc1c1F'} - Best regards, Takayuki 2016年2月6日(土) 23:01 Michal Krompiec : > Hi Taka, > You have to call SanitizeMol() on the product(s) explicitely. The error is > caused by the reactants not being 'sanitized'. > Best wishes, > Michal > > > On Saturday, 6 February 2016, Taka Seri wrote: > >> Dear RDKitters, >> >> I have question about rdkit reaction function. >> I want to generate molecules using several reaction steps. >> I referred rdkit blog post, and wrote following code. >> But second step of reaction caused error. >> I could not difference about mol and mol2 object. >> I wonder if anyone could help me. >> Best regards, >> >> Takayuki >> >> >> In [1]: from rdkit import Chem >> >> In [2]: from rdkit.Chem import AllChem >> >> In [3]: mol = Chem.MolFromSmiles("c1ccc(F)cc1") >> >> In [6]: rxn = AllChem.ReactionFromSmarts('[cH&$(c(c)c):2]>>[c:2][F]') >> >> #first step works fine. >> >> In [7]: ps = rxn.RunReactants((mol,)) >> >> #Bud second step did not work... >> >> In [9]: mol2 = ps[0][0] >> >> In [11]: ps = rxn.RunReactants((mol2,)) >> >> [22:23:10] >> >> >> >> >> Pre-condition Violation >> >> getNumImplicitHs() called without preceding call to calcImplicitValence() >> >> Violation occurred on line 166 in file >> /Users/landrgr1/anaconda3/anaconda/conda-bld/work/Code/GraphMol/Atom.cpp >> >> Failed Expression: d_implicitValence>-1 >> >> >> >> >> >> --- >> >> RuntimeError Traceback (most recent call >> last) >> >> in () >> >> > 1 ps = rxn.RunReactants((mol2,)) >> >> >> RuntimeError: Pre-condition Violation >> >> >> -- Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Re: [Rdkit-discuss] Question about Run Reaction
Hi Taka, You have to call SanitizeMol() on the product(s) explicitely. The error is caused by the reactants not being 'sanitized'. Best wishes, Michal On Saturday, 6 February 2016, Taka Seri wrote: > Dear RDKitters, > > I have question about rdkit reaction function. > I want to generate molecules using several reaction steps. > I referred rdkit blog post, and wrote following code. > But second step of reaction caused error. > I could not difference about mol and mol2 object. > I wonder if anyone could help me. > Best regards, > > Takayuki > > > In [1]: from rdkit import Chem > > In [2]: from rdkit.Chem import AllChem > > In [3]: mol = Chem.MolFromSmiles("c1ccc(F)cc1") > > In [6]: rxn = AllChem.ReactionFromSmarts('[cH&$(c(c)c):2]>>[c:2][F]') > > #first step works fine. > > In [7]: ps = rxn.RunReactants((mol,)) > > #Bud second step did not work... > > In [9]: mol2 = ps[0][0] > > In [11]: ps = rxn.RunReactants((mol2,)) > > [22:23:10] > > > > > Pre-condition Violation > > getNumImplicitHs() called without preceding call to calcImplicitValence() > > Violation occurred on line 166 in file > /Users/landrgr1/anaconda3/anaconda/conda-bld/work/Code/GraphMol/Atom.cpp > > Failed Expression: d_implicitValence>-1 > > > > > --- > > RuntimeError Traceback (most recent call > last) > > in () > > > 1 ps = rxn.RunReactants((mol2,)) > > > RuntimeError: Pre-condition Violation > > > -- Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
[Rdkit-discuss] Question about Run Reaction
Dear RDKitters, I have question about rdkit reaction function. I want to generate molecules using several reaction steps. I referred rdkit blog post, and wrote following code. But second step of reaction caused error. I could not difference about mol and mol2 object. I wonder if anyone could help me. Best regards, Takayuki In [1]: from rdkit import Chem In [2]: from rdkit.Chem import AllChem In [3]: mol = Chem.MolFromSmiles("c1ccc(F)cc1") In [6]: rxn = AllChem.ReactionFromSmarts('[cH&$(c(c)c):2]>>[c:2][F]') #first step works fine. In [7]: ps = rxn.RunReactants((mol,)) #Bud second step did not work... In [9]: mol2 = ps[0][0] In [11]: ps = rxn.RunReactants((mol2,)) [22:23:10] Pre-condition Violation getNumImplicitHs() called without preceding call to calcImplicitValence() Violation occurred on line 166 in file /Users/landrgr1/anaconda3/anaconda/conda-bld/work/Code/GraphMol/Atom.cpp Failed Expression: d_implicitValence>-1 --- RuntimeError Traceback (most recent call last) in () > 1 ps = rxn.RunReactants((mol2,)) RuntimeError: Pre-condition Violation -- Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss