This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Quick question: samtool idxstats and multiple mapping

Hello,

A quick naive question please: Samtools idxstats outputs the number of reads mapped to a given reference sequence. Right? What does it do in case of multiple mapping please? Does it count the best alignment for a read or does it adds 1 to all reference sequences where it mapped? I could not find any detail in the documentation.

Many thanks

sequencing alignment

samtools idxstats outputs total mapped. If you would like to see secondary alignments, try flagstat from samtools. It would print secondary alignment.

1 answer

As cpad0112 mentioned, every alignment is counted, whether secondary or supplementary. So if a read has multiple recorded alignments then each is counted.

BTW, this is only true of BAM files. For CRAM files on 0 will be returned.

Thank you so much to both!! Really helpful!!

Hi Devon, Thanks for the reply. Is there any documentation about the multi-mapped you could share? I am wondering whether every method in samtools/sambamba take the XA flag into account; or it is specific for idxstats in samtools.

Whether a read is multimapping or not is determined by the aligner (it sets a bit in the FLAG field in the SAM/BAM/CRAM output). Samtools is just reporting whatever the aligner wrote. The XA tag is a custom tag produced by a couple aligners, almost all tools (including samtools) will ignore it completely.

Log in to answer this question.