This is a test version of Biostars. For the public version, visit https://www.biostars.org.
BedTools intersect - Segmentation fault

Hi,

Has anyone experienced the "segmentation fault" error while trying to use bedtools intersect option? I am trying to see overlap exons between 2 bed files but I'm getting this error all the time. Any help will be much appreciated.

Thank you

bedtools exons

Output of three commands: ẁhich bedtools, bedtools --version and uname -a could be helpful to know about your setup

2 answers

If you are working with very large files, sort the bed files based on Chr and then Pos. sort -k1,1 -k2,2n and then use -sorted option.

From the manual:

-sorted For very large B files, invoke a "sweeping" algorithm that requires position-sorted (e.g., sort -k1,1 -k2,2n for BED files) input. When using -sorted, memory usage remains low even for very large files

If you still face the problem, split the files by Chr and then try to run the program at chromosome level. Otherwise provide more details about your data and post the exact error

Thank you very much for that, it helped a lot. I sorted the bed file and then used sort -k1,1V to reverse the order so it is in ascending order.. Now I get the error:

Error: The genome file sorted.bed.ascending has no valid entries. Exiting.

Do you know why is this? The files seem fine now..

Thank you once again!

can you post few lines from your files ?

Another option:

$ sort-bed exons1.bed > sorted_exons1.bed
$ sort-bed exons2.bed > sorted_exons2.bed
$ bedops --element-of 1 sorted_exons1.bed sorted_exons2.bed > exons1_that_overlap_exons2.bed
$ bedops --element-of 1 sorted_exons2.bed sorted_exons1.bed > exons2_that_overlap_exons1.bed

Log in to answer this question.