Disable automatic merging of consecutive windows in DeepTools bamcoverage
2
0
Entering edit mode
23 months ago

Hi all,

I'm using deeptools bamcoverage to output the coverage of my bam files window by window. For my analysis the windows have to be of constant size, but "If consecutive bins have the same number of reads overlapping, they will be merged" by the tool. Is there a way to disable this? I haven't seen anything in the documentation but maybe I'm blind. I realise I could find a way to correct this in R, but it is giving me a bit of a headache at the moment so I was wondering if there was an easy solution I've been perhaps overlooking...

Thanks!

bamcoverage deeptools • 1.4k views
ADD COMMENT
2
Entering edit mode
23 months ago
ATpoint 85k

That's not possible. bamCoverage produces bedGraph files and the format assumes that consecutive windows are merged. If you want something like a per-window count matrix then make first a window BED file with bedtools makewindows, then covert to SAF (Converting from BED to SAF/GFF) and then use featureCounts to get counts per window. Normalization can then be done with standard approaches such as DESeq2 or edgeR. Does that make sense?

ADD COMMENT
1
Entering edit mode

I see, I was working with the bigwig output, which made it seem like unmerged consecutive windows might be an option - thanks a lot for your suggestion though, I'll have a go at it and see how I get on!

ADD REPLY
1
Entering edit mode
23 months ago
Jack Tierney ▴ 410

This answer doesn't actually do what you ask but it may be an alternative way forward. Perhaps you could reverse engineer the file you want. By expanding bins that have been merged into x individual bins with the same score where x = (merged bin size) / (specified bin size)?

ADD COMMENT
0
Entering edit mode

Hey Jack, that's basically what I have been trying to do - I am sure it is possible I just haven't found the right way to execute it yet in R. I've managed to code all the merged bins as 1 and all the unmerged bins as 0 so the merged bins are easy to pull out and manipulate. However, I haven't found a way to generalize the expansion of merged bins into individual bins yet - I hope if I keep searching I'll stumble over the right function/ combination of functions!

ADD REPLY

Login before adding your answer.

Traffic: 1616 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6