Do not mention BAM when encountering an invalid bgzipped file

If a program reads both a BAM file and a bgzipped compressed FASTA or VCF
file, the error message can confuse the user because it’s easy to overlook
the "e.g.", and the user might think that the BAM file is the problematic
one while it is the other.
This commit is contained in:
Marcel Martin
2024-12-16 15:48:02 +01:00
committed by Peter Cock
parent 83ca2ed29a
commit 275f04c458

View File

@ -442,8 +442,7 @@ def _load_bgzf_block(handle, text_mode=False):
raise StopIteration
if magic != _bgzf_magic:
raise ValueError(
r"A BGZF (e.g. a BAM file) block should start with "
r"%r, not %r; handle.tell() now says %r"
r"A BGZF block should start with %r, not %r; handle.tell() now says %r"
% (_bgzf_magic, magic, handle.tell())
)
gzip_mod_time, gzip_extra_flags, gzip_os, extra_len = struct.unpack(