#-- Read transducin alignment and structures
aln <- read.fasta(system.file("examples/transducin.fa",package="bio3d"))
pdbs <- read.fasta.pdb(aln)
# Find core
core <- core.find(pdbs,
#write.pdbs = TRUE,
verbose=TRUE)
rm(list=c("pdbs", "core"))
#-- OR for demo purposes just read previously saved transducin data
attach(transducin)
# Previously fitted coordinates based on sub 1.0A^3 core. See core.find() function.
xyz <- pdbs$xyz
#-- Do PCA ignoring gap containing positions
pc.xray <- pca.xyz(xyz, rm.gaps=TRUE)
# Plot results (conformer plots & scree plot)
plot(pc.xray, col=annotation[, "color"])
## Plot atom wise loadings
plot.bio3d(pc.xray$au[,1], ylab="PC1 (A)")
## Plot loadings in relation to reference structure 1TAG
gaps.res <- gap.inspect(pdbs$ali)
pdb <- read.pdb("1tag")
ind <- grep("1TAG", pdbs$id)
res.ind <- pdbs$resno[ind, gaps.res$f.ind]
op <- par(no.readonly=TRUE)
par(mfrow = c(3, 1), cex = 0.6, mar = c(3, 4, 1, 1))
plot.bio3d(res.ind, pc.xray$au[,1], sse=pdb, ylab="PC1 (A)")
plot.bio3d(res.ind, pc.xray$au[,2], sse=pdb, ylab="PC2 (A)")
plot.bio3d(res.ind, pc.xray$au[,3], sse=pdb, ylab="PC3 (A)")
par(op)
# Write PC trajectory
a <- mktrj.pca(pc.xray, pc=1, file="pc1.pdb",
resno = pdbs$resno[1, gaps.res$f.inds],
resid = aa123(pdbs$ali[1, gaps.res$f.inds]) )
b <- mktrj.pca(pc.xray, pc=2, file="pc2.pdb",
resno = pdbs$resno[1, gaps.res$f.inds],
resid = aa123(pdbs$ali[1, gaps.res$f.inds]) )
c <- mktrj.pca(pc.xray, pc=3, file="pc3.pdb",
resno = pdbs$resno[1, gaps.res$f.inds],
resid = aa123(pdbs$ali[1, gaps.res$f.inds]) )
detach(transducin)
Run the code above in your browser using DataLab