Learn R Programming

Rpdb (version 2.3.4)

subset.atoms: Subsetting ‘atoms’ and ‘pdb’ Objects

Description

Return subsets of ‘atoms’ or ‘pdb’ objects which meet conditions.

Usage

# S3 method for atoms
subset(x, subset, drop = FALSE, reindex.all = TRUE, ...)

# S3 method for pdb subset(x, subset, drop = FALSE, reindex.all = TRUE, ...)

Value

Return a subsetted object of the same class as x.

Arguments

x

object to be subsetted.

subset

logical expression indicating elements or rows to keep: missing values are taken as false.

drop

passed on to [ indexing operator.

reindex.all

a single element logical vector indicating if residues and elements IDs have to be reindexed after subsetting.

...

further arguments to be passed to or from other methods.

Details

For an ‘atoms’ object the method is similar to the data.frame method (see subset) but allow to directly reindex the elements and residues IDs. For a ‘pdb’ object subsetting is applied on the atoms and conect components of the object in a consistent way. First the atoms component is subsetted and then the conect component is filtered to keep only the conectivity for the subset.

See Also

subset, pdb, atoms, reindex

Examples

Run this code
x <- read.pdb(system.file("examples/PCBM_ODCB.pdb", package="Rpdb"))
y <- subset(x, x$atoms$eleid %in% sample(x$atoms$eleid, 10))
is(y)
y <- subset(x$atoms, x$atoms$eleid %in% sample(x$atoms$eleid, 10))
is(y)
x <- coords(x)
y <- subset(x, x < 0)
is(y)

Run the code above in your browser using DataLab