Hi Toby,

On Mon, Apr 7, 2014 at 3:37 PM, Toby Wright <toby.wri...@inhibox.com> wrote:

>
> Noticed something odd but I'm not confident enough with reaction SMARTS to
> say it's a bug. I'm reacting with an OH, leading to the oxygen losing the
> hydrogen and gaining a second bond. For example:
>
> > rxn = AllChem.ReactionFromSmarts("[O:1]>>C[O:1]")
> > mol = Chem.MolFromSmiles("OC")
> > p = rxn.RunReactants((mol,))[0][0]
> > Chem.SanitizeMol(p)
> rdkit.Chem.rdmolops.SanitizeFlags.SANITIZE_NONE
> > Chem.MolToSmiles(p)
> 'COC'
>
> So far so good. Now to add explicit hydrogens to the oxygen. If mol is
> "[OH]C" or "[H]OC" the same behaviour as above happens. However if it is
> "[2H]OC" we run into:
>
> ValueError: Sanitization error: Explicit valence for atom # 1 O, 3, is
> greater than permitted
>
>
because the deuterium is being preserved whereas in the other cases the
> hydrogen is discarded. I can't find anything in the SMARTS documentation to
> suggest that this is the correct behaviour so I'm going to suggest that if
> the [H] was being discarded by the reaction then so should the [2H].
>

You've diagnosed what is happening correctly: the RemoveHs() functionality
does not remove the [2H] since that's not something that can be replaced by
inspecting the valence of the O atom.

That's not the real problem here though. The reaction above also won't work
for ethers or anything with a double bond to an O. What you more likely
want is something like:
rxn = AllChem.ReactionFromSmarts("[OH;D1:1]>>C[O:1]")
this will match CO, but not C=O, COC, or CO[2H].
If you want the reaction to also apply to the deuterated species, which you
say later in your email you don't, I think you're going to have to AddHs to
the molecules before calling RunReactants() and explicitly include the H in
the reaction query. Or, of course, you could add as second reaction to deal
with Hs that are actually present.

-greg



> In either case it's not a problem for me as I have no particular interest
> in Deuterium containing molecules so I don't need a workaround or quick
> fix. I just happened across the behaviour and thought it worth reporting.
>
> Yours,
>
> Toby Wright
>
> --
> InhibOx Ltd
>
>
> ------------------------------------------------------------------------------
> Put Bad Developers to Shame
> Dominate Development with Jenkins Continuous Integration
> Continuously Automate Build, Test & Deployment
> Start a new project now. Try Jenkins in the cloud.
> http://p.sf.net/sfu/13600_Cloudbees_APR
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to