Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help
Special pages
SBGrid Resources
SBGrid Consortium
SBGrid Data Bank
Software Webinars
PyMOL Webinar
PyMOL Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Example Scripts
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Dis/Enable Objects=== If someone has many (possibly hundreds) of objects -- say distance objects -- one can turn them all on or off by using Python scripts within PyMol. The following script will extend the commands "sd" and "hd" for "show distance" and "hide distance," respectively. The first script, <source lang="python"> from pymol import cmd num_dist = 100 def show_dist(): """ show all of my distance objects """ for i in range(num_dist): cmd.enable('_dist%s'%i) def hide_dist(): """ hide all of my distance objects """ for i in range(num_dist): cmd.disable('_dist%s'%i) cmd.extend('sd',show_dist) cmd.extend('hd',hide_dist) </source> works on 100 objects. We can extend the idea with more elegant scripting to work w/o forcing us to keep track of the number of objects: <source lang="python"> def show_dist(): dists = [name for name in cmd.get_names() if cmd.get_type(name) == 'object:distance'] for name in dists: cmd.enable(name) </source> Now, just running "sd" would show all the distance objects.
Summary:
Please note that all contributions to PyMOL Wiki are considered to be released under the GNU Free Documentation License 1.2 (see
PyMOL Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Example Scripts
(section)
Add topic