mist:methylation inference for single-cell along trajectory

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.

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

Example Workflow for Single-Group Analysis

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

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

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.227413 -0.566194681 0.49674387  0.30320000  0.037980981
## ENSMUSG00000000003 1.527619  1.870152256 1.85332834 -0.96004338 -3.083163989
## ENSMUSG00000000028 1.291792 -0.005227589 0.05765756  0.07207434  0.004934504
## ENSMUSG00000000037 1.016348 -3.257666563 8.76044333 -2.75116356 -2.680965354
## ENSMUSG00000000049 1.028070 -0.096955091 0.10975496  0.08420041  0.066931775
##                     Sigma2_1  Sigma2_2 Sigma2_3 Sigma2_4
## ENSMUSG00000000001  5.383558 14.310198 2.984890 1.998424
## ENSMUSG00000000003 24.602786  3.375769 5.875722 9.098321
## ENSMUSG00000000028  8.030708  7.046490 3.244337 2.135548
## ENSMUSG00000000037  8.263102 12.222927 6.980449 2.688522
## ENSMUSG00000000049  6.411922  8.842490 2.782212 1.271061

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.050954053        0.033547296        0.013886568        0.007557075 
## ENSMUSG00000000028 
##        0.005194391

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

Example Workflow for Two-Group Analysis

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

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

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.250718 -0.56289010 0.55453230  0.25912459 -0.02025195
## ENSMUSG00000000003 1.539100  1.95175056 2.24560140 -1.19370378 -3.39218667
## ENSMUSG00000000028 1.253798 -0.01955611 0.06485863  0.09700425  0.01010011
##                     Sigma2_1  Sigma2_2 Sigma2_3 Sigma2_4
## ENSMUSG00000000001  5.980244 12.921808 3.935885 1.819666
## ENSMUSG00000000003 25.620457  3.117702 6.538156 8.384602
## ENSMUSG00000000028  7.243489  9.016720 2.973728 2.339782
head(rowData(Dat_sce_g2)$mist_pars, n = 3)
##                        Beta_0      Beta_1    Beta_2     Beta_3     Beta_4
## ENSMUSG00000000001  1.9104032 -0.57872954 4.9243763 -3.9764908 -0.5320874
## ENSMUSG00000000003 -0.8448691 -1.25784706 3.7495250 -1.7037591 -0.7258602
## ENSMUSG00000000028  2.3062257  0.08498863 0.5012864 -0.0220092 -0.4628289
##                     Sigma2_1 Sigma2_2 Sigma2_3 Sigma2_4
## ENSMUSG00000000001  5.873293 6.738398 3.652289 1.338222
## ENSMUSG00000000003  6.984634 9.981743 4.711829 3.316134
## ENSMUSG00000000028 11.665493 4.851821 3.406777 2.719749

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.035874749        0.032809765        0.022698583        0.010003872 
## ENSMUSG00000000028 
##        0.004078033

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.1 (2026-06-24)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 26.04.1 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.32.so;  LAPACK version 3.12.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [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: Etc/UTC
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] ggplot2_4.0.3               SingleCellExperiment_1.35.2
##  [3] SummarizedExperiment_1.43.0 Biobase_2.73.2             
##  [5] GenomicRanges_1.65.4        Seqinfo_1.3.2              
##  [7] IRanges_2.47.5              S4Vectors_0.51.10          
##  [9] BiocGenerics_0.59.12        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.9        S7_0.2.2                 bitops_1.1-0            
##  [7] fastmap_1.2.0            RCurl_1.98-1.20          GenomicAlignments_1.49.2
## [10] XML_3.99-0.25            digest_0.6.39            lifecycle_1.0.5         
## [13] survival_3.8-12          magrittr_2.0.5           compiler_4.6.1          
## [16] rlang_1.3.0              sass_0.4.10              tools_4.6.1             
## [19] yaml_2.3.12              rtracklayer_1.73.0       knitr_1.52              
## [22] labeling_0.4.3           S4Arrays_1.13.2          curl_8.1.0              
## [25] DelayedArray_0.39.8      RColorBrewer_1.1-3       abind_1.4-8             
## [28] BiocParallel_1.47.0      withr_3.0.3              sys_3.4.3               
## [31] grid_4.6.1               scales_1.4.0             MASS_7.3-66             
## [34] mcmc_0.9-8               cli_3.6.6                mvtnorm_1.4-2           
## [37] rmarkdown_2.32           crayon_1.5.3             httr_1.4.9              
## [40] rjson_0.2.23             BiocBaseUtils_1.15.1     cachem_1.1.0            
## [43] splines_4.6.1            parallel_4.6.1           BiocManager_1.30.27     
## [46] XVector_0.53.0           restfulr_0.0.17          vctrs_0.7.3             
## [49] Matrix_1.7-6             jsonlite_2.0.0           SparseM_1.84-2          
## [52] carData_3.0-6            car_3.1-5                MCMCpack_1.7-1          
## [55] Formula_1.2-6            maketools_1.3.2          jquerylib_0.1.4         
## [58] glue_1.8.1               codetools_0.2-20         gtable_0.3.6            
## [61] BiocIO_1.23.3            tibble_3.3.1             pillar_1.11.1           
## [64] htmltools_0.5.9          quantreg_6.1             R6_2.6.1                
## [67] evaluate_1.0.5           lattice_0.23-1           Rsamtools_2.29.0        
## [70] cigarillo_1.3.1          bslib_0.12.0             MatrixModels_0.5-4      
## [73] coda_0.19-4.1            SparseArray_1.13.4       xfun_0.62               
## [76] buildtools_1.0.0         pkgconfig_2.0.3