I download a BAM file from ftp-trace.ncbi.nlm.nih.gov:/giab/ftp/data/NA12878/10Xgenomics_ChromiumGenome_LongRanger2.0_06202016/NA12878_GRCh38.bam (171G), and I am trying to view the comparison result of the BAM file using the following command:
[yyn@localhost All]$ samtools flagstat NA12878_GRCh38.bam
The result shows that the file is truncated, the result as follows:
[E::bgzf_uncompress] Inflate operation failed: progress temporarily not possible, or in() / out() returned an error
[E::bgzf_read] Read block operation failed with error 1 after 0 of 4 bytes
[bam_flagstat_core] Truncated file? Continue anyway.
72639 + 0 in total (QC-passed reads + QC-failed reads)
896 + 0 secondary
0 + 0 supplementary
2529 + 0 duplicates
72639 + 0 mapped (100.00% : N/A)
71743 + 0 paired in sequencing
36865 + 0 read1
34878 + 0 read2
48600 + 0 properly paired (67.74% : N/A)
69949 + 0 with itself and mate mapped
1794 + 0 singletons (2.50% : N/A)
10233 + 0 with mate mapped to a different chr
2869 + 0 with mate mapped to a different chr (mapQ>=5)
The total number of reads is only 72639, Obviously, this is the wrong result. And I checked the file again with the following command
[yyn@localhost All]$ samtools quickcheck -qv NA12878_GRCh38.bam && echo 'all ok' || echo 'failed check'
The result is:
all ok
I checked the contents of the file again, and the result showed that there was no problem with the first 72620 lines in the file, but there was a problem with the first 72630 lines, so the file should be truncated in the 72620 to 72630 lines.
[yyn@localhost All]$ samtools view NA12878_GRCh38.bam | head -n 72610 >> head72610.sam
That's ok.
[yyn@localhost All]$ samtools view NA12878_GRCh38.bam | head -n 72620 >> head72620.sam
[E::bgzf_uncompress] Inflate operation failed: progress temporarily not possible, or in() / out() returned an error
[E::bgzf_read] Read block operation failed with error 1 after 0 of 4 bytes
[main_samview] truncated file.
samtools sort
and samtools index
are the same error results as above. Does anyone know what's going on? Thanks!