cmap: Contact Map

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/cmap.R

Description

Construct a Contact Map for Given Protein Structure(s).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
cmap(...)

## Default S3 method:
cmap(...)

## S3 method for class 'xyz'
cmap(xyz, grpby = NULL, dcut = 4, scut = 3, pcut=1, binary=TRUE,
            mask.lower = TRUE, collapse=TRUE, gc.first=FALSE, ncore=1, nseg.scale=1, ...)

## S3 method for class 'pdb'
cmap(pdb, inds = NULL, verbose = FALSE, ...)

Arguments

xyz

numeric vector of xyz coordinates or a numeric matrix of coordinates with a row per structure/frame.

grpby

a vector counting connective duplicated elements that indicate the elements of xyz that should be considered as a group (e.g. atoms from a particular residue).

dcut

a cutoff distance value below which atoms are considered in contact.

scut

a cutoff neighbour value which has the effect of excluding atoms that are sequentially within this value.

pcut

a cutoff probability of structures/frames showing a contact, above which atoms are considered in contact with respect to the ensemble. Ignored if binary=FALSE.

binary

logical, if FALSE the raw matrix containing fraction of frames that two residues are in contact is returned.

mask.lower

logical, if TRUE the lower matrix elements (i.e. those below the diagonal) are returned as NA.

collapse

logical, if FALSE an array of contact maps for all frames is returned.

gc.first

logical, if TRUE will call gc() first before calculation of distance matrix. This is to solve the memory overload problem when ncore > 1 and xyz has many rows, with a bit sacrifice on speed.

ncore

number of CPU cores used to do the calculation. ncore>1 requires package ‘parallel’ installed.

nseg.scale

split input data into specified number of segments prior to running multiple core calculation. See fit.xyz.

pdb

a structure object of class "pdb", obtained from read.pdb.

inds

a list object of ATOM and XYZ indices as obtained from atom.select.

verbose

logical, if TRUE details of the selection are printed.

...

arguments passed to and from functions.

Details

A contact map is a simplified distance matrix. See the distance matrix function dm for further details.

Function "cmap.pdb" is a wrapper for "cmap.xyz" which selects all ‘notwater’ atoms and calculates the contact matrix grouped by residue number.

Value

Returns a N by N numeric matrix composed of zeros and ones, where one indicates a contact between selected atoms.

Author(s)

Barry Grant

References

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

See Also

dm, dccm, dist, dist.xyz

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
##- Read PDB file
pdb <- read.pdb( system.file("examples/hivp.pdb", package="bio3d") )

## Atom Selection indices
inds <- atom.select(pdb, "calpha")

## Reference contact map
ref.cont <- cmap( pdb$xyz[inds$xyz], dcut=6, scut=3 )
plot.cmap(ref.cont)

## Not run: 
##- Read Traj file
trj <- read.dcd( system.file("examples/hivp.dcd", package="bio3d") )
## For each frame of trajectory
sum.cont <- NULL
for(i in 1:nrow(trj)) {

  ## Contact map for frame 'i'
  cont <- cmap(trj[i,inds$xyz], dcut=6, scut=3)

  ## Product with reference
  prod.cont <- ref.cont * cont
  sum.cont <- c(sum.cont, sum(prod.cont,na.rm=TRUE))
}

plot(sum.cont, typ="l")

## End(Not run)

bio3d documentation built on April 3, 2018, 9:05 a.m.