|
From: Jason V. <jas...@sc...> - 2014-01-31 16:38:27
|
Carsten, What about http://www.pymolwiki.org/index.php/List_Selection and http://www.pymolwiki.org/index.php/List_Selection2? I also made a similar script for retrieving object names: http://www.pymolwiki.org/index.php/GetNamesInSel. Cheers, -- Jason On Fri, Jan 31, 2014 at 10:30 AM, Schubert, Carsten [JRDUS] < CSC...@it...> wrote: > Hi All, > > > > probably a question for the developers, but may not hurt to ask publicly: > Is there a functionality in Pymol to list the residues in a given > selection? I am looking for the equivalent to the get_chains() function. I > have scripted something up, but the code is not 100% clean and not flexible > enough. For large molecules the performance is not great either. > > > > > > #### start script > > def list_resi(obj=""): > > """ > > DESCRIPTION > > > > "list_resi" prints and returns the unique residue IDs from the input > > object. The object must be present in the object list > > on the GUI. Selections are currently not implemented. > > Chain or Segments are also not taken into account > > USAGE > > > > list_resi obj > > > > EXAMPLES > > > > list_resi my_prot > > > > l = list_resi(my_prot) > > """ > > > > if ( obj == "" ): > > obj="(all)" > > > > ol = cmd.get_object_list() > > if (obj in ol): > > pass > > else: > > print "Error: Object (%s) not found" % obj > > return > > > > stored.resi_list = [] > > cmd.iterate(obj,"stored.resi_list.append(int(resi))") > > stored.resi_list=list(set(stored.resi_list)) # make list > unique > > stored.resi_list.sort() > > > > for i in range(0,len(stored.resi_list)): > > print "%s," % stored.resi_list[i], > > if ((i+1) % 10 == 0): > > print "" > > > > return stored.resi_list > > > > ##### End Script > > > > Thanks for any input > > > > > > Carsten > > > ------------------------------------------------------------------------------ > WatchGuard Dimension instantly turns raw network data into actionable > security intelligence. It gives you real-time visual feedback on key > security issues and trends. Skip the complicated setup - simply import > a virtual appliance and go from zero to informed in seconds. > > http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk > _______________________________________________ > 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 Director of Core Modeling Products Schrödinger, Inc. (e) Jas...@sc... (o) +1 (603) 374-7120 |