text: user1377: I have few bam files and would like to get read counts using 
  samtools idxstats
  
  [Data is aligned to hg19 transcriptome]. To use that command I need a sorted bam file. So to sort them I gave the following command.
  samtools sort -T /tmp/input.sorted -o input.sorted.bam input.bam
  
  This ended up showing:
  [W::bam_hdr_read] EOF marker is absent. The input is probably truncated.
  [E::bgzf_read] bgzf_read_block error -1 after 0 of 4 bytes
  [bam_sort_core] truncated file. Aborting.
  
  And the tmp dir has 6 input.sorted.nnnn.bam files.
  
  user77: The cause of the error is that your input file is truncated or /tmp is running out of space. If you can do samtools view -H input.bam without error (reading the header also checks for the magic number at the end of the file) then it's like the that /tmp is filling up.
  
original_text: 1377: <p>I have few bam files and would like to get read counts using </p>
  
  <pre><code>samtools idxstats
  </code></pre>
  
  <p>[Data is aligned to hg19 transcriptome]. To use that command I need a sorted bam file. So to sort them I gave the following command.</p>
  
  <pre><code>samtools sort -T /tmp/input.sorted -o input.sorted.bam input.bam
  </code></pre>
  
  <p>This ended up showing:</p>
  
  <pre><code>[W::bam_hdr_read] EOF marker is absent. The input is probably truncated.
  [E::bgzf_read] bgzf_read_block error -1 after 0 of 4 bytes
  [bam_sort_core] truncated file. Aborting.
  </code></pre>
  
  <p>And the tmp dir has 6 input.sorted.nnnn.bam files.</p>
   77: <p>The cause of the error is that your input file is truncated or /tmp is running out of space. If you can do <code>samtools view -H input.bam</code> without error (reading the header also checks for the magic number at the end of the file) then it's like the that /tmp is filling up.</p>
  