htslib icon indicating copy to clipboard operation
htslib copied to clipboard

tabix could print a better error message when `tbx_parse1` fails with no `-p` option given

Open jrandall opened this issue 8 years ago • 6 comments

The error message printed when tabix fails to parse the input when there is no preset -p option given is of the form:

[E::get_intv] failed to parse TBX_GENERIC, was wrong -p [type] used?

While specifying an incorrect -p [type] entry could be one reason for this, in the case of TBX_GENERIC there was not even a -p option given - so really it comes down to the values of -e and -b being wrong, but those are not mentioned here.

It would be helpful when TBX_GENERIC is set to say something that mentions -e and -b in addition to -p.

Relevant code: https://github.com/samtools/htslib/blob/1e2ed48935a58845cecb64880e8cf7553c7db852/tbx.c#L151

jrandall avatar Mar 10 '16 16:03 jrandall

Hi,

I have been trying to index a file using Tabix. I have zipped it using bzip. and the format is : CHRNum start end feature (feature is a CSV list) and I get the error :

[E::get_intv] failed to parse TBX_GENERIC, was wrong -p [type] used?

This is how a line looks like in the file :

chr1 9849735 9849748 1,1,1,1,1,1,1,1

Any help would be much appreciated. Thank you.

rehamFatima avatar Nov 20 '18 16:11 rehamFatima

You need to provide either the -p or -s,-b,-e options to tabix. For example tabix -s1 -b2 -e3 file.txt.gz

pd3 avatar Nov 20 '18 16:11 pd3

Thanks @pd3 but I am running command as :

tabix -s 1 -b 2 -e 3 intropolis_test_bz.tsv.gz

rehamFatima avatar Nov 20 '18 16:11 rehamFatima

it also says :

[E::hts_idx_push] unsorted positions on sequence #243912249: 1 followed by 0

while we sorted the file using sort -k 1,1 -k 2,2n

rehamFatima avatar Nov 20 '18 16:11 rehamFatima

Try sort -k1,1d -k2,2n -k3,3n

pd3 avatar Nov 20 '18 16:11 pd3

Thanks Petr, I tried that and got the following output of one line only :

tbx_index_build failed: intropolis_chrGRC38.sorted.NA.tsv.gz

rehamFatima avatar Nov 21 '18 10:11 rehamFatima