Re: [AMBER] Principal Component Analysis

From: Jason Swails <>
Date: Wed, 2 Dec 2015 08:50:24 -0500

On Wed, Dec 2, 2015 at 5:23 AM, Beale, John <> wrote:

> Amber community,
> I need to do principal component analysis on some Amber datasets. I worked
> through tutorial A22 (Accelerated MD) which gives an example of the use of
> PCA and a script for processing the data. My script is given below:
> _______________________________________________________________________________
> #!/bin/csh
> cpptraj nac.prmtop <<EOF
> trajin 1 last 1
> reference nac.inpcrd
> center origin :1-35
> image origin center
> strip :WAT,Na+
> rms reference mass :1-35.CA,C,N out RMSD.out
> matrix covar name matrixdat @CA out covmat-ca.dat
> analyze matrix matrixdat out evecs-ca.dat vecs 5
> analyze matrix matrixdat name evecs-ca vecs 5
> analyze modes fluct out analyzemodesflu.dat name evecs-ca beg 1 end 5
> analyze modes displ out analyzemodesdis.dat name evecs-ca beg 1 end 5
> projection modes evecs-ca.dat out pca12-ca beg 1 end 3 @CA
> go
> When I run this cpptraj script, several files are output. Four of them
> are: RMSD.out, analyzemodesflu.dat, analyzemodesdis.dat, and pca12-ca. The
> pca12-ca file contains (with my projection settings) three columns of
> numbers. I can use these to create a contour plot. My question is, which
> file, analyzemodesflu.dat, analyzemodesdis.dat, or pca12-ca, will have the
> principal components that I need? Or, do they all represent PCAs for
> different purposes?

​Maybe I'm not understanding what you're asking, but the eigenmodes that
are the principal components are stored in evecs-ca.dat (the second matrix
diagonalization doesn't seem to do anything but waste time, unless I'm
missing something). That's why you read in evecs-ca.dat when computing
projections (rather than the fluctuations or displacements from the normal
modes, which you calculate with the "analyze modes" commands).

pca12-ca only stores the projections along the first 3 PCs (which, as you
mentioned, you can use to create a 3-D contour surface of the subspace
spanned by the first 3 PCs).​


Jason M. Swails
Rutgers University
Postdoctoral Researcher
AMBER mailing list
Received on Wed Dec 02 2015 - 06:00:09 PST
Custom Search