samtools-coverage - Man Page

produces a histogram or table of coverage per chromosome

Synopsis

samtools coverage [options] [in1.sam|in1.bam|in1.cram [in2.sam|in2.bam|in2.cram] [...]]

Description

Computes the depth at each position or region and draws an ASCII-art histogram or tabulated text.

The tabulated form uses the following headings.

rnameReference name / chromosome
startposStart position
endposEnd position (or sequence length)
numreadsNumber reads aligned to the region (after filtering)
covbasesNumber of covered bases with depth >= 1
coveragePercentage of covered bases [0..100]
meandepthMean depth of coverage
meanbaseqMean baseQ in covered region
meanmapqMean mapQ of selected reads

Options

Input options:

-b--bam-list FILE

List of input BAM files, one file per line [null]

-l--min-read-len INT

Ignore reads shorter than INT base pairs [0]

-q--min-MQ INT

Minimum mapping quality for an alignment to be used [0]

-Q--min-BQ INT

Minimum base quality for a base to be considered [0]

--rf--incl-flags STR|INT

Required flags: skip reads with mask bits unset [null]

--ff--excl-flags STR|INT

Filter flags: skip reads with mask bits set [UNMAP,SECONDARY,QCFAIL,DUP]

-d--depth INT

Maximum allowed coverage depth [1000000]. If 0, depth is set to the maximum integer value effectively removing any depth limit.

Output options:

-m--histogram

Show histogram instead of tabular output.

-A--ascii

Show only ASCII characters in histogram using colon and fullstop for full and half height characters.

-o--output FILE

Write output to FILE [stdout].

-H--no-header

Don't print a header in tabular mode.

-w--n-bins INT

Number of bins in histogram.  [terminal width - 40]

-r--region REG

Show specified region. Format: chr:start-end.

-h--help

Shows command help.

Examples

Running coverage in tabular mode, on a specific region, with tabs shown as spaces for clarity in this man page.

samtools coverage -r chr1:1M-12M input.bam

#rname  startpos  endpos    numreads  covbases  coverage  meandepth  meanbaseq  meanmapq
chr1    1000000   12000000  528695    1069995   9.72723   3.50281    34.4       55.8

An example of the histogram output is below, with ASCII block characters replaced by "#" for rendering in this man page.

samtools coverage -A -w 32 -r chr1:1M-12M input.bam

chr1 (249.25Mbp)
>  24.19% | .                              | Number of reads: 528695
>  21.50% |::                              |     (132000 filtered)
>  18.81% |::                              | Covered bases:   1.07Mbp
>  16.12% |::                           :  | Percent covered: 9.727%
>  13.44% |::  :  .       ::            : :| Mean coverage:   3.5x
>  10.75% |:: ::  :       ::          : : :| Mean baseQ:      34.4
>   8.06% |:::::  :       ::        : : : :| Mean mapQ:       55.8
>   5.37% |::::: ::      :::      : ::::: :| 
>   2.69% |::::: :::     :::  ::: :::::::::| Histo bin width: 343.8Kbp
>   0.00% |:::::::::::. :::::::::::::::::::| Histo max bin:   26.873%
        1.00M     4.44M     7.87M       12.00M

Author

Written by Florian P Breitwieser.

See Also

samtools(1), samtools-depth(1),

Samtools website: <http://www.htslib.org/>

Referenced By

samtools(1), samtools-depth(1).

7 April 2022 samtools-1.15.1 Bioinformatics tools