The PyRosetta community uses PyMOL so much, we decided to streamline the visualization of output by creating a PyMOL_Mover. This Mover allows you to observe structural and score change instantaneously, which greatly aids the understanding of any protocol and the development of novel algorithms. This page accompanies the workshops found on the Tutorials page.
After loading PyMOL, click in the upper window command line (Tk Window Upper Command Line) and run the script PyMOLPyRosettaServer.py to start the listener:
The file PyMOLPyRosettaServer.py is found in the main directory of PyRosetta. No further work is required to view PyMOL_Mover output from the same computer. We recommend adding this to your .pymolrc (and to make a .pymolrc if you don't have one), which should be located in your home directory on a Mac or Linux machine.
However if want to run PyMOL on one machine (say your desktop computer) and PyRosetta on other then you will need to change the default setup. By default PyMOLPyRosettaServer.py script is listening for connects at 127.0.0.1 address which will allow only connections from a local machine. In order to accept connection from non-local machines we will need to change that. This can be done by (a) allow PyMOL-server to accept connections on all network addresses assigned to the host by using empty string ('') as IP address. Or (b) we explicitly specifying IP address we want to listen-to. In for instance if our machine have IP address '184.108.40.206' on the local network and we want server to listen to port 9001 we can put the following line into .pymolrc to automatically start the listener on that address:
Be sure that the connection is to an IP address that is reachable from machine running PyMOL_Mover and that PyMOL_Mover is configured to output to that address.
In Rosetta and PyRosetta, a macromolecule (and information on a single conformation) is stored in a Pose object. To explore the PyMOL_Mover, you will want to start PyRosetta and create a Pose object from a PDB file.
When the PyMOL_Mover> is applied to a Pose, the Pose coordinate data is sent to PyMOL, rendering an image of the structure.
The PyMOL_Mover method send_energy() commands PyMOL to color the loaded structure based on the relative residue energies. Make sure the pose has been scored before calling the method.
The default color spectrum spans from blue (low score/favorable energy) to red (high score/unfavorable energy). Rosetta scores are determined using a weighted sum of various score terms. The send_energy() method can accept the name of any score term and color residues based on this term. (If the input term had a zero weight in the last score function applied to the pose, i.e., is not used, no relevant coloring will occur.) The example here would color the residues based on the value of its (full-atom) Van der Waals attractive energy.
The PyMOL_Mover features an update_energy option that, when true, automatically colors residues by energy when you apply the PyMOL_Mover.
You can set the PyMOL_Mover to send a specific score term when it is applied (if update_energy is set to true) with the energy_type option. The example here would here would color the residues based on the value of its (full-atom) solvation energy every time you apply the PyMOL_Mover:
To send PyMOL_Mover output to a PyMOL instance on a different computer, change the PyMOL_Mover link options to the new computer's IP address and port:
If the PyMOL_Mover's keep_history> option is set to true, PyMOL will load structures with the same name into successive states. You can then view the states intuitively by cycling through the PyMOL object states or creating a movie using PyMOL's frame features.
The color of a PyMOL molecular object is independent of its state, so if you view a series of structures sent from Rosetta — and their respective energy colorings — with the same name, the only accessible residue coloring will be the last one performed. An alternate method to accurately view intermediate changes of a Rosetta structure that avoids this complication is to change the Pose's name before sending structural data. This causes PyMOL to load these structures into different objects, thus allowing PyMOL to remember multiple colorings. This is particularly useful when you want to inspect energy changes during a protocol. The example here would change the Pose name — and thus the name of the structure in PyMOL — to "new_name".
So far, all the commands to PyMOL have been manual, relying on usage of PyMOL_Mover.apply. The PyMOL_Observer object automatically monitors Poses for conformational changes and, when triggered, applies its own PyMOL_Mover. Since a PyMOL_Observer has a PyMOL_Mover, all of the PyMOL_Mover options are available.