BEDtools error: file has non positional records, which are only valid for the groupBy tool
1
3
Entering edit mode
6.3 years ago

Hello,

I am trying to use bedtools subtract in the following way:

$ bedtools subtract -a A.bed -b B.bed

but I get the following error:

ERROR: file A.bed has non positional records, which are only valid for the groupBy tool

When I tried to Google the answer, none of the solutions provided seemed to help. Here is the head of A.bed:

$ head A.bed
chr1    1       249250621
chr2    1       243199373
chr3    1       198022430
chr4    1       191154276
chr5    1       180915260
chr6    1       171115067
chr7    1       159138663
chrX    1       155270560
chr8    1       146364022
chr9    1       141213431

The cross checked that the columns are tab delimited and the three important columns are in the right order. Additionally, there are no invisible characters after the final column that might throw off Bedtools.

Any insight into the problem would be greatly appreciated!

Bedtools • 7.1k views
ADD COMMENT
1
Entering edit mode

Are the delimiters the same in both files?

ADD REPLY
0
Entering edit mode

I just checked, and they are. But I found out that the end characters for A.bed are windows end characters and B.bed are Linux end characters. After I fixed this issue, the program worked.

ADD REPLY
3
Entering edit mode
6.3 years ago

I found the solution. I made A.bed in Windows and B.bed in Linux, so the two files had conflicting end characters. When I turned the Windows end characters into Linux end characters, Bedtools started working properly again

ADD COMMENT
1
Entering edit mode

Welcome to the world of bioinformatics :-)

ADD REPLY
1
Entering edit mode

We learn...do not use Windows in Bioinformatics ;-D

ADD REPLY
0
Entering edit mode

This fixed it for me.

One of my files had trailing carriage return characters (\r or ^M).

The invisible characters can be displayed with

cat -e polluted.bed
chr1    0       248956422^M$
chr10   0       133797422^M$
chr11   0       135086622^M$

Stripped them out with

cat polluted.bed | tr -d '\r' > clean.bed

To give

cat -e clean.bed
chr1    0       248956422$
chr10   0       133797422$
chr11   0       135086622$

Then bedtools worked properly.

ADD REPLY

Login before adding your answer.

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