1samtools-depth(1) Bioinformatics tools samtools-depth(1)
2
3
4
6 samtools depth - computes the read depth at each position or region
7
9 samtools depth [options] [in1.sam|in1.bam|in1.cram
10 [in2.sam|in2.bam|in2.cram] [...]]
11
12
14 Computes the depth at each position or region.
15
16
18 -a Output all positions (including those with zero depth)
19
20 -a -a, -aa
21 Output absolutely all positions, including unused reference se‐
22 quences. Note that when used in conjunction with a BED file
23 the -a option may sometimes operate as if -aa was specified if
24 the reference sequence has coverage outside of the region spec‐
25 ified in the BED file.
26
27 -b FILE Compute depth at list of positions or regions in specified BED
28 FILE. []
29
30 -f FILE Use the BAM files specified in the FILE (a file of filenames,
31 one file per line) []
32
33 -H Write a comment line showing column names at the beginning of
34 the output. The names are CHROM, POS, and then the input file
35 name for each depth column. If one of the inputs came from
36 stdin, the name “-” will be used for the corresponding column.
37
38 -l INT Ignore reads shorter than INT. This is the number of bases in
39 the sequence, minus any soft clips.
40
41 -m, -d INT
42 (Deprecated since 1.13) This option previously limited the
43 depth to a maximum value. It is still accepted as an option,
44 but ignored.
45
46 Note for single files, the behaviour of old samtools depth -J
47 -q0 -d INT FILE is identical to samtools mpileup -A -Q0 -x -d
48 INT FILE | cut -f 1,2,4
49
50 -o FILE Write output to FILE. Using “-” for FILE will send the output
51 to stdout (also the default if this option is not used).
52
53 -q INT Only count reads with base quality greater than or equal to INT
54
55 -Q INT Only count reads with mapping quality greater than or equal to
56 INT
57
58 -r CHR:FROM-TO
59 Only report depth in specified region.
60
61 -X If this option is set, it will allow the user to specify cus‐
62 tomized index file location(s) if the data folder does not con‐
63 tain any index file. Example usage: samtools depth [options] -X
64 /data_folder/in1.bam [/data_folder/in2.bam [...]] /in‐
65 dex_folder/index1.bai [/index_folder/index2.bai [...]]
66
67 -g FLAGS
68 By default, reads that have any of the flags UNMAP, SECONDARY,
69 QCFAIL, or DUP set are skipped. To include these reads back in
70 the analysis, use this option together with the desired flag or
71 flag combination. FLAGS can be specified in hex by beginning
72 with `0x' (i.e. /^0x[0-9A-F]+/), in octal by beginning with `0'
73 (i.e. /^0[0-7]+/), as a decimal number not beginning with '0'
74 or as a comma-separated list of flag names. [0]
75
76 For a list of flag names see samtools-flags(1).
77
78 -G FLAGS
79 Discard any read that has any of the flags specified by FLAGS
80 set. FLAGS are specified as for the -g option. [UNMAP,SEC‐
81 ONDARY,QCFAIL,DUP]
82
83 -J Include reads with deletions in depth computation.
84
85 -s For the overlapping section of a read pair, count only the
86 bases of the first read. Note this algorithm changed in 1.13
87 so the results may differ slightly to older releases.
88
89
91 It may appear that "samtools depth" is simply "samtools mpileup" with
92 some of the columns removed, and indeed earlier versions of this com‐
93 mand were just this. However both then and now there are subtle dif‐
94 ferences in parameters which make the two not entirely comparable.
95 Differences, other than the obvious speed benefits, include:
96
97
98 o Deletions (CIGAR element "D") are counted by default in "depth".
99 This can be turned off with the -J option. "Mpileup" always ignores
100 these bases, and has no option to count them.
101
102
103 o Beware there are idiosyncrasies in option naming. Specifically -q
104 and -Q options have their meanings swapped between "depth" and
105 "mpileup".
106
107
108 o The removal of overlapping sequences (option -s) is on by default in
109 "mpileup" and off by default in "depth". Additionally the overlap
110 removal algorithm differs, giving subtle changes when Ns are present
111 in the sequence. Also any paired read is considered for overlap re‐
112 moval by "depth", rather than only those with the properly-paired
113 flag set ("mpileup"). See above for a more detailed description.
114
115
116 o The default minimum quality value is 0 for "depth" and 13 for
117 "mpileup".
118
119
120 o Specifying multiple BAMs will produce one depth column per file with
121 "depth", but these are merged in "mpileup".
122
123
124 o "Depth" doesn't have a maximum depth limit, while "mpileup" defaults
125 to a maximum of 8000.
126
127
128 o If a reference is specified to "mpileup" the BAQ algorithm will be
129 used to adjust quality values, although it can be disabled. "Depth"
130 never uses BAQ.
131
132
133
135 Written by Heng Li and James Bonfield from the Sanger Institute.
136
137
139 samtools(1), samtools-mpileup(1), samtools-coverage(1), samtools-
140 sort(1)
141
142 Samtools website: <http://www.htslib.org/>
143
144
145
146samtools-1.13 7 July 2021 samtools-depth(1)