Hi all,

While working on a ChIP-Seq data set consisting out of 16 samples I want to see the differences in peak height. To achieve this I first need a merged peak location. To achieve this I was thinking of a tool which could merge all 16 of my peak files at once. E.G. bedtools merge / multiinter. Only thing is that I have the feeling this is not exactly what I want and it becomes difficult to see if bedtools does a good job here.

I want to achieve a peak location in the following way:

A: start = 25 : end = 50  
B: start = 30 : end = **65**  
C: start = **20** : end = 45  
MERGED: start = 20 : end = 65

Which tool/ mode from bedtools can achieve this result. Any hints are very much appreciated. Thanks!

Sander
This should do it, concatenate peak locations in all peaks, sort them and merge

    cat A B C .... | sort -k1,1 -k2,2n | mergeBed -i stdin > locations.bed

To know which files the peaks co-ordinates are merged from, you need to have an identifier in each file before merging.

Use

    awk '{print $0"\t","peakFile-"NR}' A > A_id

This will add a new last column with label "peakFile-1" incremented per row, which will be nice, if you want to track later, which exact and how many peaks were used from which file for the current peak merge. I leave it you to implement a loop to label all the files automatically. Once its done, use the `collapse `operator from mergeBed.

    cat A_id B_id C_id .... | sort -k1,1 -k2,2n | mergeBed -i stdin - o collapse -c 4

where `c` is the column number having the id's we just entered before.

Output:

    chr1    20    65     peakFile-3, peakFile-1, peakFile-2

Enjoy!