Convert igraph data.frame to dataframe of nodes and edges (used as input to visNetwork). Only applicable for undirected networks.

getNodesEdges(df.data)

Arguments

df.data

igraph data.frame (output from scMiko::wgcna2graphDF)

Value

named list of nodes and edges, where each entry is a data.frame.

Examples


# 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 igraph::graph_from_adjacency_matrix(w.mat, mode = c(graph.type),     diag = F, weighted = T): object 'w.cur' not found
w.df.top$module.membership <- module.name
#> Error in eval(expr, envir, enclos): object 'module.name' not found

# get nodes and edges
node.edge.output <- getNodesEdges(w.df.top)
#> Error in as.data.frame(d): object 'w.df.top' not found
vis.nodes <- node.edge.output$nodes
#> Error in eval(expr, envir, enclos): object 'node.edge.output' not found
vis.links <- node.edge.output$edges
#> Error in eval(expr, envir, enclos): object 'node.edge.output' not found