Difference between revisions of "Get Names"

From PyMOLWiki
Jump to navigation Jump to search
(Undo revision 10576 by Harijay (talk))
m (Reverted edits by Harijay (talk) to last revision by Inchoate)
Line 1: Line 1:
'''get_names_of_type''' 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_of_type( [string: "type"] )
+
cmd.get_names( [string: "objects"|"selections"|"all"|"public_objects"|"public_selections"] )
 
</source>
 
</source>
  
 
===NOTES===
 
===NOTES===
The object types are strings such as "object:molecule" for a molecule type and "object:map" for a map.
+
The default behavior is to return only object names.
  
 
=== EXAMPLES ===
 
=== EXAMPLES ===
Truncate names of all molecules
+
Multiple alignments
 
<source lang="python">
 
<source lang="python">
# Get names for all molecules.
+
# structure align all proteins in PyMOL to the protein named "PROT".  Effectively a
for x in cmd.get_names_of_type("object:molecule"): cmd.set_name(x,x[:5])
+
# poor multiple method for multiple structure alignment.
 +
for x in cmd.get_names("all"): cealign( "PROT", x)
 
</source>  
 
</source>  
  
 
===SEE ALSO===
 
===SEE ALSO===
[[get_type]], [[count_atoms]], [[count_states]],[[get_names_of_type]]
+
[[get_type]], [[count_atoms]], [[count_states]]
  
 
[[Category:Commands|Get Names]]
 
[[Category:Commands|Get Names]]

Revision as of 07:36, 2 March 2012

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

PYMOL API

cmd.get_names( [string: "objects"|"selections"|"all"|"public_objects"|"public_selections"] )

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)

SEE ALSO

get_type, count_atoms, count_states