Re: [PyMOL] Problem with 'byring' selection

2017-06-03 Thread Thomas Holder
Hi Vijay,

All "by" operators have a weak priority. This means the following two 
expressions are equivalent:

elem S & byring all w. 4 of elem O
elem S & byring (all w. 4 of elem O)

This is a bit unfortunate, I agree that it is not very intuitive. I would 
actually expect the highest priority. But we don't want to change the logic of 
a program which exists for 17 years now. The solution is to set parenthesis in 
the right places. So to get the ring sulfurs which are within 4 Angstroms of 
Oxygens, this is the correct expression:

(elem S & byring all) w. 4 of elem O
Which is equivalent to:
((elem S) & (byring all)) w. 4 of (elem O)

It's good to know the priority of operators, but if you are unsure, it never 
hurts to place the extra parenthesis to be explicit.

Operator priorities are defined here:
https://sourceforge.net/p/pymol/code/HEAD/tree/trunk/pymol/layer3/Selector.cpp#l323

Hope that helps.

Cheers,
  Thomas


> On Jun 3, 2017, at 2:20 PM, Vijay Masand  wrote:
> 
> Dear Tsjerk and Thomas
> For the following small molecule: 
> ClC1[OH+]C(Cl)=CN=C1C(=O)N([NH+]1CCC(SC1)F)CCN
> As you advised to use following logic for selecting nitrogen atoms of
> rings exclusively.
> abc=cmd.select('elem N and byring not elem N')
> Likewise, to select Sulphur atoms which are part of rings only and at
> a distance of 4A from Oxygen atom, following should be used:
> abc = cmd.select('elem S and byring not elem S w. 4 of elem O')
> But this selected the Sulphur atoms which is part of a ring but at 4.8
> A from Oxygen atom. In reality, It should not happen.
> When I used the logic, which involves deletion of 'not':
> abc = cmd.select('elem S and byring elem S w. 4 of elem O')
> Sulphur atom present at a distance of 4.8 A from Oxygen atom was not selected.
> I hope I will be benefited with better explanation.
> Cheers
> Vijay
> 
> On 6/3/17, Vijay Masand  wrote:
>> Dear Tsjerk and Thomas
>> Thanks for the information. This important information is not
>> available on this page of PyMOLWiki:
>> https://pymolwiki.org/index.php/Selection_Algebra
>> I hope the page will be modified soon to include this important
>> information.
>> Cheers
>> Vijay
>> 
>> On 6/3/17, Tsjerk Wassenaar  wrote:
>>> Hi Vijay,
>>> 
>>> It is logic. 'byring elem N' selects all nitrogens and then expands the
>>> selection to include the rings in which these participate. 'elem N and
>>> byring elem N' does the same, but then intersects (and) to extract only
>>> nitrogens. But that is the same as 'elem N'. If you want to have the
>>> nitrogens from rings, you can do 'elem N and byring not elem N'. That
>>> selects the non-nitrogen atoms and expands the selection over rings. So
>>> only nitrogens in rings can be added to teh selection. Then intersecting
>>> to
>>> get only nitrogens will yield only those that are members of rings.
>>> 
>>> Hope it helps,
>>> 
>>> Tsjerk
>>> 
>>> On Jun 3, 2017 5:45 AM, "Vijay Masand"  wrote:
>>> 
 Dear PyMOL Users,
 I am using PyMOL 1.8.6 on Windows 10 (64 bit) with Python 2.7.12. I
 was working with small molecule
 (ClC1[OH+]C(Cl)=CN=C1C(=O)N([NH+]1CCC(SC1)F)CCN).
 When I tried to select all Nitrogen atoms which are exclusively in the
 ring only, I tried following command:
 abc=cmd.select('byring elem N')
 But, this selected not only Nitrogen atoms in the ring but Carbon
 atoms of the ring also.
 But, following command worked perfectly:
 abc=cmd.select('elem N & byring elem N')
 Is it a bug or something else?
 Cheers
 Vijay
> 
> 
> -- 
> Assistant Professor
> Department of Chemistry,
> Vidya Bharati College, Amravati, 444 602
> Maharashtra, India.
> Phone number- +91-9403312628
> https://sites.google.com/site/vijaymasand/

--
Thomas Holder
PyMOL Principal Developer
Schrödinger, Inc.


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] Problem with 'byring' selection

2017-06-03 Thread Vijay Masand
Dear Tsjerk and Thomas
For the following small molecule: ClC1[OH+]C(Cl)=CN=C1C(=O)N([NH+]1CCC(SC1)F)CCN
As you advised to use following logic for selecting nitrogen atoms of
rings exclusively.
abc=cmd.select('elem N and byring not elem N')
Likewise, to select Sulphur atoms which are part of rings only and at
a distance of 4A from Oxygen atom, following should be used:
abc = cmd.select('elem S and byring not elem S w. 4 of elem O')
But this selected the Sulphur atoms which is part of a ring but at 4.8
A from Oxygen atom. In reality, It should not happen.
When I used the logic, which involves deletion of 'not':
abc = cmd.select('elem S and byring elem S w. 4 of elem O')
Sulphur atom present at a distance of 4.8 A from Oxygen atom was not selected.
I hope I will be benefited with better explanation.
Cheers
Vijay

On 6/3/17, Vijay Masand  wrote:
> Dear Tsjerk and Thomas
> Thanks for the information. This important information is not
> available on this page of PyMOLWiki:
> https://pymolwiki.org/index.php/Selection_Algebra
> I hope the page will be modified soon to include this important
> information.
> Cheers
> Vijay
>
> On 6/3/17, Tsjerk Wassenaar  wrote:
>> Hi Vijay,
>>
>> It is logic. 'byring elem N' selects all nitrogens and then expands the
>> selection to include the rings in which these participate. 'elem N and
>> byring elem N' does the same, but then intersects (and) to extract only
>> nitrogens. But that is the same as 'elem N'. If you want to have the
>> nitrogens from rings, you can do 'elem N and byring not elem N'. That
>> selects the non-nitrogen atoms and expands the selection over rings. So
>> only nitrogens in rings can be added to teh selection. Then intersecting
>> to
>> get only nitrogens will yield only those that are members of rings.
>>
>> Hope it helps,
>>
>> Tsjerk
>>
>> On Jun 3, 2017 5:45 AM, "Vijay Masand"  wrote:
>>
>>> Dear PyMOL Users,
>>> I am using PyMOL 1.8.6 on Windows 10 (64 bit) with Python 2.7.12. I
>>> was working with small molecule
>>> (ClC1[OH+]C(Cl)=CN=C1C(=O)N([NH+]1CCC(SC1)F)CCN).
>>> When I tried to select all Nitrogen atoms which are exclusively in the
>>> ring only, I tried following command:
>>> abc=cmd.select('byring elem N')
>>> But, this selected not only Nitrogen atoms in the ring but Carbon
>>> atoms of the ring also.
>>> But, following command worked perfectly:
>>> abc=cmd.select('elem N & byring elem N')
>>> Is it a bug or something else?
>>> Cheers
>>> Vijay
>>>
>>> --
>>> Assistant Professor
>>> Department of Chemistry,
>>> Vidya Bharati College, Amravati, 444 602
>>> Maharashtra, India.
>>> Phone number- +91-9403312628
>>> https://sites.google.com/site/vijaymasand/
>>>
>>> 
>>> --
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> ___
>>> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
>>> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>>>
>>
>
>
> --
> Assistant Professor
> Department of Chemistry,
> Vidya Bharati College, Amravati, 444 602
> Maharashtra, India.
> Phone number- +91-9403312628
> https://sites.google.com/site/vijaymasand/
>


-- 
Assistant Professor
Department of Chemistry,
Vidya Bharati College, Amravati, 444 602
Maharashtra, India.
Phone number- +91-9403312628
https://sites.google.com/site/vijaymasand/

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


Re: [PyMOL] Problem with 'byring' selection

2017-06-02 Thread Tsjerk Wassenaar
Hi Vijay,

It is logic. 'byring elem N' selects all nitrogens and then expands the
selection to include the rings in which these participate. 'elem N and
byring elem N' does the same, but then intersects (and) to extract only
nitrogens. But that is the same as 'elem N'. If you want to have the
nitrogens from rings, you can do 'elem N and byring not elem N'. That
selects the non-nitrogen atoms and expands the selection over rings. So
only nitrogens in rings can be added to teh selection. Then intersecting to
get only nitrogens will yield only those that are members of rings.

Hope it helps,

Tsjerk

On Jun 3, 2017 5:45 AM, "Vijay Masand"  wrote:

> Dear PyMOL Users,
> I am using PyMOL 1.8.6 on Windows 10 (64 bit) with Python 2.7.12. I
> was working with small molecule
> (ClC1[OH+]C(Cl)=CN=C1C(=O)N([NH+]1CCC(SC1)F)CCN).
> When I tried to select all Nitrogen atoms which are exclusively in the
> ring only, I tried following command:
> abc=cmd.select('byring elem N')
> But, this selected not only Nitrogen atoms in the ring but Carbon
> atoms of the ring also.
> But, following command worked perfectly:
> abc=cmd.select('elem N & byring elem N')
> Is it a bug or something else?
> Cheers
> Vijay
>
> --
> Assistant Professor
> Department of Chemistry,
> Vidya Bharati College, Amravati, 444 602
> Maharashtra, India.
> Phone number- +91-9403312628
> https://sites.google.com/site/vijaymasand/
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

[PyMOL] Problem with 'byring' selection

2017-06-02 Thread Vijay Masand
Dear PyMOL Users,
I am using PyMOL 1.8.6 on Windows 10 (64 bit) with Python 2.7.12. I
was working with small molecule
(ClC1[OH+]C(Cl)=CN=C1C(=O)N([NH+]1CCC(SC1)F)CCN).
When I tried to select all Nitrogen atoms which are exclusively in the
ring only, I tried following command:
abc=cmd.select('byring elem N')
But, this selected not only Nitrogen atoms in the ring but Carbon
atoms of the ring also.
But, following command worked perfectly:
abc=cmd.select('elem N & byring elem N')
Is it a bug or something else?
Cheers
Vijay

-- 
Assistant Professor
Department of Chemistry,
Vidya Bharati College, Amravati, 444 602
Maharashtra, India.
Phone number- +91-9403312628
https://sites.google.com/site/vijaymasand/

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net