getNodesEdges: Get nodes and edges from igraph data.frame for visNetwork

View source: R/utility_functions.R

getNodesEdgesR Documentation

Get nodes and edges from igraph data.frame for visNetwork

Description

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

Usage

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]
module.gene.cur <- module.list.all[[module.name]]
w.cur <- w.mat[rownames(w.mat) %in% module.gene.cur, colnames(w.mat) %in% module.gene.cur]

# get igraph data.frame for subset of connections
w.df.top <- wgcna2graphDF(w.cur, top.n = top.n.interactions)
w.df.top$module.membership <- module.name

# get nodes and edges
node.edge.output <- getNodesEdges(w.df.top)
vis.nodes <- node.edge.output$nodes
vis.links <- node.edge.output$edges


NMikolajewicz/scMiko documentation built on June 28, 2023, 1:41 p.m.