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.237303 -0.80538598 0.72080928  0.4251259 -0.07355208
## ENSMUSG00000000003 1.484392  1.55615013 2.29650933 -1.0260499 -3.04916491
## ENSMUSG00000000028 1.285119 -0.01975652 0.07208422  0.0544290  0.03540316
## ENSMUSG00000000037 1.040071 -2.12303509 5.59232341 -1.1147840 -2.30649070
## ENSMUSG00000000049 1.034663 -0.05313817 0.05847330  0.0787287  0.05831636
##                     Sigma2_1  Sigma2_2 Sigma2_3 Sigma2_4
## ENSMUSG00000000001  5.201994 13.511180 3.769499 1.734025
## ENSMUSG00000000003 24.754051  7.041535 6.700874 9.279612
## ENSMUSG00000000028  8.114469  7.558136 2.850906 2.239709
## ENSMUSG00000000037  9.080661 12.493077 6.019883 2.241691
## ENSMUSG00000000049  6.341110 10.504352 2.972976 1.200929

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.035617687        0.033548117        0.016230431        0.006389468 
## ENSMUSG00000000028 
##        0.005627398

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.249787 -0.941790050 1.03699703  0.55030569 -0.397928949
## ENSMUSG00000000003 1.563741  1.909010731 2.38367139 -1.54510712 -3.123347562
## ENSMUSG00000000028 1.277546  0.003077572 0.06487294  0.04207186  0.002180267
##                     Sigma2_1  Sigma2_2 Sigma2_3 Sigma2_4
## ENSMUSG00000000001  5.380056 14.148860 3.427506 1.702339
## ENSMUSG00000000003 24.876215  4.640167 5.722674 9.491763
## ENSMUSG00000000028  7.812907  7.689459 2.978111 2.096568
head(rowData(Dat_sce_g2)$mist_pars, n = 3)
##                        Beta_0    Beta_1   Beta_2     Beta_3    Beta_4  Sigma2_1
## ENSMUSG00000000001  1.8859317 -2.013795 10.39180 -10.968199  2.460508  5.237160
## ENSMUSG00000000003 -0.8639267 -3.909302 10.16810  -4.128963 -2.133202  6.007425
## ENSMUSG00000000028  2.3366162 -2.763743 13.50098 -16.986315  6.320165 11.135932
##                     Sigma2_2 Sigma2_3 Sigma2_4
## ENSMUSG00000000001  6.565495 3.180021 1.346843
## ENSMUSG00000000003 11.719358 4.839551 2.993808
## ENSMUSG00000000028  5.164648 3.783526 3.087723

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.06131446         0.05511296         0.02639441         0.01061977 
## ENSMUSG00000000028 
##         0.01048246

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-05-01 r89994)
## 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.35.1
##  [3] SummarizedExperiment_1.43.0 Biobase_2.73.1             
##  [5] GenomicRanges_1.65.0        Seqinfo_1.3.0              
##  [7] IRanges_2.47.1              S4Vectors_0.51.2           
##  [9] BiocGenerics_0.59.2         generics_0.1.4             
## [11] MatrixGenerics_1.25.0       matrixStats_1.5.0          
## [13] mist_1.5.0                  BiocStyle_2.41.0           
## 
## loaded via a namespace (and not attached):
##  [1] tidyselect_1.2.1         dplyr_1.2.1              farver_2.1.2            
##  [4] Biostrings_2.81.1        S7_0.2.2                 bitops_1.0-9            
##  [7] fastmap_1.2.0            RCurl_1.98-1.18          GenomicAlignments_1.49.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.73.0       knitr_1.51              
## [22] labeling_0.4.3           S4Arrays_1.13.0          curl_7.1.0              
## [25] DelayedArray_0.39.2      RColorBrewer_1.1-3       abind_1.4-8             
## [28] BiocParallel_1.47.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] BiocBaseUtils_1.15.1     cachem_1.1.0             splines_4.6.0           
## [46] parallel_4.6.0           BiocManager_1.30.27      XVector_0.53.0          
## [49] restfulr_0.0.16          vctrs_0.7.3              Matrix_1.7-5            
## [52] jsonlite_2.0.0           SparseM_1.84-2           carData_3.0-6           
## [55] bookdown_0.46            car_3.1-5                MCMCpack_1.7-1          
## [58] Formula_1.2-5            magick_2.9.1             jquerylib_0.1.4         
## [61] glue_1.8.1               codetools_0.2-20         gtable_0.3.6            
## [64] BiocIO_1.23.3            tibble_3.3.1             pillar_1.11.1           
## [67] htmltools_0.5.9          quantreg_6.1             R6_2.6.1                
## [70] evaluate_1.0.5           lattice_0.22-9           Rsamtools_2.29.0        
## [73] cigarillo_1.3.0          bslib_0.11.0             MatrixModels_0.5-4      
## [76] Rcpp_1.1.1-1.1           coda_0.19-4.1            SparseArray_1.13.2      
## [79] xfun_0.57                pkgconfig_2.0.3