# The Netboost users guide
Author: Pascal Schlosser, Jochen Knaus
Date: 2020-10-27

Pascal Schlosser, Jochen Knaus

#### 27 October 2020

#### Package

netboost 1.6.0

# Contents

# 1 Introduction

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.

# 2 Loading an example dataset

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

    ##

    ## netboost 1.6.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)

    ## idx: 1 (0.1%) - Tue Oct 27 21:56:30 2020

    ##
    ## 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" "filter"

    colnames(results$MEs)

    ##  [1] "ME0_1_pc1" "ME0_1_pc2" "ME4_pc1"   "ME14_pc1"  "ME14_pc2"  "ME6_pc1"
    ##  [7] "ME6_pc2"   "ME7_pc1"   "ME11_pc1"  "ME11_pc2"  "ME9_pc1"   "ME9_pc2"
    ## [13] "ME8_pc1"   "ME13_pc1"  "ME13_pc2"  "ME2_pc1"   "ME12_pc1"  "ME15_pc1"
    ## [19] "ME15_pc2"  "ME1_pc1"   "ME1_pc2"   "ME5_pc1"   "ME10_pc1"  "ME3_pc1"
    ## [25] "ME3_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        ME4      ME14       ME6        ME7
    ## PC1 0.07681420 0.50125421 0.4419347 0.4777013 0.52079949
    ## PC2 0.05416773 0.06023611 0.1443083 0.1266931 0.07778952

`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

# 3 Session Info

    sessionInfo()

    ## R version 4.0.3 (2020-10-10)
    ## Platform: x86_64-pc-linux-gnu (64-bit)
    ## Running under: Ubuntu 18.04.5 LTS
    ##
    ## Matrix products: default
    ## BLAS:   /home/biocbuild/bbs-3.12-bioc/R/lib/libRblas.so
    ## LAPACK: /home/biocbuild/bbs-3.12-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.6.0   BiocStyle_2.18.0
    ##
    ## loaded via a namespace (and not attached):
    ##  [1] Biobase_2.50.0        dynamicTreeCut_1.63-1 bit64_4.0.5
    ##  [4] splines_4.0.3         foreach_1.5.1         R.utils_2.10.1
    ##  [7] RcppParallel_5.0.2    Formula_1.2-4         BiocManager_1.30.10
    ## [10] stats4_4.0.3          latticeExtra_0.6-29   blob_1.2.1
    ## [13] impute_1.64.0         yaml_2.2.1            backports_1.1.10
    ## [16] pillar_1.4.6          RSQLite_2.2.1         lattice_0.20-41
    ## [19] glue_1.4.2            digest_0.6.27         RColorBrewer_1.1-2
    ## [22] checkmate_2.0.0       colorspace_1.4-1      preprocessCore_1.52.0
    ## [25] htmltools_0.5.0       Matrix_1.2-18         R.oo_1.24.0
    ## [28] pkgconfig_2.0.3       magick_2.5.0          bookdown_0.21
    ## [31] purrr_0.3.4           GO.db_3.12.0          scales_1.1.1
    ## [34] jpeg_0.1-8.1          tibble_3.0.4          htmlTable_2.1.0
    ## [37] generics_0.0.2        IRanges_2.24.0        ggplot2_3.3.2
    ## [40] ellipsis_0.3.1        fastcluster_1.1.25    nnet_7.3-14
    ## [43] BiocGenerics_0.36.0   survival_3.2-7        magrittr_1.5
    ## [46] crayon_1.3.4          memoise_1.1.0         evaluate_0.14
    ## [49] R.methodsS3_1.8.1     doParallel_1.0.16     foreign_0.8-80
    ## [52] data.table_1.13.2     tools_4.0.3           lifecycle_0.2.0
    ## [55] matrixStats_0.57.0    stringr_1.4.0         S4Vectors_0.28.0
    ## [58] munsell_0.5.0         cluster_2.1.0         AnnotationDbi_1.52.0
    ## [61] compiler_4.0.3        rlang_0.4.8           grid_4.0.3
    ## [64] rstudioapi_0.11       iterators_1.0.13      htmlwidgets_1.5.2
    ## [67] WGCNA_1.69            base64enc_0.1-3       rmarkdown_2.5
    ## [70] gtable_0.3.0          codetools_0.2-16      DBI_1.1.0
    ## [73] R6_2.4.1              gridExtra_2.3         knitr_1.30
    ## [76] dplyr_1.0.2           bit_4.0.4             Hmisc_4.4-1
    ## [79] stringi_1.5.3         parallel_4.0.3        Rcpp_1.0.5
    ## [82] vctrs_0.3.4           rpart_4.1-15          png_0.1-7
    ## [85] tidyselect_1.1.0      xfun_0.18

    warnings()