Plot RMSF in b factor column
I would like to write out a pdb that has the RMSF in the b factor column. Currently I get the error message below:
Error in write.pdb(pdb = NULL, xyz = pdb$xyz, file = "RMSF.pdb", : write.pdb: the lengths of all input vectors != 'length(xyz)/3'.
When I check the following I get the same #
nrow(pdb$atom) [1] 9741 length(pdb$xyz)/3 [1] 9741
Below is the script I am currently using. Any suggestions would be appreciated.
library(bio3d)
mydcdfile <- "MD.dcd" mypdbfile <- "MD.pdb"
dcd <- read.dcd(mydcdfile) pdb <- read.pdb(mypdbfile)
align trajectory and store new coordinates as xyz
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)
#RMSF rf <- rmsf(xyz[,ca.inds$xyz]) rf <- rmsf(xyz) plot(rf, ylab="RMSF", xlab="Residue Position", typ="l") write.pdb(pdb=NULL, xyz=pdb$xyz, file="RMSF.pdb", b=rf)
Comments (2)
-
-
- changed status to resolved
- Log in to comment
Looks like you have Calpha atom RMSF values but are trying to write an all atom PDB hence the error message...
Make your PDB match your RMSF vector or vice-versa.
For example something like this...