Body: <p>I download a BAM file from <a href="ftp://ftp-trace.ncbi.nlm.nih.gov//giab/ftp/data/NA12878/10Xgenomics_ChromiumGenome_LongRanger2.0_06202016/NA12878_GRCh38.bam" rel="nofollow noreferrer">ftp-trace.ncbi.nlm.nih.gov:/giab/ftp/data/NA12878/10Xgenomics_ChromiumGenome_LongRanger2.0_06202016/NA12878_GRCh38.bam</a> (171G), and I am trying to view the comparison result of the BAM file using the following command:</p>
  <pre><code>[yyn@localhost All]$ samtools flagstat NA12878_GRCh38.bam
  </code></pre>
  <p>The result shows that the file is truncated, the result as follows:</p>
  <pre><code>[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&gt;=5)
  </code></pre>
  <p>The total number of reads is only 72639, Obviously, this is the wrong result. And I checked the file again with the following command</p>
  <pre><code>[yyn@localhost All]$ samtools quickcheck -qv NA12878_GRCh38.bam &amp;&amp; echo 'all ok' || echo 'failed check'
  </code></pre>
  <p>The result is:</p>
  <pre><code>all ok
  </code></pre>
  <p>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.</p>
  <pre><code>[yyn@localhost All]$ samtools view NA12878_GRCh38.bam | head -n 72610 &gt;&gt; head72610.sam
  </code></pre>
  <p>That's ok.</p>
  <pre><code>[yyn@localhost All]$ samtools view NA12878_GRCh38.bam | head -n 72620 &gt;&gt; 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.
  </code></pre>
  <p><code>samtools sort</code> and <code>samtools index</code> are the same error results as above. Does anyone know what's going on? Thanks!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-12T09:33:23.240Z
Comments.Text: As you say, the file is truncated. Why are you investigating this instead of just downloading the entire file?
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-12T23:58:31.503Z
Comments.Text: 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.
Comments.UserDisplayName: yyn
Tags: <sam><samtools>
Title: Inflate operation failed: progress temporarily not possible, or in() / out() returned an error
ThreadText: # Inflate operation failed: progress temporarily not possible, or in() / out() returned an error
  
  (Asked by: username_0 on 2021-04-12)
  
  I download a BAM file from [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) (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!
  
  **Tags:** sam, samtools
  
  > **Comments:**
  > **username_1**: As you say, the file is truncated. Why are you investigating this instead of just downloading the entire file?  
  > **username_0**: 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.  
  
  ---
  
  ## 0 answers
  
  