I would like to compute the average score across multiple bed files (say from ChIP-seq) for a specific genomic region.
Let's say I have the following three bed files and I wish to compute the average score for chr1:10-20
<caption>a.bed</caption>chr | start | end | score |
chr1 | 10 | 20 | 3 |
<caption>b.bed</caption>
chr | start | end | score |
chr1 | 12 | 14 | 3 |
<caption>c.bed</caption>
chr | start | end | score |
chr1 | 16 | 18 | 3 |
The desired output I wish to obtain is the following
<caption>desired output</caption>chr | start | end | mean.score |
chr1 | 10 | 11 | 1 |
chr1 | 12 | 14 | 2 |
chr1 | 15 | 15 | 1 |
chr1 | 16 | 18 | 2 |
chr1 | 19 | 20 | 1 |
What is the best way or computationally inexpensive way of computing this without creating a data frame with the score column populated for every single bp for every single file?
https://www.biostars.org/p/329080/