Hi Jan,

This is a small bug in the code that applies the query properties to the
new molecule.
In your case you can see that things are technically ok by doing:
   newmol[0][0].GetAtomWithIdx(0).SetNoImplicit(True)
before calling Chem.MolToSmiles()

Here's the bug report: https://github.com/rdkit/rdkit/issues/1544

It should be an easy fix.

-greg



On Mon, Aug 28, 2017 at 2:47 PM, Jan Halborg Jensen <jhjen...@chem.ku.dk>
wrote:

> Is it possible to remove hydrogens using ReactionFromSmarts, for example
> changing Cc1ccccc1 to [CH2]c1ccccc1?
>
> I can do it using ReplaceSubstructs but I am trying to write more general
> code that also does other transformations that are better done
> with ReactionFromSmarts.  I can also create [CH2+]c1ccccc1? and then
> remove the + from the SMILES string but that is a hack
>
> Here's sample code that, unfortunately, produces Cc1ccccc1
>
> from rdkit import Chem
> from rdkit.Chem import AllChem
>
> m = Chem.MolFromSmiles("Cc1ccccc1")
> rxn_smarts = '[CX4;H3:1]>>[CX4;H2:1]'
>
> rxn = AllChem.ReactionFromSmarts(rxn_smarts)
> newmol = rxn.RunReactants((m,))
> print Chem.MolToSmiles(newmol[0][0],canonical=False)
>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to