how to plot the contribution of each residue in PCA histogram.

Issue #500 resolved
Former user created an issue

I was easy to plot the PCA histogram by selecting CA atoms in the pdb file, as described in the bio3d manual. Is there any way to see the contribution of whole residue in the PCA histogram plot?

Comments (14)

  1. santosh chaudhary

    HI, thanks for the reply. Yes, but i have performed PCA analysis by taking all atoms of the residues except hydrogen.

  2. Xinqiu Yao

    You might try the sum of square of loadings within one residue. For example,

    tapply(pc$au, pdb$atom$resno, function(x) sqrt(sum(x^2)))
    

    where 'pc' is the pca result and pdb should exactly match the data used for pca.

    Let me know if you still have questions.

  3. Barry Grant

    This can be done for you with the function plot.pca.loadings() it can take a vector of residue numbers as input and will then group your atom contributions for each atom with a similar residue number. Read the docs for this function and give it a try.

  4. Amir Zeb

    Hello Santosh,

    Will you please like to let me know how may I superimpose trajectory taking all the atoms? I know only C_alpha atoms superimposition by command like ca.inds <- atom.select(pdb, elety="CA")

    Thanks in advance!

    Amir

  5. Xinqiu Yao

    If use all atoms, you don't need 'atom.select'. Simply call 'fit.xyz()', e.g. xyz.fitted <- fit.xyz(xyz[1, ], xyz).

  6. Amir Zeb

    Thanks Xin-Qiu,

    I tried your instructions but could not produce the pc1 for the whole protein atoms. Once I put the command you suggested, i'm getting some warning like:

    xyz.fitted <- fit.xyz(xyz[1, ], xyz)

    Warning message: In fit.xyz(xyz[1, ], xyz) : No fitting indices provided, using the 381 non NA positions

    Please let me know where am I wrong.

    Thanks

  7. Xinqiu Yao

    The warning is normal - you can safely ignore it. What do you mean 'could not produce the pc1 for the whole protein atoms'? Did pca(xyz.fitted) work?

  8. Amir Zeb

    Dear Xin-Qiu,

    I am following this tutorial "http://thegrantlab.org/bio3d/tutorials/trajectory-analysis" Once I set path to my working directory, I am issuing the following commands.

    Library(Bio3d)

    dcd <- 'xxx file' pdb <- 'xxx file'

    dcd <- read.dcd ("xxx file") pdb <- read.pdb ("xxx file")

    xyz.fitted <- fit.xyz(xyz[1, ], xyz) for this command, I am getting the following error

    Error in matrix(colSums(rbind(gap.pos1, gap.pos2), na.rm = TRUE), ncol = ncol(x)) : non-numeric matrix extent

    Then I tried this command, xyz <- fit.xyz(fixed=pdb$xyz, mobile=dcd), so I got the following warning.

    Warning message: In fit.xyz(fixed = pdb$xyz, mobile = dcd) : No fitting indices provided, using the 381 non NA positions

    But again if I use the command which you have kindly provided me, I am getting same warning as mentioned in previous comment. If I ignore this warning and use this command p1 <- mktrj.pca(pc, pc=1, b=pc$au[,1], file="pc1.pdb") to produce the pc1, I could not, which is clearly explained on the Bio3d Web link.

    Please let me know if there is some tutorial to do PCA of whole atoms of proteins on their trajectory.

    Thanks

  9. Amir Zeb

    Thanks Santosh,

    Yeah, I have converted the same pdb file to dcd file in VMD, and then performed the PCA analysis in RStudio. Actually, I could get PCA but only for CA (Carbon alpha) atoms.

    I want to get PCA for the whole protein, means that side chain atoms should be included.

    Will you have please any idea, How to do this?

    Thanks

    Amir

  10. Log in to comment