cmap                  package:bio3d                  R Documentation

_C_o_n_t_a_c_t _M_a_p

_D_e_s_c_r_i_p_t_i_o_n:

     Construct a Contact Map for a Given Protein Structure.

_U_s_a_g_e:

     cmap(xyz, grpby=NULL, dcut = 4, scut = 3, mask.lower = TRUE)

_A_r_g_u_m_e_n_t_s:

     xyz: numeric vector of xyz coordinates. 

   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. 

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

_D_e_t_a_i_l_s:

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

_V_a_l_u_e:

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

_A_u_t_h_o_r(_s):

     Barry Grant

_R_e_f_e_r_e_n_c_e_s:

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

_S_e_e _A_l_s_o:

     'dm', 'dccm', 'dist', 'dist.xyz'

_E_x_a_m_p_l_e_s:

     ##- Read PDB and Traj files
     pdb <- read.pdb( system.file("examples/hivp.pdb", package="bio3d") )
     ##trj <- read.dcd( system.file("examples/hivp.dcd", 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)

     ## Not run: 
     ## 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)

