Part 4: Interactive Automation
When using PyMOL as an interactive GUI application, things can be automated with:
- set_key: Bind a key like F1 to a command or Python function
- alias: Make an alias for a sequence of commands
- cmd.extend: Bind a Python function to a PyMOL command
Examples
PML syntax example to show all atoms in sphere representation:
set_key F1, as spheres
Python syntax example to toggle between orthoscopic and perspective camera:
cmd.set_key('F2', lambda: cmd.set('orthoscopic', not cmd.get_setting_int('orthoscopic')))
Cartoon/stick/sphere preset as nice command:
alias nice, as cartoon; show sticks, organic; show spheres, inorganic
Map actions to F-keys
- Bind two F-keys to set black and white background color (Use bg_color command)
- Bind two F-keys to show and hide the sequence viewer (seq_view setting)
- Bind one F-key to toggle the sequence viewer
- Bind “ligand zoom” to an F-key (Use zoom or orient and the organic selector)
Map actions to commands
- Write a “ligand zoom” command
© 2017 Schrödinger, Inc.