Get object list
Jump to navigation
Jump to search
cmd.get_object_list is an API only command which returns the list of all molecular objects in selection. It will not return selection names or objects which are not of type molecule.
PyMOL API
list cmd.get_object_list(string selection='(all)')
Important: Always put the selection in parenthesis to force PyMOL to interpret it as an atom selection. Otherwise this might fail on name wildcards, groups, etc.
For proper atom selections this should be identical to:
list cmd.get_names('objects', 0, string selection='(all)')
Examples
PyMOL> fetch 2x19 2xwu 1d7q, async=0
PyMOL> print(cmd.get_object_list('solvent'))
['2x19', '2xwu']
PyMOL> print(cmd.get_object_list('hydro'))
['1d7q']
PyMOL> print(cmd.get_object_list('2x*')) # FAIL!!! (fixed in PyMOL 1.7.6)
['2x19']
PyMOL> print(cmd.get_object_list('(2x*)')) # correct, with parenthesis
['2x19', '2xwu']