This is a read-only mirror of pymolwiki.org

Difference between revisions of "Get Names"

From PyMOL Wiki
Jump to navigation Jump to search
m
 
m (1 revision)
 
(16 intermediate revisions by 7 users not shown)
Line 1: Line 1:
===DESCRIPTION===
 
 
'''get_names''' returns a list of object and/or selection names.
 
'''get_names''' returns a list of object and/or selection names.
  
 
===PYMOL API===
 
===PYMOL API===
 
<source lang="python">
 
<source lang="python">
cmd.get_names( [string: "objects"|"selections"|"all"] )
+
cmd.get_names(type,enabled_only,selection)
 
</source>
 
</source>
  
 +
===ARGUMENTS===
 +
* '''type : string''' determines the type of objects to be returned. It can take any of the following values:
 +
** '''objects''' Structure objects
 +
** '''selections''' All selection
 +
** '''all''' Objects and Selections
 +
** '''public_objects''' (default)
 +
** '''public_selections'''
 +
** '''public_nongroup_objects'''
 +
** '''public_group_objects'''
 +
** '''nongroup_objects'''
 +
** '''group_objects'''
 +
* '''enabled_only : boolean''' If 1, only enabled objects are returned. Default 0 (all objects)
 +
* '''selection'''
 
===NOTES===
 
===NOTES===
 
The default behavior is to return only object names.
 
The default behavior is to return only object names.
Line 15: Line 27:
 
# structure align all proteins in PyMOL to the protein named "PROT".  Effectively a  
 
# structure align all proteins in PyMOL to the protein named "PROT".  Effectively a  
 
# poor multiple method for multiple structure alignment.
 
# poor multiple method for multiple structure alignment.
for x in cmd.get_names("*"): cealign( "PROT", x)
+
for x in cmd.get_names("all"): cealign( "PROT", x)
 
</source>  
 
</source>  
 +
 +
Determine whether or not an object (objName) is enabled:
 +
<source lang="python">
 +
if objName in cmd.get_names(enabled_only=1):
 +
    print objName, "is enabled"
 +
</source>
  
 
===SEE ALSO===
 
===SEE ALSO===
[[Cmd get_type]], [[Cmd count_atoms]], [[Cmd count_states]]
+
[[get_type]], [[get_names_of_type]], [[count_atoms]], [[count_states]]
  
 
[[Category:Commands|Get Names]]
 
[[Category:Commands|Get Names]]

Latest revision as of 03:47, 7 March 2016

get_names returns a list of object and/or selection names.

PYMOL API

cmd.get_names(type,enabled_only,selection)

ARGUMENTS

  • type : string determines the type of objects to be returned. It can take any of the following values:
    • objects Structure objects
    • selections All selection
    • all Objects and Selections
    • public_objects (default)
    • public_selections
    • public_nongroup_objects
    • public_group_objects
    • nongroup_objects
    • group_objects
  • enabled_only : boolean If 1, only enabled objects are returned. Default 0 (all objects)
  • selection

NOTES

The default behavior is to return only object names.

EXAMPLES

Multiple alignments

# structure align all proteins in PyMOL to the protein named "PROT".  Effectively a 
# poor multiple method for multiple structure alignment.
for x in cmd.get_names("all"): cealign( "PROT", x)

Determine whether or not an object (objName) is enabled:

if objName in cmd.get_names(enabled_only=1):
    print objName, "is enabled"

SEE ALSO

get_type, get_names_of_type, count_atoms, count_states