Question: Bedtools Error: Type checker found wrong number of fields while tokenizing data line.
0
gravatar for User 7754
20 months ago by
User 7754240
United Kingdom
User 7754240 wrote:

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 • 1.8k views
ADD COMMENTlink modified 20 months ago by Alex Reynolds30k • written 20 months ago by User 7754240

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

did you try this ?

ADD REPLYlink written 20 months ago by Pierre Lindenbaum129k

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

ADD REPLYlink written 20 months ago by User 7754240

none of your commands above remove the trailing tabs.

try

sed 's/[\t]*$//' bed1.txt > bed1.corrected.txt
ADD REPLYlink written 20 months ago by Pierre Lindenbaum129k

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 REPLYlink written 20 months ago by User 7754240
3
gravatar for Alex Reynolds
20 months ago by
Alex Reynolds30k
Seattle, WA USA
Alex Reynolds30k wrote:

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 COMMENTlink modified 20 months ago • written 20 months ago by Alex Reynolds30k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 802 users visited in the last hour