Hi All, With the help of Thomas Holder (thanks to him), now I can show and obtain the number of water in the first shell of my six peptides (an amyloid fibrils). However, I have a little problem with the command count_atoms in my script
Below my script (*.pml) for Pymol 1.3 : mstop dss hide all select CL, resn CL delete CL ## Select WATER with residue ID SOL select WATER, resn SOL ## Select Amyloid, resi 1-54 select Amyloid, resi 1-54 and not WATER ## Show in cartoon Amyloid show cartoon, Amyloid ## Show in different colors peptides because it is nice. set cartoon_color, black, resi 2-8 set cartoon_color, red, resi 11-17 set cartoon_color, green, resi 20-26 set cartoon_color, blue, resi 29-35 set cartoon_color, yellow, resi 38-44 set cartoon_color, chocolate, resi 47-53 ## Not use for the moment ##set cartoon_color, gray50, resi 56-62 ##set cartoon_color, wheat, resi 65-71 ##set cartoon_color, aquamarine, resi 74-80 ##set cartoon_color, pink, resi 83-89 ##set cartoon_color, orange, resi 92-98 ##et cartoon_color, forest, resi 101-107 ## Select water in the first shell (e.g. within 3.5 A of the Amyloid atoms) select WATER_firstshell, WATER within 3.5 A of Amyloid ## Give the number of water in the first shell of the fibrils ## Works ---> Give number of water atoms (including oxygen and Hs) print cmd.count_atoms("WATER_firstshell") ## Print the residu ID of each water in the first shell iterate ("WATER_firstshell"), print resi set cartoon_fancy_helices=1 set cartoon_discrete_colors, on set antialias = 1 ray ------------------- As you can imagine the "firstshell_WATER" variable contains the water O and H atoms. It is not what I want! Indeed I want that count_atoms command counts only the number of Water oxygen. So I use count_atoms("firstshell_WATER" and elem O) This command works if I use the pymol GUI but If I use the command in my script. Indeed print cmd.count_atoms("firstshell_WATER" and elem O) show a syntax error Thanks in advance for your help. Stephane ------------------------------ Message: 7 Date: Thu, 22 Sep 2011 11:14:36 +0200 From: Thomas Holder <spel...@users.sourceforge.net> Subject: Re: [PyMOL] Write in a file the number of water at a distance from a protein surface To: ABEL Stephane 175950 <stephane.a...@cea.fr> Cc: "pymol-users@lists.sourceforge.net" <pymol-users@lists.sourceforge.net> Message-ID: <4e7afc7c.4060...@users.sourceforge.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hi Stephane, you can select those waters using the "within" or "gap" selection operators. "within" measures from the atom centre, whereas "gap" takes the VDW radius into accout but selects everything beyond instead of near. Have a look at those examples: # use '... within ...' select firstshell, solvent within 3.5 of polymer # or use 'not (... gap ...)' select firstshell, solvent and not (polymer gap 0.5) # shows the selected water molecules as a sphere show spheres, firstshell and elem O # writes the results in a file python stored.out = open('/tmp/water-IDs.txt', 'w') print >> stored.out, '## At 0.5 Ang of the protein surface there are', print >> stored.out, cmd.count_atoms('firstshell and elem O'), print >> stored.out, 'water molecules' print >> stored.out, '## Water ID and resi are' cmd.iterate('firstshell', 'print >> stored.out, ID, resi') stored.out.close() python end http://www.pymolwiki.org/index.php/Selection_Algebra http://www.pymolwiki.org/index.php/Iterate Hope that helps, Cheers, Thomas On 09/21/2011 11:03 PM, ABEL Stephane 175950 wrote: > Hi All, > > I have simulated a protein in water cubic box and I would like to > know how to show and obtain the number of water in the first shell of > the protein (or at x Ang of the protein surface) using a pymol > script. I can to do this using the pymol GUI but I would prefer that > the script : > > - shows the selected water molecules as a sphere > - and writes the results in a file with the water ID (i.e. residue > number), for example like this: > > ## At x Ang of the protein surface there are XX water molecules > ## Water ID are > > Thanks in advance for your help. > > Stephane -- Thomas Holder MPI for Developmental Biology ------------------------------ Message: 8 Date: Thu, 22 Sep 2011 10:05:46 +0000 From: ABEL Stephane 175950 <stephane.a...@cea.fr> Subject: [PyMOL] RE : Write in a file the number of water at a distance from a protein surface To: Thomas Holder <spel...@users.sourceforge.net> Cc: "pymol-users@lists.sourceforge.net" <pymol-users@lists.sourceforge.net> Message-ID: <3e39b768bb199548ab18f7289e7534af0ad...@exdag0-b0.intra.cea.fr> Content-Type: text/plain; charset="iso-8859-1" Thank you for your response, i will try your suggestion A bientot Stephane ________________________________________ De : Thomas Holder [ad...@thomas-holder.de] de la part de Thomas Holder [spel...@users.sourceforge.net] Date d'envoi : jeudi 22 septembre 2011 11:14 ? : ABEL Stephane 175950 Cc : pymol-users@lists.sourceforge.net Objet : Re: [PyMOL] Write in a file the number of water at a distance from a protein surface Hi Stephane, you can select those waters using the "within" or "gap" selection operators. "within" measures from the atom centre, whereas "gap" takes the VDW radius into accout but selects everything beyond instead of near. Have a look at those examples: # use '... within ...' select firstshell, solvent within 3.5 of polymer # or use 'not (... gap ...)' select firstshell, solvent and not (polymer gap 0.5) # shows the selected water molecules as a sphere show spheres, firstshell and elem O # writes the results in a file python stored.out = open('/tmp/water-IDs.txt', 'w') print >> stored.out, '## At 0.5 Ang of the protein surface there are', print >> stored.out, cmd.count_atoms('firstshell and elem O'), print >> stored.out, 'water molecules' print >> stored.out, '## Water ID and resi are' cmd.iterate('firstshell', 'print >> stored.out, ID, resi') stored.out.close() python end http://www.pymolwiki.org/index.php/Selection_Algebra http://www.pymolwiki.org/index.php/Iterate Hope that helps, Cheers, Thomas On 09/21/2011 11:03 PM, ABEL Stephane 175950 wrote: > Hi All, > > I have simulated a protein in water cubic box and I would like to > know how to show and obtain the number of water in the first shell of > the protein (or at x Ang of the protein surface) using a pymol > script. I can to do this using the pymol GUI but I would prefer that > the script : > > - shows the selected water molecules as a sphere > - and writes the results in a file with the water ID (i.e. residue > number), for example like this: > > ## At x Ang of the protein surface there are XX water molecules > ## Water ID are > > Thanks in advance for your help. > > Stephane -- Thomas Holder MPI for Developmental Biology ------------------------------ ---------------------------------------------------------------------------- -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 ------------------------------ _______________________________________________ PyMOL-users mailing list PyMOL-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pymol-users End of PyMOL-users Digest, Vol 64, Issue 17 ******************************************* ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 _______________________________________________ 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