Merge regions in bedgraph file
I have a bedgraph file with the chromosome, start and end point, and the coverage:
CM000994.3 10167710 10167711 95
CM000994.3 10167718 10167720 95
I want to merge regions that are close together.
With a bed file I could use something like this:
bedtools merge -d 1000 -i file.bed >file.merged.bed
Is there a similar thing for bedgraph files? I could convert to bed and then merge, but then I loose the information about coverage.
• 2,091 views
•
link
1 answer
Thanks. I was able to do this with:
bedtools merge -d 1000 -c 4 -o sum -i Coverage.bedgraph > Coverage.merged.bedgraph
• 0 views
•
link
Log in to answer this question.
bedGraphs are BED files, and
bedtools mergehas options-cand-owhich determine how it should summarize additional columns of overlapping regions, e.g. summing, averaging. Check the help section ofbedtools merge.