MODKIT_BEDGRAPH produces empty output when pileup run with --combine-mods

Open Beginner friendly
#91 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
awk

Research direction

Start with modules/local/bed2bedgraphs/modkit_bedgraphs/main.nf and inspect the awk filter against pileup output produced with --combine-mods. Reproduce the command from the issue, verify the column format and strand/mod conditions, and confirm that the resulting bedgraph files contain methylation data rather than zero lines.

Written by the indexing model from the issue text.

Description

bug
Description of the bug

I ran the ONT workflow (pipeline version 2.0.0) with --combine-mods in the pileup step. The bedgraph output files came out empty for all 4 of my samples. There was no error or warning, they just have 0 lines.

Command I used for pileup (matches what the pipeline ran internally):

modkit pileup --motif CG 0 --combine-mods --ref <reference.fa> <input.bam>

What I think might be happening is that with --combine-mods, modkit writes just a bare base letter (e.g. C) into column 4 of the pileup output, instead of a base,context,offset triplet like C,CG,0.

The bedgraph conversion script (modules/local/bed2bedgraphs/modkit_bedgraphs/main.nf) filters on column 4 expecting that triplet format:

awk -v strand=$strand -v mod=$mod 'BEGIN{OFS="\t"} (($4==mod) && ($6==strand)) && ($5 >= 5) {print $1,$2,$3,$11,$12,$13}' ${in_bed}

where mod is one of "C,CHH,0", "C,CHG,0", "C,CG,0", "A,A,0".

Since column 4 in my pileup output is just "C", it never matches any of those triplets, so the filter drops every row. This happens consistently across all 4 of my samples and all 8 output files (positive/negative strand × 4 mod/context combos).

To reproduce:

  1. Run the ONT workflow with --combine-mods set in the pileup step.
  2. Check the resulting *.bedgraph.gz files, they'll have 0 lines.

Expected: bedgraph files should contain the methylation data from the pileup step.
Actual: bedgraph files are empty, with no error reported anywhere in the log.
Workaround: I pulled methylation data directly from the pileup .bed.gz output instead, which seems unaffected by this issue.

Command used and terminal output

Relevant files

No response

System information

No response

Dominant language
Nextflow
Stars
25
Forks
8
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nf-core/methylong

All issues in nf-core/methylong

Similar issues

More Bioinformatics issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.