Hi all, I tried to run samtools depth on my bam file to generate average depth using
samtools depth input.bam | awk '{sum+=$3} END { print "Average = ",sum/NR}'
This gave me the following error
[E::bgzf_read_block] Failed to read BGZF block data at offset 46634025926 expected 12816 bytes; hread returned -1
[E::bgzf_read] Read block operation failed with error 4 after 0 of 4 bytes
Average = 34.0651
Not sure what is going on. Is the average output fine or should I be concerned with this error message? I tried googling this error and also tried this but appears there there were no issues
samtools quickcheck -qvvv inout.bam
verbosity set to 3
checking NA24695C.bam
opened NA24695C.bam
NA24695C.bam is sequence data
NA24695C.bam has 3366 targets in header.
NA24695C.bam has good EOF block.
I got a similar type of error running coverage on my bam file. It appears that the coverage is not calculated any other #rname other than chr1. They were all zeros. This error appears to be present irrespective of the input BAM file.
samtools coverage input.bam
#rname startpos endpos numreads covbases coverage meandepth meanbaseq meanmapq
[E::bgzf_read_block] Failed to read BGZF block data at offset 3724556367 expected 12617 bytes; hread returned -1
[E::bgzf_read] Read block operation failed with error 4 after 0 of 4 bytes
chr1 1 248956422 43909613 174013226 69.8971 26.2529 34.9 50.8
chr2 1 242193529 0 0 0 0 0 0
chr3 1 198295559 0 0 0 0 0 0
chr4 1 190214555 0 0 0 0 0 0
chr5 1 181538259 0 0 0 0 0 0
chr6 1 170805979 0 0 0 0 0 0
chr7 1 159345973 0 0 0 0 0 0
chr8 1 145138636 0 0 0 0 0 0
Update: I just discovered that the error message could be due to running samtools over VPN. There was no issue with the BAM as I was able to run the samtool command onsite without any error message.