get_module_hierarchy_graph: Module Hierarchy Visualization

View source: R/Network_Visualizations.R

get_module_hierarchy_graphR Documentation

Module Hierarchy Visualization

Description

Utilizes various layout algorithms from ggraph to visualize module hierarchy with desired root.

Usage

  get_module_hierarchy_graph(htbl,max.depth = 5,anchor.mid = NULL,h.scale = NULL,is.circular = TRUE,layout = "dendrogram")

Arguments

htbl

Two column data.frame table capturing module hierarchy. First column is the parent module, and second column is an immediate child module.

max.depth

Maximum number of hierarchy depth to propagate. Default value 5 is often sufficient to capture the entire MEGENA hierarchy.

anchor.mid

Default is NULL. If specified, it is taken as the root module, and its module hierarchy is subsetted.

h.scale

When layout = "dendrogram" is used, it scales the heights of the dendrogram branching points to make the plot less busy.

is.circular

Default is TRUE. If TRUE, circular dendrogram is drawn.

layout

Options are "dendrogram" and "treemap". See ?ggraph for layout option descriptions.

add_names

If TRUE, it adds modules names at respective branching points.

Details

Returns a list containing the results.

Value

A list object with the components:

pobj

ggplot object for the hierarchy graph.

graph.obj

igraph object for the hierarchy graph.

anchor.mid

The root module id.

Author(s)

Won-Min Song

Examples

  ## Not run: 
    rm(list = ls())
    data(Sample_Expression)
    ijw <- calculate.correlation(datExpr[1:100,],doPerm = 2)
    el <- calculate.PFN(ijw[,1:3])
    g <- graph.data.frame(el,directed = FALSE)
    MEGENA.output <- do.MEGENA(g = g,remove.unsig = FALSE,doPar = FALSE,n.perm = 10)
    output.summary <- MEGENA.ModuleSummary(MEGENA.output,
                                           mod.pvalue = 0.05,hub.pvalue = 0.05,
                                           min.size = 10,max.size = 5000,
                                           annot.table = NULL,id.col = NULL,symbol.col = NULL,
                                           output.sig = TRUE)
    tbl = output.summary$module.table
    htbl = tbl[,c("module.parent","module.id")]
    hplot = get_module_hierarchy_graph(htbl,max.depth = 5,anchor.mid = NULL,h.scale = NULL,is.circular = FALSE,layout = "dendrogram",add_names = TRUE)
    print(hplot$pobj)
  
## End(Not run)

songw01/MEGENA documentation built on Jan. 19, 2024, 6:51 p.m.