← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / skills / bioskills / bio-methylation-analysis-methylation-calling / references / usage-guide.md

Methylation Calling - Usage Guide

Overview

Methylation calling extracts a per-cytosine methylation level, the beta value M/(M+U), from an aligned bisulfite or EM-seq BAM. The extractor counts reads that show a retained C (methylated) versus a converted T (unmethylated) at each reference cytosine and divides. Two extractor families exist and the choice is dictated by the aligner: bismark_methylation_extractor reads a Bismark BAM (it consumes Bismark's own XM call string), while MethylDackel and BISCUIT recompute calls from BAM plus reference and work on bwa-meth BAMs, which carry no XM tag. The output is a coverage file, a bedGraph track, or a genome-wide cytosine report spanning CpG (and, for plants, CHG/CHH) context. Because a beta is a count ratio rather than a measurement, the trustworthiness of every number depends on conversion efficiency, variant-awareness, overlap handling, and the 5mC vs 5hmC conflation.

Prerequisites

conda install -c bioconda bismark methyldackel samtools
# Optional, aligner-dependent:
conda install -c bioconda biscuit   # SNP-aware / allele-specific methylation

bismark_methylation_extractor --version
MethylDackel --version

Conceptual prerequisites: - A deduplicated, aligned bisulfite/EM-seq BAM (WGBS or PBAT deduplicated; RRBS NOT deduplicated). See bismark-alignment. - The genome FASTA used for alignment (mandatory for the Bismark cytosine report and for MethylDackel/BISCUIT, which recompute calls against it). - An unmethylated lambda spike-in is strongly recommended at library prep and is mandatory in plants, ESCs, and neurons, where non-CpG methylation is real biology and the CHH-as-conversion proxy fails. - The extractor must match the aligner: a bwa-meth BAM has no XM tag and cannot be read by bismark_methylation_extractor.

Quick Start

Tell your AI agent what you want to do: - "Extract CpG methylation from my Bismark BAM and make a methylKit coverage file" - "My WGBS was aligned with bwa-meth, extract methylation with MethylDackel" - "Check the bisulfite conversion rate before I trust these betas" - "Call methylation SNP-aware so C/T variants are not read as unmethylation" - "Extract all contexts for my plant methylome"

Example Prompts

Conversion-rate QC first

"Before extracting CpG betas, report my bisulfite conversion efficiency from the CHH rate, and tell me whether I need a lambda spike-in for this tissue."

Bismark extraction

"Run methylation extraction on my deduplicated paired-end Bismark BAM, merge the symmetric CpG dyads, produce a genome-wide cytosine report, and trim the R2 5' end-repair artifact based on the M-bias plot."

bwa-meth / MethylDackel

"This BAM was aligned with bwa-meth. Extract per-CpG methylation with MethylDackel, merge contexts, and exclude likely C/T SNP positions."

Variant-aware and allele-specific

"I am analyzing a human cohort. Call methylation jointly with SNPs so polymorphic CpGs are not miscalled, and phase the reads to test allele-specific methylation at known imprinted loci."

Plant / non-CpG

"Extract CpG, CHG, and CHH methylation for my Arabidopsis sample and report the conversion rate from the lambda spike-in, not from CHH."

What the Agent Will Do

  1. Confirm the aligner (Bismark vs bwa-meth) and pick the matching extractor.
  2. Measure conversion efficiency from the CHH rate (mammals) or a lambda spike-in (plants/ESC/neurons) and gate on >=99% before trusting any beta.
  3. Inspect the M-bias plot and set end-trim bounds from the flat region, not a fixed level.
  4. Extract per-cytosine calls in the requested context, merging the symmetric CpG dyad where appropriate.
  5. Apply variant-awareness for human/population data so a C/T SNP is not scored as unmethylation.
  6. Produce coverage/bedGraph/cytosine-report output, noting the coordinate base (cov and cytosine report 1-based; bedGraphs 0-based), and hand count data (not pre-thresholded betas) to downstream testing.

Output Files

File Content Coordinate base Downstream use
*.bismark.cov(.gz) per-CpG M/U summary 1-based methylKit input
.bedGraph(.gz) / _CpG.bedGraph methylation track 0-based IGV / UCSC
*.CpG_report.txt(.gz) every genome cytosine 1-based bsseq input
*_splitting_report.txt per-context % methylated n/a conversion-rate QC
BISCUIT pileup VCF / epiBED joint methylation+SNP / per-read epialleles per spec SNP-aware betas, ASM

Tips