Learn R Programming

MEGENA (version 1.3.7)

plot_module: Module plotting function.

Description

Extract subnetworks for modules and plot.

Usage

plot_module(output.summary,PFN,subset.module = NULL,col.names,
gene.set = NULL,color.code = "logFC",show.legend = TRUE,
label.hubs.only = TRUE,hubLabel.col = "red",hubLabel.sizeProp = 0.5,show.topn.hubs = 10,
node.sizeProp = 13,label.sizeProp = 13,label.scaleFactor = 10,label.alpha = 0.5,
layout = "kamada.kawai",output.plot = TRUE,out.dir = "modulePlot")

Arguments

output.summary

output from summary function, "MEGENA.ModuleSummary".

PFN

igraph object retaining PFN topology.

subset.module

A character vector for list of module names to plot. Default = NULL plots all modules in output.summary.

col.names

a character vector for list of colors to be used for coloring children modules.

gene.set

A list object containing signatures for customized coloring of nodes in resulting network plot.

color.code

A character vector with matched length to "gene.set", to specify colors for each signature.

label.hubs.only

TRUE/FALSE to show labels for significant hub genes only, or all genes. Defauly is TRUE.

hubLabel.col

Label color for hubs. Default is "red"

show.legend

TRUE/FALSE for showing node legend on the bottom of the figure.

hubLabel.sizeProp

A multiplicative factor to adjust hub label sizes with respect to node size values. Default is 0.5

show.topn.hubs

Maximal number of hubs to label on module subnetwork. Default is 10.

node.sizeProp

A multiplicative factor to adjust node sizes with respect to 90th percentile degree node size. Default is 13

label.sizeProp

A multiplicative factor to adjust node label sizes with respect to 90th percentile degree node size. Default is 13

label.scaleFactor

Overall scale factor to control the final size of node labels appearing in figure. Default is 10.

label.alpha

Transparency value ranging from 0 (transparent) to 1 (solid). Default is 0.5.

layout

Network layout algorithm to apply. Options are: "kamada.kawai", "fruchterman.reingold".

output.plot

logical value. output.plot = TRUE generates figure files under folder, "modulePlot".

out.dir

if output.plot = TRUE, then out.dir is created and resulting figures are exported to .png files to the folder.

Value

A list object holding ggplot objects for plotted modules.

Details

Subnetwork plot functionality with application of "ggrepel" package for node labeling. The most effective way to control overall node label size is through label.scaleFactor.

Examples

Run this code
# NOT RUN {
rm(list = ls())
library(MEGENA)

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)

pnet.obj <- plot_module(output = output.summary,PFN = g,subset.module = "comp1_2",
	layout = "kamada.kawai",label.hubs.only = FALSE,
	gene.set = list("hub.set" = c("CD3E","CD2")),color.code =  c("red"),
	output.plot = FALSE,out.dir = "modulePlot",col.names = c("grey","grey","grey"),
	hubLabel.col = "black",hubLabel.sizeProp = 1,show.topn.hubs = Inf,show.legend = TRUE)
	
pnet.obj
# }

Run the code above in your browser using DataLab