This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Dfference between intersectBed and multiIntersectBed

When I compare the two bed files using intersectBed and multiIntersectBEd, I see different results like:

multiIntersectBed -i R1_merge.bg R2_merge.bg | grep "gi|589289284|ref|NW_006711693.1|"

gi|589289284|ref|NW_006711693.1|    43585    43665    1    1    1    0
gi|589289284|ref|NW_006711693.1|    43585    43665    1    2    0    1
intersectBed -a R1_merge.bg -b R2_merge.bg | grep "gi|589289284|ref|NW_006711693.1|"

gi|589289284|ref|NW_006711693.1|    43585    43665

From multiIntersectBed, I am expecting something like:

gi|589289284|ref|NW_006711693.1|    43585    43665    2    1,2    1    1

Though the coordinates are the same, I do not understand why multiIntersectBed showing them in two separate lines ? I could not figure out the problem here.

genome bedtools

It works after sorting both the files again. But I do not understand how the intersectBed is working without sorting.

The intersect tool has alternate, tree-based method for finding intersections without sorting. It is slower and requires more memory, however.

That's interesting. Thanks.

1 answer

Not to leave it as an open question, I'm answering it.

Intersectbed can also work without sorting the bed file. But multiintersectBed requires sorted bed file.

Log in to answer this question.