This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Question about Bedtools intersect: allows for multiple matches?

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 answer

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

Log in to answer this question.