Question: Bedtools Error: Type checker found wrong number of fields while tokenizing data line.
0
gravatar for User 7754
5 weeks ago by
User 7754170
United Kingdom
User 7754170 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 • 182 views
ADD COMMENTlink modified 5 weeks ago by Alex Reynolds26k • written 5 weeks ago by User 7754170

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

did you try this ?

ADD REPLYlink written 5 weeks ago by Pierre Lindenbaum115k

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

ADD REPLYlink written 5 weeks ago by User 7754170

none of your commands above remove the trailing tabs.

try

sed 's/[\t]*$//' bed1.txt > bed1.corrected.txt
ADD REPLYlink written 5 weeks ago by Pierre Lindenbaum115k

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 5 weeks ago by User 7754170
2
gravatar for Alex Reynolds
5 weeks ago by
Alex Reynolds26k
Seattle, WA USA
Alex Reynolds26k 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 5 weeks ago • written 5 weeks ago by Alex Reynolds26k
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: 1490 users visited in the last hour