brentp / hts-nim

nim wrapper for htslib for parsing genomics data files

Home Page:https://brentp.github.io/hts-nim/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: unhandled exception: invalid bgzf file [ValueError]

Stikus opened this issue · comments

Hello.
When I ran mosdepth on our bam file I've got error which origin is from hts-nim - that's why I've created issue here.
Here is my error:

root@b79bb970b062:/outputs# mosdepth -t 20 . /inputs/330003740807_S10.bam
bam.nim(390)             open
Error: unhandled exception: invalid bgzf file [ValueError]

And here is output of samtools view:

root@b79bb970b062:/outputs# samtools view -H /inputs/330003740807_S10.bam | head
[W::bam_hdr_read] EOF marker is absent. The input is probably truncated
@HD     VN:1.4  SO:coordinate
@SQ     SN:chr1 LN:248956422
@SQ     SN:chr2 LN:242193529
@SQ     SN:chr3 LN:198295559
@SQ     SN:chr4 LN:190214555
@SQ     SN:chr5 LN:181538259
@SQ     SN:chr6 LN:170805979
@SQ     SN:chr7 LN:159345973
@SQ     SN:chr8 LN:145138636
@SQ     SN:chr9 LN:138394717

And picard's ValidateSamFiles

root@0ea62a6ac57e:/outputs# java -jar $PICARD ValidateSamFile -I /inputs/330003740807_S10.bam -R /ref/GRCh38.d1.vd1/GRCh38.d1.vd1.fa -QUIET true 
Picked up _JAVA_OPTIONS: -Djava.io.tmpdir=/tmp
10:36:39.816 INFO  NativeLibraryLoader - Loading libgkl_compression.so from jar:file:/soft/picard-2.25.0.jar!/com/intel/gkl/native/libgkl_compression.so
ERROR::TRUNCATED_FILE:Read name /inputs/330003740807_S10.bam, BAM file has defective last gzip block
...

I'll try to recreate this bam, but our bioinformatics pipeline worked fine with this bam (various variant callers and HLA-typers) and samtools throws warning - not error. Maybe hts-nim should throw warning too? As you can see - the file is totally readable.