Re: [Rdkit-discuss] FindAtomEnvironmentOfRadiusN

2017-03-27 Thread Greg Landrum
Yes, the radius is a number of bonds.
I'm not going to argue that this is particularly intuitive (since I can
fall either way on the question), but I would say that it's consistent: the
environment is provided as a list of bond ids and the function is
documented to "find bond subgraphs of a particular radius around an atom"
on the C++ side or "Finds the bonds within a certain radius of an atom in a
molecule" on the Python side.

-greg


On Mon, Mar 27, 2017 at 4:43 PM, Peter Gedeck 
wrote:

> Good point. It seems the algorithm uses bonds and not atoms, so radius 3
> means include the next three bonds. Maybe Greg can comment here.
>
> Best,
>
> Peter
>
>
> On Mon, Mar 27, 2017 at 10:39 AM Pavel Polishchuk <
> pavel_polishc...@ukr.net> wrote:
>
>> Thank you!
>> That was a bug in my expectations. :)
>>
>> BTW, as I see from test examples for the 0 atom in CC1CC1 an environment
>> with radius 3 exists. Thus, radius should be interpreted as a number of
>> bonds from the rooted atom, not a number of atoms. I did not expect this as
>> well.
>>
>>
>> Pavel.
>>
>
--
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] FindAtomEnvironmentOfRadiusN

2017-03-27 Thread Pavel Polishchuk

I guessed why it occurred. I'm interested is it expected behavior?
So, if a radius is greater than the number of available bonds in all 
directions from the rooted atom the function will return empty list as 
it considers that such environment does not exist. Is this a correct 
expectation?


Pavel.

On 03/27/2017 03:53 PM, Peter Gedeck wrote:

Hello,

The atom numbers start with 0. From the middle atom, there are no 
environments with radius 2. You will get a result if you use the first 
(=0) or the last (=2) atom. Try this:


m = Chem.MolFromSmiles("NCO")
i = Chem.FindAtomEnvironmentOfRadiusN(m, 1, 0)
Chem.MolToSmiles(Chem.PathToSubmol(m, i))
i = Chem.FindAtomEnvironmentOfRadiusN(m, 2, 0)
Chem.MolToSmiles(Chem.PathToSubmol(m, i))
i = Chem.FindAtomEnvironmentOfRadiusN(m, 3, 0)
Chem.MolToSmiles(Chem.PathToSubmol(m, i))

and you will get:

'CN'
'NCO'
''

Is this more intuitive to you?

Best,

Peter


On Mon, Mar 27, 2017 at 9:35 AM Pavel Polishchuk 
> wrote:


Dear RDKitters,

   I found the issue with FindAtomEnvironmentOfRadiusN but this
can be a
feature. However, I did not findthis information in help and did not
expect such behavior.
   If I apply FindAtomEnvironmentOfRadiusN function to a small
molecule
and specify the radius greater than the size of the molecule the
function returns empty list of bond indices (and empty mol).

m = Chem.MolFromSmiles("NCO")

i = Chem.FindAtomEnvironmentOfRadiusN(m, 1, 1)
Chem.MolToSmiles(Chem.PathToSubmol(m, i))

returns "NCO"

i = Chem.FindAtomEnvironmentOfRadiusN(m, 2, 1)
Chem.MolToSmiles(Chem.PathToSubmol(m, i))

returns ""

   In the latter case I expected the same output "NCO". Were my
expectations mistaken?

Kind regards,
Pavel.


--
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


Re: [Rdkit-discuss] FindAtomEnvironmentOfRadiusN

2017-03-27 Thread Peter Gedeck
Hello,

The atom numbers start with 0. From the middle atom, there are no
environments with radius 2. You will get a result if you use the first (=0)
or the last (=2) atom. Try this:

m = Chem.MolFromSmiles("NCO")
i = Chem.FindAtomEnvironmentOfRadiusN(m, 1, 0)
Chem.MolToSmiles(Chem.PathToSubmol(m, i))
i = Chem.FindAtomEnvironmentOfRadiusN(m, 2, 0)
Chem.MolToSmiles(Chem.PathToSubmol(m, i))
i = Chem.FindAtomEnvironmentOfRadiusN(m, 3, 0)
Chem.MolToSmiles(Chem.PathToSubmol(m, i))

and you will get:

'CN'
'NCO'
''

Is this more intuitive to you?

Best,

Peter


On Mon, Mar 27, 2017 at 9:35 AM Pavel Polishchuk 
wrote:

> Dear RDKitters,
>
>I found the issue with FindAtomEnvironmentOfRadiusN but this can be a
> feature. However, I did not findthis information in help and did not
> expect such behavior.
>If I apply FindAtomEnvironmentOfRadiusN function to a small molecule
> and specify the radius greater than the size of the molecule the
> function returns empty list of bond indices (and empty mol).
>
> m = Chem.MolFromSmiles("NCO")
>
> i = Chem.FindAtomEnvironmentOfRadiusN(m, 1, 1)
> Chem.MolToSmiles(Chem.PathToSubmol(m, i))
>
> returns "NCO"
>
> i = Chem.FindAtomEnvironmentOfRadiusN(m, 2, 1)
> Chem.MolToSmiles(Chem.PathToSubmol(m, i))
>
> returns ""
>
>In the latter case I expected the same output "NCO". Were my
> expectations mistaken?
>
> Kind regards,
> Pavel.
>
>
> --
> 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