Atom selections aren't directly exposed to Python, but you can have PyMOL build
a Python list containing whatever information you need:
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')]
Cheers,
Warren
> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> Sent: Thursday, October 17, 2002 12:03 PM
> To: [email protected]
> Subject: [PyMOL] What's in a selection
>
>
>
>
> Hi,
>
> How can I tell which atoms are in a selection? For example,
> I've opened up a
> pdb file and selected all non-backbone atoms within five
> angstroms of the active
> site. Now I want to get a list of the atoms in that
> selection. My selection
> was called "nearby" and I tried "print nearby" but got a NameError.
>
> Sorry if the answer's obvious and I've just missed it.
>
> thanks,
>
> -michael
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: viaVerio will pay you up to
> $1,000 for every account that you consolidate with us.
> http://ad.doubleclick.net/clk;4749864;7604308;v?
> http://www.viaverio.com/consolidator/osdn.cfm
> _______________________________________________
> PyMOL-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pymol-users
>