- edited description
PCA in the dihedral space
Hi, I was trying to do torsion PCA for interface residues over an MD trajcetory, i want only to consider the side chain torsions (chi1-chi2), i tried the following code but i think something is wrong in the selection, would you please help with that:
library(bio3d)
library(igraph)
library(ncdf4)
trj <- read.ncdf("TRAJECTORY.nc",first=1,last=100)
pdbfile <- read.pdb("PDBFILE.pdb")
sele1 = atom.select(pdbfile,string="protein", elety=c("N", "CA", "CB","CG"), resno=65:103)
sele2 = atom.select(pdbfile,string="protein", elety=c("CA", "CB", "*G","*D"), resno=65:103)
inds.xyz = c(sele1$xyz, sele2$xyz)
tor <- t(apply(trj, 1, inds.xyz, atm.inc=1))
gaps <- gap.inspect(tor)
pc <- pca.tor(tor[,gaps$f.inds])
Also, what if i need simply to tell bio3d to use the side chain angles that is already built in, i.e. use the standard definition, chi1, chi2 etc..
Regards, Marawan
Comments (10)
-
reporter -
- edited description
-
Yes, the first atom selection may have a problem (you might want to use "*G" instead of "CG").
Also, the line
tor <- t(apply(trj, 1, inds.xyz, atm.inc=1))
is wrong because the function to call is missing.You may check out a script under 'new_funs/' called xyz2torsion.R (and also an associated help document file), which was developed for a similar purpose as yours. I am not sure it has been updated properly. Let me know if it works or not.
-
reporter Hi Xin-Qiu Yao, I could find the function but could not find the associated help document, so I am not sure how to use it? Any clue?
Regards
-
There is a file under the same directory called 'xyz2torsion.Rd'.
-
reporter I tried this code: library(bio3d) library(igraph) library(ncdf4) if(!exists("foo", mode="function")) source("xyz2torsion.R")
trj <- read.ncdf("TRAJ.nc",first=1,last=200) pdbfile <- read.pdb("PDB.pdb")
tor <- xyz2torsion(pdbfile, trj, tbl=("sidechain")) gaps <- gap.inspect(tor) pc <- pca.tor(tor[,gaps$f.inds]) plot(pc, col=bwr.colors(nrow(trj2))) plot.pca.loadings(pc)
But got this error:
tor <- xyz2torsion(pdbfile, trj, tbl=("sidechain"))
|
| | 0%Error in xyz2torsion(pdbfile, trj, tbl = ("sidechain")) : could not find function "big.matrix" Execution halted -
Try 'library(bigmemory)' first.
-
reporter thanks, it works, but I had to load the parallel library as well. Another question, how can we use the xyz2torsion function to select only specific residues, these residues should come into two or more patches, for example, resno=5-20 and resno=30-40.
-
colnames(tor)
, where 'tor' is the output fromxyz2torsion()
, can give information about residue numbers and names of the angle calculated. You can use this information to pick up a subset you want.Alternatively, you can trim the pdb and xyz beforehand and so the final output will be the one you desired. For example,
inds <- atom.select(pdb, resno=c(5:20, 30:40)) spdb <- trim(pdb, inds) sxyz <- xyz[, inds$xyz] tor <- xyz2torsion(spdb, sxyz, tbl='chi1')
-
- changed status to resolved
- Log in to comment