Build functional gene modules with GNET2

Chen Chen

2019-05-02

1. Introduction

GNET2 is a R package used for build regulator network and cluster genes to functional groups with E-M process. It iteratively perform TF assigning and Gene assigning, until the assignment of genes did not change, or max number of iterations is reached.

2. Installation

To install, open R and type:

install.packages("devtools")
library("devtools")
install_github("chrischen1/GNET2")

3. Build module networks

We first generate random expression data and a list of regulator gene names.

The input is typically a p by n matrix of expression data of p genes and n samples, for example log2 RPKM from RNA-Seq.

set.seed(2)
init_group_num = 8
init_method = 'boosting'
exp_data <- matrix(rnorm(600*12),600,12)
reg_names <- paste0('TF',1:20)
rownames(exp_data) <- c(reg_names,paste0('gene',1:(nrow(exp_data)-length(reg_names))))
colnames(exp_data) <- paste0('condition_',1:ncol(exp_data))
se <- SummarizedExperiment::SummarizedExperiment(assays=list(counts=exp_data))

The module construction process make take a few time, depending on the size of data and maximum iterations allowed.

# Build with the original K-means split stratgy
gnet_result <- gnet(se,reg_names,init_method,init_group_num,heuristic = T)
#> Determining initial group number...
#> Building module networks...
#> Iteration 1
#> Iteration 2
#> Iteration 3
#> Iteration 4
#> Iteration 5
#> Done.

4. Plot the modules and trees

Plot the regulators module and heatmap of the expression inferred downstream genes for each sample. It can be interpreted as two parts: the bars at the top shows how samples are splited by the regression tree and the heatmap at the bottom shows how downstream genes are regulated by each subgroup determined by the regulators.

plot_gene_group(gnet_result,group_idx = 0)

Plot the tree of the first group

plot_tree(gnet_result,group_idx = 0)

Plot the correlation of each group and auto detected knee point.

group_above_kn <- plot_group_correlation(gnet_result)

print(group_above_kn)
#> [1] 1 3

The group indices in group_above_kn can been used as a list of indices of the data point with correlation higher than the knee point. You may consider use them only for further analysis.

sessionInfo()
#> R version 3.6.0 (2019-04-26)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 18.04.2 LTS
#> 
#> Matrix products: default
#> BLAS:   /home/biocbuild/bbs-3.9-bioc/R/lib/libRblas.so
#> LAPACK: /home/biocbuild/bbs-3.9-bioc/R/lib/libRlapack.so
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C              
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] GNET2_1.0.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.1                  lattice_0.20-38            
#>  [3] tidyr_0.8.3                 visNetwork_2.0.6           
#>  [5] assertthat_0.2.1            digest_0.6.18              
#>  [7] R6_2.4.0                    GenomeInfoDb_1.20.0        
#>  [9] plyr_1.8.4                  stats4_3.6.0               
#> [11] evaluate_0.13               ggplot2_3.1.1              
#> [13] pillar_1.3.1                zlibbioc_1.30.0            
#> [15] rlang_0.3.4                 lazyeval_0.2.2             
#> [17] data.table_1.12.2           rstudioapi_0.10            
#> [19] S4Vectors_0.22.0            Matrix_1.2-17              
#> [21] rmarkdown_1.12              DiagrammeR_1.0.1           
#> [23] labeling_0.3                BiocParallel_1.18.0        
#> [25] downloader_0.4              readr_1.3.1                
#> [27] stringr_1.4.0               htmlwidgets_1.3            
#> [29] igraph_1.2.4.1              RCurl_1.95-4.12            
#> [31] munsell_0.5.0               DelayedArray_0.10.0        
#> [33] compiler_3.6.0              influenceR_0.1.0           
#> [35] rgexf_0.15.3                xfun_0.6                   
#> [37] pkgconfig_2.0.2             BiocGenerics_0.30.0        
#> [39] htmltools_0.3.6             tidyselect_0.2.5           
#> [41] SummarizedExperiment_1.14.0 tibble_2.1.1               
#> [43] gridExtra_2.3               GenomeInfoDbData_1.2.1     
#> [45] IRanges_2.18.0              matrixStats_0.54.0         
#> [47] XML_3.98-1.19               viridisLite_0.3.0          
#> [49] crayon_1.3.4                dplyr_0.8.0.1              
#> [51] bitops_1.0-6                grid_3.6.0                 
#> [53] jsonlite_1.6                gtable_0.3.0               
#> [55] magrittr_1.5                scales_1.0.0               
#> [57] stringi_1.4.3               XVector_0.24.0             
#> [59] reshape2_1.4.3              viridis_0.5.1              
#> [61] brew_1.0-6                  xgboost_0.82.1             
#> [63] RColorBrewer_1.1-2          tools_3.6.0                
#> [65] Biobase_2.44.0              glue_1.3.1                 
#> [67] purrr_0.3.2                 hms_0.4.2                  
#> [69] Rook_1.1-1                  parallel_3.6.0             
#> [71] yaml_2.2.0                  colorspace_1.4-1           
#> [73] GenomicRanges_1.36.0        knitr_1.22