Dear Abhinav,

I'm CCing the mailing list on this reply because it is of general
interest. I've also combined both of your questions into one response.

On Wed, Jul 1, 2009 at 12:14 AM, Abhinav Chawade<[email protected]> wrote:
>
> I found a SMIRKS and SMILES combo that does not give result as expected from
> Daylight toolkit

Both of these differences arise because of different handling of Hs in
the RDKit reaction SMARTS and Daylight's SMIRKS.

> Input Smiles C1(C=CC=C2)=C2CCC(C=CC=C3)=C3O1
> Input Smirks [*:1]-[O]-[*:2]>>[*:1]-[N]-[*:2]
> Output with RDKit c1ccc2c(c1)CCc1ccccc1N2
> Output with Daylight C1Cc2ccccc2[N]c3ccccc13

In the first case what Daylight does is convert the O into an N with
no Hs, which produces a radical in your products. If you want Daylight
to produce a stable molecule instead of a radical you could use the
SMIRKS '[*:1]-[O]-[*:2]>>[*:1]-[NH]-[*:2]' The RDKit, on the other
hand, converts the O into a "normal" N, since that N is three
coordinate it has an implicit H. At the moment I can't really see how
to get the RDKit to produce a radical species using reaction SMARTS,
but I don't think that's a common use case; I'm open to
counter-arguments.

> Also adding to last email, following same SMIRKS produces 2 products from
> Daylight toolkit but 1 on RDKit
>
> Input Smiles OP(OC1=CC2=CC=CC=C2C=C1)(O)=O
> Input Smirks [*:1]-[O]-[*:2]>>[*:1]-[N]-[*:2]
> Output with RDKit O=P(O)(O)Nc1cc2c(cccc2)cc1
> Output with Daylight OP(=O)(O)[N]c1ccc2ccccc2c1.[NH]P(=O)(O)Oc1ccc2ccccc2c1
>

In this case the second product comes because the Daylight matcher
recognizes the implicit hydrogen on one of the terminal Os as
something that should be matched by the pattern (an aside: both
products from Daylight are again radicals). The RDKit does not find
this match, so it does not do the replacement. The way Daylight
handles this is, in my opinion, odd since the SMARTS CO[*] does not
match the molecule CO, it's a special case in their SMIRKS matcher.

If you really want to duplicate this kind of behavior in the RDKit,
you just need to add Hs to your molecules before feeding them to the
reaction:

[17]>>> m = Chem.MolFromSmiles('CCO')

[18]>>> mh = Chem.AddHs(m)

[19]>>> r=AllChem.ReactionFromSmarts('[*:1]-[O]-[*:2]>>[*:1]-[NH]-[*:2]')

[20]>>> ps = r.RunReactants((mh,))

[21]>>> Chem.MolToSmiles(ps[0][0],True)
Out[21] '[H]NC(C([H])([H])[H])([H])[H]'

Calling remove Hs later on the products gets a SMILES that's more readable:
[22]>>> p0 = Chem.RemoveHs(ps[0][0])

[23]>>> Chem.MolToSmiles(p0,True)
Out[23] 'CCN'

Best Regards,
-greg

Reply via email to