Visualization¶
Synopsis¶
This example is continued from Plotting. The aim of this part is visual comparison of experimental and theoretical modes. We will generate molecular graphics that was presented in our paper [AB09].
Load data¶
We start by importing everything from the ProDy package:
In [1]: from prody import *
In [2]: from pylab import *
In [3]: ion()
Then we load data saved in Calculations:
In [4]: pca = loadModel('p38_xray.pca.npz')
In [5]: anm = loadModel('1p38.anm.npz')
In [6]: ensemble = loadEnsemble('p38_X-ray.ens.npz')
In [7]: ref_selection = parsePDB('p38_ref_selection.pdb')
Write NMD files¶
We will save PCA and ANM data in NMD format.
NMWiz can read and visualize multiple NMD files at once. Interested
user is referred to NMWiz documentation for more information. NMD files
are saved as follows using writeNMD()
functions:
In [8]: writeNMD('p38_pca.nmd', pca[:3], ref_selection)
Out[8]: 'p38_pca.nmd'
In [9]: writeNMD('p38_anm.nmd', anm[:3], ref_selection)
Out[9]: 'p38_anm.nmd'
It is also possible to load VMD to visualize normal mode data
from within an interactive Python session. For this to work, you need
VMD and NMWiz plugin installed. Check if VMD path is correct using
pathVMD()
:
In [10]: pathVMD()
Out[10]: '/usr/local/bin/vmd'
If this is not the correct path to your VMD executable you can change it using the same function.
In [11]: viewNMDinVMD('p38_pca.nmd')