From: Tsjerk W. <ts...@gm...> - 2012-09-28 16:02:33
|
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 <jas...@sc...> 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 > <Ste...@ce...> 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 <Ste...@ce...> >> Subject: [PyMOL] Obtain the number of molecule in the first hydration >> shell of a peptide. >> To: "pym...@li..." >> <pym...@li...> >> Message-ID: >> <3E39B768BB199548AB18F7289E7534AF02C4D8C0@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 >> PyM...@li... >> 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 (PyM...@li...) >> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >> Archives: http://www.mail-archive.com/pym...@li... > > > > -- > Jason Vertrees, PhD > PyMOL Product Manager > Schrödinger, Inc. > > (e) Jas...@sc... > (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 (PyM...@li...) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pym...@li... -- Tsjerk A. Wassenaar, Ph.D. post-doctoral researcher Biocomputing Group Department of Biological Sciences 2500 University Drive NW Calgary, AB T2N 1N4 Canada |