How PCA contribution analysis reads residue numbers from PDB files instead of starting at 1

Issue #963 new
dengwuji created an issue

Hi , forgive my unfamiliarity with the R language, I'm doing PCA Contributions need to analyze how to read residue numbers from the PDB file instead of starting with 1.I am not familiar with the R language, can you please give an example or modification? Thank you very much! My original code:

library("bio3d")

dcd <- read.dcd("10_100_dt10.dcd")
pdb <- read.pdb("pro_ligand.pdb")

ca.inds <- atom.select(pdb, elety="CA")
xyz <- fit.xyz(fixed=pdb$xyz, mobile=dcd,
fixed.inds=ca.inds$xyz,
mobile.inds=ca.inds$xyz)
dim(xyz) == dim(dcd)

png("ca-pca_contribution.png", width = 8, height = 4, units = "in", res = 1000)
par(cex.axis = 0.5)

plot.bio3d(pc$au[,1], ylab="Contribution", xlab="C-alpha Position", typ="l", xlim=c(1, length(pc$au[,1])), col="#FF9671")
points(pc$au[,2], typ="l", col="#0089BA")

x_ticks <- seq(25, length(pc$au[,1]), by=50)
x_labels <- seq(25, length(pc$au[,1]), by=50)

axis(side = 1, at = x_ticks, labels = FALSE, tcl = -0.2)
mtext(x_labels, side = 1, at = x_ticks, line = 1, cex = 0.5)

axis(side = 2, cex.axis = 0.5)

box()

legend("topright", legend=c("PC1", "PC2"), lty=c(1, 1), col=c("#FF9671", "#0089BA"))
dev.off()

Comments (2)

  1. Xinqiu Yao

    If you simply want to label the plot with actual PDB residue numbers, try plot.bio3d(..., resno=pdb).

    Hope it may help.

  2. Log in to comment