Ramachandran plot evolution in time

The cell below uses JSAnimation to embed a "movie" of the behavior of GK enzyme in an MD simulation. The $\phi$ and $\psi$ angles of residues in the "hinge" region of the enzyme are monitored as the motion of the lobes for GK evolve in time.


In [2]:
%pylab inline
from JSAnimation import IPython_display
from matplotlib import animation


Populating the interactive namespace from numpy and matplotlib

In [7]:
fig = plt.figure(figsize=[12,6])
ax = plt.subplot(121)
line1, = ax.plot([], [], '.')
ax2 = plt.subplot(122)
line2, = ax2.plot([], [], 'r-')

ax.axhline(linewidth=.5, color='black')
ax.axvline(linewidth=.5, color='black')
ax.set_xlabel('$\phi$', fontsize=16)
ax.set_ylabel('$\psi$',fontsize=16)
ax.set_title('Ramachandran Plot', fontsize=20)
ax.axis([-180,180,-180,180])

ax2.axis([0,4000,1.7,2.2])
ax2.set_xlabel('Time (ps)', fontsize=16)
ax2.set_ylabel('Distance $\AA$',fontsize=16)
ax2.set_title('Motion of the Lobes', fontsize=20)
ax2.grid()

def init():
    line1.set_data([], [])
    line2.set_data([], [])
    return line1,line2,

def animate(i):
    CV= loadtxt('data/COLVAR_4F4J')
    backbone = 1
    ranges = 10
    dist = CV[0:ranges*i+ranges, 1]
    phi = CV[-ranges+i*ranges:ranges*i+ranges, backbone+1]*180/pi
    psi = CV[-ranges+i*ranges:ranges*i+ranges, backbone+10]*180/pi
    time = linspace(0,2*(i*ranges+ranges), (i*ranges+ranges))
    line1.set_data(psi,phi)
    line2.set_data(time,dist)
    return line1, line2,

animation.FuncAnimation(fig, animate, init_func=init,
                        frames=200, interval=50, blit=True)


Out[7]:


Once Loop Reflect