10.01-diff-methyl-DSS-CTmask ================ Kathleen Durkin 2026-11-04 - [1 Setup](#1-setup) - [2 Download methylation calls](#2-download-methylation-calls) - [3 Mask C -\> T SNPs](#3-mask-c---t-snps) - [4 Read Bismark coverage into a BSseq object](#4-read-bismark-coverage-into-a-bsseq-object) - [5 Multi-factor model (design-level tests)](#5-multi-factor-model-design-level-tests) - [5.1 Parental treatment effect](#51-parental-treatment-effect) - [5.2 Stage-dependence of the treatment effect](#52-stage-dependence-of-the-treatment-effect) - [6 Save outputs](#6-save-outputs) - [7 Two-group smoothed test within each stage](#7-two-group-smoothed-test-within-each-stage) - [8 Save outputs](#8-save-outputs) Differential methylation analysis using the `DSS` package (Dispersion Shrinkage for Sequencing data) This is essentially a repeat of `10-diff-methyl-DSS`, but this time I’m first masking C/T SNPs from consideration. WGBS works by converting unmethylated Cs to Us, which are then read as Ts during sequencing. This means that instances of C -\> T SNPs are falsely interpreted as unmethylated cytosines, when there’s actually no cytosine there in the first place. SNPs have been called using the bisulfite-conversion-aware caller `BS-Snper` in `12-snp-calling-BS-Snper`. Inputs: Bismark coverage files `[].deduplicated.bismark.cov.gz`, the same ones used in `06.x` (stored under `../data/bismark-methyl-extraction/`). # 1 Setup I ended up needing to run this code from using a .sh script from the terminal for two reasons. First, Klone doesn’t seem to have the DSS package available, and I don’t seem to have the requisite permissions to install it, so I need to run all of this code within a conda environment. Second, some of these runs are so comuptationally intensive that I need \>200G of memory. I therefore needed to request a node with a really high amount of memory on which to run this code. Below is a copy of the simple `.sh` script I’m using for the run. From a Klone login node, I can just use the `sbatch` command to run this `.sh` script, which will request a suffiently powered node, open a conda environment, and run all R code in this `.Rmd` file. ``` bash #!/bin/bash #SBATCH --account=srlab #SBATCH --partition=cpu-g2-mem2x #SBATCH --cpus-per-task=8 #SBATCH --mem=350G #SBATCH --time=1-00:00:00 #SBATCH --output=dss_%j.out #SBATCH --error=dss_%j.err #SBATCH --chdir=/gscratch/srlab/kdurkin1/kathleen-coral/project/code apptainer exec --bind /gscratch:/gscratch \ /gscratch/srlab/kdurkin1/srlab-R4.4-bioinformatics-container-703094b.sif \ bash -c 'source /srlab/programs/miniforge3-24.7.1-0/etc/profile.d/conda.sh && conda activate /gscratch/srlab/kdurkin1/.conda/envs/dss && Rscript -e "rmarkdown::render(\"10.Rmd\")"' ``` ``` r # Install if needed: # if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager") # BiocManager::install(c("DSS", "bsseq")) library(DSS) library(bsseq) library(readr) library(dplyr) library(stringr) library(tibble) library(ggplot2) ``` # 2 Download methylation calls (if necessary) ``` bash # Run wget to retrieve FastQs and MD5 files # Note: the --no-clobber command will skip re-downloading any files that are already present in the output directory wget \ --directory-prefix ../data/bismark-methyl-extraction \ --recursive \ --no-check-certificate \ --continue \ --cut-dirs 4 \ --no-host-directories \ --no-parent \ --quiet \ --no-clobber \ --accept="*.deduplicated.bismark.cov.gz,checksums.md5" https://gannet.fish.washington.edu/gitrepos/ceasmallr/output/02.20-bismark-methylation-extraction/ ``` ``` bash cd ../data/bismark-methyl-extraction/ echo "How many methylation calling files were downloaded?" ls *.deduplicated.bismark.cov.gz | wc -l echo "" echo "Check file checksums:" grep '.deduplicated.bismark.cov.gz' checksums.md5 | md5sum -c - ``` We should have N=32 (n=15 ControlxControl crosses, n=17 ExposedxExposed crosses) # 3 Mask C -\> T SNPs We’ve already called SNPs using `BS-Snper`, and saved a file of all C/T (and G/A, from the opposite strand) SNPs in all samples. For each Bismark .cov file, remove every CpG site which overlaps a C/T SNP. Do this using `intersectBed`, to keep .cov rows not present in the CT file ``` bash cd ../data/bismark-methyl-extraction for file in *.bismark.cov.gz do zcat ${file} \ | awk 'BEGIN{OFS="\t"}{print $1,$2-1,$2,$4,$5,$6}' \ | intersectBed -v -a - -b ../../output/12-snp-calling-BS-Snper/per-sample/all_CT_GA_SNPs.bed \ | awk 'BEGIN{OFS="\t"}{print $1,$3,$3,$4,$5,$6}' \ | gzip > ${file%.bismark.cov.gz}.CT_masked.bismark.cov.gz echo ${file} zcat ${file} | wc -l zcat ${file%.bismark.cov.gz}.CT_masked.bismark.cov.gz | wc -l done ``` # 4 Read Bismark coverage into a BSseq object Bismark `.cov` columns (no header): `chr start end meth% count_methylated count_unmethylated`. For `DSS` we need, per sample, a df with columns `chr`, `pos`, `N` (total coverage), and `X` (methylated count). (Positions are 1-based in both Bismark `.cov` and `bsseq`, so no offset is needed) ``` r file.list <- list.files("../data/bismark-methyl-extraction", pattern = "\\.CT_masked\\.bismark\\.cov\\.gz$", full.names = TRUE) # As in 06.2, drop the low-yield libraries (<100M Cs) # BUT, could keep all samples and let DSS handle the coverage differences -- come back to later. drop <- c("CF01-CM01-Zygote", "CF08-CM04-Larvae", "CF08-CM05-Larvae", "EF04-EM04-Zygote", "EF05-EM05-Zygote") file.list <- file.list[!str_detect(basename(file.list), str_c(drop, collapse = "|"))] # format sample IDs sample.ids <- basename(file.list) %>% str_replace("_R1_001\\.fastp-trim_bismark_bt2_pe\\.deduplicated\\.CT_masked\\.bismark\\.cov\\.gz$", "") %>% str_replace("_R1_001\\.fastp-trim\\.REPAIRED_bismark_bt2_pe\\.deduplicated\\.CT_masked\\.bismark\\.cov\\.gz$", ".REP") # Grab treatment and lifestage info from Sample IDs # first letter of the cross code = parental treatment (C = control, E = exposed) # stage encoded in the ID string (Zygote / Larvae) meta <- tibble( sample = sample.ids, file = file.list, treatment = case_when(str_starts(sample.ids, "E") ~ "Exposed", str_starts(sample.ids, "C") ~ "Control", TRUE ~ NA_character_), stage = case_when(str_detect(sample.ids, "Zygote") ~ "Zygote", str_detect(sample.ids, "Larvae") ~ "Larvae", TRUE ~ NA_character_) ) %>% # reference levels: Control (so the coefficient = effect of exposure) and Zygote (earlier stage) mutate(treatment = factor(treatment, levels = c("Control", "Exposed")), stage = factor(stage, levels = c("Zygote", "Larvae"))) knitr::kable(count(meta, treatment, stage)) ``` | treatment | stage | n | |:----------|:-------|----:| | Control | Zygote | 7 | | Control | Larvae | 5 | | Exposed | Zygote | 4 | | Exposed | Larvae | 11 | ``` r colData <- DataFrame(treatment = meta$treatment, stage = meta$stage, row.names = meta$sample) BSobj <- read.bismark(files = meta$file, colData = colData, rmZeroCov = TRUE, # drops positions covered in 0 samples strandCollapse = FALSE, # .cov isn't a cytosine report; leave off BPPARAM = MulticoreParam(workers = 12, progressbar = TRUE), verbose = TRUE) ``` ## [read.bismark] Parsing files and constructing valid loci ... ## | | | 0% | |=== | 4% | |===== | 8% | |======== | 12% | |=========== | 15% | |============= | 19% | |================ | 23% | |=================== | 27% | |====================== | 31% | |======================== | 35% | |=========================== | 38% | |============================== | 42% | |================================ | 46% | |=================================== | 50% | |====================================== | 54% | |======================================== | 58% | |=========================================== | 62% | |============================================== | 65% | |================================================ | 69% | |=================================================== | 73% | |====================================================== | 77% | |========================================================= | 81% | |=========================================================== | 85% | |============================================================== | 88% | |================================================================= | 92% | |=================================================================== | 96% | |======================================================================| 100% ## Done in 59.9 secs ## [read.bismark] Parsing files and constructing 'M' and 'Cov' matrices ... ## | | | 0% | |=== | 4% | |===== | 7% | |======== | 11% | |========== | 15% | |============= | 19% | |================ | 22% | |================== | 26% | |===================== | 30% | |======================= | 33% | |========================== | 37% | |============================= | 41% | |=============================== | 44% | |================================== | 48% | |==================================== | 52% | |======================================= | 56% | |========================================= | 59% | |============================================ | 63% | |=============================================== | 67% | |================================================= | 70% | |==================================================== | 74% | |====================================================== | 78% | |========================================================= | 81% | |============================================================ | 85% | |============================================================== | 89% | |================================================================= | 93% | |=================================================================== | 96% | |======================================================================| 100% ## Done in 28.2 secs ## [read.bismark] Constructing BSseq object ... ``` r BSobj # positions are the UNION across samples; missing positions get N = 0 ``` ## An object of type 'BSseq' with ## 30896191 methylation loci ## 27 samples ## has not been smoothed ## All assays are in-memory ``` r # DSS tolerates missingness # For now, require non-zero coverage in at least half the samples of each treatment x stage cell to reduce noise # (MAY WANT TO ADJUST LATER) cov_mat <- getCoverage(BSobj, type = "Cov") # loci x samples cells <- interaction(meta$treatment, meta$stage, drop = TRUE) keep <- Reduce(`&`, lapply(levels(cells), function(cl) { idx <- which(cells == cl) rowSums(cov_mat[, idx, drop = FALSE] > 0) >= ceiling(length(idx) / 2) })) BSobj <- BSobj[keep, ] cat("Loci retained after coverage filter:", nrow(BSobj), "\n") ``` ## Loci retained after coverage filter: 7403330 EDIT: All of the downstream model fitting calls are *super* intensive and take forever to run. Since I have to run this from Rscript, and thus cannot easily retain R objects between runs, this is making script troubleshooting super time-intensive and annoying. To facilitate troubleshooting, I’m going to add a test run option that will randomly subsample a tiny fraction of the data to proceed with. ONLY use this for test-runs ``` r # Keeps all samples but randomly thins loci genome-wide # set test_run to FALSE for full-data runs test_run <- FALSE test_frac <- 0.02 # keep 2% of loci if (test_run) { set.seed(1) idx <- sort(sample(nrow(BSobj), size = floor(nrow(BSobj) * test_frac))) BSobj <- BSobj[idx, ] cat("TEST RUN — loci subsampled to:", nrow(BSobj), "\n") } ``` Also save the set of loci being tested in the following analyses (for reference when evaluating the effects of including/excluding my low-coverage offspring samples) ``` r gr <- granges(BSobj) tested <- data.frame(chr = as.character(seqnames(gr)), start = start(gr) - 1L, end = start(gr)) write_tsv(tested, file.path("../output/10.01-diff-methyl-DSS-CTmask", "tested_loci.bed.gz"), col_names = FALSE) cat("Tested-locus set size:", nrow(tested), "loci\n") ``` ## Tested-locus set size: 7403330 loci ``` r # compact summary knitr::kable(as.data.frame(table(tested$chr)), col.names = c("chr", "n_loci_tested")) ``` | chr | n_loci_tested | |:------------|--------------:| | NC_007175.2 | 880 | | NC_035780.1 | 852138 | | NC_035781.1 | 784550 | | NC_035782.1 | 898267 | | NC_035783.1 | 792930 | | NC_035784.1 | 1378978 | | NC_035785.1 | 421036 | | NC_035786.1 | 472177 | | NC_035787.1 | 660380 | | NC_035788.1 | 862661 | | NC_035789.1 | 279333 | # 5 Multi-factor model (design-level tests) Fit an interaction model for tests of *stage-dependence* (does effect of parental exposure differ between the life stages) ``` r design <- data.frame(treatment = meta$treatment, stage = meta$stage) # Interaction model: does the parental-treatment effect differ by stage? fit_int <- DMLfit.multiFactor(BSobj, design = design, formula = ~ treatment + stage + treatment:stage) ``` ## Fitting DML model for CpG site: 100000 , 200000 , 300000 , 400000 , 500000 , 600000 , 700000 , 800000 , 900000 , 1000000 , 1100000 , 1200000 , 1300000 , 1400000 , 1500000 , 1600000 , 1700000 , 1800000 , 1900000 , 2000000 , 2100000 , 2200000 , 2300000 , 2400000 , 2500000 , 2600000 , 2700000 , 2800000 , 2900000 , 3000000 , 3100000 , 3200000 , 3300000 , 3400000 , 3500000 , 3600000 , 3700000 , 3800000 , 3900000 , 4000000 , 4100000 , 4200000 , 4300000 , 4400000 , 4500000 , 4600000 , 4700000 , 4800000 , 4900000 , 5000000 , 5100000 , 5200000 , 5300000 , 5400000 , 5500000 , 5600000 , 5700000 , 5800000 , 5900000 , 6000000 , 6100000 , 6200000 , 6300000 , 6400000 , 6500000 , 6600000 , 6700000 , 6800000 , 6900000 , 7000000 , 7100000 , 7200000 , 7300000 , 7400000 , ``` r # Inspect coefficient names so we test the right columns colnames(fit_int$X) ``` ## [1] "(Intercept)" "treatmentExposed" ## [3] "stageLarvae" "treatmentExposed:stageLarvae" ``` r # Expected: "(Intercept)" "treatmentExposed" "stageLarvae" "treatmentExposed:stageLarvae" ``` ## 5.1 Parental treatment effect Fit an additive model (no interaction) to test for signal of parental treatment effect while *controlling for stage*. Note that, for a multi-factor analysis, DSS doesn’t seem to rely on a threshold of % methylation difference? Just an FDR pval. ``` r fit_add <- DMLfit.multiFactor(BSobj, design = design, formula = ~ treatment + stage) ``` ## Fitting DML model for CpG site: 100000 , 200000 , 300000 , 400000 , 500000 , 600000 , 700000 , 800000 , 900000 , 1000000 , 1100000 , 1200000 , 1300000 , 1400000 , 1500000 , 1600000 , 1700000 , 1800000 , 1900000 , 2000000 , 2100000 , 2200000 , 2300000 , 2400000 , 2500000 , 2600000 , 2700000 , 2800000 , 2900000 , 3000000 , 3100000 , 3200000 , 3300000 , 3400000 , 3500000 , 3600000 , 3700000 , 3800000 , 3900000 , 4000000 , 4100000 , 4200000 , 4300000 , 4400000 , 4500000 , 4600000 , 4700000 , 4800000 , 4900000 , 5000000 , 5100000 , 5200000 , 5300000 , 5400000 , 5500000 , 5600000 , 5700000 , 5800000 , 5900000 , 6000000 , 6100000 , 6200000 , 6300000 , 6400000 , 6500000 , 6600000 , 6700000 , 6800000 , 6900000 , 7000000 , 7100000 , 7200000 , 7300000 , 7400000 , ``` r test_trt <- DMLtest.multiFactor(fit_add, coef = "treatmentExposed") head(test_trt[order(test_trt$pvals), ]) ``` ## chr pos stat pvals fdrs ## 3164535 NC_035783.1 47063138 -11.20139 4.014000e-29 2.971696e-22 ## 1568970 NC_035781.1 54566109 -11.07856 1.594096e-28 5.900809e-22 ## 1854345 NC_035782.1 23797484 10.69016 1.131773e-26 2.688259e-20 ## 3164533 NC_035783.1 47063100 -10.66700 1.452460e-26 2.688259e-20 ## 5945781 NC_035787.1 45662859 10.24411 1.257759e-24 1.862321e-18 ## 500578 NC_035780.1 36481455 -10.21824 1.642982e-24 2.027257e-18 ``` r # DMLs = FDR threshold (multiFactor gives per-site fdrs, not a methylKit-style % difference) dml_trt <- test_trt[which(test_trt$fdrs < 0.05), ] cat("Treatment DMLs (FDR < 0.05):", nrow(dml_trt), "\n") ``` ## Treatment DMLs (FDR < 0.05): 7412 ``` r # Regions dmr_trt <- callDMR(test_trt, p.threshold = 0.01, minlen = 50, minCG = 3, dis.merge = 100) cat("Treatment DMRs:", nrow(dmr_trt), "\n") ``` ## Treatment DMRs: 1756 ## 5.2 Stage-dependence of the treatment effect A *null* interaction at treatment-associated loci = inherited signal preserved across stages (H1.2 supported). A *significant* interaction = the effect differs between zygote and larva, i.e. evidence of developmental reprogramming. ``` r test_intx <- DMLtest.multiFactor(fit_int, coef = "treatmentExposed:stageLarvae") head(test_intx[order(test_intx$pvals), ]) ``` ## chr pos stat pvals fdrs ## 5308482 NC_035786.1 26848260 -7.041529 1.901412e-12 1.407678e-05 ## 118458 NC_035780.1 8153271 -6.072932 1.255955e-09 4.649126e-03 ## 5802627 NC_035787.1 27908837 -5.810520 6.227925e-09 1.536913e-02 ## 5213240 NC_035786.1 11658552 5.681226 1.337328e-08 2.001481e-02 ## 6777366 NC_035788.1 66167519 5.638656 1.713825e-08 2.001481e-02 ## 4827650 NC_035785.1 16140415 5.636172 1.738718e-08 2.001481e-02 ``` r dml_intx <- test_intx[which(test_intx$fdrs < 0.05), ] cat("Loci with stage-dependent treatment effect (FDR < 0.05):", nrow(dml_intx), "\n") ``` ## Loci with stage-dependent treatment effect (FDR < 0.05): 14 # 6 Save outputs ``` r save_bed <- function(df, path, score_col) { # callDMR() returns NULL when no regions pass; callDML() can return 0 rows. # Write an empty .bed in that case rather than erroring, so a knit completes. if (is.null(df) || nrow(df) == 0) { file.create(path) message("save_bed: no rows for ", basename(path), " — wrote empty file.") return(invisible(NULL)) } # Region tables (callDMR) carry chr/start/end; single-base DML tables # (DMLtest/callDML) carry chr/pos — derive a 0-based, half-open interval. if (all(c("chr","start","end") %in% names(df))) { start <- df$start; end <- df$end } else if (all(c("chr","pos") %in% names(df))) { start <- df$pos - 1L; end <- df$pos } else { stop("save_bed: df lacks chr/start/end or chr/pos for ", basename(path), " - columns are: ", paste(names(df), collapse=", ")) } score <- if (score_col %in% names(df)) df[[score_col]] else NA_real_ bed <- data.frame(chr = df$chr, start = start, end = end, score = score) write.table(bed, path, quote = FALSE, sep = "\t", row.names = FALSE, col.names = FALSE) } # Site-level tables write_tsv(test_trt, file.path("../output/10.01-diff-methyl-DSS-CTmask", "multifactor_treatment_test.tsv")) write_tsv(test_intx, file.path("../output/10.01-diff-methyl-DSS-CTmask", "multifactor_interaction_test.tsv")) # Region-level BEDs (multifactor DMR uses `areaStat` as region-level test statistic) save_bed(dmr_trt, file.path("../output/10.01-diff-methyl-DSS-CTmask", "treatment_DMR.bed"), "areaStat") ``` # 7 Two-group smoothed test within each stage Also want to try within-stage tests with DSS. For non-multifactor tets, DSS makes use of smoothing and dispersion shrinkage to essentiallys “borrow” info across neighboring CpG sites. This cvan be useful for handling low-coverage libraries, which is an existing problem with the zygot libraries. It also produces effect estimates of the same type as `methylKit` (% methylation difference), which could be useful for more direct comparisons to the conventions used in Rondon et al. 2017 and Venkataraman et al. 2024. It would also be useful for questions involving directional concordance (hyper- v hypo-methylation) WARNING: Both the Zygote and Larvae stage-specific DMLtest() runs are **very** memory-intensive. I’ve needed to up the node request to ~300G just to successfully complete them, and it takes a while to finish. ``` r run_stage <- function(stage_label) { s_idx <- which(meta$stage == stage_label) BS_s <- BSobj[, s_idx] g_exp <- meta$sample[s_idx][meta$treatment[s_idx] == "Exposed"] g_ctrl <- meta$sample[s_idx][meta$treatment[s_idx] == "Control"] dml <- DMLtest(BS_s, group1 = g_exp, group2 = g_ctrl, smoothing = TRUE) out <- list( dml = callDML(dml, delta = 0.25, p.threshold = 0.01), dmr = callDMR(dml, delta = 0.10, p.threshold = 0.01, minlen = 50, minCG = 3, dis.merge = 100, pct.sig = 0.5) ) # write per-stage results to disk immediately, so a later crash can't lose them saveRDS(dml, file.path("../output/10.01-diff-methyl-DSS-CTmask", paste0(stage_label, "_DMLtest.rds"))) write_tsv(as.data.frame(dml), file.path("../output/10.01-diff-methyl-DSS-CTmask", paste0(stage_label, "_DMLtest.tsv.gz"))) rm(dml, BS_s); gc() out } res_zyg <- run_stage("Zygote"); gc() ``` ## Smoothing ... ## Estimating dispersion for each CpG site, this will take a while ... ## Computing test statistics ... ## used (Mb) gc trigger (Mb) max used (Mb) ## Ncells 10575024 564.8 26981909 1441.0 26981909 1441.0 ## Vcells 977422682 7457.2 2944828186 22467.3 2944811133 22467.2 ``` r res_lar <- run_stage("Larvae"); gc() ``` ## Smoothing ... ## Estimating dispersion for each CpG site, this will take a while ... ## Computing test statistics ... ## used (Mb) gc trigger (Mb) max used (Mb) ## Ncells 10575086 564.8 26981909 1441.0 26981909 1441.0 ## Vcells 977528981 7458.0 2947643566 22488.8 2947643566 22488.8 ``` r cat("Zygote: DMLs =", nrow(res_zyg$dml), " DMRs =", nrow(res_zyg$dmr), "\n") ``` ## Zygote: DMLs = 7192 DMRs = 5128 ``` r cat("Larvae: DMLs =", nrow(res_lar$dml), " DMRs =", nrow(res_lar$dmr), "\n") ``` ## Larvae: DMLs = 5214 DMRs = 4590 Use existing `.rds` saves if available ``` r # summarise_stage <- function(stage) { # rds <- file.path("../output/10.01-diff-methyl-DSS-CTmask", paste0(stage, "_DMLtest.rds")) # if (!file.exists(rds)) { # message(stage, ": ", basename(rds), " not found — skipping") # return(NULL) # } # # dml_test <- readRDS(rds) # the full DMLtest() output (per-CpG stats) # # # Called DMLs and DMRs (same thresholds as the 06.3 run) # dmls <- callDML(dml_test, delta = 0.25, p.threshold = 0.01) # dmrs <- callDMR(dml_test, delta = 0.10, p.threshold = 0.01, # minlen = 50, minCG = 3, dis.merge = 100, pct.sig = 0.5) # # # callDMR returns NULL if no regions pass # n_dmr <- if (is.null(dmrs)) 0L else nrow(dmrs) # # cat("\n===", stage, "===\n") # cat("CpG sites tested: ", nrow(dml_test), "\n") # cat("DMLs (|diff|>0.25, p<0.01):", nrow(dmls), "\n") # cat(" hyper (exposed > control):", sum(dmls$diff > 0), "\n") # cat(" hypo (exposed < control):", sum(dmls$diff < 0), "\n") # cat("DMRs: ", n_dmr, "\n") # if (n_dmr > 0) { # cat(" mean DMR length (bp): ", round(mean(dmrs$length), 1), "\n") # cat(" mean CpGs per DMR: ", round(mean(dmrs$nCG), 1), "\n") # } # # invisible(list(test = dml_test, dml = dmls, dmr = dmrs)) # } # # zyg <- summarise_stage("Zygote") # lar <- summarise_stage("Larvae") ``` # 8 Save outputs ``` r # Per-stage DML BEDs (diff = mu1 - mu2 = exposed - control) save_bed(res_zyg$dml, "../output/10.01-diff-methyl-DSS-CTmask/zygote_DML.bed", "diff") save_bed(res_lar$dml, "../output/10.01-diff-methyl-DSS-CTmask/larvae_DML.bed", "diff") # Region-level BEDs (diff.Methy is exposed - control at the region level) save_bed(res_zyg$dmr, "../output/10.01-diff-methyl-DSS-CTmask/zygote_DMR.bed", "diff.Methy") save_bed(res_lar$dmr, "../output/10.01-diff-methyl-DSS-CTmask/larvae_DMR.bed", "diff.Methy") ```