I have following 5 narrow peak files after peak calling.


I need to get the intersection of peaks into a new file (The peaks that represent all these files). I used following code but I got higher number of peaks not a lower number.

bedtools intersect -a K14_peaks.narrowPeak -b K15_peaks.narrowPeak K16_peaks.narrowPeak K3_peaks.narrowPeak K8_peaks.narrowPeak -wo > intersected.bed

Can someone help me? Thank you.


1 Answer 1


bedtools intersect with multiple files after -b performs pairwise intersections between -a and each file in -b. It does not intersect all files simultaneously. See here, from the Bedtools documentation. The green section only contains intervals from -a that also intersect at least one interval in any -b file. Bedtools intersect

What I think you're looking for is bedtools multiinter (documentation here is unfortunately blank). bedtools multiinter -i input [input...] will produce a BED file that covers every position listed in your input files, followed by how many and which of your input samples overlap that given position.

You can use this BED file and create something like an UpSet plot to visualize how many bases/peaks are shared between any combination of your samples.

  • $\begingroup$ Thank you very much. Do you think is it ok do intersection one by one? I did it one by one. First intersecting the first two and generating the intersected file and then intersected file is again intersected with the third one. I got less peaks in this manner. Is it ok to do that? $\endgroup$
    – MudithMMBc
    Mar 10, 2020 at 17:46
  • $\begingroup$ It's not wrong to do it this way, no. But it is more difficult, takes longer, and you lose a lot of information in the process. If you use multiinter, you can later select that regions supported by all samples with awk '{if ($4 == x) print}' where x is the number of samples (5 in your case). And you haven't gotten rid of the sites that are supported by 3 or 4 samples, say. $\endgroup$ Mar 11, 2020 at 17:01
  • $\begingroup$ Oh. I'll try that way. Thank you very much. $\endgroup$
    – MudithMMBc
    Mar 11, 2020 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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