Hi,

* Michael George Lerner <mler...@umich.edu> [2005-07-06 09:28] wrote:
>
<with my editing to put the original e-mail in the correct location>

> On Wed, 6 Jul 2005, Sebastien Gerega wrote:
> 
> >Is there a way to list the residues that are in a selection? For example 
> >if I use the command "select near, sel01 around 6" how can I obtain a list 
> >of the residues in the "near" selection?
> 
> I asked a similar question a while ago, and Kristan Rother archived the 
> answer at <http://www.rubor.de/bioinf/tips_python.html#insel>.  Here it 
> is:
> 
> Using PyMOL commands:
> 
> list=[]
> iterate (name ca),list.append((resi,resn))
> print list
> 
> [('ASP', '1'), ('CYS', '2'), ('ALA', '3'), ('TRP', '4'), ('HIS', '5'), 
> ('LEU',
>  '6'), ('GLY', '7'), ('GLU', '8'), ('LEU', '9'), ('VAL', '10'), ('TRP', 
>  '11'),
> ('CYS', '12'), ('THR', '13')]
> 
> or using a Python script (in PyMOL):
> 
> from pymol import cmd,stored
> stored.list=[]
> cmd.iterate("(name ca)","stored.list.append((resi,resn))")
> print stored.list
> 
> [('1', 'ASP'), ('2', 'CYS'), ('3', 'ALA'), ('4', 'TRP'), ('5', 'HIS'), 
> ('6', '
> LEU'), ('7', 'GLY'), ('8', 'GLU'), ('9', 'LEU'), ('10', 'VAL'), ('11', 
> 'TRP'),
> ('12', 'CYS'), ('13', 'THR')]

Or as a variation on the first method, you don't need to make the list,
just do (using the original questions selection "near":


  iterate near, print resi,resn,name
  (to get all atoms)

or

  iterate near & n. ca, print resi,resn
  (for just the alpha-carbons, though if the "near" selection wasn't
  created with the "byres" option, then some residues in the
  selection may not have a CA included)

Cheers,
Rob
-- 
Robert L. Campbell, Ph.D.                         <r...@post.queensu.ca>
Senior Research Associate                            phone: 613-533-6821
Dept. of Biochemistry, Queen's University,             fax: 613-533-2497
Kingston, ON K7L 3N6  Canada       http://adelie.biochem.queensu.ca/~rlc
    PGP Fingerprint: 9B49 3D3F A489 05DC B35C  8E33 F238 A8F5 F635 C0E2

Reply via email to