Learn R Programming

bio3d (version 2.4-4)

read.ncdf: Read AMBER Binary netCDF files

Description

Read coordinate data from a binary netCDF trajectory file.

Usage

read.ncdf(trjfile, headonly = FALSE, verbose = TRUE, time = FALSE,
          first = NULL, last = NULL, stride = 1, cell = FALSE,
          at.sel = NULL)

Value

A list of trajectory header data, 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. If time=TRUE, row names of returned coordinates or cell are set to be the physical time of corresponding frames.

Arguments

trjfile

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

headonly

logical, if TRUE only trajectory header information is returned. If FALSE only trajectory coordinate data is returned.

verbose

logical, if TRUE print details of the reading process.

time

logical, if TRUE the first and last have the time unit ps; Otherwise the unit is the frame number.

first

starting time or frame number to read; If NULL, start from the begining of the file(s).

last

read data until last time or frame number; If NULL or equal to -1, read until the end of the file(s).

stride

take at every stride frame(s)

cell

logical, if TRUE and headonly is FALSE return cell information only. Otherwise, return header or coordinates.

at.sel

an object of class ‘select’ indicating a subset of atomic coordinates to be read.

Author

Barry Grant

Details

Reads a AMBER netCDF format trajectory file with the help of David W. Pierce's (UCSD) ncdf4 package available from CRAN.

References

Grant, B.J. et al. (2006) Bioinformatics 22, 2695--2696. https://www.unidata.ucar.edu/software/netcdf/ https://cirrus.ucsd.edu/~pierce/ncdf/ https://ambermd.org/FileFormats.php#netcdf

See Also

read.dcd, write.ncdf, read.pdb, write.pdb, atom.select

Examples

Run this code
if (FALSE) {
##-- Read example trajectory file
trtfile <- system.file("examples/hivp.dcd", package="bio3d")
trj <- read.dcd(trtfile)

## Write to netCDF format
write.ncdf(trj, "newtrj.nc")

## Read trj
trj <- read.ncdf("newtrj.nc")
}

Run the code above in your browser using DataLab