Learn R Programming

bio3d (version 2.1-2)

cmap: Contact Map

Description

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

Usage

cmap(xyz, grpby=NULL, dcut = 4, scut = 3, pcut=1, mask.lower = TRUE,
         ncore=1, nseg.scale=1)

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 cuttoff distance value below which atoms are considered in contact.
scut
a cuttoff 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
mask.lower
logical, if TRUE the lower matrix elements (i.e. those below the diagonal) are returned as NA.
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.

Value

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

Details

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

References

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

See Also

dm, dccm, dist, dist.xyz

Examples

Run this code
##- 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.dmat(ref.cont)

##- 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")

Run the code above in your browser using DataLab