This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Tabix on bed file can't parse

Hello,

I'm trying to use tabix on a bed file and it seems that tabix is unable to parse my file. Here is my file :

chr7    1000    5000    name1   1   +
chr7    15000   25000   name3   4   +
chr7    35000   75000   name4   8   +
chr7    57373   987412  name5   16  -

my commands are :

$ bgzip example_sort.bed

$ tabix -p bed example_sort.bed.gz

and the outputs are : Code:

[E::get_intv] failed to parse TBX_GENERIC, was wrong -p [type] used?
The offending line was: "chr7    1000    5000    name1   1   +"
[E::get_intv] failed to parse TBX_GENERIC, was wrong -p [type] used?
The offending line was: "chr7    15000   25000   name3   4   +"
[E::hts_idx_push] Unsorted positions on sequence #4653157: 1 followed by 0
tbx_index_build failed: example_sort.bed.gz

Any ideas would be appreciated! Thanks

Aubin

software error

what are the outputs of

gunzip -c example_sort.bed .gz |  tr "\t" "#"  | head

and

gunzip -c example_sort.bed .gz | sort -t $'\t' -k1,1 -k2,2n --check

That last error seems to suggest an unsorted file (although the name would suggest its sorted). What command did you use to sort the file?

It's unclear what is wrong with the first two errors, they look like perfectly good bed lines, but I can think of two possiblities:

  1. The column delimiters are spaces rather than tabs
  2. There are hidden characters in there

Can you post the output of

zcat example_sort.bed | cat -A | head

OK it works now, the problem was the automatic change of tabulations with 4 spaces with my f** text editor

Thanks for the help!

nibua

1 answer

Make sure that the columns are separated by a tab and not by whitespaces. (This is what Pierre is trying to check ;) )

Thanks that was the error

Log in to answer this question.