Re: [Rdkit-discuss] Getting Started: labeling sidechain by number of core atom it was attached to

2017-02-23 Thread Markus Metz
Hello Greg:

Duh! I guess I sat too long in front of the screen.

As always, thank you very much for your help!

Markus


On Wed, Feb 22, 2017 at 7:50 PM, Greg Landrum 
wrote:

> Hi Markus,
>
>
> On Thu, Feb 23, 2017 at 1:41 AM, Markus Metz  wrote:
>
>>
>> According to the example it is possible to use the option
>> labelByIndex=True in ReplaceCore.
>> Converting the sidechains from mol to smiles with isomericSmiles=True
>> labels the sidechains with 1 and 5.
>> Where do these numbers come from?
>>
>
> They are the indices of the atoms in the core.
>
>
>> I included the atom indices in the mol drawing but the core atoms are 1
>> and 8. (please see attached jupyter file). What am I missing?
>>
>
> The code where you assign the atom map numbers so that you can see the
> indices:
>
>
> matches = m1.GetSubstructMatch(core)
> print(matches)
>
> for i, atom_idx in enumerate(matches, 1):
> m1.GetAtomWithIdx(atom_idx).SetProp('molAtomMapNumber', str(atom_idx))
>
>
> is using the indices in m1. You want the indices in the core:
>
>
> for i, atom_idx in enumerate(matches, 1):
> m1.GetAtomWithIdx(atom_idx).SetProp('molAtomMapNumber', str(i))
>
>
> (Note: you can also do SetIntProp() and skip the conversion of i to a
> string).
>
> Best,
> -greg
>
>
--
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


Re: [Rdkit-discuss] Getting Started: labeling sidechain by number of core atom it was attached to

2017-02-22 Thread Greg Landrum
Hi Markus,


On Thu, Feb 23, 2017 at 1:41 AM, Markus Metz  wrote:

>
> According to the example it is possible to use the option
> labelByIndex=True in ReplaceCore.
> Converting the sidechains from mol to smiles with isomericSmiles=True
> labels the sidechains with 1 and 5.
> Where do these numbers come from?
>

They are the indices of the atoms in the core.


> I included the atom indices in the mol drawing but the core atoms are 1
> and 8. (please see attached jupyter file). What am I missing?
>

The code where you assign the atom map numbers so that you can see the
indices:


matches = m1.GetSubstructMatch(core)
print(matches)

for i, atom_idx in enumerate(matches, 1):
m1.GetAtomWithIdx(atom_idx).SetProp('molAtomMapNumber', str(atom_idx))


is using the indices in m1. You want the indices in the core:


for i, atom_idx in enumerate(matches, 1):
m1.GetAtomWithIdx(atom_idx).SetProp('molAtomMapNumber', str(i))


(Note: you can also do SetIntProp() and skip the conversion of i to a
string).

Best,
-greg
--
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