Question about Bedtools intersect: allows for multiple matches?
1
0
Entering edit mode
5.0 years ago
fr ▴ 210

I have a binned genome (file G.bed) that I'm trying to intersect with another file (myfile.bed). It is possible that some of the bins in G.bed have multiple matches in myfile.bed).

I was going to use bedtools intersect -a G.bed -b myfile.bed -wo, or bedtools intersect -b G.bed -a myfile.bed -wo.

but if I understand correctly this will give the intersection to either file on a 1:1 relationship right? Or would it also add additional rows for multiple matches? (i.e. exploding rows)

Thanks a lot in advance

bedtools pybedtools • 1.1k views
ADD COMMENT
2
Entering edit mode
5.0 years ago

It will add additional rows for multiple matches:

$cat testerA.bed
chr1    100     200
chr1    150     250
chr1    500     1000

$cat testerB.bed
chr1    100     125
chr1    125     150
chr1    149     151
chr1    700     1000

$bedtools intersect -a testerA.bed -b testerB.bed -wo
chr1    100     200     chr1    100     125     25
chr1    100     200     chr1    125     150     25
chr1    100     200     chr1    149     151     2
chr1    150     250     chr1    149     151     1
chr1    500     1000    chr1    700     1000    300
ADD COMMENT

Login before adding your answer.

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