Optimized DMR analysis based on bimodal normal distribution model and cost function for regional methylation analysis.
Li S, Garrett-Bakelman FE, Akalin A, Zumbo P, Levine R, To BL, Lewis ID, Brown AL, D'Andrea RJ, Melnick A, Mason CE. An optimized algorithm for detecting and annotating regional differential methylation. BMC Bioinformatics. 2013;14 Suppl 5:S10.
install.packages( c("data.table", "mixtools", "devtools"))
source("http://bioconductor.org/biocLite.R")
biocLite(c("GenomicRanges","IRanges"))
# install from github
library(devtools)
install_github("edmr", username = "ShengLi",build_vignettes=FALSE)
Step 1. Load add-on packages and example data
library(edmr)
library(GenomicRanges)
library(IRanges)
library(mixtools)
library(data.table)
data(edmr)
Step 2. myDiff evalution and plotting
# fitting the bimodal normal distribution to CpGs distribution
myMixmdl=myDiff.to.mixmdl(myDiff, plot=T, main="example")
# plot cost function and the determined distance cutoff
plotCost(myMixmdl, main="cost function")
Step 3. Calculate DMRs
# calculate all DMRs candidate
mydmr=edmr(myDiff, mode=1, ACF=TRUE)
# further filtering the DMRs
mysigdmr=filter.dmr(mydmr)
## annotation
# get genebody annotation GRangesList object
genebody.file=system.file("extdata", "hg19_refseq_all_types.bed.gz", package = "edmr")
genebody=genebody.anno(file=genebody.file)
# plot the eDMR genebody annotation
plot.dmr.distr(mysigdmr, genebody, main="eDMR genebody annotation", xlab="DMR count")
# get CpG islands and shores annotation
cpgi.file=system.file("extdata", "hg19_cpgisland_all.bed.gz", package = "edmr")
cpgi=cpgi.anno(file=cpgi.file)
# plot the eDMR CpG islands and shores annotation
plot.dmr.distr(mysigdmr, cpgi, main="eDMR CpG islands and shores annotation", xlab="DMR count")
# prepare genes for pathway analysis with significant DMRs at its promoter regions
dmr.genes=get.dmr.genes(myDMR=mysigdmr, subject=genebody$promoter, id.type="gene.symbol")
dmr.genes