samtools-depth - Man Page
computes the read depth at each position or region
Synopsis
samtools depth [options] [in1.sam|in1.bam|in1.cram [in2.sam|in2.bam|in2.cram] [...]]
Description
Computes the depth at each position or region.
Options
- -a
Output all positions (including those with zero depth)
- -a -a, -aa
Output absolutely all positions, including unused reference sequences. Note that when used in conjunction with a BED file the -a option may sometimes operate as if -aa was specified if the reference sequence has coverage outside of the region specified in the BED file.
- -b FILE
Compute depth at list of positions or regions in specified BED FILE. []
- -f FILE
Use the BAM files specified in the FILE (a file of filenames, one file per line) []
- -H
Write a comment line showing column names at the beginning of the output. The names are CHROM, POS, and then the input file name for each depth column. If one of the inputs came from stdin, the name “-” will be used for the corresponding column.
- -l INT
Ignore reads shorter than INT. This is the number of bases in the sequence, minus any soft clips.
- -m, -d INT
(Deprecated since 1.13) This option previously limited the depth to a maximum value. It is still accepted as an option, but ignored.
Note for single files, the behaviour of old samtools depth -J -q0 -d INT FILE is identical to samtools mpileup -A -Q0 -x -d INT FILE | cut -f 1,2,4
- -o FILE
Write output to FILE. Using “-” for FILE will send the output to stdout (also the default if this option is not used).
- -q, --min-BQ INT
Only count reads with base quality greater than or equal to INT
- -Q, --min-MQ INT
Only count reads with mapping quality greater than or equal to INT
- -r CHR:FROM-TO
Only report depth in specified region.
- -X
If this option is set, it will allow the user to specify customized index file location(s) if the data folder does not contain any index file. Example usage: samtools depth [options] -X /data_folder/in1.bam [/data_folder/in2.bam [...]] /index_folder/index1.bai [/index_folder/index2.bai [...]]
- -g FLAGS
By default, reads that have any of the flags UNMAP, SECONDARY, QCFAIL, or DUP set are skipped. To include these reads back in the analysis, use this option together with the desired flag or flag combination. FLAGS can be specified in hex by beginning with `0x' (i.e. /^0x[0-9A-F]+/), in octal by beginning with `0' (i.e. /^0[0-7]+/), as a decimal number not beginning with '0' or as a comma-separated list of flag names. [0]
For a list of flag names see samtools-flags(1).
- -G FLAGS
Discard any read that has any of the flags specified by FLAGS set. FLAGS are specified as for the -g option. [UNMAP,SECONDARY,QCFAIL,DUP]
- -J
Include reads with deletions in depth computation.
- -s
For the overlapping section of a read pair, count only the bases of the first read. Note this algorithm changed in 1.13 so the results may differ slightly to older releases.
Caveats
It may appear that "samtools depth" is simply "samtools mpileup" with some of the columns removed, and indeed earlier versions of this command were just this. However both then and now there are subtle differences in parameters which make the two not entirely comparable. Differences, other than the obvious speed benefits, include:
- Deletions (CIGAR element "D") are ignored by default in "depth". These may be counted by adding the -J option. "Mpileup" always counts the deleted bases, and has no option to toggle this.
- Beware there are idiosyncrasies in option naming. Specifically -q and -Q options have their meanings swapped between "depth" and "mpileup".
- The removal of overlapping sequences (option -s) is on by default in "mpileup" and off by default in "depth". Additionally the overlap removal algorithm differs, giving subtle changes when Ns are present in the sequence. Also any paired read is considered for overlap removal by "depth", rather than only those with the properly-paired flag set ("mpileup"). See above for a more detailed description.
- The default minimum quality value is 0 for "depth" and 13 for "mpileup".
- Specifying multiple BAMs will produce one depth column per file with "depth", but these are merged in "mpileup".
- "Depth" doesn't have a maximum depth limit, while "mpileup" defaults to a maximum of 8000.
- If a reference is specified to "mpileup" the BAQ algorithm will be used to adjust quality values, although it can be disabled. "Depth" never uses BAQ.
Author
Written by Heng Li and James Bonfield from the Sanger Institute.
See Also
samtools(1), samtools-mpileup(1), samtools-coverage(1), samtools-sort(1)
Samtools website: <http://www.htslib.org/>
Referenced By
samtools(1), samtools-coverage(1), samtools-mpileup(1).