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.254575 -0.4949142663  0.46565967  0.24851565 -0.006176689
## ENSMUSG00000000003 1.592362  1.8735453707  2.28295335 -2.15367140 -2.296047749
## ENSMUSG00000000028 1.295453  0.0006939163  0.08955076  0.03148809 -0.005111840
## ENSMUSG00000000037 1.010166 -5.1789817589 14.03543197 -6.28306891 -2.551477575
## ENSMUSG00000000049 1.022311 -0.1272919615  0.11435153  0.09278697  0.078035602
##                     Sigma2_1  Sigma2_2 Sigma2_3 Sigma2_4
## ENSMUSG00000000001  5.916454 14.196810 3.449475 1.745520
## ENSMUSG00000000003 26.816497  3.452943 7.000773 9.003503
## ENSMUSG00000000028  7.969615  7.909045 3.399676 2.335364
## ENSMUSG00000000037  8.282613 14.612752 7.172192 2.437618
## ENSMUSG00000000049  6.158922  9.313981 2.970335 1.151625

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.069890800        0.031619364        0.011225357        0.007397007 
## ENSMUSG00000000028 
##        0.004846096

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.270174 -0.55966923 0.4885798  0.29978136  0.00344160
## ENSMUSG00000000003 1.563354  1.84124716 2.6538326 -2.26761826 -2.55747957
## ENSMUSG00000000028 1.313615  0.00132114 0.1019892  0.02856796 -0.01904834
##                     Sigma2_1  Sigma2_2 Sigma2_3 Sigma2_4
## ENSMUSG00000000001  5.876221 14.298430 3.317110 1.748155
## ENSMUSG00000000003 26.035001  2.788004 7.339796 9.316059
## ENSMUSG00000000028  8.393618  6.779335 3.148449 2.377919
head(rowData(Dat_sce_g2)$mist_pars, n = 3)
##                        Beta_0    Beta_1   Beta_2     Beta_3     Beta_4
## ENSMUSG00000000001  1.9327342 -1.211246 6.484904 -4.7490946 -0.7000398
## ENSMUSG00000000003 -0.8464124 -1.360966 3.741507 -1.3416745 -0.9418059
## ENSMUSG00000000028  2.3667953 -0.338784 1.937104 -0.8593967 -0.5796002
##                     Sigma2_1 Sigma2_2 Sigma2_3 Sigma2_4
## ENSMUSG00000000001  5.731067 5.589106 3.326758 1.471585
## ENSMUSG00000000003  7.147467 9.286840 4.862007 3.473663
## ENSMUSG00000000028 11.215405 5.834329 4.571783 3.597128

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.05824948         0.03431762         0.02345514         0.01278449 
## ENSMUSG00000000028 
##         0.00408217

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 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.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.1           
##  [9] BiocGenerics_0.58.1         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.1        S7_0.2.2                 bitops_1.0-9            
##  [7] fastmap_1.2.0            RCurl_1.98-1.19          GenomicAlignments_1.48.0
## [10] XML_3.99-0.23            digest_0.6.39            lifecycle_1.0.5         
## [13] survival_3.8-9           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.72.0       knitr_1.51              
## [22] S4Arrays_1.12.0          labeling_0.4.3           curl_7.1.0              
## [25] DelayedArray_0.38.2      RColorBrewer_1.1-3       abind_1.4-8             
## [28] BiocParallel_1.46.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.31           crayon_1.5.3             httr_1.4.8              
## [40] rjson_0.2.23             cachem_1.1.0             splines_4.6.1           
## [43] parallel_4.6.1           BiocManager_1.30.27      XVector_0.52.0          
## [46] restfulr_0.0.17          vctrs_0.7.3              Matrix_1.7-5            
## [49] jsonlite_2.0.0           SparseM_1.84-2           carData_3.0-6           
## [52] car_3.1-5                MCMCpack_1.7-1           Formula_1.2-5           
## [55] maketools_1.3.2          jquerylib_0.1.4          glue_1.8.1              
## [58] codetools_0.2-20         gtable_0.3.6             BiocIO_1.22.0           
## [61] tibble_3.3.1             pillar_1.11.1            htmltools_0.5.9         
## [64] quantreg_6.1             R6_2.6.1                 evaluate_1.0.5          
## [67] lattice_0.22-9           Rsamtools_2.28.0         cigarillo_1.2.1         
## [70] bslib_0.11.0             MatrixModels_0.5-4       coda_0.19-4.1           
## [73] SparseArray_1.12.2       xfun_0.60                buildtools_1.0.0        
## [76] pkgconfig_2.0.3