EnMCB

Xin Yu

2020-01-16

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:

library(EnMCB)
## Setting options('download.file.method.GEOquery'='auto')
## Setting options('GEOquery.inmemory.gpl'=FALSE)
methylation_dataset<-create_demo()

res<-IdentifyMCB(methylation_dataset)

Start calculating the correlation, this may take a while…

## 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, which.max, which.min
## Loading required package: GenomicRanges
## Loading required package: stats4
## Loading required package: S4Vectors
## 
## Attaching package: 'S4Vectors'
## The following object is masked from 'package:base':
## 
##     expand.grid
## Loading required package: IRanges
## Loading required package: GenomeInfoDb
## Loading required package: SummarizedExperiment
## 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")'.
## Loading required package: DelayedArray
## Loading required package: matrixStats
## 
## Attaching package: 'matrixStats'
## The following objects are masked from 'package:Biobase':
## 
##     anyMissing, rowMedians
## Loading required package: BiocParallel
## 
## Attaching package: 'DelayedArray'
## The following objects are masked from 'package:matrixStats':
## 
##     colMaxs, colMins, colRanges, rowMaxs, rowMins, rowRanges
## The following objects are masked from 'package:base':
## 
##     aperm, apply, rowsum
## 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.1    2013-03-22

(or you can try to use IdentifyMCB_parallel function instead)

|
| | 0% |
|### | 4% |
|###### | 9% |
|######### | 13% |
|############ | 17% |
|############### | 22% |
|################## | 26% |
|##################### | 30% |
|######################## | 35% |
|########################### | 39% |
|############################## | 43% |
|################################# | 48% |
|##################################### | 52% |
|######################################## | 57% |
|########################################### | 61% |
|############################################## | 65% |
|################################################# | 70% |
|#################################################### | 74% |
|####################################################### | 78% |
|########################################################## | 83% |
|############################################################# | 87% |
|################################################################ | 91% |
|################################################################### | 96% |
|######################################################################| 100% Now gathering the results, please wait … Statistics ( 5 MCBs in total): chr1 : total MCBs: 1 Mean Length: 6 (Range: 6 6 ) chr2 : total MCBs: 1 Mean Length: 167 (Range: 167 167 ) chr6 : total MCBs: 1 Mean Length: 129 (Range: 129 129 ) chr8 : total MCBs: 2 Mean Length: 303.5 (Range: 181 426 )

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"]>2,]

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")

#select the best
onemodel<-models$best_cox_model[[2]]

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

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

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,
                    predition_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 Under development (unstable) (2019-12-14 r77569)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.3 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.11-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.11-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] stats4    parallel  stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] survival_3.1-8                                    
##  [2] IlluminaHumanMethylation450kanno.ilmn12.hg19_0.6.0
##  [3] minfi_1.33.0                                      
##  [4] bumphunter_1.29.0                                 
##  [5] locfit_1.5-9.1                                    
##  [6] iterators_1.0.12                                  
##  [7] foreach_1.4.7                                     
##  [8] Biostrings_2.55.4                                 
##  [9] XVector_0.27.0                                    
## [10] SummarizedExperiment_1.17.1                       
## [11] DelayedArray_0.13.2                               
## [12] BiocParallel_1.21.2                               
## [13] matrixStats_0.55.0                                
## [14] Biobase_2.47.2                                    
## [15] GenomicRanges_1.39.1                              
## [16] GenomeInfoDb_1.23.6                               
## [17] IRanges_2.21.3                                    
## [18] S4Vectors_0.25.10                                 
## [19] BiocGenerics_0.33.0                               
## [20] EnMCB_0.99.15                                     
## 
## loaded via a namespace (and not attached):
##   [1] backports_1.1.5          Hmisc_4.3-0              BiocFileCache_1.11.4    
##   [4] plyr_1.8.5               lazyeval_0.2.2           splines_4.0.0           
##   [7] TH.data_1.0-10           ggplot2_3.2.1            digest_0.6.23           
##  [10] htmltools_0.4.0          checkmate_1.9.4          magrittr_1.5            
##  [13] memoise_1.1.0            cluster_2.1.0            doParallel_1.0.15       
##  [16] limma_3.43.0             readr_1.3.1              annotate_1.65.0         
##  [19] sandwich_2.5-1           askpass_1.1              siggenes_1.61.0         
##  [22] prettyunits_1.1.0        jpeg_0.1-8.1             colorspace_1.4-1        
##  [25] blob_1.2.0               rappdirs_0.3.1           xfun_0.12               
##  [28] dplyr_0.8.3              crayon_1.3.4             RCurl_1.95-4.12         
##  [31] genefilter_1.69.0        GEOquery_2.55.1          zeallot_0.1.0           
##  [34] zoo_1.8-7                glue_1.3.1               registry_0.5-1          
##  [37] gtable_0.3.0             zlibbioc_1.33.0          MatrixModels_0.4-1      
##  [40] Rhdf5lib_1.9.0           survivalsvm_0.0.5        shape_1.4.4             
##  [43] rms_5.1-4                HDF5Array_1.15.2         SparseM_1.78            
##  [46] scales_1.1.0             mvtnorm_1.0-12           DBI_1.1.0               
##  [49] rngtools_1.4             bibtex_0.4.2.2           Rcpp_1.0.3              
##  [52] htmlTable_1.13.3         xtable_1.8-4             progress_1.2.2          
##  [55] foreign_0.8-74           bit_1.1-15.1             mclust_5.4.5            
##  [58] preprocessCore_1.49.0    Formula_1.2-3            glmnet_3.0-2            
##  [61] htmlwidgets_1.5.1        httr_1.4.1               RColorBrewer_1.1-2      
##  [64] acepack_1.4.1            pkgconfig_2.0.3          reshape_0.8.8           
##  [67] XML_3.98-1.20            nnet_7.3-12              dbplyr_1.4.2            
##  [70] tidyselect_0.2.5         rlang_0.4.2              AnnotationDbi_1.49.0    
##  [73] munsell_0.5.0            tools_4.0.0              RSQLite_2.2.0           
##  [76] evaluate_0.14            stringr_1.4.0            yaml_2.2.0              
##  [79] knitr_1.26               bit64_0.9-7              beanplot_1.2            
##  [82] scrime_1.3.5             purrr_0.3.3              nlme_3.1-143            
##  [85] doRNG_1.7.1              quantreg_5.54            nor1mix_1.3-0           
##  [88] pracma_2.2.9             xml2_1.2.2               biomaRt_2.43.1          
##  [91] rstudioapi_0.10          compiler_4.0.0           png_0.1-7               
##  [94] curl_4.3                 tibble_2.1.3             stringi_1.4.5           
##  [97] GenomicFeatures_1.39.2   lattice_0.20-38          Matrix_1.2-18           
## [100] survivalROC_1.0.3        multtest_2.43.0          vctrs_0.2.1             
## [103] pillar_1.4.3             lifecycle_0.1.0          data.table_1.12.8       
## [106] bitops_1.0-6             rtracklayer_1.47.0       latticeExtra_0.6-29     
## [109] R6_2.4.1                 gridExtra_2.3            codetools_0.2-16        
## [112] polspline_1.1.17         MASS_7.3-51.5            assertthat_0.2.1        
## [115] rhdf5_2.31.3             openssl_1.4.1            pkgmaker_0.27           
## [118] withr_2.1.2              GenomicAlignments_1.23.1 Rsamtools_2.3.2         
## [121] multcomp_1.4-12          GenomeInfoDbData_1.2.2   hms_0.5.3               
## [124] rpart_4.1-15             quadprog_1.5-8           grid_4.0.0              
## [127] tidyr_1.0.0              base64_2.0               rmarkdown_2.0           
## [130] DelayedMatrixStats_1.9.0 illuminaio_0.29.0        base64enc_0.1-3

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)