Get Names: Difference between revisions

From PyMOLWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 3: Line 3:
===PYMOL API===
===PYMOL API===
<source lang="python">
<source lang="python">
cmd.get_names( [string: "objects"|"selections"|"all"|"public_objects"|"public_selections"] )
cmd.get_names_of_type( [string: "type"] )
</source>
</source>


===NOTES===
===NOTES===
The default behavior is to return only object names.
The object types are strings such as "object:molecule" for a molecule type and "object:map" for a map.


=== EXAMPLES ===
=== EXAMPLES ===
Multiple alignments
Truncate names of all molecules
<source lang="python">
<source lang="python">
# structure align all proteins in PyMOL to the protein named "PROT".  Effectively a
# Get names for all molecules.
# poor multiple method for multiple structure alignment.
for x in cmd.get_names_of_type("object:molecule"): cmd.set_name(x,x[:5])
for x in cmd.get_names("all"): cealign( "PROT", x)
</source>  
</source>  



Revision as of 13:11, 1 March 2012

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

PYMOL API

cmd.get_names_of_type( [string: "type"] )

NOTES

The object types are strings such as "object:molecule" for a molecule type and "object:map" for a map.

EXAMPLES

Truncate names of all molecules

# Get names for all molecules.
for x in cmd.get_names_of_type("object:molecule"): cmd.set_name(x,x[:5])

SEE ALSO

get_type, count_atoms, count_states,get_names_of_type