samtools depth [options] [in1.sam|in1.bam|in1.cram [in2.sam|in2.bam|in2.cram] [...]]
Computes the depth at each position or region.
Output all positions (including those with zero depth)
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.
Compute depth at list of positions or regions in specified BED FILE. 
Use the BAM files specified in the FILE (a file of filenames, one file per line) 
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.
Ignore reads shorter than INT
At a position, read at most INT reads per input file. This means figures greater than INT may be reported in the output.
Setting this limit reduces the amount of memory and time needed to process regions with very high coverage. Passing zero for this option sets it to the highest possible value, effectively removing the depth limit. 
Note that up to release 1.8, samtools would enforce a minimum value for this option. This no longer happens and the limit is set exactly as specified.
Write output to FILE. Using “-” for FILE will send the output to stdout (also the default if this option is not used).
Only count reads with base quality greater than or equal to INT
Only count reads with mapping quality greater than or equal to INT
Only report depth in specified region.
If this option is set, it will allows 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 [...]]
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. 
For a list of flag names see samtools-flags(1).
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]
Include reads with deletions in depth computation.
For the overlapping section of a read pair, count only the bases of a single read. This is accomplished by lowering to 0 the quality values of one read for the span of the overlapping section. As a consequence, the algorithm will consider only bases with a quality above 0.
Written by Heng Li from the Sanger Institute.
samtools (1), samtools-mpileup (1), samtools-coverage (1), samtools-sort (1)
Samtools website: <http://www.htslib.org/>
Copyright © 2021 Genome Research Limited (reg no. 2742969) is a charity registered in England with number 1021457. Terms and conditions.