How to get the intersection of peaks after peak calling using MACS2? I have following 5 narrow peak files after peak calling.

K14_peaks.narrowPeak
K15_peaks.narrowPeak
K16_peaks.narrowPeak
K3_peaks.narrowPeak
K8_peaks.narrowPeak


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 &gt; intersected.bed


Can someone help me?
Thank you.
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.


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.