I have BED files of ChIP-seq peaks with different conditions, and I would like to make a heatmap showing the similarity/overlap between the peaks.
I have designed a program to take in bedtools intersect overlaps by using a double for loop. The program builds a CSV and heatmap based on the information provided in this double for loop below. I was wondering if a bedtools intersect double for loop would be the best way to find the similarity/overlap between peaks?
for i in *bed; do for j in *bed; do echo $i $j;bedtools intersect -u -a $i -b $j | wc -l; done; done
The reason I'm asking this is because
bedtools intersect -u -a test1 -b test2 | wc -l
can give a different result from
bedtools intersect -u -a test2 -b test1 | wc -l
causing the heatmap to be unsymmetrical.