I am trying to use broadPeak package on my ChIP-seq data. As an input file I should provide "...The input file of the sorted ChIP-seq read-mapping profile in the genome needs to be in bedGraph format. The four tab-delimited columns are chromosome, start, stop and tag count. ...... The size of each record (the bin) should be equal (e.g. 200bp, if you scan the genome by dividing it to 200bp non-overlapping bins)..".
I wonder if there is an established and straightforward way to create such bedGraph file with windows of a fixed size from a sorted bam file? I failed to find some ready-to-use scripts a la bamtoBedGraph conversion. As far as I understand the one from the bedtools genomeCoverage doesn't allow you to choose windows where you want to count reads.
Does anyone know the way how to do it relatively easy and fast? My only guess is to create a bed file with a genome divided into regions of required size. Convert it into GFF and then annotate with the reads count. But I think that it will be very slow and I guess not very elegant way to solve the problem.
Any piece of advice will be appreciated!