text: user1813: samtools idxstats produces a four column output  (see here)
  The output is TAB-delimited with each line consisting of reference sequence name, sequence length, 
  # mapped read-segments and # unmapped read-segments. It is written to stdout. Note this may count reads 
  multiple times if they are mapped more than once or in multiple fragments. 
  
  What is the meaning of unmapped reads here? Naively, I would take it to mean all the reads that didn't map to a specific feature... however in a sample with millions of reads most of them should be counted as such, which is not the case in my calculations, where the number of unmapped reads is of the same order as the number of mapped reads.
  I will very much appreciate explanations from people experience with samtools.
  
  user77: An unmapped read segment is any entry with bit 4 of the flag field set (i.e., it's unmapped). Assuming the reference to which you aligned reasonably matches the sample from which the reads were generated, less than ~10% of to total reads should be unmapped.
  Please note that BAM files have no idea what a "feature" is. They only contain information about reads and the chromosomes/contigs to which they align.
  
original_text: 1813: <p><code>samtools idxstats</code> produces a four column output  (<a href="http://www.htslib.org/doc/samtools-idxstats.html" rel="nofollow noreferrer">see here</a>)</p>
  <pre><code>The output is TAB-delimited with each line consisting of reference sequence name, sequence length, 
  # mapped read-segments and # unmapped read-segments. It is written to stdout. Note this may count reads 
  multiple times if they are mapped more than once or in multiple fragments. 
  </code></pre>
  <p>What is the meaning of <em>unmapped reads</em> here? Naively, I would take it to mean all the reads that didn't map to a specific feature... however in a sample with millions of reads most of them should be counted as such, which is not the case in my calculations, where the number of unmapped reads is of the same order as the number of mapped reads.</p>
  <p>I will very much appreciate explanations from people experience with <code>samtools</code>.</p>
   77: <p>An unmapped read segment is any entry with bit 4 of the flag field set (i.e., it's unmapped). Assuming the reference to which you aligned reasonably matches the sample from which the reads were generated, less than ~10% of to total reads should be unmapped.</p>
  <p>Please note that BAM files have no idea what a &quot;feature&quot; is. They only contain information about reads and the chromosomes/contigs to which they align.</p>
  