plot_subgraph: subnetwork plotting functionality.

Description Usage Arguments Details Value Author(s) Examples

Description

A modification of plot_module() function for more general subnetwork plotting purpose.

Usage

1
2
3
4
plot_subgraph(module,hub = NULL,PFN,node.default.color = "black",
gene.set = NULL,color.code = "grey",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,layout = "kamada.kawai")

Arguments

module

A character vector containing gene names to be subsetted.

hub

If provided, genes in hub will be highlighted as triangles in resulting figure.

PFN

igraph object retaining PFN topology.

node.default.color

Default node colors for those that do not intersect with signatures in gene.set.

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.

show.legend

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

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"

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.

layout

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

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.

Value

A list object holding ggplot object and node annotation table.

Author(s)

Won-Min Song

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## 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_subgraph(module = output.summary$modules[[1]],
hub = c("CD3E","CD2"),PFN = g,node.default.color = "black",
gene.set = NULL,color.code = c("grey"),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,layout = "kamada.kawai")

# the plot	
pnet.obj[[1]]

# the annotation
pnet.obj[[2]]

## End(Not run)

Example output

Loading required package: doParallel
Loading required package: foreach
Loading required package: iterators
Loading required package: parallel
Loading required package: igraph

Attaching package:igraphThe following objects are masked frompackage:stats:

    decompose, spectrum

The following object is masked frompackage:base:

    union

i = 1
i = 2
- outputting correlation results...
####### PFN Calculation commences ########
[1] "PFG is complete."
Commence multiscale clustering....
Calculating distance metric and similarity...
iteration:1
- #. tested:1
- k=2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,
- #. of split:4
- assess improvements over compactness
iteration:2
- #. tested:4
- k=2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,
- #. of split:1
- k=2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,
- #. of split:4
- assess improvements over compactness
- k=2,3,4,5,6,7,
- #. of split:0
- k=2,3,4,5,6,7,8,
- #. of split:0
iteration:3
- #. tested:3
- k=2,3,4,5,6,
- #. of split:0
- k=2,3,4,5,6,7,
- #. of split:0
- k=2,3,4,5,6,7,8,9,
- #. of split:0
Commence MHA...
Calculating hub significance.....
permutation no.:1,2,3,4,5,6,7,8,9,10,
permutation no.:1,2,3,4,5,6,7,8,9,10,
permutation no.:1,2,3,4,5,6,7,8,9,10,
permutation no.:1,2,3,4,5,6,7,8,9,10,
permutation no.:1,2,3,4,5,6,7,8,9,10,
permutation no.:1,2,3,4,5,6,7,8,9,10,
permutation no.:1,2,3,4,5,6,7,8,9,10,
permutation no.:1,2,3,4,5,6,7,8,9,10,
permutation no.:1,2,3,4,5,6,7,8,9,10,
Identifying similar scales....
- Calculating within-module degree profiles.....
K.max:8
Cluster scales based on degree profiles...
k = 2,3,4,5,6,7,8,
- identified: 3
Identifying hub genes significant in each scale level...
Assigning module/KDA membership
Calculating node topological properties
 - # of genes: 43 
 - # of hubs: 2 
- generating module subnetwork figure...
         node.lab       id node.size node.shape          X1          X2
CD3E         CD3E     CD3E 38.505399        hub  1.08196871  0.68793133
CD3D         CD3D     CD3D 18.598795       gene -0.59820031  1.78460447
CD2           CD2      CD2 37.451167        hub -0.71857815  0.11006972
CXCL11     CXCL11   CXCL11  8.873881       gene -2.80800335 -1.89082777
ITK           ITK      ITK 19.368649       gene  0.76348184 -1.11081879
ACAP1       ACAP1    ACAP1 15.717805       gene  1.15210236  2.26095347
IL2RG       IL2RG    IL2RG 18.598795       gene  0.36733038  1.60218017
PTPRCAP   PTPRCAP  PTPRCAP 11.197591       gene  2.59417336  1.35442226
SLAMF6     SLAMF6   SLAMF6 15.717805       gene  2.24192949 -0.67315919
SH2D1A     SH2D1A   SH2D1A 16.796386       gene  0.99394723 -0.54646429
SIRPG       SIRPG    SIRPG 13.000000       gene -1.28293814  1.20820169
CD5           CD5      CD5 11.197591       gene  0.09939443  0.21472777
NKG7         NKG7     NKG7  8.873881       gene  2.25255225  0.53915864
TIGIT       TIGIT    TIGIT 15.717805       gene -1.97729514  0.44093412
CD96         CD96     CD96 14.472676       gene  0.16917838 -0.91337377
CD247       CD247    CD247 11.197591       gene -1.85510282  1.61603281
CXCR3       CXCR3    CXCR3 14.472676       gene -0.26170585  1.49011281
PTPN7       PTPN7    PTPN7 13.000000       gene  1.82132662  2.09332717
TBC1D10C TBC1D10C TBC1D10C 13.000000       gene  2.42218823  1.83304880
UBASH3A   UBASH3A  UBASH3A  8.873881       gene -0.38127016  0.90757841
LY9           LY9      LY9 11.197591       gene  1.84689228 -0.80501203
GZMA         GZMA     GZMA 11.197591       gene  0.77134288 -0.08465634
CD48         CD48     CD48 11.197591       gene  1.09191214  2.60026484
TBX21       TBX21    TBX21  8.873881       gene -2.18598610  1.00502491
CXCL10     CXCL10   CXCL10 13.000000       gene -3.19673967  0.02057735
ICOS         ICOS     ICOS 11.197591       gene -1.66109807 -0.23938802
CD3G         CD3G     CD3G 11.197591       gene -0.57709549 -1.72670732
GBP5         GBP5     GBP5 16.796386       gene -2.25683022 -0.58039711
SLAMF1     SLAMF1   SLAMF1  8.873881       gene  1.79028925 -2.24590971
HLA-B       HLA-B    HLA-B  8.873881       gene -3.41450719 -0.61733258
GIMAP5     GIMAP5   GIMAP5  8.873881       gene  1.57235419  1.58263799
HLA-H       HLA-H    HLA-H  5.598795       gene -2.88851193 -1.32383245
TMEM176A TMEM176A TMEM176A  8.873881       gene  0.90793077  1.13745597
LCK           LCK      LCK 11.197591       gene -0.07070277 -0.23816541
ZNF831     ZNF831   ZNF831  8.873881       gene  2.10309341 -1.88143345
SIT1         SIT1     SIT1  8.873881       gene  0.17930021  2.57430663
SLA2         SLA2     SLA2 13.000000       gene -1.46023794  2.01432460
TRAT1       TRAT1    TRAT1  8.873881       gene -0.34060378 -1.45033811
CCL5         CCL5     CCL5 14.472676       gene  0.43121773  0.75318386
GZMK         GZMK     GZMK  8.873881       gene  2.51778528  0.05452838
ZAP70       ZAP70    ZAP70  8.873881       gene  2.59044179  3.12663638
GPR174     GPR174   GPR174  8.873881       gene  0.46540416 -2.52744789
CXCL9       CXCL9    CXCL9 13.000000       gene -1.78131423 -0.90553579

MEGENA documentation built on May 1, 2019, 8:07 p.m.