Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make faidx error messages slightly more enlightening #1743

Merged
merged 1 commit into from
Feb 15, 2024

Conversation

nickzoic
Copy link
Contributor

@nickzoic nickzoic commented Feb 8, 2024

This adds a small amount of extra information to errors when running samtools faidx, specifically it adds a helpful message when dealing with zero-length compressed data, which can occur eg: when downloading a file from the internet fails.

before:

$ bgzip < /dev/null > empty.gz
$ ls -l empty.gz
-rw-rw-r-- 1 nick nick 28 Feb  8 11:41 empty.gz
$ samtools faidx empty.gz
[faidx] Could not build fai index empty.gz.fai
$

after:

$ ./samtools faidx empty.gz
[E::fai_build_core] File truncated at line 1
[faidx] Could not build fai index empty.gz.fai
$

which is a pretty big hint that something has gone wrong in your tool chain somewhere.

... and also line numbers to some of the other error messages to make it easier to track down the problematic lines.

@jkbonfield jkbonfield merged commit 4ff46a6 into samtools:develop Feb 15, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants