This is a read-only mirror of pymolwiki.org

List Selection

From PyMOL Wiki
Revision as of 15:01, 23 February 2005 by Krother (talk | contribs)
Jump to navigation Jump to search
# 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')]

#!/usr/bin/python
#
# as Python script:
#
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')]