Home

flaggstat

Flaggstat is a utility within the SAMtools software suite used to summarize alignment data from BAM or SAM files. It analyzes the flag field of each read and produces a concise report describing the composition of reads in the alignment, such as how many reads were mapped and how many were paired. The name Flaggstat is a variant spelling; the canonical command in SAMtools is flagstat.

The program reads an input BAM/SAM file and outputs several lines, each reporting counts for a category.

Flaggstat is widely used as a quick quality-control step before downstream analyses. It does not provide per-base

Usage is straightforward: run samtools flagstat <alignment.bam>. In newer SAMtools versions or with large datasets, the

Typical
categories
include
total
reads,
mapped
reads,
paired
reads
in
sequencing,
read1,
read2,
properly
paired
reads,
reads
with
their
mate
mapped,
and
reads
where
the
mate
maps
to
a
different
chromosome.
Some
versions
also
report
singletons
and
two
primary
alignments.
The
exact
set
of
categories
and
formatting
can
vary
slightly
between
SAMtools
releases.
metrics
or
coverage
information,
but
it
offers
a
fast
snapshot
of
alignment
success
and
library
characteristics,
helping
to
identify
issues
such
as
low
mapping
rates
or
imbalanced
pairing.
-@
option
can
be
used
to
enable
multithreading,
and
the
exact
output
format
may
differ
across
releases.
Because
Flaggstat
relies
on
the
SAM
flag
field,
its
accuracy
depends
on
proper
flagging
during
alignment
and
any
QC
filtering
applied
to
the
BAM.
For
more
detailed
statistics,
users
may
supplement
it
with
additional
tools
in
the
SAMtools
suite.