molPX Di-Ala example¶
Guillermo Pérez-Hernández guille.perez@fu-berlin.de
In this notebook we will be using a trajectory of Di-Ala-peptide to easily identify conformations in the Ramachandran plot.
[1]:
import molpx
%matplotlib ipympl
Start from files on disk¶
[2]:
top = molpx._molpxdir(join='notebooks/data/ala2.pdb')
MD_trajfiles = [molpx._molpxdir(join='notebooks/data/ala2.mini.xtc')] #short trajectory
rama_files = [molpx._molpxdir(join='notebooks/data/ala2.mini.phi.psi.dat')]
Visualize a FES and the molecular structures behind it¶
Execute the following cell and click either on the FES or on the slidebar. Once you get familiar with it, try uncommenting these options and see what happens:
proj_idxs=[1]
n_overlays=5
sticky=True
color_list='random'
With sticky option is True
, you can see the effect of a right-click on the dots of the FES
[3]:
mpx_wdg_box = molpx.visualize.FES(MD_trajfiles,
top,
rama_files,
nbins=50,
proj_labels=['$\phi$',
'$\psi$'],
atom_selection="symbol != H",
#proj_idxs=[1],
#n_overlays=5,
#sticky=True,
#color_list='random'
)
mpx_wdg_box
Visualize trajectories and molecular structures (and the FES, optionally)¶
[4]:
from molpx import visualize, _linkutils
from imp import reload
reload(visualize)
reload(_linkutils)
from matplotlib import pyplot as plt
plt.close('all')
mpx_wdg_box = molpx.visualize.traj(MD_trajfiles,
top,
rama_files,
plot_FES = True,
proj_labels=['$\phi$', '$\psi$']
)
mpx_wdg_box
Repeat from memory¶
You can load the trajectory data using mdtraj
and numpy
and use that directly as an input:
[5]:
import numpy as np
import mdtraj as md
MD_trajs = [md.load(fname, top=top) for fname in MD_trajfiles]
phi_psi = [np.loadtxt(fname) for fname in rama_files]
[6]:
mpx_wdg_box = molpx.visualize.FES(MD_trajs,
top,
phi_psi,
nbins=50,
proj_labels=['$\phi$',
'$\psi$'],
atom_selection="symbol != H",
#proj_idxs=[1],
#n_overlays=5,
#sticky=True,
#color_list='random'
)
mpx_wdg_box
The mpx_wdg_box
¶
It is a class derived from the ipython widgets HBox and VBox, with molPX’s extra information as attributes starting with “linked_*”
[12]:
for attr in dir(mpx_wdg_box):
if attr.startswith('linked_'):
print(attr)
linked_ax_wdgs
linked_axes
linked_data_arrays
linked_figs
linked_mdgeoms
linked_ngl_wdgs