DSS package contains a function callDMR for returning differentially methylated regions using WGBS or RRBS data. One of the options for this function, dis.merge, will merge nearby regions into one large region, but this does not seem to be working. Using default parameters on my data, I've found two nearby DMRs at pos 73421855-73422132 and 73422191-73422850. The default setting is to keep regions >50bp apart as separate DMRs, but changing this value to 100 should merge them; this option doesn't seem to be working as I have tried changing it to 100, 1000, 10000, or 100000 without any change in the number of DMRs returned.
The commands I used were as follows:
library(DSS)
require(bsseq)
m_050 = read.table( "m_050/DSS_methylation_frequency_m.tsv", header = TRUE )
names(m_050) = c("chr", "pos", "N", "X")
p_064 = read.table( "p_064/DSS_methylation_frequency_p.tsv", header = TRUE )
names(p_064) = c("chr", "pos", "N", "X")
BSobj = makeBSseqData( list(m_050, p_064), c("m", "p") )
dmlTest.sm = DMLtest(BSobj, group1="m", group2="p", smoothing = TRUE)
dmrs = callDMR( dmlTest.sm, p.threshold = 0.01)
dmrs.str = callDMR( dmlTest.sm)
dmrs.str.merge = callDMR( dmlTest.sm, dis.merge = 10000)
No difference was observed in # DMRs returned in dmrs.str vs dmrs.str.merge
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] splines stats4 parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] DSS_2.30.1 bsseq_1.18.0 SummarizedExperiment_1.12.0 DelayedArray_0.8.0
[5] BiocParallel_1.16.6 matrixStats_0.55.0 GenomicRanges_1.34.0 GenomeInfoDb_1.18.2
[9] IRanges_2.16.0 S4Vectors_0.20.1 Biobase_2.42.0 BiocGenerics_0.28.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 compiler_3.5.2 XVector_0.22.0 R.methodsS3_1.7.1
[5] bitops_1.0-6 R.utils_2.9.0 tools_3.5.2 DelayedMatrixStats_1.4.0
[9] zlibbioc_1.28.0 rhdf5_2.26.2 lattice_0.20-38 BSgenome_1.50.0
[13] Matrix_1.2-15 GenomeInfoDbData_1.2.0 rtracklayer_1.42.2 Biostrings_2.50.2
[17] gtools_3.8.1 locfit_1.5-9.1 grid_3.5.2 data.table_1.12.6
[21] HDF5Array_1.10.1 XML_3.98-1.20 limma_3.38.3 Rhdf5lib_1.4.3
[25] scales_1.0.0 Rsamtools_1.34.1 GenomicAlignments_1.18.1 permute_0.9-5
[29] colorspace_1.4-1 RCurl_1.95-4.12 munsell_0.5.0 R.oo_1.23.0