PCA: How to project the holo trajectory onto the first two eigenvectors of the apo one

Issue #463 resolved
Former user created an issue

Hi, I would like to preform PCA for the holo and apo forms of a protein. To detect differences between both forms I would like to project the holo trajectory onto a subset, i.e., the first two, eigenvectors of the apo trajectory. Can I do that using Bio3d? Kind regards, Jorge

Comments (3)

  1. Lars Skjærven

    Absolutely. Make sure you superimpose both trajectories to the same structure. Then use pca.xyz() to calculate the PCs of apo. Project the holo traj onto apo-PCs with project.pca(). Plot with plot.pca().

    # read in calpha trajectories
    apo <- read.ncdf("apo.nc")
    holo <- read.ncdf("holo.nc")
    
    # superimpose (same number of calpha atoms)
    xyz1 <- fit.xyz(apo[1, ], apo)
    xyz2 <- fit.xyz(apo[1, ], holo)
    
    # perform PCA
    pc <- pca.xyz(xyz1)
    
    # project holo traj to PCs
    proj2 <- project.pca(xyz2, pc)
    
    # blues for apo
    cols1 <- densCols(pc$z[,1:2])
    
    # yellow-orange for holo
    cr <-  colorRampPalette(c("#FCFF00", "#FF9400", "#FF3100"))
    cols2 <- densCols(proj2[,1:2], colramp=cr)
    
    # plot projections
    plot(pc$z[, 1:2], col=cols1, pch=16)
    points(proj2[, 1:2], col=cols2, pch=16)
    
  2. Log in to comment