Construct a graph from a given adjacency matrix

buildGraph(adjMatrix, geneset_df = NULL, gs_names = NULL)

Arguments

adjMatrix

A Matrix::Matrix() indicating for which pair of nodes an edge should be added; 1 indicating an edge, 0 indicating no edge.

geneset_df

data.frame, a data.frame of genesets with at least two columns, one called Genesets containing geneset identifiers and one called Genes containing a list of genes belonging to the individual genesets.

gs_names

vector, a vector of geneset descriptions/names, e.g. the Term / Description column of geneset_df.

Value

An igraph object to be further manipulated or processed/plotted (e.g. via igraph::plot.igraph() or visNetwork::visIgraph())

Examples

adj <- Matrix::Matrix(0, 100, 100)
adj[c(80:100), c(80:100)] <- 1
geneset_names <- as.character(stats::runif(100, min = 0, max = 1))
rownames(adj) <- colnames(adj) <- geneset_names
graph <- buildGraph(adj)