This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Merging Bam Files

Dear all,

I having trouble with analyzing my ChIP-seq data. I have an IP, input with replica (ChIP1, Input1, ChIP2, Input2). I merged the alignement files (.bam hg19) with bamtools merge, then called peaks. The problem is merging summs the reads at a given position. Like:

Example

So, the final goal is, how to merge the samples as the read numbers averaged not summed at same positions?

Regards, Laszlo

bam merge

1 answer

If you really want the average, the I would do what you did in the table above and count each sample separately and do the averaging at the count level. However, I suspect that is not something that you want to do, as the magnitude of count data is quite important.

Hi Davis,

I can count the read number for given regions with coverageBed for the samples, then create a coverage file that contains the average for the two, but from then you can't call peaks. I need to do this somehow manipulating sam/bam headers. Any suggestions?

L

If you want to call peaks, just merge the BAM files and call peaks. It is not possible to "average" two BAM files.

Log in to answer this question.