Bedtools Error: Type checker found wrong number of fields while tokenizing data line.
1
0
Entering edit mode
6.1 years ago
User 7754 ▴ 270

Hi,

I get an error for having an extra tab but removing the extra tab does not solve the error, has anybody run into this?

cat bed1.txt bed2.txt | sort -k1,1 -k2,2n | mergeBed -i stdin > merged.bed

Error: Type checker found wrong number of fields while tokenizing data line. Perhaps you have extra TAB at the end of your line? Check with "cat -t"

sed 's/\t$//' bed1.txt > bed1.corrected.txt

Doesn't work. I also tried to replace all spaces/tabs and then reformat into a tab-delimited, but I get the same error.

awk '{$1=$1};1' bed1.txt | sed 's/ /\t/g' > bed1.corrected.txt
bedtools • 7.8k views
ADD COMMENT
0
Entering edit mode

Perhaps you have extra TAB at the end of your line? Check with "cat -t"

did you try this ?

ADD REPLY
0
Entering edit mode

Yes; but shouldn't the sed command get rid of them?

ADD REPLY
0
Entering edit mode

none of your commands above remove the trailing tabs.

try

sed 's/[\t]*$//' bed1.txt > bed1.corrected.txt
ADD REPLY
0
Entering edit mode

Hi Pierre, thank you, I have tried that but I still get the same error after doing that to each bed file: cat bed1.corrected.txt bed2.corrected.txt | sort -k1,1 -k2,2n | mergeBed -i stdin > merged.bed

ADD REPLY
4
Entering edit mode
6.1 years ago

So long as inputs have at least three columns, the following use of BEDOPS tools should work on inputs with different numbers of columns (or lines with lone tabs at the end):

$ cat bed1.txt bed2.txt | sort-bed - | bedops --merge - > answer.bed

The merged output will only have three columns.

ADD COMMENT

Login before adding your answer.

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