3
$\begingroup$

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!

$\endgroup$
2
  • 1
    $\begingroup$ As you say, the file is truncated. Why are you investigating this instead of just downloading the entire file? $\endgroup$
    – terdon
    Commented Apr 12, 2021 at 9:33
  • $\begingroup$ I downloaded it three times using lftp, all of which are like this, and I can't restore it with bamUtil. But downloading with Aspera is slower than lftp. $\endgroup$
    – yyn
    Commented Apr 12, 2021 at 23:58

1 Answer 1

1
$\begingroup$

My best guess would be a corruption during download as:

samtools quickcheck -qvvvv ftp://ftp-trace.ncbi.nlm.nih.gov:/giab/ftp/data/NA12878/10Xgenomics_ChromiumGenome_LongRanger2.0_06202016/NA12878_GRCh38.bam                
verbosity set to 4
checking ftp://ftp-trace.ncbi.nlm.nih.gov:/giab/ftp/data/NA12878/10Xgenomics_ChromiumGenome_LongRanger2.0_06202016/NA12878_GRCh38.bam
opened ftp://ftp-trace.ncbi.nlm.nih.gov:/giab/ftp/data/NA12878/10Xgenomics_ChromiumGenome_LongRanger2.0_06202016/NA12878_GRCh38.bam
ftp://ftp-trace.ncbi.nlm.nih.gov:/giab/ftp/data/NA12878/10Xgenomics_ChromiumGenome_LongRanger2.0_06202016/NA12878_GRCh38.bam is sequence data
ftp://ftp-trace.ncbi.nlm.nih.gov:/giab/ftp/data/NA12878/10Xgenomics_ChromiumGenome_LongRanger2.0_06202016/NA12878_GRCh38.bam has 196 targets in header.
ftp://ftp-trace.ncbi.nlm.nih.gov:/giab/ftp/data/NA12878/10Xgenomics_ChromiumGenome_LongRanger2.0_06202016/NA12878_GRCh38.bam has good EOF block.

Plus I can successfully run idxstats from remote and fetch individual chromosomes without error via samtools view. Try redownloading before digging deeper.

$\endgroup$
1
  • $\begingroup$ Thanks for your advice, I will redownload it by using Aspera instead of lftp. $\endgroup$
    – yyn
    Commented Apr 13, 2021 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.