This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to find overlapping regions in a single bed file

I have a .bed file from a ChIP-seq experiment that has some overlapping regions (peaks) across the genome.

How can I:

  • Find out how many regions overlap with at least one other region?
  • Determine how much overlap there is between each overlapping region?
chip-seq bed

1 answer

BEDOPS bedmap has --count and --bases operations for investigating self-overlaps or overlaps between BED file(s), e.g.,:

sort-bed peaks.bed | bedmap --echo --count --bases - > answer.bed

Ref. https://github.com/bedops/bedops

This appears to work, but is there a way to make the results output as new columns rather than output in a new row for each individual region.

This is what the output looks like:

chr1    4399801 4400245 peak_12659  719 .   32.37675    -1  1.92924 222
|1|444                                  
chr1    2495548 2495992 peak_11970  542 .   36.95443    -1  2.58372 222
|1|444                                  
chr1    3572002 3572264 peak_901    1000    .   148.62292   -1  3.94096 145
|1|262  

It makes sorting more cumbersome.

Add --delim '\t' if you want results in separate columns

I tried that and the output is in new columns, but still outputs in new rows:

chr1    4399801 4400245 peak_12659  719 .   32.37675    -1  1.92924 222
    1   444                         
chr1    2495548 2495992 peak_11970  542 .   36.95443    -1  2.58372 222
    1   444                         
chr1    3572002 3572264 peak_901    1000    .   148.62292   -1  3.94096 145
    1   262             

How can I have the output appear as columns in the same row as each peak?

Log in to answer this question.