print len(set([(i.resn, i.resi) for i in cmd.get_model("resn URE").atom])) # :-)

Cheers,

Tsjerk

On Fri, Sep 28, 2012 at 4:37 PM, Jason Vertrees
<jason.vertr...@schrodinger.com> wrote:
> Hi Stephane,
>
> Tsjerk as usual provides a clever answer. However, if in any case a
> urea goes missing an atom, maybe due to experimental reasons, or you
> want to use this technique for something other than urea then Tsjerk's
> answer will need to be modified.
>
> I offer a slightly different solution. I've written a script that
> counts distinct molecular objects in a given selection. You can
> download it from the PyMOLWiki here,
>
>     http://www.pymolwiki.org/index.php/Count_molecules_in_selection.
>
> See the examples to learn how to use it.
>
> Tsjerk's solution will always be faster. Mine will be more flexible.
> Use what works for you.
>
> Cheers,
>
> -- Jason
>
> On Fri, Sep 28, 2012 at 10:03 AM, ABEL Stephane 175950
> <stephane.a...@cea.fr> wrote:
>> for the pymol-users mailing list archive and to close my message
>>
>> Tsjerk Wassenaar gave the command :
>>
>> print cmd.count_atoms("byres resn URE within 3.5 of peptide")/8. it works !!!
>>
>> Thanks to him !!!
>>
>> Bye
>>
>> Stephane
>>
>> ------------------------------
>>
>> Message: 8
>> Date: Fri, 28 Sep 2012 12:59:27 +0000
>> From: ABEL Stephane 175950 <stephane.a...@cea.fr>
>> Subject: [PyMOL] Obtain the number of molecule in the first hydration
>>         shell of a peptide.
>> To: "pymol-users@lists.sourceforge.net"
>>         <pymol-users@lists.sourceforge.net>
>> Message-ID:
>>         <3e39b768bb199548ab18f7289e7534af02c4d...@exdag0-b0.intra.cea.fr>
>> Content-Type: text/plain; charset="us-ascii"
>>
>> Dear pymol users,
>>
>> I would like to obtain with Pymol (v1.3) the number of urea molecules in the 
>> first shell of a peptide. To do this I have defined the object urea as 
>> following
>>
>> select UREA, resn URE
>>
>> and used the following cutoff for the first hydration shell:
>>
>> select UREA_firstshell, UREA within 3.5 of peptide
>>
>> And finally used the command:
>>
>> print cmd.count_atoms("UREA_firstshell") to obtain the number of atom at the 
>> distance of 3.5 A from the peptide.
>>
>> Of course, these commands work well, but my aim is to obtain the number of 
>> molecules instead of the number of atoms.  How to do  that ?
>>
>> For info,  urea has 8 atoms.
>>
>> Thank you for you help
>>
>> Stephane
>>
>>
>> ------------------------------
>>
>> ------------------------------------------------------------------------------
>> Got visibility?
>> Most devs has no idea what their production app looks like.
>> Find out how fast your code is with AppDynamics Lite.
>> http://ad.doubleclick.net/clk;262219671;13503038;y?
>> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
>>
>> ------------------------------
>>
>> _______________________________________________
>> PyMOL-users mailing list
>> PyMOL-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/pymol-users
>>
>>
>> End of PyMOL-users Digest, Vol 76, Issue 10
>> *******************************************
>> ------------------------------------------------------------------------------
>> Got visibility?
>> Most devs has no idea what their production app looks like.
>> Find out how fast your code is with AppDynamics Lite.
>> http://ad.doubleclick.net/clk;262219671;13503038;y?
>> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
>> _______________________________________________
>> 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
>
>
>
> --
> Jason Vertrees, PhD
> PyMOL Product Manager
> Schrödinger, Inc.
>
> (e) jason.vertr...@schrodinger.com
> (o) +1 (603) 374-7120
>
> ------------------------------------------------------------------------------
> Got visibility?
> Most devs has no idea what their production app looks like.
> Find out how fast your code is with AppDynamics Lite.
> http://ad.doubleclick.net/clk;262219671;13503038;y?
> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
> _______________________________________________
> 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



-- 
Tsjerk A. Wassenaar, Ph.D.

post-doctoral researcher
Biocomputing Group
Department of Biological Sciences
2500 University Drive NW
Calgary, AB T2N 1N4
Canada

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
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

Reply via email to