Forrest logo
back to the samtools tool

samtools:tldr:21f3a

samtools: Print alignment statistics about a file.
$ samtools flagstat ${sorted_input}
try on your machine

The command "samtools flagstat ${sorted_input}" is used to generate basic statistics on an input file in .sam or .bam format using the samtools tool.

Here's a breakdown of the command:

  • "samtools": It is a command-line program used for manipulating alignments in SAM (Sequence Alignment/Map) and BAM (Binary Alignment/Map) formats. SAM is a tab-delimited text file format that represents read alignments to a reference genome, while BAM is the binary version of SAM.

  • "flagstat": It is a subcommand of samtools used for computing basic statistics of an alignment file.

  • "${sorted_input}": It represents a variable that should be replaced with the path to the sorted input file in .sam or .bam format. The sorted_input file is the file you want to generate statistics for.

When you run this command with the appropriate input file specified, samtools flagstat will output statistics that provide information about various aspects of the alignment file. This includes the total number of reads, the number of reads that are mapped (aligned) to the reference genome, the number of reads that are properly paired, the number of reads with mapping quality of zero, and more.

Overall, the command is useful for quickly getting summary statistics about an alignment file, which can be helpful in understanding the quality and characteristics of the sequencing data.

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