cnapath | R Documentation |
Find k shortest paths between a pair of nodes, source and sink, in a correlation network.
cnapath(cna, from, to=NULL, k=10, collapse=TRUE, ncore=NULL, ...)
## S3 method for class 'cnapath'
summary(object, ..., pdb = NULL, label = NULL, col = NULL,
plot = FALSE, concise = FALSE, cutoff = 0.1, normalize = TRUE, weight = FALSE)
## S3 method for class 'cnapath'
print(x, ...)
## S3 method for class 'cnapath'
plot(x, ...)
## S3 method for class 'ecnapath'
plot(x, ...)
cna |
A ‘cna’ object or a list of ‘cna’ objects obtained from
|
from |
Integer vector or matrix indicating node id(s) of source. If is matrix
and |
to |
Integer vector indicating node id(s) of sink. All combinations of
|
k |
Integer, number of suboptimal paths to identify. |
collapse |
Logical, if TRUE results from all source/sink pairs are merged with a single ‘cnapath’ object returned. |
ncore |
Number of CPU cores used to do the calculation. By default (NULL), use all detected CPU cores. |
object |
A ‘cnapath’ class of object obtained from
|
pdb |
A ‘pdb’ class of object obtained from |
label |
Character, label for paths identified from different networks. |
col |
Colors for plotting statistical results for paths identified from different networks. |
plot |
Logical, if TRUE path length distribution and node degeneracy will be plotted. |
concise |
Logical, if TRUE only ‘on path’ residues will be displayed in the node degeneracy plot. |
cutoff |
Numeric, nodes with node degeneracy larger than |
normalize |
Logical, if TRUE node degeneracy is divided by the total (weighted) number of paths. |
weight |
Logical, if TRUE each path is weighted by path length in calculating the node degeneracty. |
x |
A 'cnapath' class object, or a list of such objects, as obtained from function |
... |
Additional arguments passed to igraph function
|
The function cnapath
returns a (or a list of) ‘cnapath’
class of list containing following three components:
path |
a list object containing all identified suboptimal paths. Each entry of the list is a sequence of node ids for the path. |
epath |
a list object containing all identified suboptimal paths. Each entry of the list is a sequence of edge ids for the path. |
dist |
a numeric vector of all path lengths. |
The function summary.cnapath
returns a matrix of (normalized)
node degeneracy for ‘on path’ residues.
Xin-Qiu Yao
Yen, J.Y. (1971) Management Science 17, 712–716.
cna
, cna.dccm
,
vmd.cna
, vmd.cnapath
,
get.shortest.paths
.
# Redundant testing excluded
if (!requireNamespace("igraph", quietly = TRUE)) {
message('Need igraph installed to run this example')
} else {
attach(transducin)
inds = match(c("1TND_A", "1TAG_A"), pdbs$id)
npdbs <- trim(pdbs, row.inds=inds)
gaps.res <- gap.inspect(npdbs$ali)
modes <- nma(npdbs)
cij <- dccm(modes)
net <- cna(cij, cutoff.cij=0.3)
# get paths
pa1 <- cnapath(net[[1]], from = 314, to=172, k=50)
pa2 <- cnapath(net[[2]], from = 314, to=172, k=50)
# print the information of a path
pa1
# print two paths simultaneously
pas <- list(pa1, pa2)
names(pas) <- c("GTP", "GDP")
print.cnapath(pas)
# Or, for the same effect,
# summary(pa1, pa2, label=c("GTP", "GDP"))
try({
# replace node numbers with residue name and residue number in the PDB file
pdb <- read.pdb("1tnd")
pdb <- trim.pdb(pdb, atom.select(pdb, chain="A", resno=npdbs$resno[1, gaps.res$f.inds]))
print.cnapath(pas, pdb=pdb)
# plot path length distribution and node degeneracy
print.cnapath(pas, pdb = pdb, col=c("red", "darkgreen"), plot=TRUE)
}, silent=TRUE)
if(inherits(.Last.value, "try-error")) {
message("Need internet to run the example")
}
# View paths in 3D molecular graphic with VMD
#vmd.cnapath(pa1, pdb, launch = TRUE)
#vmd.cnapath(pa1, pdb, colors = 7, launch = TRUE)
#vmd.cnapath(pa1, pdb, spline=TRUE, colors=c("pink", "red"), launch = TRUE)
#pdb2 <- read.pdb("1tag")
#pdb2 <- trim.pdb(pdb2, atom.select(pdb2, chain="A", resno=npdbs$resno[2, gaps.res$f.inds]))
#vmd.cnapath(pa2, pdb2, launch = TRUE)
detach(transducin)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.