cnapath: Suboptimal Path Analysis for Correlation Networks

View source: R/cnapath.R

cnapathR Documentation

Suboptimal Path Analysis for Correlation Networks

Description

Find k shortest paths between a pair of nodes, source and sink, in a correlation network.

Usage

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, ...)

Arguments

cna

A ‘cna’ object or a list of ‘cna’ objects obtained from cna.

from

Integer vector or matrix indicating node id(s) of source. If is matrix and to is NULL, the first column represents source and the second sink.

to

Integer vector indicating node id(s) of sink. All combinations of from and to values will be used as source/sink pairs.

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 cnapath. Multiple ‘object’ input is allowed for comparing paths from different networks.

pdb

A ‘pdb’ class of object obtained from read.pdb and is used as the reference for node residue ids (in summary.cnapath) or for molecular visulaization with VMD (in vmd.cnapath).

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 cutoff are shown in the output.

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 cnapath.

...

Additional arguments passed to igraph function get.shortest.paths (in the function cnapath), passed to summary.cnapath (in print.cnapath), as additional paths for comparison (in summary.cnapath).

Value

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.

Author(s)

Xin-Qiu Yao

References

Yen, J.Y. (1971) Management Science 17, 712–716.

See Also

cna, cna.dccm, vmd.cna, vmd.cnapath, get.shortest.paths.

Examples


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

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

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

}


bio3d documentation built on Oct. 27, 2022, 1:06 a.m.