Hi Greg,

Thanks for your reply. Could you explain more which pattern you use for
GetSubstructMatch? How can we guess which product' atoms are mapped to a
reaction template?

Best
GS.

śr., 12 lut 2020 o 15:50 Greg Landrum <greg.land...@gmail.com> napisał(a):

> Hi Grzegorz,
>
> Nice one! This is a bug in the way Reaction SMARTS (or Reaction SMILES for
> that matter) is parsed.
> At the moment there's not any way to directly work around the problem. You
> can add a single bond in the reaction and then manually convert that to a
> dative bond in the products. Something like this could work:
>
> In [40]: rxn = AllChem.ReactionFromSmarts('[O:1]>>[O:1]-[H+]')
>
>
> In [41]: ps = rxn.RunReactants((Chem.MolFromSmiles('CCC[O-]'),))
>
>
> In [42]: newPs = []
>
>
> In [43]: for p in ps:
>     ...:     p = p[0]
>     ...:     match = p.GetSubstructMatch(pattern)
>     ...:     if not match:
>     ...:         continue
>     ...:     newP = Chem.RWMol(p)
>     ...:
> newP.GetBondBetweenAtoms(match[0],match[1]).SetBondType(Chem.BondType.DATIVE)
>
>     ...:     newPs.append(newP)
>     ...:
>
>
> In [44]: newPs[0].UpdatePropertyCache(strict=False)
>
>
> In [45]: Chem.MolToSmiles(newPs[0])
>
> Out[45]: '[H+]<-[O-]CCC'
>
>
> Note that I changed the definition of your reaction: I removed the [H+]
> from the reactants since you weren't mapping it into the products.
>
>
> -greg
>
>
> On Wed, Feb 12, 2020 at 3:27 PM Grzegorz Skoraczyński <
> g.skoraczyn...@mimuw.edu.pl> wrote:
>
>> Hello,
>>
>> Imagine that we want to simulate an ESI protonation of the molecule. We
>> want to add a positively charged proton to a lone pair of the oxygen atom
>> of the molecule. I tried to create a reaction SMARTS with extended molecule
>> SMARTS definition, but unfortunately, it results in ValueError error, the
>> description of which suggests a different problem (parsing problem).
>>
>> >>> from rdkit.Chem import AllChem
>> >>> rxn = AllChem.ReactionFromSmarts('[O:1].[H+]>>[O:1]->[H+]')
>>
>> ---------------------------------------------------------------------------
>> ValueError                                Traceback (most recent call
>> last)
>> <ipython-input-42-06f8a10b5869> in <module>()
>> ----> 1 rxn = AllChem.ReactionFromSmarts('[O:1].[H+]>>[O:1]->[H+]')
>>
>> ValueError: ChemicalReactionParserException: multi-step reactions not
>> supported
>>
>> RDKit version: 2020.03.1dev1.
>>
>> Could you help me with creating a dative bond in reaction SMARTS?
>>
>> Best regards
>> Grzegorz Skoraczyński
>> _______________________________________________
>> Rdkit-discuss mailing list
>> Rdkit-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
>
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to