Learn R Programming

Bios2cor (version 2.2.1)

xyz2torsion: Convert Cartesian Coordinates to Torsion Angles

Description

Convert cartesian coordinate matrix to torsion angles with function torsion.pdb.

Usage

xyz2torsion(pdb, xyz, tbl = c("basic", "mainchain", 
     "sidechain", "all", "phi", "psi", paste("chi", 1:5, sep="")), ncore = NULL)

Value

Returns a MxP matrix, where M is the number of frames and P the number of valid torsion angles.

Arguments

pdb

A PDB structure object as obtained from read.pdb.

xyz

Cartesian coordinates as a Mx(3N) matrix.

tbl

Names of torsion angles to calculate.

ncore

Number of CPU cores used to do the calculation. By default (NULL), use all detected CPU cores.

Author

Xin-Qiu Yao

Details

Available values for the argument ‘tbl’ include:

  • Basic: "phi", "psi", "chi1".

  • Mainchain: "phi", "psi".

  • Sidechain: "chi1", "chi2", "chi3", "chi4", "chi5".

  • All: all of the above.

  • Each individual angle.

References

Grant, B.J. et al. (2006) Bioinformatics 22, 2695--2696.

See Also

torsion.xyz, torsion.pdb

Examples

Run this code
  pdb <- system.file("rotamer/toy_coordinates.pdb", package= "Bios2cor")
  trj <- system.file("rotamer/toy_dynamics.dcd", package= "Bios2cor")
  
  pdb <- read.pdb(pdb)
  trj <- read.dcd(trj)
 
  #Selecting only "CA" atoms
  ca.inds <- atom.select(pdb, elety = "CA")

  #Getting xyz coordinates using fit.xyz form bio3d package
  xyz <- fit.xyz(fixed = pdb$xyz, mobile = trj,fixed.inds=ca.inds$xyz,mobile.inds=ca.inds$xyz)
 
  frames <- seq(from= 1, to= 40, by= 2)
  
  #Creating torsion object for side chains using xyz2torsion function from bio3d package
  tor <- xyz2torsion(pdb, xyz[frames,], tbl = "sidechain", ncore= 1)

Run the code above in your browser using DataLab