1
$\begingroup$

I have 7 biological replicate of a normal sample after peak-calling I converted it into bed files and now I want to find what are the common region between those .

So i tried with bedtool intersect

my command is this 
bedtools intersect -a SRR2920506.filtered.bed -b SRR2920531.filtered.bed SRR2920466.filtered.bed SRR2920478.filtered.bed SRR2920507.filtered.bed SRR2920532.filtered.bed  > answer.bed

it says " the intersect tool can detect overlaps between a single -a file and multiple -b files (instead of just one previously). One simply provides multiple -b files on the command line."

My doubt is the file that goes to "a" argument is not query which i have to detect overlaps against "b" files as these are all biological replicate. Am i doing the right way?

Secondly I tried with bedops but the number of overlaps which is reported is really low when i compare the result which i get from bedtools intersect function.

Any suggestion or help regarding how to intersect multiple would be really appreciated

$\endgroup$
3
$\begingroup$

If you want to find the intersection between ALL your bedfiles, you can try multiIntersectBed (available since bedtools 2.14.3).

It should work like this :

multiIntersectBed -i SRR2920506.filtered.bed SRR2920531.filtered.bed SRR2920466.filtered.bed SRR2920478.filtered.bed SRR2920507.filtered.bed SRR2920532.filtered.bed  > answer.bed

To sort your bedfiles by chromosome then by start :

sort -k 1,1 -k2,2n myfile.bed
$\endgroup$
  • $\begingroup$ ERROR: input file: (SRR2920466.filtered.bed) is not sorted by chrom then start. this came as i tried with multiIntersectBed $\endgroup$ – krushnach Chandra Nov 21 at 16:27
  • 1
    $\begingroup$ Yep this is described as the second line of the usage. I just updated the answer $\endgroup$ – Paul Endymion Nov 21 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.