I usually use bedtools intersect
to find overlapping regions of bed files, but it seems like this tool can only output overlap between a pair of files. I need something that can do the following from many bed files and only report regions contained in all of the bed files.
Example input from 4 separate bed files:
chr1 50 100
chr1 60 120
chr1 30 90
chr1 50 90
Desired output:
chr1 60 90
Any tools for this? Maybe I should just cat
all the bed files together and merge them?
I was able to find all overlapping regions of my BEDs using bedtools multiinter, although I had to filter the output to only keep regions found in all BEDs.
I'll try out bedops --intersect too since the output might be easier to keep in my pipeline. To sort the BEDs, I found bedtools sort worked great.
bedops --intersect
will give you the answer you want without additional steps.Thanks it was just one pipe to awk using bedtools, but I'm going to switch to bedops. +1 for every answer lol they're all good
I agree. I used the bedops --intersect and it has same functionality as bedtools multiinter and you won't require even filtering.