Contents

0.1 Introduction

mist (Methylation Inference for Single-cell along Trajectory) is an R package for differential methylation (DM) analysis of single-cell DNA methylation (scDNAm) data. The package employs a Bayesian approach to model methylation changes along pseudotime and estimates developmental-stage-specific biological variations. It supports both single-group and two-group analyses, enabling users to identify genomic features exhibiting temporal changes in methylation levels or different methylation patterns between groups.

This vignette demonstrates how to use mist for: 1. Single-group analysis. 2. Two-group analysis.

0.2 Installation

To install the latest version of mist, run the following commands:

if (!requireNamespace("BiocManager", quietly = TRUE)) {
    install.packages("BiocManager")
}

# Install mist from GitHub
BiocManager::install("https://github.com/dxd429/mist")

From Bioconductor:

if (!requireNamespace("BiocManager", quietly = TRUE)) {
    install.packages("BiocManager")
}
BiocManager::install("mist")

To view the package vignette in HTML format, run the following lines in R:

library(mist)
vignette("mist")

0.3 Example Workflow for Single-Group Analysis

In this section, we will estimate parameters and perform differential methylation analysis using single-group data.

1 Step 1: Load Example Data

Here we load the example data from GSE121708.

library(mist)
library(SingleCellExperiment)
# Load sample scDNAm data
Dat_sce <- readRDS(system.file("extdata", "small_sampleData_sce.rds", package = "mist"))

2 Step 2: Estimate Parameters Using estiParamSingle

# Estimate parameters for single-group
Dat_sce <- estiParamSingle(
    Dat_sce = Dat_sce,
    Dat_name = "Methy_level_group1",
    ptime_name = "pseudotime"
)

# Check the output
head(rowData(Dat_sce)$mist_pars)
##                      Beta_0      Beta_1     Beta_2      Beta_3      Beta_4
## ENSMUSG00000000001 1.270651 -0.47186806 0.32963522  0.30439744  0.06337645
## ENSMUSG00000000003 1.583218  1.01333604 4.92302942 -3.85246492 -2.44563463
## ENSMUSG00000000028 1.273106 -0.06555137 0.12842424  0.07653342  0.04178288
## ENSMUSG00000000037 1.036779 -3.76633385 9.86705756 -2.63385757 -3.50219738
## ENSMUSG00000000049 1.012547 -0.07209959 0.09435702  0.10397753  0.06180564
##                     Sigma2_1  Sigma2_2 Sigma2_3 Sigma2_4
## ENSMUSG00000000001  5.785907 13.672379 4.068507 1.737734
## ENSMUSG00000000003 23.993799  4.703801 5.297336 8.352908
## ENSMUSG00000000028  7.213110 10.411544 2.831234 2.389155
## ENSMUSG00000000037  9.043003 13.051445 7.157006 2.152556
## ENSMUSG00000000049  5.468817  9.001613 2.773162 1.352381

3 Step 3: Perform Differential Methylation Analysis Using dmSingle

# Perform differential methylation analysis for the single-group
Dat_sce <- dmSingle(Dat_sce)

# View the top genomic features with drastic methylation changes
head(rowData(Dat_sce)$mist_int)
## ENSMUSG00000000037 ENSMUSG00000000003 ENSMUSG00000000001 ENSMUSG00000000049 
##        0.054961080        0.034931047        0.011385568        0.008574870 
## ENSMUSG00000000028 
##        0.007329838

4 Step 4: Perform Differential Methylation Analysis Using plotGene

# Produce scatterplot with fitted curve of a specific gene
library(ggplot2)
plotGene(Dat_sce = Dat_sce,
         Dat_name = "Methy_level_group1",
         ptime_name = "pseudotime", 
         gene_name = "ENSMUSG00000000037")

4.1 Example Workflow for Two-Group Analysis

In this section, we will estimate parameters and perform DM analysis using data from two phenotypic groups.

5 Step 1: Load Two-Group Data

# Load two-group scDNAm data
Dat_sce <- readRDS(system.file("extdata", "small_sampleData_sce.rds", package = "mist"))

6 Step 2: Estimate Parameters Using estiParamTwoGroups

# Estimate parameters for both groups
Dat_sce <- estiParamTwo(
    Dat_sce = Dat_sce,
    Dat_name_g1 = "Methy_level_group1",
    Dat_name_g2 = "Methy_level_group2",
    ptime_name_g1 = "pseudotime",
    ptime_name_g2 = "pseudotime_g2"
)

# Check the output
head(rowData(Dat_sce)$mist_pars_group1, n = 3)
##                      Beta_0      Beta_1    Beta_2      Beta_3       Beta_4
## ENSMUSG00000000001 1.265479 -0.84123852 0.6924136  0.45464430 -0.008571301
## ENSMUSG00000000003 1.599962  1.25715445 3.5920020 -2.47899071 -2.702329226
## ENSMUSG00000000028 1.287191 -0.05364528 0.1775574  0.05829547 -0.034220081
##                     Sigma2_1  Sigma2_2 Sigma2_3 Sigma2_4
## ENSMUSG00000000001  5.742699 14.095392 3.310469 1.949700
## ENSMUSG00000000003 23.957363  3.101447 5.547107 8.452306
## ENSMUSG00000000028  7.771315  7.754786 3.264941 2.367027
head(rowData(Dat_sce)$mist_pars_group2, n = 3)
##                        Beta_0      Beta_1   Beta_2    Beta_3    Beta_4
## ENSMUSG00000000001  1.9307436 -0.07123563 2.768290 -1.278696 -1.584433
## ENSMUSG00000000003 -0.7969592 -1.82910478 5.018215 -1.822206 -1.344583
## ENSMUSG00000000028  2.3177447 -1.45123158 6.183050 -5.731032  1.097013
##                     Sigma2_1 Sigma2_2 Sigma2_3 Sigma2_4
## ENSMUSG00000000001  5.859393 6.559744 3.477407 1.431118
## ENSMUSG00000000003  6.832205 8.706746 4.029906 2.716183
## ENSMUSG00000000028 11.170286 5.897188 3.501913 3.414828

7 Step 3: Perform Differential Methylation Analysis for Two-Group Comparison Using dmTwoGroups

# Perform DM analysis to compare the two groups
Dat_sce <- dmTwoGroups(Dat_sce)

# View the top genomic features with different temporal patterns between groups
head(rowData(Dat_sce)$mist_int_2group)
## ENSMUSG00000000037 ENSMUSG00000000003 ENSMUSG00000000001 ENSMUSG00000000049 
##         0.03572091         0.03302410         0.02649985         0.01001201 
## ENSMUSG00000000028 
##         0.00696869

7.1 Conclusion

mist provides a comprehensive suite of tools for analyzing scDNAm data along pseudotime, whether you are working with a single group or comparing two phenotypic groups. With the combination of Bayesian modeling and differential methylation analysis, mist is a powerful tool for identifying significant genomic features in scDNAm data.

Session info

## R Under development (unstable) (2024-10-21 r87258)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.1 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.21-bioc/R/lib/libRblas.so 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0
## 
## 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       
## 
## time zone: America/New_York
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] ggplot2_3.5.1               SingleCellExperiment_1.29.1
##  [3] SummarizedExperiment_1.37.0 Biobase_2.67.0             
##  [5] GenomicRanges_1.59.1        GenomeInfoDb_1.43.2        
##  [7] IRanges_2.41.2              S4Vectors_0.45.2           
##  [9] BiocGenerics_0.53.3         generics_0.1.3             
## [11] MatrixGenerics_1.19.0       matrixStats_1.4.1          
## [13] mist_0.99.10                BiocStyle_2.35.0           
## 
## loaded via a namespace (and not attached):
##  [1] tidyselect_1.2.1         farver_2.1.2             dplyr_1.1.4             
##  [4] Biostrings_2.75.3        bitops_1.0-9             fastmap_1.2.0           
##  [7] RCurl_1.98-1.16          GenomicAlignments_1.43.0 XML_3.99-0.18           
## [10] digest_0.6.37            lifecycle_1.0.4          survival_3.8-3          
## [13] magrittr_2.0.3           compiler_4.5.0           rlang_1.1.4             
## [16] sass_0.4.9               tools_4.5.0              yaml_2.3.10             
## [19] rtracklayer_1.67.0       knitr_1.49               labeling_0.4.3          
## [22] S4Arrays_1.7.1           curl_6.1.0               DelayedArray_0.33.3     
## [25] abind_1.4-8              BiocParallel_1.41.0      withr_3.0.2             
## [28] grid_4.5.0               colorspace_2.1-1         scales_1.3.0            
## [31] MASS_7.3-63              mcmc_0.9-8               tinytex_0.54            
## [34] cli_3.6.3                mvtnorm_1.3-2            rmarkdown_2.29          
## [37] crayon_1.5.3             httr_1.4.7               rjson_0.2.23            
## [40] cachem_1.1.0             zlibbioc_1.53.0          splines_4.5.0           
## [43] parallel_4.5.0           BiocManager_1.30.25      XVector_0.47.1          
## [46] restfulr_0.0.15          vctrs_0.6.5              Matrix_1.7-1            
## [49] jsonlite_1.8.9           SparseM_1.84-2           carData_3.0-5           
## [52] bookdown_0.41            car_3.1-3                MCMCpack_1.7-1          
## [55] Formula_1.2-5            magick_2.8.5             jquerylib_0.1.4         
## [58] snow_0.4-4               glue_1.8.0               codetools_0.2-20        
## [61] gtable_0.3.6             BiocIO_1.17.1            UCSC.utils_1.3.0        
## [64] munsell_0.5.1            tibble_3.2.1             pillar_1.10.1           
## [67] htmltools_0.5.8.1        quantreg_5.99.1          GenomeInfoDbData_1.2.13 
## [70] R6_2.5.1                 evaluate_1.0.1           lattice_0.22-6          
## [73] Rsamtools_2.23.1         bslib_0.8.0              MatrixModels_0.5-3      
## [76] Rcpp_1.0.13-1            coda_0.19-4.1            SparseArray_1.7.2       
## [79] xfun_0.50                pkgconfig_2.0.3