This function generates a VMD scene file and a PDB file that can be read and rendered by the VMD molecular viewer. Chose ‘color by chain’ to see corresponding regions of structure colored by community along with the community protein structure network.


# S3 method for cna
vmd(x, pdb, layout = layout.cna(x, pdb, k=3), 
    col.sphere=NULL, col.lines = "silver", weights = NULL, 
    radius = table(x$communities$membership)/5, alpha = 1,
    vmdfile = "network.vmd", pdbfile = "network.pdb", 
                full = FALSE, launch = FALSE, exefile=NULL, ...)
# S3 method for ecna
vmd(x, n=1, ...)
# S3 method for cnapath
vmd(x, pdb, out.prefix = "vmd.cnapath", spline = FALSE, 
   colors = c("blue", "red"), launch = FALSE, exefile=NULL, mag=1.0, ...)
# S3 method for ecnapath
vmd(x, ...)



A 'cna' or 'cnapath' class object, or a list of such objects, as obtained from functions cna or cnapath.


The index to indicate which network or path to view with vmd.


A 'pdb' class object such as obtained from ‘read.pdb’ function.


A numeric matrix of Nx3 XYZ coordinate matrix, where N is the number of community spheres to be drawn.


A numeric vector containing the sphere colors.


A character object specifying the color of the edges (default 'silver'). Must use VMD colors names.


A numeric vector specifying the edge width. Default is taken from E(x$$weight.


A numeric vector containing the sphere radii. Default is taken from the number of community members divided by 5.


A single element numeric vector specifying the VMD alpha transparency parameter. Default is set to 1.


A character element specifying the output VMD scene file name that will be loaded in VMD.


A character element specifying the output pdb file name to be loaded in VMD.


Logical, if TRUE the full all-atom network rather than the clustered community network will be drawn. Intra community edges are colored according to the community membership, while inter community edges are thicker and colored black.


Logical. If TRUE, a VMD session will be started with the output of ‘vmd.cna’.


Prefix for the names of output files, ‘vmd.cnapath.vmd’ and ‘vmd.cnapath.pdb’.


Logical, if TRUE all paths are displayed as spline curves.


Character vector or integer scalar, define path colors. If a character vector, passed to colorRamp function to generate the color scales. If an integer, color all paths the same way with VMD color ID equal to the integer.


file path to the ‘VMD’ program on your system (i.e. how is ‘VMD’ invoked). If NULL, use OS-dependent default path to the program.


A numeric factor to scale the maximal thickness of paths.


additional arguments passed to the function colorRamp (in vmd.cnapath).


This function generates a scaled sphere (communities) and stick (edges) representation of the community network along with the corresponding protein structure divided into chains, one chain for each community. The sphere radii are proportional to the number of community members and the edge widths correspond to network edge weights.


Two files are generated as output. A pdb file with the residue chains assigned according to the community and a text file containing The drawing commands for the community representation.


Humphrey, W., Dalke, A. and Schulten, K., ``VMD - Visual Molecular Dynamics'' J. Molec. Graphics 1996, 14.1, 33-38.


Barry Grant


if (FALSE) { if (!requireNamespace("igraph", quietly = TRUE)) { message('Need igraph installed to run this example') } else { # Load the correlation network from MD data attach(hivp) # Read the starting PDB file to determine atom correspondence pdbfile <- system.file("examples/hivp.pdb", package="bio3d") pdb <- read.pdb(pdbfile) # View cna vmd.cna(net, pdb, launch=FALSE) ## within VMD set 'coloring method' to 'Chain' and 'Drawing method' to Tube ##-- From NMA pdb.gdi = read.pdb("1KJY") pdb.gdi = trim.pdb(pdb.gdi,, chain="A", elety="CA")) modes.gdi = nma(pdb.gdi) cij.gdi = dccm(modes.gdi) net.gdi = cna(cij.gdi, cutoff.cij=0.35) #vmd.cna(net.gdi, pdb.gdi, alpha = 0.7, launch=TRUE) detach(hivp) } }