Learn R Programming

Rpdb (version 2.0)

merge.pdb: Merge Two Obejct of Class pdb

Description

Merge two objects of class pdb.

Usage

## S3 method for class 'pdb':
merge(x, y, reindex = TRUE, ...)

Arguments

x, y
objects of class pdb to be merged.
reindex
a single element logical vector indicating if residue and element IDs should be reindexed after merging.
...
further arguments passed to or from other methods.

Value

  • Return an object of class pdb merging x and y. If x and y have different basis attributes an error is returned.

Details

The atoms and conect components of the two pdb objects are merged together by row. The basis attribute of x and y must be the same (see basis). The residue and element IDs of y are shifted to avoid any confusion with those of x. If the cryst1 components of x and y differ the cryst1 component of x is used to build the returned object.

See Also

pdb, basis, merge, merge.coords

Examples

Run this code
## Merge two 'pdb' objects
x1 <- read.pdb(system.file("examples/PCBM_ODCB.pdb",package="Rpdb"))
x2 <- x1
x2$atoms$x1 <- x2$atoms$x1 + 10
y <- merge(x1, x2)

## Two merge more than two 'pdb' objects together
## first create a list of 'pdb' objects and use the reduce function to merged them all.
x3 <- x1
x3$atoms$x1 <- x3$atoms$x1 - 10
L <- list(x1, x2, x3)
y <- Reduce(merge, L)

Run the code above in your browser using DataLab