BedTools options - Overlap exons for various bed files
2
0
Entering edit mode
6.6 years ago
Maria333 ▴ 20

Hi,

Does anyone know whether we can use bedtools for finding overlap exons for more than a few bed files, i.e for a list of bed files? 

I know there is the -b option for more than 1 bed file, but I need to do it for hundreds of bed files. Is this possible?

Thank you,

Maria

bedtools bed files • 2.1k views
ADD COMMENT
2
Entering edit mode
6.6 years ago
Chirag Nepal ★ 2.3k

You can try something like this:

intersectBed -wa -wb -s -a exons -b yourBEDFile.bed

Now, you can loop this, something like this:

 

for name in $(ls *bed)

do

      intersectBed -wa -wb -s -a exons -b $name > yourOutputFile_$name

done

 

 

 

ADD COMMENT
1
Entering edit mode

It seems that it's possible to use wildcards with -b option, from bedtools webpage:
"NEW!!!: -b may be followed with multiple databases and/or wildcard (*) character(s)."

So it wouldn't be necessary to perform a loop, just -b *.bed. But I've never use it.

ADD REPLY
0
Entering edit mode

I just tried this but it gets the error: "Segmentation fault (core dumped)".. Is there a restriction for the amount of bed files we put?

Thank you

ADD REPLY
0
Entering edit mode

Thank you both. I will try both these. Hope it works!

ADD REPLY
1
Entering edit mode
6.6 years ago

If you can use BEDOPS, you can specify as many BED files as you want:

$ bedops -e 1 exons.bed file1.bed file2.bed ... fileN.bed > answer.bed
ADD COMMENT
0
Entering edit mode

Hi Alex,

Thank you for your response. Is it possible that I use a whole file which includes all the bed files instead of putting them on the command line manually? When they are too many, it will be impossible to put them all there..

Thank you

ADD REPLY

Login before adding your answer.

Traffic: 1633 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