Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Extract methylation calls from Bismark BAM files using bismark_methylation_extractor. Generates per-cytosine reports for CpG, CHG, and CHH contexts. Use when extracting methylation levels from aligned bisulfite sequencing data for downstream analysis.
.claude/skills/bio-methylation-calling/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | — | — |
| case-15 | ✗→✓ | ▲ Improved | — | — |
| case-17 | ✗→✓ | ▲ Improved | — | — |
| case-18 | ✗→✓ | ▲ Improved | — | — |
| case-19 | ✗→✓ | ▲ Improved | — | — |
Reference examples tested with: pandas 2.2+
Before using code patterns, verify installed versions match. If versions differ:
pip show <package> then help(module.function) to check signatures<tool> --version then <tool> --help to confirm flagsIf code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
"Extract methylation calls from my Bismark BAM" → Generate per-cytosine methylation reports (CpG, CHG, CHH contexts) from aligned bisulfite sequencing data.
bismark_methylation_extractor --bedGraph --cytosine_report sample.bambash# Extract methylation calls from Bismark BAM bismark_methylation_extractor --gzip --bedGraph \ sample_bismark_bt2.bam
bashbismark_methylation_extractor --paired-end --gzip --bedGraph \ sample_bismark_bt2_pe.bam
bashbismark_methylation_extractor \ --paired-end \ # For paired-end data --gzip \ # Compress output --bedGraph \ # Generate bedGraph file --cytosine_report \ # Genome-wide cytosine report --genome_folder /path/to/genome/ \ # Required for cytosine_report --buffer_size 10G \ # Memory buffer --parallel 4 \ # Parallel extraction -o output_dir/ \ sample.bam
bash# Most common - extract only CpG methylation bismark_methylation_extractor \ --paired-end \ --no_overlap \ # Avoid double counting overlapping reads --gzip \ --bedGraph \ --CX \ # Also extract CHG/CHH (optional) sample.bam
bash# Comprehensive report with all CpGs in genome bismark_methylation_extractor \ --paired-end \ --gzip \ --bedGraph \ --cytosine_report \ --genome_folder /path/to/genome/ \ sample.bam
bash# Default: strand-specific output # CpG_OT_sample.txt - Original Top strand # CpG_OB_sample.txt - Original Bottom strand # CpG_CTOT_sample.txt - Complementary to OT # CpG_CTOB_sample.txt - Complementary to OB # Merge strands (CpG methylation is usually symmetric) bismark_methylation_extractor --merge_non_CpG --gzip sample.bam
bash# For paired-end data with overlapping reads bismark_methylation_extractor \ --paired-end \ --no_overlap \ # Ignore overlapping portion of read 2 --gzip \ sample_pe.bam
bash# bismark2bedGraph creates coverage file bismark_methylation_extractor --bedGraph --gzip sample.bam # Or run separately bismark2bedGraph -o sample CpG_context_sample.txt.gz # Coverage format: chr start end methylation_percentage count_meth count_unmeth
bash# bedGraph to BigWig (requires UCSC tools) bedGraphToBigWig sample.bedGraph.gz chrom.sizes sample.bw
bash# Check for methylation bias across read positions bismark_methylation_extractor --paired-end \ --mbias_only \ # Only generate M-bias plot sample.bam # Generates sample.M-bias.txt and sample.M-bias_R1.png, sample.M-bias_R2.png
bash# Ignore positions with systematic bias (found from M-bias plot) bismark_methylation_extractor \ --paired-end \ --ignore 2 \ # Ignore first 2 bp of read 1 --ignore_r2 2 \ # Ignore first 2 bp of read 2 --ignore_3prime 2 \ # Ignore last 2 bp of read 1 --ignore_3prime_r2 2 \ # Ignore last 2 bp of read 2 sample.bam
bash# Main output files: # CpG_context_sample.txt.gz - Per-read CpG methylation # sample.bismark.cov.gz - Coverage file # sample.bedGraph.gz - bedGraph for visualization # sample.CpG_report.txt.gz - Genome-wide CpG report (with --cytosine_report) # Coverage file format: # chr start end methylation% count_methylated count_unmethylated
pythonimport pandas as pd cov = pd.read_csv('sample.bismark.cov.gz', sep='\t', header=None, names=['chr', 'start', 'end', 'meth_pct', 'count_meth', 'count_unmeth']) cov['coverage'] = cov['count_meth'] + cov['count_unmeth'] cov_filtered = cov[cov['coverage'] >= 10]
| Parameter | Description | |-----------|-------------| | --paired-end | Paired-end mode | | --gzip | Compress output | | --bedGraph | Generate bedGraph | | --cytosine_report | Full genome cytosine report | | --genome_folder | Path to genome (for cytosine_report) | | --CX | Report CHG/CHH contexts | | --no_overlap | Avoid counting overlapping reads twice | | --parallel | Parallel extraction threads | | --mbias_only | Only M-bias analysis | | --ignore N | Ignore first N bp of read 1 | | --ignore_r2 N | Ignore first N bp of read 2 |
| Format | Description | Use Case | |--------|-------------|----------| | CpG_context | Per-read methylation calls | Detailed analysis | | .bismark.cov | Per-CpG coverage summary | methylKit input | | .bedGraph | Methylation track | Genome browser | | .CpG_report | All genome CpGs | Comprehensive analysis |
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +36 percentage points is the difference between those two pass rates over the 22 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.