EnMCB

Xin Yu

2021-05-19

Introduction

This package is designed to help you to create the methylation correlated blocks using methylation profiles. A stacked ensemble of machine learning models, which combined the Cox regression, support vector regression and elastic-net regression model, can be constructed using this package1. You also can choose one of them to build DNA methylation signatures associated with disease progression.

Note: This package is still under developing. Some of the functions may change.

Followings are brief insturctions for using this package:

You can install and test our package by downloading source package.

Installation

#if(!requireNamespace("BiocManager", quietly = TRUE))
#    install.packages("BiocManager")
#BiocManager::install("EnMCB")

Useage

First, you need a methylation data set, currently only most common platform ‘Illumina Infinium Human Methylation 450K’ is supported.

You can use your own datasets,or use our demo data.

You can automatically run following:

suppressPackageStartupMessages(library(EnMCB))

methylation_dataset<-create_demo()

res<-IdentifyMCB(methylation_dataset)
## Loading required package: IlluminaHumanMethylation450kanno.ilmn12.hg19
## Loading required package: minfi
## Loading required package: BiocGenerics
## Loading required package: parallel
## 
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:parallel':
## 
##     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
##     clusterExport, clusterMap, parApply, parCapply, parLapply,
##     parLapplyLB, parRapply, parSapply, parSapplyLB
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
## 
##     Filter, Find, Map, Position, Reduce, anyDuplicated, append,
##     as.data.frame, basename, cbind, colnames, dirname, do.call,
##     duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
##     lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
##     pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
##     tapply, union, unique, unsplit, which.max, which.min
## Loading required package: GenomicRanges
## Loading required package: stats4
## Loading required package: S4Vectors
## 
## Attaching package: 'S4Vectors'
## The following objects are masked from 'package:base':
## 
##     I, expand.grid, unname
## Loading required package: IRanges
## Loading required package: GenomeInfoDb
## Loading required package: SummarizedExperiment
## Loading required package: MatrixGenerics
## Loading required package: matrixStats
## 
## Attaching package: 'MatrixGenerics'
## The following objects are masked from 'package:matrixStats':
## 
##     colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
##     colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
##     colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
##     colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
##     colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
##     colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
##     colWeightedMeans, colWeightedMedians, colWeightedSds,
##     colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
##     rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
##     rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
##     rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
##     rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
##     rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
##     rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
##     rowWeightedSds, rowWeightedVars
## Loading required package: Biobase
## Welcome to Bioconductor
## 
##     Vignettes contain introductory material; view with
##     'browseVignettes()'. To cite Bioconductor, see
##     'citation("Biobase")', and for packages 'citation("pkgname")'.
## 
## Attaching package: 'Biobase'
## The following object is masked from 'package:MatrixGenerics':
## 
##     rowMedians
## The following objects are masked from 'package:matrixStats':
## 
##     anyMissing, rowMedians
## Loading required package: Biostrings
## Loading required package: XVector
## 
## Attaching package: 'Biostrings'
## The following object is masked from 'package:base':
## 
##     strsplit
## Loading required package: bumphunter
## Loading required package: foreach
## Loading required package: iterators
## Loading required package: locfit
## locfit 1.5-9.4    2020-03-24

IdentfyMCB() function will calculated Pearson correlation coefficients between the any two CpGs. A value of Pearson correlation coefficients which under the threshold was used to identify boundaries between any two adjacent markers indicating uncorrelated methylation. Markers not separated by a boundary were combined into the MCB.You can extract the MCB information,

MCB<-res$MCBinformation

and select some of MCBs for further modeling.

MCB<-MCB[MCB[,"CpGs_num"]>=5,]

In order to build models, one may run following:

# sample the dataset into training set and testing set
trainingset<-colnames(methylation_dataset) %in% sample(colnames(methylation_dataset),0.6*length(colnames(methylation_dataset)))

testingset<-!trainingset

#build the models
library(survival)
data(demo_survival_data)

models<-metricMCB(MCB,
                    training_set = methylation_dataset[,trainingset],
                    Surv = demo_survival_data[trainingset],
                    Method = "cox",ci = TRUE)

#select the best
onemodel<-models$best_cox_model$cox_model

Then, you can predict the risk by the model you build:

newcgdata<-data.frame(t(methylation_dataset[,testingset]))
           
prediction_results<-predict(onemodel, newcgdata)

In order to build ensemble model, one may run following:

# You can choose one of MCBs:
select_single_one=1

em<-ensemble_model(t(MCB[select_single_one,]),
                    training_set=methylation_dataset[,trainingset],
                    Surv_training=demo_survival_data[trainingset])

Note that this function only can be used for single MCB only, otherwise the precessing time could be very long.

Then, you can predict the risk by the model you build:

em_prediction_results<-ensemble_prediction(ensemble_model = em,
                    prediction_data = methylation_dataset[,testingset])

This function will return the single vector with risk scores predicted by ensemble model.

For detailed information, you can find at our references.

Session Info

sessionInfo()
## R version 4.1.0 (2021-05-18)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.2 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.13-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.13-bioc/R/lib/libRlapack.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_GB              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] stats4    parallel  stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] survival_3.2-11                                   
##  [2] IlluminaHumanMethylation450kanno.ilmn12.hg19_0.6.0
##  [3] minfi_1.38.0                                      
##  [4] bumphunter_1.34.0                                 
##  [5] locfit_1.5-9.4                                    
##  [6] iterators_1.0.13                                  
##  [7] foreach_1.5.1                                     
##  [8] Biostrings_2.60.0                                 
##  [9] XVector_0.32.0                                    
## [10] SummarizedExperiment_1.22.0                       
## [11] Biobase_2.52.0                                    
## [12] MatrixGenerics_1.4.0                              
## [13] matrixStats_0.58.0                                
## [14] GenomicRanges_1.44.0                              
## [15] GenomeInfoDb_1.28.0                               
## [16] IRanges_2.26.0                                    
## [17] S4Vectors_0.30.0                                  
## [18] BiocGenerics_0.38.0                               
## [19] EnMCB_1.4.0                                       
## 
## loaded via a namespace (and not attached):
##   [1] utf8_1.2.1                survivalsvm_0.0.5        
##   [3] rms_6.2-0                 tidyselect_1.1.1         
##   [5] RSQLite_2.2.7             AnnotationDbi_1.54.0     
##   [7] htmlwidgets_1.5.3         grid_4.1.0               
##   [9] BiocParallel_1.26.0       munsell_0.5.0            
##  [11] codetools_0.2-18          preprocessCore_1.54.0    
##  [13] colorspace_2.0-1          filelock_1.0.2           
##  [15] knitr_1.33                rstudioapi_0.13          
##  [17] GenomeInfoDbData_1.2.6    bit64_4.0.5              
##  [19] rhdf5_2.36.0              TH.data_1.0-10           
##  [21] vctrs_0.3.8               generics_0.1.0           
##  [23] xfun_0.23                 BiocFileCache_2.0.0      
##  [25] R6_2.5.0                  doParallel_1.0.16        
##  [27] illuminaio_0.34.0         bitops_1.0-7             
##  [29] rhdf5filters_1.4.0        cachem_1.0.5             
##  [31] reshape_0.8.8             DelayedArray_0.18.0      
##  [33] assertthat_0.2.1          BiocIO_1.2.0             
##  [35] scales_1.1.1              multcomp_1.4-17          
##  [37] nnet_7.3-16               gtable_0.3.0             
##  [39] conquer_1.0.2             sandwich_3.0-1           
##  [41] rlang_0.4.11              MatrixModels_0.5-0       
##  [43] genefilter_1.74.0         splines_4.1.0            
##  [45] rtracklayer_1.52.0        GEOquery_2.60.0          
##  [47] checkmate_2.0.0           yaml_2.2.1               
##  [49] GenomicFeatures_1.44.0    backports_1.2.1          
##  [51] Hmisc_4.5-0               inum_1.0-4               
##  [53] tools_4.1.0               nor1mix_1.3-0            
##  [55] ggplot2_3.3.3             ellipsis_0.3.2           
##  [57] stabs_0.6-4               jquerylib_0.1.4          
##  [59] RColorBrewer_1.1-2        siggenes_1.66.0          
##  [61] Rcpp_1.0.6                plyr_1.8.6               
##  [63] base64enc_0.1-3           sparseMatrixStats_1.4.0  
##  [65] progress_1.2.2            zlibbioc_1.38.0          
##  [67] purrr_0.3.4               RCurl_1.98-1.3           
##  [69] prettyunits_1.1.1         rpart_4.1-15             
##  [71] openssl_1.4.4             zoo_1.8-9                
##  [73] cluster_2.1.2             magrittr_2.0.1           
##  [75] data.table_1.14.0         SparseM_1.81             
##  [77] mvtnorm_1.1-1             mboost_2.9-5             
##  [79] hms_1.1.0                 evaluate_0.14            
##  [81] xtable_1.8-4              XML_3.99-0.6             
##  [83] jpeg_0.1-8.1              mclust_5.4.7             
##  [85] gridExtra_2.3             shape_1.4.6              
##  [87] compiler_4.1.0            biomaRt_2.48.0           
##  [89] tibble_3.1.2              crayon_1.4.1             
##  [91] htmltools_0.5.1.1         Formula_1.2-4            
##  [93] tidyr_1.1.3               libcoin_1.0-8            
##  [95] DBI_1.1.1                 dbplyr_2.1.1             
##  [97] MASS_7.3-54               rappdirs_0.3.3           
##  [99] boot_1.3-28               Matrix_1.3-3             
## [101] readr_1.4.0               quadprog_1.5-8           
## [103] pkgconfig_2.0.3           GenomicAlignments_1.28.0 
## [105] foreign_0.8-81            xml2_1.3.2               
## [107] annotate_1.70.0           bslib_0.2.5.1            
## [109] rngtools_1.5              multtest_2.48.0          
## [111] beanplot_1.2              doRNG_1.8.2              
## [113] scrime_1.3.5              stringr_1.4.0            
## [115] digest_0.6.27             pracma_2.3.3             
## [117] rmarkdown_2.8             base64_2.0               
## [119] htmlTable_2.2.1           DelayedMatrixStats_1.14.0
## [121] restfulr_0.0.13           curl_4.3.1               
## [123] Rsamtools_2.8.0           quantreg_5.85            
## [125] rjson_0.2.20              lifecycle_1.0.0          
## [127] nlme_3.1-152              jsonlite_1.7.2           
## [129] Rhdf5lib_1.14.0           survivalROC_1.0.3        
## [131] askpass_1.1               limma_3.48.0             
## [133] fansi_0.4.2               pillar_1.6.1             
## [135] lattice_0.20-44           KEGGREST_1.32.0          
## [137] fastmap_1.1.0             httr_1.4.2               
## [139] glue_1.4.2                png_0.1-7                
## [141] glmnet_4.1-1              bit_4.0.4                
## [143] stringi_1.6.2             sass_0.4.0               
## [145] HDF5Array_1.20.0          nnls_1.4                 
## [147] blob_1.2.1                polspline_1.1.19         
## [149] partykit_1.2-13           latticeExtra_0.6-29      
## [151] memoise_2.0.0             dplyr_1.0.6

References


  1. Xin Yu et al. 2019 Predicting disease progression in lung adenocarcinoma patients based on methylation correlated blocks using ensemble machine learning classifiers (under review)