Merge regions in bedgraph file
1
0
Entering edit mode
3.4 years ago
eoneill627 ▴ 20

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.

bedgraph • 1.5k views
ADD COMMENT
1
Entering edit mode

bedGraphs are BED files, and bedtools merge has options -c and -o which determine how it should summarize additional columns of overlapping regions, e.g. summing, averaging. Check the help section of bedtools merge.

ADD REPLY
0
Entering edit mode
3.4 years ago
eoneill627 ▴ 20

Thanks. I was able to do this with:

bedtools merge -d 1000 -c 4 -o sum -i Coverage.bedgraph > Coverage.merged.bedgraph
ADD COMMENT

Login before adding your answer.

Traffic: 1559 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