Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mirror

Reflexion of Atomic Coordinates


Description

Perform a reflexion (or mirror) operation on atomic coordinates with respect to a given reflexion plan.

Usage

mirror(...)

## S3 method for class 'coords'
mirror(x, p1, p2 = NULL, p3 = NULL, mask = TRUE,
  cryst1 = NULL, ...)

## S3 method for class 'pdb'
mirror(x, p1, p2 = NULL, p3 = NULL, mask = TRUE,
  cryst1 = x$cryst1, ...)

Arguments

x

an R object containing atomic coordinates.

p1

a numeric vector of length 3 containing the coordinates of the first point defining the reflexion plan. Can also be a 3x3 matrix or data.frame containing by row p1, p2 and p3.

p2

a numeric vector of length 3 containing the coordinates of the second point defining the reflexion plan.

p3

a numeric vector of length 3 containing the coordinates of the thrid point defining the reflexion plan.

mask

a logical vector indicating the set of coordinates to which to apply the reflexion.

cryst1

an object of class ‘cryst1’ use to convert fractional into Cartesian coordinates when need.

...

further arguments passed to or from other methods.

Details

mirror is generic functions. Method for objects of class ‘coords’ first convert the coordinates into Cartesian coordinates using cryst1 if needed. Once reflected, the coordinates are reconverted back to the orginal basis set using again cryst1. Method for objects of class ‘pdb’ first extract coordinates from the object using the function coords, perform the reflection, and update the coordinates of the ‘pdb’ object using the function coords<-.

Value

An object of the same class as x with reflected coordinates.

See Also

Helper functions for reflection with respect to a given Cartesian plan or a plan defined by two lattice vectors:
Mxy, Myz, Mzx, Mab, Mbc, Mca
Passing from Cartesian to fractional coordinates (or Vis Versa):
xyz2abc, abc2xyz

Examples

# First lets read a pdb file
x <- read.pdb(system.file("examples/PCBM_ODCB.pdb",package="Rpdb"))
cell <- cell.coords(x)
visualize(x, mode = NULL)
# Mirror operation with respect to the ab-plan
visualize(mirror(x, rep(0,3), p1=cell[,"a"], p2=cell[,"b"]), mode = NULL)
# Mirror operation with respect to the ab-plan for residue 1
visualize(mirror(x, rep(0,3), p1=cell[,"a"], p2=cell[,"b"], mask=x$atoms$resid==1), mode = NULL)

Rpdb

Read, Write, Visualize and Manipulate PDB Files

v2.3
GPL
Authors
Julien Idé
Initial release
2014-02-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.