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("c1ccccc1")
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', 'Fc1cccc(F)c1', 'Fc1ccccc1F'}

---------------------------------------------------------
Best regards,
Takayuki

2016年2月6日(土) 23:01 Michal Krompiec <michal.kromp...@gmail.com>:

> 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 <serit...@gmail.com> 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)
>>
>> <ipython-input-11-9e3b0e79dbd7> in <module>()
>>
>> ----> 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

Reply via email to