Re: [PyMOL] select by absolute coordinate
Martin, It is remarkable that a question like this hasn't come up before, but it reveals a rather large whole in PyMOL's selection language: though we have some proximity operators, we are not currently able to select atoms based on absolute or relative coordinate vector relationships. So the present answer to your question appears to be no. Sorry about that! Cheers, Warren -Original Message- From: Martin Höfling [mailto:martin.hoefl...@gmx.de] Sent: Monday, March 02, 2009 11:34 AM To: pymol-users@lists.sourceforge.net Subject: [PyMOL] select by absolute coordinate I quickly checked the selection algebra and property selector wiki pages and couldn't find anything related to this. Is it possible e.g. to select all atoms with (absolute) z - coordinates greater than 5A? Best Martin -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ PyMOL-users mailing list PyMOL-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pymol-users
Re: [PyMOL] select by absolute coordinate
Am 04.03.2009 um 06:46 schrieb Warren DeLano: Hey Warren, It is remarkable that a question like this hasn't come up before, but it reveals a rather large whole in PyMOL's selection language: though we have some proximity operators, we are not currently able to select atoms based on absolute or relative coordinate vector relationships. So the present answer to your question appears to be no. Sorry about that! Just to give the application to my question: If you wanna select the upper leaflet of a bilayer - an easy method - shown to me in VMD is to select by residue all Phosphor atoms with e.g. z 40... Well I scripted a bit around it which worked in my case: def leafletIndex(): ''' Create leaflet indices for upper and lower bilayer, based on Phosphor atoms ''' cmd.delete(Phosphor) cmd.delete(UpperLeaflet) cmd.delete(LowerLeaflet) cmd.select(Phosphor,name P*) ext=cmd.get_extent(Phosphor) lower=ext[0][2] upper=ext[1][2] middle=upper-lower atoms = cmd.get_model(Phosphor) cmd.select(UpperLeaflet,None) cmd.select(LowerLeaflet,None) for at in atoms.atom: if at.coord[2] middle: cmd.select(UpperLeaflet,UpperLeaflet or index %d%at.index) else: cmd.select(LowerLeaflet,LowerLeaflet or index %d%at.index) cmd.select(UpperLeaflet,byres UpperLeaflet) cmd.select(LowerLeaflet,byres LowerLeaflet) cmd.deselect() Best Martin
Re: [PyMOL] select by absolute coordinate
Hi, I have a couple of quick notes about your specific application: This works well when bilayers are flat. So, it works well for small bilayers and it works well at the beginning of a simulation. For medium to large bilayers, undulations throughout the simulation will cause this algorithm to break. Here are some other things that don't work: - selecting all lipids where atom X is higher than atom Y. In longer simulations, lipids wiggle around enough that the heads can tilt and the tails can even be higher than the heads. - same as above, but looking at the center of mass of the head vs. the COM of the tail. This fails for the same reason. It turns out that lipids really wiggle a lot. - etc. These are easy errors to miss because the algorithms work well at the beginning of the simulation, so even a quick visual examination won't show the problems. In my experience, the easiest thing to do is to use your method on the first frame of a simulation, inspect the selection visually, and then write it out explicitly for use in subsequent frames. You probably know all of this, but I thought I'd mention it in case someone was tempted to just take your code and apply it individually to each frame of a simulation without really thinking about it. Unfortunately, I've seen people make this particular error a few times (in both VMD and C), and usually you can't tell they're making it just by reading their Methods section :(. Cheers, -michael On Wed, Mar 4, 2009 at 6:04 AM, Höfling Martin martin.hoefl...@gmx.dewrote: Am 04.03.2009 um 06:46 schrieb Warren DeLano: Hey Warren, It is remarkable that a question like this hasn't come up before, but it reveals a rather large whole in PyMOL's selection language: though we have some proximity operators, we are not currently able to select atoms based on absolute or relative coordinate vector relationships. So the present answer to your question appears to be no. Sorry about that! Just to give the application to my question: If you wanna select the upper leaflet of a bilayer - an easy method - shown to me in VMD is to select by residue all Phosphor atoms with e.g. z 40... Well I scripted a bit around it which worked in my case: def leafletIndex(): ''' Create leaflet indices for upper and lower bilayer, based on Phosphor atoms ''' cmd.delete(Phosphor) cmd.delete(UpperLeaflet) cmd.delete(LowerLeaflet) cmd.select(Phosphor,name P*) ext=cmd.get_extent(Phosphor) lower=ext[0][2] upper=ext[1][2] middle=upper-lower atoms = cmd.get_model(Phosphor) cmd.select(UpperLeaflet,None) cmd.select(LowerLeaflet,None) for at in atoms.atom: if at.coord[2] middle: cmd.select(UpperLeaflet,UpperLeaflet or index %d%at.index) else: cmd.select(LowerLeaflet,LowerLeaflet or index %d%at.index) cmd.select(UpperLeaflet,byres UpperLeaflet) cmd.select(LowerLeaflet,byres LowerLeaflet) cmd.deselect() Best Martin -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ PyMOL-users mailing list PyMOL-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pymol-users -- Michael Lerner, Ph.D. IRTA Postdoctoral Fellow Laboratory of Computational Biology NIH/NHLBI 5635 Fishers Lane, Room T909, MSC 9314 Rockville, MD 20852 (UPS/FedEx/Reality) Bethesda MD 20892-9314 (USPS)
Re: [PyMOL] select by absolute coordinate
Am 04.03.2009 um 17:32 schrieb Michael Lerner: Hey Michael You probably know all of this, but I thought I'd mention it in case someone was tempted to just take your code and apply it individually to each frame of a simulation without really thinking about it. Unfortunately, I've seen people make this particular error a few times (in both VMD and C), and usually you can't tell they're making it just by reading their Methods section :(. Yes you're absolutely right about this, you should never do this without at least visually checking if this is correct. The main usage for me is that I don't wanna create complex index files for gromacs with gromacs' make_ndx tool but instead check the index groups before or create them from pymol. I used this on the first frame only - so faar to check diffusion in leaflets separately. What one can try to do - if you need it every step and the bilayer bends to much - is to make the whole selection and determination of middle point locally, only with lipids in a certain range around the specific one. But this is then probably a couple more lines :-) Best Martin
[PyMOL] select by absolute coordinate
I quickly checked the selection algebra and property selector wiki pages and couldn't find anything related to this. Is it possible e.g. to select all atoms with (absolute) z - coordinates greater than 5A? Best Martin