samtools-idxstats(1)

πŸ’… samtools-idxstats πŸ’…

okay bestie, welcome to the samtools-idxstats(1) page β€” it's part of the whole samtools bioinformatics tools situation, and honestly it's giving "underrated little icon" energy. Let's get into it.


✨ NAME ✨

samtools idxstats β€” reports alignment summary statistics πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

samtools idxstats in.sam|in.bam|in.cram

🌸 DESCRIPTION 🌸

So what this bad boy does is it goes and retrieves the stats chillin' inside the index file that corresponds to your input file, and then prints them. That's it. That's the whole vibe. πŸ’–

⚠️ but listen β€” before you call idxstats, your input BAM file should already be indexed by samtools index. Like, do that first, it's the whole point, iykyk.

Now, if you run this on a SAM file, or a CRAM file, or a BAM that isn't indexed? It's not gonna crash on you, bestie β€” it'll still produce the same summary statistics. It just does it by reading through the entire file. Which is, and I cannot stress this enough, far slower than using the BAM indices 😭 like genuinely so much slower. Consider yourself warned.

The output is TAB-delimited, and each line is made of these four things, in this order:

  1. reference sequence name
  2. sequence length
  3. # mapped read-segments
  4. # unmapped read-segments

It gets written to stdout. 🫢

πŸ‘€ one heads-up though: this may count reads multiple times if they're mapped more than once, or if they're in multiple fragments. So don't come for it about the numbers, that's just how it is.

✨ OPTIONS ✨

  • -X β€” this lets you specify a customised index file location, like if your index is living somewhere else rent-free. e.g.:
samtools idxstat [options] -X /data_folder/data.bam
/index_folder/index.bai

πŸ‘‘ AUTHOR πŸ‘‘

Written by Heng Li from the Sanger Institute. slay, honestly. πŸ’œ


🌈 SEE ALSO 🌈

Samtools website: http://www.htslib.org/ ⭐


okay that's the whole page, you're all caught up 🧚 and before you go β€” this was brought to you by samtools-1.24, dated 9 July 2026. yes, 2026. we're so ahead. periodt πŸ’…βœ¨πŸ“

πŸ“¦ where this page comes from