netboost 1.0.0
The netboost package, implements a three-step dimension reduction technique. First, a boosting-based filter is combined with the topological overlap measure to identify the essential edges of the network. Second, sparse hierarchical clustering is applied on the selected edges to identify modules and finally module information is aggregated by the first principal components. The primary analysis is then carried out on these summary measures instead of the original data.
The package comes with an example dataset included. We import the acute myeloid leukemia patient data from The Cancer Genome Atlas public domain database. The dataset consists of one thousand DNA methylation sites and gene expression levels on chromosome 18 for 80 patients.
require("netboost")
## Loading required package: netboost
## Registered S3 method overwritten by 'R.oo':
## method from
## throw.default R.methodsS3
##
## Registered S3 methods overwritten by 'ggplot2':
## method from
## [.quosures rlang
## c.quosures rlang
## print.quosures rlang
## netboost 1.0.0 loadedDefault CPU cores: 1
data("tcga_aml_meth_rna_chr18", package = "netboost")
dim(tcga_aml_meth_rna_chr18)
## [1] 80 1000
The netboost()
function integrates all major analysis steps and generates
multiple plots. In this step we also set analysis parameters:
stepno
defines the number of boosting steps taken
soft_power
(if null, automatically chosen) the exponent in the transformation
of the correlation
min_cluster_size
the minimal size of clusters, n_pc
the number of maximally
computed principal components
scale
if data should be scaled and centered prior to analysis
ME_diss_thres
defines the merging threshold for identified clusters.
For details on the options please see ?netboost
and the corresponding paper
Schlosser et al. 2019 (under review).
results <- netboost(datan = tcga_aml_meth_rna_chr18, stepno = 20L,
soft_power = 3L, min_cluster_size = 10L, n_pc = 2, scale = TRUE, ME_diss_thres = 0.25)
## Netboost: Filtering
## idx: 1 (0.1%) - Thu May 2 23:36:18 2019
## mergeCloseModules: Merging modules whose distance is less than 0.25
## multiSetMEs: Calculating module MEs.
## Working on set 1 ...
## moduleEigengenes: Calculating 33 module eigengenes in given set.
## multiSetMEs: Calculating module MEs.
## Working on set 1 ...
## moduleEigengenes: Calculating 17 module eigengenes in given set.
## multiSetMEs: Calculating module MEs.
## Working on set 1 ...
## moduleEigengenes: Calculating 16 module eigengenes in given set.
## Calculating new MEs...
## multiSetMEs: Calculating module MEs.
## Working on set 1 ...
## moduleEigengenes: Calculating 16 module eigengenes in given set.
##
## Netboost extracted 16 modules (including background) with an average size of 28.3333333333333 (excluding background) from Tree 1.
##
## Netboost detected 15 modules and 1 background modules in 1 trees resulting in 25 aggreagate measures.
## Average size of the modules was 28.3333333333333.
## 575 of 1000 features (57.5%) were not assigned to modules.
For each detected independent tree in the dataset (here one) the first graph shows a dendrogram of initial modules and at which level they are merged, the second graph a module dendrogram after merging and the third the dendrogram of features including the module-color-code.
results
contains the dendrograms (dendros), feature identifier (names) matched
to module assignment (colors), the aggregated dataset (MEs), the rotation matrix
to compute the aggregated dataset (rotation) and the proportion of variance
explained by the aggregate measures (var_explained).
Dependent on the minimum proportion of variance explained set in the
netboost()
call (default 0.5) up to n_pc
principal components are exported.
names(results)
## [1] "dendros" "names" "colors" "MEs"
## [5] "rotation" "var_explained"
colnames(results$MEs)
## [1] "ME0_1_pc1" "ME0_1_pc2" "ME7_pc1" "ME2_pc1" "ME10_pc1" "ME3_pc1"
## [7] "ME3_pc2" "ME4_pc1" "ME14_pc1" "ME14_pc2" "ME6_pc1" "ME6_pc2"
## [13] "ME11_pc1" "ME11_pc2" "ME9_pc1" "ME9_pc2" "ME8_pc1" "ME5_pc1"
## [19] "ME13_pc1" "ME13_pc2" "ME12_pc1" "ME15_pc1" "ME15_pc2" "ME1_pc1"
## [25] "ME1_pc2"
As you see for most modules the first principal component already explained more than 50% of the variance in the original features of this module. ME0_X_pcY denotes the background module (unclustered features) of the independent tree X.
Explained variance is reported by a matrix for the first n_pc
principal
components. Here we list the first 5 modules:
results$var_explained[,1:5]
## ME0_1 ME7 ME2 ME10 ME3
## PC1 0.07681420 0.52079949 0.51804175 0.52758420 0.4792995
## PC2 0.05416773 0.07778952 0.03731092 0.08330383 0.1339010
results$colors
use a numeric coding for the modules which matches their module
name. To list features of module ME10 we can extract them by:
results$names[results$colors==10]
## [1] "cg00018044" "cg00081465" "cg00142378" "cg00335802" "cg00602115"
## [6] "cg00732383" "cg01074921" "cg01875596" "cg02351804" "cg02490253"
## [11] "cg02711020" "cg02976900" "cg03116030" "cg03686067" "cg03778258"
The final dendrogram including all trees can be plotted including labels (results$names
) for
individual features. colorsrandom
controls if module-color matching should be
randomized to get a clearly differentiable pattern of the potentially many
modules. Labels are only suitable in applications with few features or with a
appropriately large pdf device.
set.seed(123)
nb_plot_dendro(nb_summary = results, labels = FALSE, colorsrandom = TRUE)
Next the primary analysis on the aggregated dataset (results$MEs
) can be
computed.
We also implemented a convenience function to transfer a clustering to a new
dataset. Here, we transfer the clustering to the same dataset resulting in
identical aggregate measures.
ME_transfer <- nb_transfer(nb_summary = results,
new_data = tcga_aml_meth_rna_chr18, scale = TRUE)
all(round(results$MEs, 12) == round(ME_transfer, 12))
## [1] TRUE
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] netboost_1.0.0 BiocStyle_2.12.0
##
## loaded via a namespace (and not attached):
## [1] matrixStats_0.54.0 robust_0.4-18 fit.models_0.5-14
## [4] bit64_0.9-7 doParallel_1.0.14 RColorBrewer_1.1-2
## [7] dynamicTreeCut_1.63-1 tools_3.6.0 backports_1.1.4
## [10] R6_2.4.0 rpart_4.1-15 Hmisc_4.2-0
## [13] DBI_1.0.0 lazyeval_0.2.2 BiocGenerics_0.30.0
## [16] colorspace_1.4-1 nnet_7.3-12 tidyselect_0.2.5
## [19] gridExtra_2.3 bit_1.1-14 compiler_3.6.0
## [22] preprocessCore_1.46.0 WGCNA_1.67 Biobase_2.44.0
## [25] htmlTable_1.13.1 bookdown_0.9 scales_1.0.0
## [28] checkmate_1.9.1 DEoptimR_1.0-8 mvtnorm_1.0-10
## [31] robustbase_0.93-4 stringr_1.4.0 digest_0.6.18
## [34] foreign_0.8-71 rmarkdown_1.12 R.utils_2.8.0
## [37] rrcov_1.4-7 base64enc_0.1-3 pkgconfig_2.0.2
## [40] htmltools_0.3.6 htmlwidgets_1.3 rlang_0.3.4
## [43] rstudioapi_0.10 RSQLite_2.1.1 impute_1.58.0
## [46] acepack_1.4.1 dplyr_0.8.0.1 R.oo_1.22.0
## [49] magrittr_1.5 GO.db_3.8.2 Formula_1.2-3
## [52] Matrix_1.2-17 Rcpp_1.0.1 munsell_0.5.0
## [55] S4Vectors_0.22.0 R.methodsS3_1.7.1 stringi_1.4.3
## [58] yaml_2.2.0 MASS_7.3-51.4 plyr_1.8.4
## [61] grid_3.6.0 blob_1.1.1 parallel_3.6.0
## [64] crayon_1.3.4 lattice_0.20-38 splines_3.6.0
## [67] knitr_1.22 pillar_1.3.1 fastcluster_1.1.25
## [70] codetools_0.2-16 stats4_3.6.0 glue_1.3.1
## [73] evaluate_0.13 latticeExtra_0.6-28 data.table_1.12.2
## [76] BiocManager_1.30.4 RcppParallel_4.4.2 foreach_1.4.4
## [79] gtable_0.3.0 purrr_0.3.2 assertthat_0.2.1
## [82] ggplot2_3.1.1 xfun_0.6 survival_2.44-1.1
## [85] pcaPP_1.9-73 tibble_2.1.1 iterators_1.0.10
## [88] AnnotationDbi_1.46.0 memoise_1.1.0 IRanges_2.18.0
## [91] cluster_2.0.9
warnings()