# NOT RUN {
# PDB server connection required - testing excluded
if (!requireNamespace("igraph", quietly = TRUE)) {
message('Need igraph installed to run this example')
} else {
##-- Build a correlation network from NMA results
## Read example PDB
pdb <- read.pdb("4Q21")
## Perform NMA
modes <- nma(pdb)
#plot(modes, sse=pdb)
## Calculate correlations
cij <- dccm(modes)
#plot(cij, sse=pdb)
## Build, and betweenness cluster, a network graph
net <- cna(cij, cutoff.cij=0.35)
#plot(net, pdb)
## within VMD set 'coloring method' to 'Chain' and 'Drawing method' to Tube
#vmd.cna(net, trim.pdb(pdb, atom.select(pdb,"calpha")), launch=TRUE )
##-- Build a correlation network from MD results
## Read example trajectory file
trtfile <- system.file("examples/hivp.dcd", package="bio3d")
trj <- read.dcd(trtfile)
## Read the starting PDB file to determine atom correspondence
pdbfile <- system.file("examples/hivp.pdb", package="bio3d")
pdb <- read.pdb(pdbfile)
## select residues 24 to 27 and 85 to 90 in both chains
inds <- atom.select(pdb, resno=c(24:27,85:90), elety='CA')
## lsq fit of trj on pdb
xyz <- fit.xyz(pdb$xyz, trj, fixed.inds=inds$xyz, mobile.inds=inds$xyz)
## calculate dynamical cross-correlation matrix
cij <- dccm(xyz)
## Build, and betweenness cluster, a network graph
net <- cna(cij)
# Plot coarse grained network based on dynamically coupled communities
xy <- plot.cna(net)
plot.dccm(cij, margin.segments=net$communities$membership)
##-- Begin to examine network structure - see CNA vignette for more details
net
summary(net)
attributes(net)
table( net$communities$members )
}
# }
Run the code above in your browser using DataLab