This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How To Pile Up Multiple Bed Files Into 1 File

I want to pileup a set of BED files (all from H3K4me3) to see some generic site of this Histone Modification.

However, I haven't found a suitable tool to do that..

I'm using a awkward way to do that, like this:

  1. cat all BED files into 1 BED file
  2. use bedtools to convert the BED file to BAM file
  3. use samtools' mpileup command to pileup the BAM file

At last, the result is a large BAM file and very time-consuming.

Does anybody know a easier way to do that?

bed pileup sam bam intersect

3 answers

You could use pipes to help with streamlining the steps, if you're not already. You could try bedtools genomeCoverageBed to do the pileup instead of samtools.

Do you want to do a display like they have for the histone modifications on the UCSC browser now? Those are called "multi wig". See if this info helps: http://biowhat.ucsd.edu/homer/ngs/ucsc.html

No, it's not multiple wiggle file. It's multiple BED file. I just want to find some peaks appears in most of the H3K4me3 samples

The BEDOPS tool called bedops will merge your BED data for you:

$ bedops --everything *.bed > merged.bed

You could convert data faster by piping output to bed2bam, which supports standard input:

$ bedops --everything *.bed | bed2bam -a stdin -g chrlist.txt > merged.bam

Log in to answer this question.