Merge multiple BED files (multiple intersect) with average score
1
1
Entering edit mode
6.5 years ago
neuro3030 ▴ 50

Hi,

I have about 57 BED files with various overlapping intervals between them. I would like to merge them all, like with multiple intersect from BEDTools, but average the score associated with the overlap across the files. I see there is a function in MergeBED to add an additional column to average the score from overlapping intervals, but I don't see this for 'multiple intersect' for multiple files.

The caveat is my limited programming knowledge, so I use the Galaxy server. Is there a way to do this?

Thanks

BED • 5.4k views
ADD COMMENT
0
Entering edit mode

Thanks for this. However, I am unfamiliar with these programs and how to use them. I see they are not listed on the Galaxy server, is there an online version of these tools to upload the files for processing? Thanks

ADD REPLY
0
Entering edit mode

Please use ADD COMMENT or ADD REPLY to answer to previous reactions, as such this thread remains logically structured and easy to follow. I have now moved your reaction but as you can see it's not optimal. Adding an answer should only be used for providing a solution to the question asked.

ADD REPLY
5
Entering edit mode
6.5 years ago

To do this efficiently, you can use bedops and bedmap to calculate this over N files (N=57, in your case).

$ bedops -u A.bed B.bed ... N.bed > union.bed
$ bedops -m A.bed B.bed ... N.bed > merge.bed
$ bedmap --echo --mean --delim "\t" merge.bed union.bed > answer.bed

The file answer.bed will contain merged intervals and the arithmetic mean of signals in overlapping intervals from files A.bed through N.bed (these are your 57 BED5 files, where the fifth column contains signal, per UCSC convention).

More documentation at: http://bedops.readthedocs.io/en/latest/

Galaxy is great, but there's no real substitute for the Unix command line. Learn it if you're doing informatics.

ADD COMMENT
0
Entering edit mode

Thanks for this. However, I am unfamiliar with these programs and how to use them. I see they are not listed on the Galaxy server, is there an online version of these tools to upload the files for processing? Thanks

ADD REPLY

Login before adding your answer.

Traffic: 1606 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6