What is "unmapped read segments" in the output of samtools idxstats? 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.
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 &quot;feature&quot; is. They only contain information about reads and the chromosomes/contigs to which they align.