Learn R Programming

bio3d (version 2.4-4)

read.dcd: Read CHARMM/X-PLOR/NAMD Binary DCD files

Description

Read coordinate data from a binary DCD trajectory file.

Usage

read.dcd(trjfile, big=FALSE, verbose = TRUE, cell = FALSE)

Value

A numeric matrix of xyz coordinates with a frame/structure per row and a Cartesian coordinate per column or a numeric matrix of cell information with a frame/structure per row and lengths and angles per column.

Arguments

trjfile

name of trajectory file to read. A vector if treat a batch of files

big

logical, if TRUE attempt to read large files into a big.matrix object

verbose

logical, if TRUE print details of the reading process.

cell

logical, if TRUE return cell information only. Otherwise, return coordinates.

Author

Barry Grant

Details

Reads a CHARMM or X-PLOR/NAMD binary trajectory file with either big- or little-endian storage formats.

Reading is accomplished with two different sub-functions: dcd.header, which reads header info, and dcd.frame, which takes header information and reads atoms frame by frame producing an nframes/natom*3 matrix of cartesian coordinates or an nframes/6 matrix of cell parameters.

References

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

See Also

read.pdb, write.pdb, atom.select

Examples

Run this code
# \donttest{
# Redundant testing excluded

##-- Read cell parameters from example trajectory file
trtfile <- system.file("examples/hivp.dcd", package="bio3d")
trj <- read.dcd(trtfile, cell = TRUE)
##-- Read coordinates from example trajectory file
trj <- read.dcd(trtfile)

## Read the starting PDB file to determine atom correspondence
pdbfile <- system.file("examples/hivp.pdb", package="bio3d")
pdb <- read.pdb(pdbfile)

## select residues 24 to 27 and 85 to 90 in both chains
inds <- atom.select(pdb, resno=c(24:27,85:90), elety='CA')

## lsq fit of trj on pdb
xyz <- fit.xyz(pdb$xyz, trj, fixed.inds=inds$xyz, mobile.inds=inds$xyz)

##-- RMSD of trj frames from PDB
r1 <- rmsd(a=pdb, b=xyz)
# }

if (FALSE) {
# Pairwise RMSD of trj frames for positions 47 to 54
flap.inds <- atom.select(pdb, resno=c(47:54), elety='CA')
p <- rmsd(xyz[,flap.inds$xyz])
# plot highlighting flap opening?
plot.dmat(p, color.palette = mono.colors)
}

Run the code above in your browser using DataLab