This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Bedtools Invalid record, record does not exist

Good morning,

I have found an error using bedtools and now I am trying to make sense of it: Using some scripts I wrote I created a .bed-file, but now when I try to use this file with bedtools it shows me the error:

Error: Invalid record in file genes.bed. Record is chr1 214785930 -2147107995

However, there is no line with this start and end position, and there is no minus sign in the whole file.

I tried it with differen systems, locally I am using bedtools v2.25.0

I uploaded a part of my .bed-file as a gist:

https://gist.github.com/menzel/a497d22f8bdba8e73d635ac998e38e1c

Maybe you can check if you see the same error, right now I tend to think there is some issue with this version of bedtools. The error occurs with merge and intersect, so you can try:

bedtools merge -i genes.bed
bedtools bed

1 answer

the bad record is

$ wget -q -O - "https://gist.githubusercontent.com/menzel/a497d22f8bdba8e73d635ac998e38e1c/raw/6199ba8939299520658dadc519422865baeec166/genes.bed" | grep 21478593 
chr1    214785930       2147859301

2147859301 ? not 214785931 ?

anyway 2147859301 is greater than C-INT_MAX : 2147483647 so any operation on this kind of number might lead to strange results. see https://stackoverflow.com/questions/19376682/

INT_MAX + 1

this operation invokes undefined behavior. Signed integer overflow is undefined behavior in C.

Log in to answer this question.