1
$\begingroup$

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.

$\endgroup$
2
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ I have mapped to a gene catalogue, i.e., I have many references, and every line in the idxstats output correspondes to one such reference. I understand how a read mapped to a reference/gene/feature is associated with it, but a read unmapped is unmapped to all of them... But what you wrote about flags makes a lot of sense - I have to look what happened at the mapping step. Thanks. $\endgroup$ – Vadim Jan 14 at 12:56
  • 2
    $\begingroup$ For paired-end reads, some aligners will assign an unmapped read to the chromosome of its mate if its mate aligned (the unmapped bit in the flag will still be set). $\endgroup$ – Devon Ryan Jan 14 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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