wgcna2graphDF.Rd
Convert TOM matrix (from WGCNA analysis) to igraph data.frame and filter top connections. Uses igraph::graph_from_adjacency_matrix to convert matrix to data.frame.
wgcna2graphDF(
w.mat,
top.n = NULL,
top.percentile = NULL,
graph.type = "undirected"
)
TOM or adjacency matrix.
Numeric specifying N top connections to return (N < number of connections). If top.n and top.percentile are NULL, all connections retained.
Numeric [0,1] specifying Nth percetile of top connections to return. If top.n and top.percentile are NULL, all connections retained.
Type of graph. Default is "undirected"
igraph data.frame
# get connectivity for specified module
module.name <- names(module.list.all)[names(module.list.all) %in% which.modules]
#> Error in eval(expr, envir, enclos): object 'module.list.all' not found
module.gene.cur <- module.list.all[[module.name]]
#> Error in eval(expr, envir, enclos): object 'module.list.all' not found
w.cur <- w.mat[rownames(w.mat) %in% module.gene.cur, colnames(w.mat) %in% module.gene.cur]
#> Error in eval(expr, envir, enclos): object 'w.mat' not found
# get igraph data.frame for subset of connections
w.df.top <- wgcna2graphDF(w.cur, top.n = top.n.interactions)
#> Error in wgcna2graphDF(w.cur, top.n = top.n.interactions): could not find function "wgcna2graphDF"
w.df.top$module.membership <- module.name
#> Error in eval(expr, envir, enclos): object 'module.name' not found