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, --min-BQ INT
54 Only count reads with base quality greater than or equal to INT
55
56 -Q, --min-MQ INT
57 Only count reads with mapping quality greater than or equal to
58 INT
59
60 -r CHR:FROM-TO
61 Only report depth in specified region.
62
63 -X If this option is set, it will allow the user to specify cus‐
64 tomized index file location(s) if the data folder does not con‐
65 tain any index file. Example usage: samtools depth [options] -X
66 /data_folder/in1.bam [/data_folder/in2.bam [...]] /in‐
67 dex_folder/index1.bai [/index_folder/index2.bai [...]]
68
69 -g FLAGS
70 By default, reads that have any of the flags UNMAP, SECONDARY,
71 QCFAIL, or DUP set are skipped. To include these reads back in
72 the analysis, use this option together with the desired flag or
73 flag combination. FLAGS can be specified in hex by beginning
74 with `0x' (i.e. /^0x[0-9A-F]+/), in octal by beginning with `0'
75 (i.e. /^0[0-7]+/), as a decimal number not beginning with '0'
76 or as a comma-separated list of flag names. [0]
77
78 For a list of flag names see samtools-flags(1).
79
80 -G FLAGS
81 Discard any read that has any of the flags specified by FLAGS
82 set. FLAGS are specified as for the -g option. [UNMAP,SEC‐
83 ONDARY,QCFAIL,DUP]
84
85 -J Include reads with deletions in depth computation.
86
87 -s For the overlapping section of a read pair, count only the
88 bases of the first read. Note this algorithm changed in 1.13
89 so the results may differ slightly to older releases.
90
91
93 It may appear that "samtools depth" is simply "samtools mpileup" with
94 some of the columns removed, and indeed earlier versions of this com‐
95 mand were just this. However both then and now there are subtle dif‐
96 ferences in parameters which make the two not entirely comparable.
97 Differences, other than the obvious speed benefits, include:
98
99
100 o Deletions (CIGAR element "D") are ignored by default in "depth".
101 These may be counted by adding the -J option. "Mpileup" always
102 counts the deleted bases, and has no option to toggle this.
103
104
105 o Beware there are idiosyncrasies in option naming. Specifically -q
106 and -Q options have their meanings swapped between "depth" and
107 "mpileup".
108
109
110 o The removal of overlapping sequences (option -s) is on by default in
111 "mpileup" and off by default in "depth". Additionally the overlap
112 removal algorithm differs, giving subtle changes when Ns are present
113 in the sequence. Also any paired read is considered for overlap re‐
114 moval by "depth", rather than only those with the properly-paired
115 flag set ("mpileup"). See above for a more detailed description.
116
117
118 o The default minimum quality value is 0 for "depth" and 13 for
119 "mpileup".
120
121
122 o Specifying multiple BAMs will produce one depth column per file with
123 "depth", but these are merged in "mpileup".
124
125
126 o "Depth" doesn't have a maximum depth limit, while "mpileup" defaults
127 to a maximum of 8000.
128
129
130 o If a reference is specified to "mpileup" the BAQ algorithm will be
131 used to adjust quality values, although it can be disabled. "Depth"
132 never uses BAQ.
133
134
135
137 Written by Heng Li and James Bonfield from the Sanger Institute.
138
139
141 samtools(1), samtools-mpileup(1), samtools-coverage(1), samtools-
142 sort(1)
143
144 Samtools website: <http://www.htslib.org/>
145
146
147
148samtools-1.15.1 7 April 2022 samtools-depth(1)