Collapse bed and only sum overlapping parts
1
0
Entering edit mode
3.8 years ago
Matthias ▴ 30

Hi,

I have a bed that looks something like this:

chr1    150000    170000    feature    10    +
chr1    160000    180000    feature    10    +

I want a way to sum the scores in only the overlapping regions, like this:

chr1    150000    160000    feature    10    +
chr1    160000    170000    feature    20    +
chr1    170000    180000    feature    10    +

Does anyone have any ideas how to do this? I wrote a super chunky python script, but its super computationally intensive and there must be a better way.

Thanks!

bed RNA-Seq alignment • 609 views
ADD COMMENT
2
Entering edit mode
3.8 years ago
Matthias ▴ 30

Figured out a bedops bedmap option:

bedops --partition my.bed |  bedmap --echo --sum --delim '\t' - my.bed

Input bed needs to be sorted first.

ADD COMMENT

Login before adding your answer.

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