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

<p>It should work like this :</p>

<pre><code>multiIntersectBed -i SRR2920506.filtered.bed SRR2920531.filtered.bed SRR2920466.filtered.bed SRR2920478.filtered.bed SRR2920507.filtered.bed SRR2920532.filtered.bed  &gt; answer.bed
</code></pre>

<p>To sort your bedfiles by chromosome then by start :</p>

<pre><code>sort -k 1,1 -k2,2n myfile.bed
</code></pre>

CC BY-SA 4.0
2019-11-21T16:27:54.093Z
ERROR: input file: (SRR2920466.filtered.bed) is not sorted by chrom then start. this came as i tried with multiIntersectBed
kcm
CC BY-SA 4.0
2019-11-21T16:36:34.090Z
Yep this is described as the second line of the usage. I just updated the answer
Paul Endymion
CC BY-SA 4.0
2019-11-21T16:26:59.547Z
2019-11-21T16:33:25.133Z
2019-11-21T16:33:25.133Z
Paul Endymion
<p>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 .</p>

<p>So i tried with bedtool intersect </p>

<pre><code>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  &gt; answer.bed
</code></pre>

<p>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."</p>

<p>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?</p>

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

<p>Any suggestion or help regarding how to intersect multiple would be really appreciated </p>

<bedtools>
bedtool intersect multiple bed files
# bedtool intersect multiple bed files

(Asked by: username_0 on 2019-11-21)

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

**Tags:** bedtools

---

## 1 answers

### Answer by username_1 on 2019-11-21. Score: 5 | Accepted answer

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

> **Comments:**
> **username_0**: ERROR: input file: (SRR2920466.filtered.bed) is not sorted by chrom then start. this came as i tried with multiIntersectBed  
> **username_1**: Yep this is described as the second line of the usage. I just updated the answer  

---

