Hi Rocco,

On Tue, Jan 5, 2016 at 12:26 AM, Rocco Moretti <[email protected]>
wrote:

>
> It doesn't look like user-set properties are copied through with
> explicitly mapped atoms in chemical reactions, although implicitly copied
> atoms do have their properties transfered. (See example session below.)
>
> Is this the intended behavior?
>

It's intended in the sense of "yes, that's how it was written". Having said
that, I can't come up at the moment with any compelling reason not to
change it though.


> If I were to want all mappable atoms (implicit & explicit) to have
> particular properties transfered across the reaction, how best would I go
> about doing so (specifically on the C++ level)?
>

After a quick scan through the code, I believe that the changes would be
made in this function:
https://github.com/rdkit/rdkit/blob/master/Code/GraphMol/ChemReactions/ReactionRunner.cpp#L388

I'm happy to add the required bits of code, but I want to spend a bit more
time thinking about the consequences. Feel free to go ahead and create the
github issue requesting the feature though. :-)

-greg




> Thanks,
> -Rocco
>
> --
>
> from rdkit import Chem
> from rdkit.Chem import AllChem
>
> def print_arb_prop(mollist):
>     for m in range(len(mollist)):
>         for a in range(mollist[m].GetNumAtoms()):
>             atom = mollist[m].GetAtomWithIdx(a)
>             if atom.HasProp("arb_prop"):
>                 print m, a, atom.GetSymbol(), atom.GetIntProp("arb_prop")
>
> mol = Chem.MolFromSmiles("ClCNOCBr")
> for a in range(mol.GetNumAtoms()):
>     mol.GetAtomWithIdx(a).SetIntProp("arb_prop", a*-2 )
>
> print_arb_prop( [mol] )
> # 0 0 Cl 0
> # 0 1 C -2
> # 0 2 N -4
> # 0 3 O -6
> # 0 4 C -8
> # 0 5 Br -10
>
> rxn1 = AllChem.ReactionFromSmarts('[N:3][O:4]>>[N:3].[O:4]')
> print_arb_prop( rxn1.RunReactants([mol])[0] )
> # 0 1 C -2
> # 0 2 Cl 0
> # 1 1 C -8
> # 1 2 Br -10
>
> rxn2 =
> AllChem.ReactionFromSmarts('[Cl:1][C:2][N:3][O:4][C:5]>>[Cl:1][C:2][N:3].[O:4][C:5]')
> print_arb_prop( rxn2.RunReactants([mol])[0] )
> # 1 2 Br -10
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Rdkit-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to