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!
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!
2 answers
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?
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)?
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!
Log in to answer this question.