Forrest logo
back to the samtools tool

samtools:tldr:50b74

samtools: Count alignments to each index (chromosome / contig).
$ samtools idxstats ${sorted_indexed_input}
try on your machine

The samtools idxstats command is used to retrieve the statistics of an indexed SAM or BAM file. It provides information about the alignment and mapping of reads within the file, which can be useful for various downstream analyses.

Here's a breakdown of the command:

  • samtools: This is the program or tool that is being executed. It is a widely-used command-line tool for working with SAM (Sequence Alignment/Map) and BAM (Binary Alignment/Map) files. It provides various functionalities for manipulating and analyzing sequencing data.

  • idxstats: This is a specific command within the samtools tool. It is used to retrieve index statistics.

  • ${sorted_indexed_input}: This is a placeholder or variable that represents the input file name, specifically a sorted and indexed SAM or BAM file. The ${} syntax is commonly used to reference variables or placeholders in command lines. You would typically replace ${sorted_indexed_input} with the actual file path and name of the sorted and indexed input file you want to analyze.

By running this command with the appropriate input file, samtools idxstats will generate a list summarizing the alignment statistics for each reference sequence (chromosome) present in the input file. The output typically consists of several columns including reference sequence name, sequence length, number of mapped reads, and number of unmapped reads.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the samtools tool