# Mean target depth, fraction of target bases at or above each depth, and duplicate-base fraction, version 2.0.0

ngs-capture-coverage\@2.0.0: this version's equations with their symbols, each constant's value, their sources and whether each was read, a worked example where the record holds one, its level and what it was checked against, the number of cases, and what was not checked. This version's record is not rewritten; a correction is added under Changes.

## What this page can and cannot show

**Level: Checked against a reference; Agrees with Picard 3.4.0 on designed cases; depths as supplied, no read filters applied. Reference kind: our own exact-arithmetic script and a hand-worked case.**

Not fully recorded, and not independently reviewed. Items marked "Not recorded" are missing from this project's records for the version named. Apart from any worked example shown, the cases and their values are not printed, so a reader cannot re-run these checks. No independent scientist has yet reviewed these methods or checks.

[Every version of this method](https://www.drybench.com/methods/m/ngs-capture-coverage) · [Every method](https://www.drybench.com/methods/m) · [What the levels mean](https://www.drybench.com/methods/levels)

## Version 2.0.0

**Level: Checked against a reference; Agrees with Picard 3.4.0 on designed cases; depths as supplied, no read filters applied. Reference kind: our own exact-arithmetic script and a hand-worked case.** `ngs-capture-coverage@2.0.0`

Built, not hosted. Generated from a snapshot of the library's records taken on 2026-11-25, as committed on 2026-11-25. A later snapshot replaces this one, so these records and this page can change.

**Verification statement:** Mean, inclusive fractions over all target bases and the duplicate-base fraction checked exactly against rationals in a script of our own, hand-worked, with the per-base and histogram forms giving the same outputs; Picard 3.4.0's MEAN\_TARGET\_COVERAGE and PCT\_TARGET\_BASES at every depth Picard prints, 1X to 100,000X, agree on the seven designed cases; the duplicate fraction is the ratio of two stated counts.

From per-base target depths or a target depth histogram with its depth-zero bin: the mean depth over all target bases, the fraction of all target bases at or above each depth (inclusive), and, where stated, the fraction of aligned bases in reads marked duplicate; a capped top bin withholds the mean (with its lower bound) and any fraction above the cap.

- **How results are reported:** none: full double precision, unrounded
- **Uncertainty:** Arithmetic on the depths supplied; how they were counted (read filters, duplicates, overlaps) is the caller's.
- **Reference, as its record states it:** 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
- **Level confirmed by this project's ruling of** 14 November 2026

[What this page can and cannot show](#what-this-page-can-and-cannot-show)

### What was checked

102 cases in 2 files, linked by this exact version.

Run through the tool at build against our own exact-arithmetic script and a hand-worked case: 70 agree within the tolerance the file states, 32 refuse as the case expects, 0 differ, 0 were not run.

- **File 1, 61 cases**
  - **Where the expected values came from:** our own exact-arithmetic script and a hand-worked case
  - **Recorded on:** 2026-11-14
  - **Reference:** second implementation (Python 3.13), 2026-11-14; licence BSD-3-Clause
  - **Tolerance as the file states it:** means and fold-80 relative 1e-14, fractions relative 1e-14 (zero exact); base counts, texts, statuses, codes and withheld rules exact

- **File 2, 41 cases**
  - **Where the expected values came from:** our own exact-arithmetic script and a hand-worked case
  - **Recorded on:** 2026-11-14
  - **Reference:** CPython standard library (fractions), 3.13.18; licence PSF-2.0
  - **Tolerance as the file states it:** means and fold-80 relative 1e-14, fractions relative 1e-14 (zero exact); base counts, texts, statuses, codes and withheld rules exact

Apart from the worked example, the cases and their values are not printed here. This shows agreement with this project's recorded cases. It does not show that a method suits your work, and it is not a qualification.

### What was not checked

How the depths were counted (read filters, duplicate marking, overlap clipping); real capture data against Picard on a whole BAM.

### Definition or model

A closed form: the result follows from the inputs by the equations alone.

### Equations

**Equation 1**

```equation
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 and unit |
| --- | --- |
| mean | mean depth over all target bases, zero-depth bases included, x |

Source: Picard (Broad Institute) metric definitions, HsMetrics: FOLD\_80\_BASE\_PENALTY, MEAN\_TARGET\_COVERAGE, PCT\_TARGET\_BASES\_\*X, PCT\_EXC\_DUPE, section HsMetrics, the page as served on 11 November 2026, for Picard 3.4.0; read in full on 2026-11-11 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning de1922338305. Free to read (MIT (Picard)), checked 2026-11-11. No erratum found (searched Picard's release notes for 3.4.0), 2026-11-11.

**Equation 2**

```equation
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 and unit |
| --- | --- |
| t | a depth threshold, x |
| fraction | fraction of all target bases at depth t or more |

Source: Picard (Broad Institute) metric definitions, HsMetrics: FOLD\_80\_BASE\_PENALTY, MEAN\_TARGET\_COVERAGE, PCT\_TARGET\_BASES\_\*X, PCT\_EXC\_DUPE, section HsMetrics, the page as served on 11 November 2026, for Picard 3.4.0; read in full on 2026-11-11 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning de1922338305. Free to read (MIT (Picard)), checked 2026-11-11. No erratum found (searched Picard's release notes for 3.4.0), 2026-11-11.

**Equation 3**

```equation
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 and unit |
| --- | --- |
| duplicate-base fraction | fraction of aligned bases in reads marked duplicate |

Ruling of this project: 11 November 2026, section "6. \`ngs-capture-metrics\`: required conventions, echoed". Not yet published; its effect is stated on this page. A choice this project made, not a value from the literature.

### Conventions

What each mode computes:

- `depthForm = per-base`: one depth per unique target base
- `depthForm = histogram`: a depth histogram over the target bases, with its depth-zero bin

### Constants

Constants: none used.

### 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**

1. m = 14.5 x, from depths; by equation 1; gives result.meanTargetCoverage.
2. f10 = 0.7, from depths, depthThresholds; by equation 2; gives result.atLeast\[1\].fraction.

The working, as the case writes it:

```equation
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.

Who worked this case: not recorded.

### What it refuses, and its input ranges

- `NO_TARGET_BASES`: the depths cover no target base Next: Send the depths over your target bases, including those at zero depth.
- `NO_ALIGNED_BASES`: the aligned bases stated are zero, so no fraction of them can be duplicate Next: Give the aligned bases your duplicate marker examined, or leave out both base counts.
- `DUPLICATES_ABOVE_TOTAL`: more duplicate bases are stated than aligned bases Next: Check the two base counts; the duplicates are a part of the aligned bases.
- `ZERO_BIN_MISSING` (invalid input): a histogram has no depth-zero bin, so zero-depth bases would silently drop out
- `DEPTHS_NOT_ASCENDING` (invalid input): the histogram's depths are not strictly ascending
- `VALUES_MISALIGNED` (invalid input): the histogram's depths and base counts are not one per bin

### Flags and notes a reply may carry

A note a reply may carry:

- `PICARD_NAMES`: With the depths declared as counted under Picard's default filters, the mean corresponds to Picard's MEAN\_TARGET\_COVERAGE, and each fraction to its PCT\_TARGET\_BASES\_\*X value for the same depth where Picard reports that depth. The fold-80 penalty corresponds to FOLD\_80\_BASE\_PENALTY only where the reads and bases those filters remove (reads of low mapping quality, bases of low base quality, and the overlapping bases of read pairs) would have added no depth at the target bases, because Picard's metric definitions say it computes fold-80 prior to some of the filters. The correspondence rests on your declaration and on the same unique target bases; it is not checked here.

### Changes

#### 2026-11-14-ngs-capture-coverage\@2.0.0-1

2026-11-14 · [`ngs-capture-coverage@2.0.0`](https://www.drybench.com/methods/m/ngs-capture-coverage) · Corrections to our methods

- **What was wrong:** With the depths declared as counted under Picard's default filters, the reply's PICARD\_NAMES note said the fold-80 penalty corresponds to Picard's FOLD\_80\_BASE\_PENALTY. Picard's metric definitions say it computes fold-80 before some of those filters (low mapping quality, low base quality, overlapping read-pair bases), so the two agree only where the filters remove no target-base depth. Where an open top bin held bases and at least a fifth of the bases were at zero depth, fold-80 was withheld as top-bin-capped, although the ratio has no finite value whatever the top bin holds.
- **Affected:** Version 1.0.0 of the assistant tool ngs\_capture\_metrics: the PICARD\_NAMES note on every reply declaring picard-defaults, and the withholding rule named for fold-80 in histograms with both conditions. No served number changed.
- **What changed:** 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.
- **How it was found:** The CSO's review of the raising run, 14 November 2026 (S85, S91), reading Picard's metric definitions page.
- **Cases added:** stored reference values re-records the retired -1 at 2.0.0, with both fold-80 withholdings at once, the bounds either side and seven Picard cases.

## Tools that use it

- [`ngs_capture_metrics`](https://www.drybench.com/methods/tools/ngs-capture-metrics)

## Cite this version

Mean target depth, fraction of target bases at or above each depth, and duplicate-base fraction. Drybench; ngs-capture-coverage\@2.0.0; [https://www.drybench.com/methods/m/ngs-capture-coverage/2.0.0](https://www.drybench.com/methods/m/ngs-capture-coverage/2.0.0) (accessed \[date\]).
