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", "group1_sampleData_sce.rds", package = "mist"))

2 Step 2: Estimate Parameters Using estiParam

# Estimate parameters for single-group
Dat_sce <- estiParam(
    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.241430 -0.946276838  0.98904128  0.63023084 -0.404308573
## ENSMUSG00000000003 1.657151  1.857718252  1.75129146 -1.45275018 -2.494631598
## ENSMUSG00000000028 1.295288  0.005517982  0.06840954  0.02774444  0.009360037
## ENSMUSG00000000037 1.014316 -5.787860284 15.88533378 -7.65842290 -2.489882372
## ENSMUSG00000000049 1.031597 -0.095340182  0.09328418  0.09031981  0.068639395
##                     Sigma2_1  Sigma2_2 Sigma2_3 Sigma2_4
## ENSMUSG00000000001  5.220367 14.921429 3.304151 1.839973
## ENSMUSG00000000003 26.612791  2.870299 5.578274 9.147422
## ENSMUSG00000000028  8.146372  7.488457 3.792368 2.344544
## ENSMUSG00000000037  8.757038 12.296174 6.580017 2.145654
## ENSMUSG00000000049  6.529040  8.730833 3.361353 1.200883

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.074433574        0.029544311        0.017794048        0.007196965 
## ENSMUSG00000000028 
##        0.004504284

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_g1 <- readRDS(system.file("extdata", "group1_sampleData_sce.rds", package = "mist"))
Dat_sce_g2 <- readRDS(system.file("extdata", "group2_sampleData_sce.rds", package = "mist"))

6 Step 2: Estimate Parameters Using estiParam

# Estimate parameters for both groups
Dat_sce_g1 <- estiParam(
     Dat_sce = Dat_sce_g1,
     Dat_name = "Methy_level_group1",
     ptime_name = "pseudotime"
 )

Dat_sce_g2 <- estiParam(
     Dat_sce = Dat_sce_g2,
     Dat_name = "Methy_level_group2",
     ptime_name = "pseudotime"
 ) 

# Check the output
head(rowData(Dat_sce_g1)$mist_pars, n = 3)
##                      Beta_0       Beta_1     Beta_2     Beta_3      Beta_4
## ENSMUSG00000000001 1.253127 -1.067169533 1.04843538  0.7110666 -0.42610311
## ENSMUSG00000000003 1.599050  1.810972137 2.10867367 -1.4769419 -2.76115614
## ENSMUSG00000000028 1.295239  0.004494557 0.06604265  0.0268299  0.00784607
##                     Sigma2_1  Sigma2_2 Sigma2_3 Sigma2_4
## ENSMUSG00000000001  5.849404 13.805629 3.228885 1.775344
## ENSMUSG00000000003 25.659544  3.898626 6.104902 9.195432
## ENSMUSG00000000028  8.244557  7.203092 3.787727 2.277945
head(rowData(Dat_sce_g2)$mist_pars, n = 3)
##                        Beta_0     Beta_1   Beta_2     Beta_3     Beta_4
## ENSMUSG00000000001  1.9265891 -0.5609386 5.200186 -5.5350773  0.7766728
## ENSMUSG00000000003 -0.8245876 -0.8678986 2.440746 -0.7806363 -0.7219310
## ENSMUSG00000000028  2.3124320 -1.5233449 7.958763 -9.7557929  3.4046674
##                     Sigma2_1  Sigma2_2 Sigma2_3 Sigma2_4
## ENSMUSG00000000001  5.933531  6.008405 3.161434 1.428969
## ENSMUSG00000000003  7.120333 10.336919 4.426956 3.098995
## ENSMUSG00000000028 11.627920  4.922777 3.981777 3.329075

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

# Perform DM analysis to compare the two groups
dm_results <- dmTwoGroups(
     Dat_sce_g1 = Dat_sce_g1,
     Dat_sce_g2 = Dat_sce_g2
 )

# View the top genomic features with different temporal patterns between groups
head(dm_results)
## ENSMUSG00000000037 ENSMUSG00000000003 ENSMUSG00000000001 ENSMUSG00000000049 
##        0.053349442        0.029496422        0.026799784        0.012356129 
## ENSMUSG00000000028 
##        0.007457991

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 version 4.6.0 Patched (2026-04-24 r89963)
## Platform: aarch64-apple-darwin23
## Running under: macOS Tahoe 26.3.1
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/4.6/Resources/lib/libRblas.0.dylib 
## LAPACK: /Library/Frameworks/R.framework/Versions/4.6/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.1
## 
## locale:
## [1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## time zone: America/New_York
## tzcode source: internal
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] ggplot2_4.0.3               SingleCellExperiment_1.34.0
##  [3] SummarizedExperiment_1.42.0 Biobase_2.72.0             
##  [5] GenomicRanges_1.64.0        Seqinfo_1.2.0              
##  [7] IRanges_2.46.0              S4Vectors_0.50.0           
##  [9] BiocGenerics_0.58.0         generics_0.1.4             
## [11] MatrixGenerics_1.24.0       matrixStats_1.5.0          
## [13] mist_1.4.0                  BiocStyle_2.40.0           
## 
## loaded via a namespace (and not attached):
##  [1] tidyselect_1.2.1         dplyr_1.2.1              farver_2.1.2            
##  [4] Biostrings_2.80.0        S7_0.2.2                 bitops_1.0-9            
##  [7] fastmap_1.2.0            RCurl_1.98-1.18          GenomicAlignments_1.48.0
## [10] XML_3.99-0.23            digest_0.6.39            lifecycle_1.0.5         
## [13] survival_3.8-6           magrittr_2.0.5           compiler_4.6.0          
## [16] rlang_1.2.0              sass_0.4.10              tools_4.6.0             
## [19] yaml_2.3.12              rtracklayer_1.72.0       knitr_1.51              
## [22] labeling_0.4.3           S4Arrays_1.12.0          curl_7.1.0              
## [25] DelayedArray_0.38.0      RColorBrewer_1.1-3       abind_1.4-8             
## [28] BiocParallel_1.46.0      withr_3.0.2              grid_4.6.0              
## [31] scales_1.4.0             MASS_7.3-65              mcmc_0.9-8              
## [34] tinytex_0.59             dichromat_2.0-0.1        cli_3.6.6               
## [37] mvtnorm_1.3-7            rmarkdown_2.31           crayon_1.5.3            
## [40] otel_0.2.0               httr_1.4.8               rjson_0.2.23            
## [43] cachem_1.1.0             splines_4.6.0            parallel_4.6.0          
## [46] BiocManager_1.30.27      XVector_0.52.0           restfulr_0.0.16         
## [49] vctrs_0.7.3              Matrix_1.7-5             jsonlite_2.0.0          
## [52] SparseM_1.84-2           carData_3.0-6            bookdown_0.46           
## [55] car_3.1-5                MCMCpack_1.7-1           Formula_1.2-5           
## [58] magick_2.9.1             jquerylib_0.1.4          glue_1.8.1              
## [61] codetools_0.2-20         gtable_0.3.6             BiocIO_1.22.0           
## [64] tibble_3.3.1             pillar_1.11.1            htmltools_0.5.9         
## [67] quantreg_6.1             R6_2.6.1                 evaluate_1.0.5          
## [70] lattice_0.22-9           Rsamtools_2.28.0         cigarillo_1.2.0         
## [73] bslib_0.10.0             MatrixModels_0.5-4       Rcpp_1.1.1-1.1          
## [76] coda_0.19-4.1            SparseArray_1.12.0       xfun_0.57               
## [79] pkgconfig_2.0.3