modkit icon indicating copy to clipboard operation
modkit copied to clipboard

Modkit pileup extract multiple modifications

Open gaoxiangcao opened this issue 7 months ago • 1 comments

Hi,

After basecalling, my modBAM contains multiple types of base modifications. I want to extract each modification type separately using modkit pileup, but I noticed that the --ignore option seems to only accept one mod code at a time. How can I filter out multiple modification types during pileup?

Thanks!

gaoxiangcao avatar May 23 '25 21:05 gaoxiangcao

Hello @gaoxiangcao,

I would not recommend using --ignore as a way to select bedMethyl records. If you want to select records by their modification code I would use something like awk or a program for handling tabular data. For example:

$ modkit pileup reads.bam - --header \
    | tee >(awk '(NR==1)||($4=="a")' > pileup_a.bed) \
    | tee >(awk '(NR==1)||(($4=="m")||($4=="h"))' > pileup_hm.bed) \
    > pileup_all.bed # or /dev/null if you want to discard it

If you want to quickly see which modification codes are in your modBAM, use modkit modbam check-tags reads.bam --head 1000

Hope this helps.

ArtRand avatar May 27 '25 23:05 ArtRand