How PCA contribution analysis reads residue numbers from PDB files instead of starting at 1
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 (8)
-
-
- changed status to new
-
Hello, yao.
forgive my unfamiliarity with the R language. if i want to generate the heatmap dccm with actual pdb residue number from x and y axis, how could i fix the code?
library(bio3d)
dcd <- read.dcd("D:/postdoc/MD/1pvh/analysis/traj/1pvh_bio3d.dcd")
pdb <- read.pdb("D:/postdoc/MD/1pvh/analysis/lif_topology-coot-0.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)
cij <- dccm(xyz[,ca.inds$xyz])
plot(cij)
i want to change the starting number iinto 34.
-
Hi,
Try
plot(cij, resno=pdb)
-
Thanks Yao,for your kindly reply. if i want to show 3 differnt chains complex dccm, how could i change the x -axis and y-axis scale , to show chain a,b,c numbers(chain A:34-202; chain B: 124-320; chain C:246-396 )? where could i search the tutorials, i have no idea after visiting your bio3D website?
-
i have visiting your bio3D website and the tutorials, but i couldn’t see the description for different chain' s dccm analysis. forgive my foolish, hoping for your kindly reply. thanks!
-
Hi,
You will need to set the ticks and labels manually, which is a bit complicated. I would suggest to use the ‘margin.segments’ to indicate chains. For example,
plot.dccm(cij, resno=pdb, margin.segments=c(rep(1,XX), rep(2, YY), rep(3, ZZ)))
Replace XX, YY, and ZZ with the length (number of residues) of chain A, B, and C, respectively.
If you really want to change the scale, try the following:
ca.inds <- atom.select(pdb, "calpha") resno <- pdb$atom$resno[ca.inds$atom] chain <- pdb$atom$chain[ca.inds$atom] xy.at <- pretty(1:ncol(cij)) xy.at <- xy.at[xy.at <= ncol(cij)] xy.at[1] <- 1 labs <- paste(chain[xy.at], resno[xy.at], sep=":") scales <- list(at=xy.at, labels=labs) plot.dccm(cij, scales=scales)
-
Thanks for your kindly and generous reply. Hope you having a nice day!
- Log in to comment
If you simply want to label the plot with actual PDB residue numbers, try
plot.bio3d(..., resno=pdb)
.Hope it may help.