Issue with using bio3d in windows
Issue
I am trying to create plots for RMSF data using the bio3d package using R in windows, but I'm running into some issues. So initially when I load in my dcd and pdb file, the dcd loads fine and the pdb loads with a warning. After that, however, I get the error: Error in mobile[, mobile.inds] : subscript out of bounds. My labmate who has a Mac tried the entire same code and files that I used, and it ran fine, without errors on her computer. Is this an issue with windows? Is there a way for me to resolve this? My two files are attached, and my code, errors, and session info is below. Thank you
This is the code I am trying to run:
library(matrixStats)
library(bio3d)
#Mouse Sun1
###RMSF#######
setwd("/Users/Darya\ Fadavi/Documents/Mofrad_Lab/vmd/SUN\ project/Mouse/Sun1/4dxt\ template")
dcd <- read.dcd('mousesun1_4dxt_stride10_CA.dcd')
pdb <- read.pdb('mousesun1_4dxt_stride10_CA.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)
rd <- rmsd(xyz[1,ca.inds$xyz], xyz[,ca.inds$xyz])
plot(rd, typ="l", ylab="RMSD", xlab="Frame No.")
points(lowess(rd), typ="l", col="red", lty=2, lwd=2)
hist(rd, breaks=40, freq=FALSE, main="RMSD Histogram", xlab="RMSD")
lines(density(rd), col="gray", lwd=3)
rf <- rmsf(xyz[,ca.inds$xyz])
plot(rf, ylab="RMSF", xlab="Residue Position", typ="l")
pc <- pca.xyz(xyz[,ca.inds$xyz])
plot(pc, col=bwr.colors(nrow(xyz)) )
cij<-dccm(xyz[,ca.inds$xyz])
plot.dccm(cij, contour=FALSE, at=seq(-1,1,by=0.25))
This is the output and errors I'm receiving:
> dcd <- read.dcd('mousesun1_4dxt_stride10_CA.dcd')
NATOM = 582
NFRAME= 150
ISTART= 0
last = 150
nstep = 150
nfile = 150
NSAVE = 1
NDEGF = 0
version 24
|=========================================================================| 100%
> pdb <- read.pdb('mousesun1_4dxt_stride10_CA.pdb')
Warning message:
In read.pdb("mousesun1_4dxt_stride10_CA.pdb") :
duplicated element numbers ('eleno') detected
> 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)
Error in mobile[, mobile.inds] : subscript out of bounds
> dim(xyz) == dim(dcd)
Error: object 'xyz' not found
> rd <- rmsd(xyz[1,ca.inds$xyz], xyz[,ca.inds$xyz])
Error in inherits(x, "pdb") : object 'xyz' not found
>
> plot(rd, typ="l", ylab="RMSD", xlab="Frame No.")
Error in plot(rd, typ = "l", ylab = "RMSD", xlab = "Frame No.") :
object 'rd' not found
> points(lowess(rd), typ="l", col="red", lty=2, lwd=2)
Error in xy.coords(x, y) : object 'rd' not found
> hist(rd, breaks=40, freq=FALSE, main="RMSD Histogram", xlab="RMSD")
Error in hist(rd, breaks = 40, freq = FALSE, main = "RMSD Histogram", :
object 'rd' not found
> lines(density(rd), col="gray", lwd=3)
Error in density(rd) : object 'rd' not found
> rf <- rmsf(xyz[,ca.inds$xyz])
Error in rmsf(xyz[, ca.inds$xyz]) : object 'xyz' not found
> plot(rf, ylab="RMSF", xlab="Residue Position", typ="l")
Error in x(x) : argument "df1" is missing, with no default
>
>
> pc <- pca.xyz(xyz[,ca.inds$xyz])
Error in is.vector(x) : object 'xyz' not found
> plot(pc, col=bwr.colors(nrow(xyz)) )
Error in plot(pc, col = bwr.colors(nrow(xyz))) : object 'pc' not found
>
> cij<-dccm(xyz[,ca.inds$xyz])
Error in inherits(x, "matrix") : object 'xyz' not found
> plot.dccm(cij, contour=FALSE, at=seq(-1,1,by=0.25))
Error in colnames(x) = NULL : object 'cij' not found
This is my session info:
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] bio3d_2.3-1 matrixStats_0.51.0
loaded via a namespace (and not attached):
[1] parallel_3.3.1 tools_3.3.1 Rcpp_0.12.6 grid_3.3.1 lattice_0.20-33
Comments (3)
-
-
I've tried your files. It seems the pdb does not match the dcd: The number of atoms in the pdb is two times larger. Note that in
fit.xyz()
, the same atomselectca.inds$xyz
is used to both fixed and mobile coordinates, which is correct only when both coordinate sets contain the same atoms. You may check the pdb file to see if it contains multiple chains.> dcd Total Frames#: 150 Total XYZs#: 1746, (Atoms#: 582) [1] -3.222 45.351 -21.96 <...> 8.19 70.593 18.41 [261900] + attr: Matrix DIM = 150 x 1746 > pdb$xyz Total Frames#: 1 Total XYZs#: 3492, (Atoms#: 1164) [1] -3.222 45.351 -21.96 <...> 6.062 72.991 10.876 [3492] + attr: Matrix DIM = 1 x 3492 > pdb Call: read.pdb(file = "mousesun1_4dxt_stride10_CA.pdb") Total Models#: 1 Total Atoms#: 1164, XYZs#: 3492 Chains#: 1 (values: P) Protein Atoms#: 1164 (residues/Calpha atoms#: 1164) Nucleic acid Atoms#: 0 (residues/phosphate atoms#: 0) Non-protein/nucleic Atoms#: 0 (residues: 0) Non-protein/nucleic resid values: [ none ] Protein sequence: GITEAQAHIIVNNALKLYSQDKTGMVDFALESGGGSILSTRCSETYETKTALLSLFGVPL WYFSQSPRVVIQPDIYPGNCWAFKGSQGYLVVRLSMKIYPTTFTMEHIPKTLSPTGNISS APKDFAVYGLETEYQEEGQPLGRFTYDQEGDSLQMFHTLERPDQAFQIVELRVLSNWGHP EYTCLYRFRVHGEPGITEAQAHIIVNNALKLYSQDKTGMVDFALE...<cut>...HGEP + attr: atom, xyz, calpha, call
-
- changed status to resolved
User input file miss-match. Not a bio3d bug
- Log in to comment