Learn R Programming

Rpdb (version 2.0)

natom.coords: Number of Atoms in coords, atoms or pdb Objects

Description

Evaluates the number of atoms in an object of class coords, atoms or pdb.

Usage

## S3 method for class 'coords':
natom(x, factor = NULL, \dots)

## S3 method for class 'atoms': natom(x, factor = NULL, ATOM = TRUE, HETATM = TRUE, \dots)

## S3 method for class 'pdb': natom(x, factor = NULL, ATOM = TRUE, HETATM = TRUE, \dots)

Arguments

x
an R object containing atomic coordinates.
factor
a factor use to split the object and evalute the number of atom in each group.
ATOM
a single element logical vector indicating if ATOM records have to be considered or not.
HETATM
a single element logical vector indicating if HETATM records have to be considered or not.
...
further arguments passed to or from other methods.

Value

  • Return an integer or a vector of integer of lenght equal to nlevels(factor) (if factor is specify) indication the number of atoms in the object or in the groups defined by factor.

Details

The atomic coordinates of the object are first filtered to keep ATOM and/or HETATM records as indicated by the 'ATOM' and 'HETATM' arguments. Then, if factor is specify, the object is splitted to evalute the number of atoms in each group defined by factor. If factor is not specify then the total number of atoms in the object is return.

See Also

natom, factor, split, coords, atoms, pdb

Examples

Run this code
x <- read.pdb(system.file("examples/PCBM_ODCB.pdb",package="Rpdb"))
natom(x)
natom(x, x$atoms$resid)
natom(x, x$atoms$resname)
natom(x, HETATM=FALSE)

Run the code above in your browser using DataLab