methylKit is the R/Bioconductor object model for short-read bisulfite (WGBS/RRBS) differential methylation. This skill owns the import-to-results spine: reading Bismark coverage or cytosine-report files into a methylRawList, then filtering by coverage, normalizing, uniting (with optional destranding), and testing for differential methylation at single CpGs (DMCs) or fixed tiles (DMRs). It also covers PCA/correlation/clustering QC and batch handling. The point that sets your results: filtering, normalization, destranding, and the overdispersion model are decisions that set the false-positive rate and which sites survive - the defaults offer no protection.
if (!require('BiocManager', quietly=TRUE)) install.packages('BiocManager')
BiocManager::install(c('methylKit', 'GenomicRanges', 'genomation', 'annotatr'))
Conceptual prerequisites:
- Bismark coverage (.cov/.cov.gz) or cytosine report (*.CpG_report.txt) input - produced upstream by methylation-calling. Destranding requires the cytosine report (the .cov format carries no strand).
- Biological replicates per group. Overdispersion correction and any valid inference need replicates; pooling them away invalidates the test.
- The genome build of the coverage files must match any annotation package used downstream; the assembly= string is metadata only.
- Large WGBS objects can exhaust memory - use dbtype='tabix', save.db=TRUE for disk-backed methylRawDB objects.
Tell your AI agent what you want to do: - "Load my Bismark coverage files into methylKit and run QC" - "Filter low-coverage CpGs, normalize, and unite my samples" - "Find differentially methylated CpGs with overdispersion correction" - "Run a fast tile-based DMR screen with methylKit" - "Check whether my samples cluster by treatment or by batch"
"Read my four Bismark coverage files into methylKit as two controls and two treated samples, then show coverage and methylation stats."
"Import my Bismark cytosine reports so I can destrand CpGs properly."
"Filter CpGs below 10x and above the 99.9th coverage percentile, then median-normalize coverage across samples before uniting."
"Generate PCA, sample correlation, and hierarchical clustering for my united methylation object and tell me whether samples separate by treatment."
"Test individual CpGs for differential methylation with MN overdispersion correction and BH adjustment, then report DMCs with at least a 25% difference at q < 0.01, split into hyper and hypo."
"Run a tile-based DMR screen at 1 kb windows requiring at least 3 covered CpGs per tile, and flag that the per-tile q is a screen, not a selection-corrected region FDR."
"My PC1 tracks sequencing batch - associate components with the batch covariate and remove the batch component before testing."
| Column | Description |
|---|---|
| chr, start, end | Genomic position of the CpG or tile |
| meth.diff | Methylation difference (%); positive = hyper in the higher-treatment group |
| pvalue | Raw p-value (F-test under MN, otherwise the chosen test) |
| qvalue | Adjusted p-value (SLIM by default; BH only if set) |
pipeline='bismarkCoverage' for .cov files and pipeline='bismarkCytosineReport' for CX/CpG reports; only the report enables proper destranding.overdispersion='MN' whenever replicates exist; the default 'none' over-calls. MN forces the F-test, so do not also pass test='Chisq' and expect a chi-square.adjust is SLIM, not BH. Set adjust='BH' if the q-values must be comparable to DSS, limma, or another tool.unite and BEFORE tileMethylCounts; tiling the raw object propagates artifacts.tileMethylCounts(cov.bases=) to at least 3 so a window needs real CpG support; the default 0 admits single-CpG "regions."pool() destroys biological replication; use it only for no-replicate exploratory visualization, never for the reported test.