Python script to plot 2D FEL
The basic instructions remain same as FEL 3D plots.
These plots are published in Interplay among Structural Stability, Plasticity, and Energetics Determined by Conformational Attuning of Flexible Loops in PD-1
Fel2d.py
## FEL using plot_surface
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import random
from matplotlib import cm
from scipy.interpolate import griddata
from scipy.interpolate import Rbf
from numpy import linspace
#from matplotlib.ticker import LinearLocator, FormatStrFormatter
import matplotlib
from scipy import interpolate
import matplotlib.mlab as ml
fig = plt.figure(figsize=None, dpi=300, facecolor=None, edgecolor=None, linewidth=0.0, frameon=None, subplotpars=None, tight_layout=None)
ax = fig.add_subplot(111)
### input file with x,y,z coordinates
x,y,z = np.loadtxt('5wt9gibbs.txt').T
X,Y = np.unique(x),np.unique(y)
xi = linspace(min(X),max(X),len(X))
yi = linspace(min(Y),max(Y),len(Y))
xi,yi = np.meshgrid(xi,yi)
X1, Y1 = np.meshgrid(X,Y)
print (len(x))
Z = griddata((x,y),z,(X1,Y1),method='cubic')
#surf = ax.plot_surface(X1, Y1, Z, rstride=1,cstride=1,alpha=1,cmap=cm.jet, linewidth=0.0, antialiased=3)
cset = ax.contourf(X1, Y1, Z, zdir='z', offset=-0, cmap=cm.jet, antialiased=3, vmin=0, vmax=18)
### put name of each axis. Cgange fontsize and lablesize accordingly
ax.set_xlabel('PC1',fontsize=12)
#ax.set_xlim(-6, 6)
ax.tick_params(axis="x", labelsize=6)
ax.set_ylabel('PC2',fontsize=12)
#ax.set_ylim(-6, 6)
ax.tick_params(axis="y", labelsize=6)
#ax.set_zlabel('Z axis', fontsize=12)
#ax.tick_params(axis="z", labelsize=6)
#ax.set_zlim(0.0, 12.0)
# Add a color bar which maps values to colors.
#fig.colorbar(surf, shrink=0.8, aspect=20)
#fig.colorbar(surf, shrink=0.5, aspect=20, extend='neither', ticks=[0, 2, 4, 6, 8, 10, 12])
plt.show()
For any queries regarding the script, kindly drop your message in the comments section below.
Please also provide your valuable feedback and stay tuned for more such blogs and scripts!!
Happy Computing!!
Thanks.but i how can i have the conformations?
ReplyDeleteHi,
ReplyDeleteThe low energy conformers can be extracted by:
1. when u run the pymol script to generate the FEL image.. dont save directly in the folder by the script.. rather let the image open as a window so that u can save it manually..
2. when image window opens.. mouse over to the basins of your interest, then somewhere on the bottom left side u could see the x and y coordinates of the basin.
3. search those values in the pca12.dat that contains the time frames also.
4. Now u wont find the exact values of the coordinate but somewhere near to it. x and y coordinates denotes to mode 1 (PC1) and mode 2 (PC2) values respectively.
5. likewise u will get the approximate idea of the time frame (mentioned in the first column of the file).
6. then using any frame extraction method .. u can extract that particular frame from the trajectory.
hello, I didn't pca12.dat file. can you pls suggest what steps need to be taken to find out the conformer at that particular ns if the same process has been done through gromacs. Also i tried your code to find the lowest energy bins in spyder ide, but i didn't get the x and y points as you have mentioned, so is there any way to find out the lowest energy regions and save it in a table?
DeleteCan I ask a question? I have recently done dPCA. Do I need motify the trajectory with -center -pbc -mol -fit rot + trans before analyse dPCA?
ReplyDeleteHow to save the FEL? I used plt.savefig('pca'). But its showing 0 axis.What should i do?
ReplyDelete