trim.xyz: Trim a XYZ Object of Cartesian Coordinates.

trim.xyzR Documentation

Trim a XYZ Object of Cartesian Coordinates.

Description

Produce a new smaller XYZ object, containing a subset of atoms.

Usage

## S3 method for class 'xyz'
trim(xyz, row.inds = NULL, col.inds = NULL, ...)

Arguments

xyz

a XYZ object containing Cartesian coordinates, e.g. obtained from read.pdb, read.ncdf.

row.inds

a numeric vector specifying which rows of the xyz matrix to return.

col.inds

a numeric vector specifying which columns of the xyz matrix to return.

...

additional arguments passed to and from functions.

Details

This function provides basic functionality for subsetting a matrix of class ‘xyz’ while also maintaining the class attribute.

Value

Returns an object of class xyz with the Cartesian coordinates stored in a matrix object with dimensions M x 3N, where N is the number of atoms, and M number of frames.

Author(s)

Lars Skjaerven

References

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

See Also

read.pdb, as.xyz.

Examples

## Not run: 
## Read a PDB file from the RCSB online database
pdb <- read.pdb("1bg2")

## Select calpha atoms
sele <- atom.select(pdb, "calpha")

## Trim XYZ
trim(pdb$xyz, col.inds=sele$xyz)

## Equals to
pdb$xyz[, sele$xyz, drop=FALSE]

## End(Not run)

bio3d documentation built on Oct. 30, 2024, 1:08 a.m.