Create bed file where each column is the number of intersections with another bed file
0
0
Entering edit mode
11 months ago
rxs1018 • 0

For example I have 3 bed files:

window.bed:

chr1    0   1000
chr1    1000    2000

lp1.bed:

chr1    20  50
chr1    1500    1900

lp2.bed:

chr1    68  786
chr1    899 987

How can I create this output in bed format:

chr1    0   1000    1   2
chr1    1000    2000    1   0

In this output columns 1, 2, 3 are the standard bed format cols, of the chromosome, start, and end of the features taken from window.bed above. Column 4 is the number of intersections between window.bed and lp1.bed per feature in window.bed. For example, the first element in column 4 is '1' because there is one intersection between window.bed and lp1.bed. Column 5 is the same but for the number of intersections between window.bed and lp2.bed for each feature in window.bed.

I suspect that it is doable with bedtools intersect, but I cannot work out the syntax.

bedtools • 320 views
ADD COMMENT

Login before adding your answer.

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