PCA analysis on MD trajectory through cpptraj
PCA analysis through CPPTRAJ module of AmberTools:
>source $AMBERHOME/amber.sh
>$AMBERHOME/bin/cpptraj
>parm comp_solv.prmtop
>trajin comp_150ns.nc
>center
>autoimage
>rms first @CA mass
>average crdset avg_set
>createcrd traj_set
>run
>crdaction traj_set rms ref avg_set @CA
>crdaction traj_set matrix covar :116-229@CA name pro_covar out covmat.dat #writes covariance matrix based on the selection of residues
>runanalysis diagmatrix pro_covar out evecs.dat vecs 100 name myevecs nmwiz nmwizvecs 100 nmwizfile porcupine.nmd nmwizmask :116-229@CA #writes the information about 100 principal components (first 100 PCs) for that particular selection, produces .nmd file that can be used to generate porcupine plots in normal mode wizard plugin of VMD.
>runanalysis modes eigenval name myevecs out evalfrac.dat gives output about the eigen values, fraction of contribution, cumulative contributions of eigen vectors(or PCs) (in evalfrac file),
>runanalysis modes fluct out rmsfluct1-10.dat name myevecs beg 1 end 10 #to write the fluctuations of first 10 PCs
>runanalysis modes fluct out rmsfluct1-2.dat name myevecs beg 1 end 2 #to write the fluctuations of first two PCs
>runanalysis modes fluct out rmsfluct-mode1.dat name myevecs beg 1 #to write the fluctuations of first PC
>crdaction traj_set projection p1 modes myevecs beg 1 end 20 :116-229@CA out pca.dat #to write the projections of first 20 PCs
>crdaction traj_set projection p2 modes myevecs beg 1 end 2 :116-229@CA out pca12.dat #to write the projections of first 2 PCs
The PCA12.dat can be opened in xmgrace to see the projections of both PCs on x and y axis. The lines can be replaced with symbols such as circles to get the appearance of a scatter plot.
To generate the Free energy landscape (FEL) plots, u need to convert the PCA12.dat file i.e. the projection file to gibbs.txt. For this u need gromacs installed in your system and then follow the following steps.
gmx sham -f 2d_proj.xvg -ls gibbs.xpm -notime #for free energy, "sham" module uses PC1 and PC2 file
gmx xpm2ps -f gibbs.xpm -o gibbs.eps -rainbow red
python xpm2txt.py -f gibbs.xpm -o gibbs.txt
The link for xpm2txt.py and scripts to generate the images of different FEL plots are mentioned in our previous blogs: xpm2txt.py , Python script to plot 2D FEL, Python script to plot 3D FEL plots
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!!
I could not understand how we came to 2d_proj.xvg while using cpptraj we got PCA12.dat? xvg is only possible with gromacs?
ReplyDeleteHow can we now use the PCA12.dat to get FEL?