Hi Everyone, I am trying to go from a bam file to a bedgraph file where I have fixed intervals of 100bp.
chr1 0 100 4
chr1 100 200 5
chr1 200 300 6
...
I have used genomeCoverageBed to compute the coverage, but can I use it to output counts in fixed window sizes of 100bp?? I would like to use that because it has scaling option and that would make one less step downstream.
If not what can I use to include scaling factor and fixed window size? igvtools count?? or deeptools??
Thanks
1 answer
If you make a pre-binned bed for your genome, then plain old coverageBed should take that + bam file and give you bin counts or means. But, coverageBed does not take scaling factors. It writes to stdout, you could pipe it through awk to scale it.
It is also fairly quick in R, if you want to use R -- the code is a little complicated to set up, but you only have to do it once! -- see the rtracklayer package for reading BAMs into GRanges objects, and the GenomicRanges package for tileGenome() and viewApply() functions.
Log in to answer this question.