Target coverage metrics: mean depth, bases at or above a depth, fold-80 penalty
ngs_capture_metrics
Gives mean target coverage, the fraction of target bases at or above each depth, and the fold-80 base penalty.
- Runs
- On the server
- Level
- Checked against a reference: Picard 3.4.0 CollectHsMetrics run offline (the outside comparison): MEAN_TARGET_COVERAGE and PCT_TARGET_BASES_*X on seven designed cases; with exact rational arithmetic in a script of our own
What it is
Returns mean target coverage, the fraction of target bases at or above each depth, and the fold-80 base penalty. Use when checking a capture or amplicon panel's measured depths, given per base or as a depth histogram, against a depth target. Not for the depth a read count should give: use `ngs_coverage_depth`. Not for library size from duplicate counts: use `ngs_library_complexity`. depthForm, depthThresholds and depthFilters are required, and topBin with a histogram; no read filter is applied.
Field: Sequencing and genomics.
What it does
You give
depthForm(required): per-base (one depth per unique target base) or histogram (depths with base counts, the depth-zero bin included). Required.depthThresholds(required): Depths at which to report the fraction of target bases at that depth or more.depthFilters(required): How the depths were counted: picard-defaults (as Picard 3.4.0 CollectHsMetrics counts them at its default arguments: among others, mapping and base quality at least 20, reads marked duplicate excluded, overlapping read-pair bases counted once), other or unknown. Required and echoed.depths: With per-base: one whole depth per unique target base, overlapping intervals counted once. Optional.histogramDepths: With histogram: whole depths, strictly ascending, starting with 0. Optional.histogramBases: With histogram: the target bases at each depth, whole numbers, in the same order. Optional.
and 3 more, listed below
No request is recorded for this tool.
Limits
- Research arithmetic for planning sequencing libraries and runs and for genomic coordinate bookkeeping; it does arithmetic on the inputs it receives, and does not measure the library, the instrument or the data.
- Arithmetic on the per-base depths or depth histogram you supply, over all the target bases they cover, with no model of coverage.
- The depths are taken as supplied, so a read filter, duplicate removal or overlap clipping applies only if you applied it, and overlapping target intervals must be supplied once per unique base.
- Picard's metric names are given only when you declare the depths were counted under its default filters; that correspondence is your declaration and is not checked here.
- A histogram must include its depth-zero bin.
- An open top bin that holds bases withholds the mean (a lower bound is given) and fold-80, and a fraction at a depth above an open top bin is withheld.
- Fold-80 is the mean depth over all target bases, zero-depth bases included, divided by the depth of the ceil(n/5)-th smallest of those bases.
- This rule was inferred from Picard 3.4.0's outputs on designed cases, not from its source or a published formula; Picard's metric description refers to non-zero-coverage targets, which its outputs on those cases do not follow.
- When at least a fifth of target bases have zero depth the value is withheld (Picard prints a question mark).
- Fold-80 describes spread; it is not a quality verdict.
- The duplicate fraction is of aligned bases in reads your duplicate marker flagged, not a measure of PCR duplication.
- Every computed number a reply returns, other than an integer or an exact decimal, is rounded once to 12 significant figures: to the nearest, a change of at most 5 × 10⁻¹² of its value, except that a lower bound is rounded down and an upper bound up, a change of less than 1 × 10⁻¹¹; the method computes, and decides any pass or fail, on the unrounded value.
It will not answer when
- the depths cover no target base.
- the aligned bases stated are zero, so no fraction of them can be duplicate.
- more duplicate bases are stated than aligned bases.
- a histogram has no depth-zero bin, so zero-depth bases would silently drop out.
Every input, with its units9 inputs
depthForm(required): per-base (one depth per unique target base) or histogram (depths with base counts, the depth-zero bin included). Required.depthThresholds(required): Depths at which to report the fraction of target bases at that depth or more.depthFilters(required): How the depths were counted: picard-defaults (as Picard 3.4.0 CollectHsMetrics counts them at its default arguments: among others, mapping and base quality at least 20, reads marked duplicate excluded, overlapping read-pair bases counted once), other or unknown. Required and echoed.depths: With per-base: one whole depth per unique target base, overlapping intervals counted once. Optional.histogramDepths: With histogram: whole depths, strictly ascending, starting with 0. Optional.histogramBases: With histogram: the target bases at each depth, whole numbers, in the same order. Optional.topBin: With histogram, required: exact, or at-or-above when the last bin counts that depth or more. Optional.alignedBases: Aligned bases, with duplicateBases, for the duplicate-base fraction. Must be at least 0 bp and at most 1000000000000000 bp. Optional.duplicateBases: Aligned bases in reads your duplicate marker flagged, with alignedBases. Must be at least 0 bp and at most 1000000000000000 bp. Optional.
Every refusal, with its code7 refusals
| Code | When |
|---|---|
NO_TARGET_BASES | the depths cover no target base. |
NO_ALIGNED_BASES | the aligned bases stated are zero, so no fraction of them can be duplicate. |
DUPLICATES_ABOVE_TOTAL | more duplicate bases are stated than aligned bases. |
ZERO_BIN_MISSING | a histogram has no depth-zero bin, so zero-depth bases would silently drop out. |
DEPTHS_NOT_ASCENDING | the histogram's depths are not strictly ascending. |
VALUES_MISALIGNED | the histogram's depths and base counts are not one per bin. |
NO_TARGET_BASES | the depths cover no target base. |
The calculation
2 methods, each with its equations, constants and worked example.
Equation 1
mean = sum over bins of depth x bases / sum of bases, over all target bases, zero-depth bases included: the record's definition
Picard's page says only "The mean coverage of a target region" (MEAN_TARGET_COVERAGE), and Picard 3.4.0's MEAN_TARGET_COVERAGE agrees with it on the seven fold-80 verification cases
inputs are read as the exact value of their shortest decimal, and the range and whole-number tests are decided on that value
per-base and histogram depths are whole numbers at most 1e6, histogram base counts whole numbers at most 1e12, aligned and duplicate bases at most 1e15, thresholds from 0 to 1e6 and may be fractional (the kit's OUT_OF_RANGE outside a range, NOT_AN_INTEGER for a fraction, S92)
order of checks: the kit's checks of each argument, then the form's: for per-base CONFLICTING_ARGUMENT for a histogram argument, MISSING_ARGUMENT, NOT_AN_INTEGER
for a histogram CONFLICTING_ARGUMENT for depths, MISSING_ARGUMENT (the two vectors, then topBin), VALUES_MISALIGNED, NOT_AN_INTEGER (depths, then bases), DEPTHS_NOT_ASCENDING, ZERO_BIN_MISSING
then CONFLICTING_ARGUMENT where one of alignedBases and duplicateBases is given alone
then NO_TARGET_BASES, NO_ALIGNED_BASES and DUPLICATES_ABOVE_TOTAL (S89)
notes in this order: FOLD80_CONVENTION, then PICARD_NAMES
| Symbol | Meaning |
|---|---|
mean | mean depth over all target bases, zero-depth bases included, x |
Source 1.
Equation 2
fraction at or above t = bases with depth >= t / all target bases: inclusive over all target bases, as Picard's PCT_TARGET_BASES_1X is "The fraction of all target bases achieving 1X or greater coverage"
thresholds other than the depths Picard reports (its page lists 1, 2, 10, 20, 30, 40, 50 and 100X
3.4.0 also prints 250X to 100,000X, and all of these are checked against Picard 3.4.0's printed values, S141) are the record's extension
| Symbol | Meaning |
|---|---|
t | a depth threshold, x |
fraction | fraction of all target bases at depth t or more |
Source 1.
Equation 3
duplicate-base fraction = duplicate bases / aligned bases: this project's ruling, consistent with Picard's PCT_EXC_DUPE, "The fraction of aligned bases that were filtered out because they were in reads marked as duplicates" (S88)
the ratio of two stated counts, with no published constant
| Symbol | Meaning |
|---|---|
duplicate-base fraction | fraction of aligned bases in reads marked duplicate |
Source not recorded.
Conventions
- depthForm = per-base: one depth per unique target base
- depthForm = histogram: a depth histogram over the target bases, with its depth-zero bin
A definition, not a model: the equation states what the quantity means. A different convention gives a different number.
Worked example
Worked example: one case of ngs-capture-coverage@2.0.0, from its inputs through each step to the answer. Values are written as a person writes them; the working carries more digits, so your own figure may differ in the last digit shown.
Inputs
- depthForm = per-base
- depths.values[0] = 0
- depths.values[1] = 0
- depths.values[2] = 5
- depths.values[3] = 10
- depths.values[4] = 10
- depths.values[5] = 10
- depths.values[6] = 20
- depths.values[7] = 20
- depths.values[8] = 30
- depths.values[9] = 40
- depths.unit = x
- depthThresholds[0] = 1 x
- depthThresholds[1] = 10 x
- depthThresholds[2] = 20 x
- depthThresholds[3] = 50 x
- depthFilters = unknown
Steps
- m = 14.5 x, from depths; by equation 1; gives result.meanTargetCoverage.
- f10 = 0.7, from depths, depthThresholds; by equation 2; gives result.atLeast[1].fraction.
The working, as the case writes it:
n = 10 bases
mean = 29/2 = 14.5
rank floor((n + 4)/5) = 2, depth there 0
Answer
result.meanTargetCoverage = 14.5 x
result.atLeast[1].fraction = 0.7
Where these values came from: our own exact-arithmetic script and a hand-worked case; Worked by hand by Drybench on 11 November 2026 (rows 31 to 33, ruling 9). This is not an independent check.
At build the tool returned this answer within the tolerance the file states: means and fold-80 relative 1e-14, fractions relative 1e-14 (zero exact); base counts, texts, statuses, codes and withheld rules exact.
fold-80 = mean over all target bases / depth at rank floor((n + 4) / 5) counted from the smallest, the depth found as the first bin whose cumulative base count reaches that rank
withheld as twentieth-percentile-zero where that depth is 0, which takes precedence over an open top bin that holds bases
the designed and fresh Picard cases exercised none of Picard's read or base filters, which Picard's page says it applies after fold-80 ("calculated prior to some of the filters are applied"), so the inference holds only where those filters remove no target-base depth
| Symbol | Meaning |
|---|---|
fold-80 | fold-80 base penalty |
n | target bases, bp |
Source not recorded.
A definition, not a model: the equation states what the quantity means. A different convention gives a different number.
Worked example
Worked example: one case of ngs-capture-fold80@1.1.0, from its inputs through each step to the answer. Values are written as a person writes them; the working carries more digits, so your own figure may differ in the last digit shown.
Inputs
- depthForm = per-base
- depths.values[0] = 0
- depths.values[1] = 0
- depths.values[2] = 0
- depths.values[3] = 0
- depths.values[4] = 0
- depths.values[5] = 0
- depths.values[6] = 0
- depths.values[7] = 0
- depths.values[8] = 0
- depths.values[9] = 5
- depths.values[10] = 6
- depths.values[11] = 7
- depths.values[12] = 8
- depths.values[13] = 9
- depths.values[14] = 10
- depths.values[15] = 11
- depths.values[16] = 12
- depths.values[17] = 13
- depths.values[18] = 14
- depths.values[19] = 15
- depths.values[20] = 16
- depths.values[21] = 17
- depths.values[22] = 18
- depths.values[23] = 19
- depths.values[24] = 20
- depths.values[25] = 21
- depths.values[26] = 22
- depths.values[27] = 23
- depths.values[28] = 24
- depths.values[29] = 25
- depths.values[30] = 26
- depths.values[31] = 27
- depths.values[32] = 28
- depths.values[33] = 29
- depths.values[34] = 30
- depths.values[35] = 31
- depths.values[36] = 32
- depths.values[37] = 33
- depths.values[38] = 34
- depths.values[39] = 35
- depths.values[40] = 36
- depths.values[41] = 37
- depths.values[42] = 38
- depths.values[43] = 39
- depths.values[44] = 40
- depths.values[45] = 41
- depths.values[46] = 42
- depths.values[47] = 43
- depths.values[48] = 44
- depths.values[49] = 45
- depths.unit = x
- depthThresholds[0] = 1 x
- depthThresholds[1] = 20 x
- depthFilters = unknown
Steps
- f = 4.1, from depths; by the equation above; gives result.fold80BasePenalty.
The working, as the case writes it:
n = 50 bases
mean = 41/2 = 20.5
rank floor((n + 4)/5) = 10, depth there 5
Answer
result.fold80BasePenalty = 4.1
Where these values came from: our own exact-arithmetic script and a hand-worked case; exact rational arithmetic on the adopted convention; the expectation committed before Picard 3.4.0 ran on it.
At build the tool returned this answer within the tolerance the file states: means and fold-80 relative 1e-14, fractions relative 1e-14 (zero exact); base counts, texts, statuses, codes and withheld rules exact.
Sources
Picard (Broad Institute) metric definitions, HsMetrics: FOLD_80_BASE_PENALTY, MEAN_TARGET_COVERAGE, PCT_TARGET_BASES_*X, PCT_EXC_DUPE
Used for: Mean target depth, fraction of target bases at or above each depth, and duplicate-base fraction. At: section HsMetrics.
Read in full, 11 November 2026
How it is checked
- Level
Checked against a reference, the lowest of its 2 methods.
- Checked against
Mean target depth, fraction of target bases at or above each depth, and duplicate-base fraction: Our own exact-arithmetic script and a hand-worked case.
Fold-80 base penalty of target coverage, as Picard 3.4.0 computes it: Our own exact-arithmetic script and a hand-worked case.
- Cases
Mean target depth, fraction of target bases at or above each depth, and duplicate-base fraction: No case set is linked to this version.
Fold-80 base penalty of target coverage, as Picard 3.4.0 computes it: No case set is linked to this version.
- Not checked
Mean target depth, fraction of target bases at or above each depth, and duplicate-base fraction: How the depths were counted (read filters, duplicate marking, overlap clipping); real capture data against Picard on a whole BAM.
Fold-80 base penalty of target coverage, as Picard 3.4.0 computes it: Picard's source (deliberately unread); other Picard versions; depths that Picard's read and base filters would reduce (low mapping quality, low base quality, overlapping read-pair bases), which the designed cases did not include; a second written source for the formula (none found); real BAMs with paired reads, clipping and filters.
What this project's records still lack1 thing
- The source's location for each equation for both methods.
Changes to its methods1 change
- 14 November 2026, ngs-capture-coverage@2.0.0: In 2.0.0 the note states the condition (the CPO's wording), twentieth-percentile-zero takes precedence, and Picard 3.4.0's MEAN_TARGET_COVERAGE and PCT_TARGET_BASES are recorded as outside checks.