Expected distinct UMI labels, counting efficiency and collisions for molecules
ngs_umi_capacity
Works out the expected distinct labels when n molecules each take one of m random labels, as a Poisson model.
- Runs
- On the server
- Level
- Its calculation passed Drybench's full check: source read, a separately written implementation, edge and refusal cases, and an outside comparison where one exists. It stays below the top level because no measured prediction error is available for the model. Calculation fully checked; model error not measured
What it is
Returns the expected number of distinct labels when n molecules each take one of m random labels, as a Poisson model. Use when sizing a UMI or label set for an expected number of molecules, or checking how many molecules a label set can count. Not for library size from duplicate counts: use `ngs_library_complexity`. Not for distances between sample indexes: use `ngs_index_collisions`. molecules, labelSpace and labelContext are required; a random length L counts 4^L labels, a convention stated in the reply.
Field: Sequencing and genomics.
What it does
You give
molecules(required): Molecules that must carry different labels within one label context. Must be at least 0 and at most 1000000000000000.labelSpace(required): How the labels available are given: stated-count (labelCount, as Fu et al.'s 960) or random-length (umiLength L, counted as 4^L, a convention). Required.labelContext(required): What the molecules share before their labels must differ, as the whole sample or per start position and strand; echoed. Required. Leading and trailing white space is removed before the pattern is checked.labelCount: Labels available, with stated-count. Must be at least 1 and at most 4503599627370496. Optional.umiLength: Random label length in bases, with random-length; at most 26, so 4^L stays exact. Must be at least 1 and at most 26. Optional.
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.
- Expected distinct labels is a model, not a measurement: Poisson occupancy as Fu et al.
- 2011 state it, assuming each molecule takes one label uniformly and independently.
- No measured prediction error is available.
- Uneven label use, from synthesis bias or otherwise, can only lower the expected distinct count, as can excluded sequences when m is taken as 4^L; so the distinct labels given are an upper bound on the expected count and the colliding molecules a lower bound on their expected number.
- UMI sequencing and PCR errors raise the observed distinct count.
- The molecules are those that must carry different labels within the stated label context (the whole sample, or one start position and strand); counted over a different context, the numbers do not apply.
- A random label of length L counts 4^L labels, a convention, not the paper's.
- No statement is made on whether a label set is enough.
- 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.
Every input, with its units5 inputs
molecules(required): Molecules that must carry different labels within one label context. Must be at least 0 and at most 1000000000000000.labelSpace(required): How the labels available are given: stated-count (labelCount, as Fu et al.'s 960) or random-length (umiLength L, counted as 4^L, a convention). Required.labelContext(required): What the molecules share before their labels must differ, as the whole sample or per start position and strand; echoed. Required. Leading and trailing white space is removed before the pattern is checked.labelCount: Labels available, with stated-count. Must be at least 1 and at most 4503599627370496. Optional.umiLength: Random label length in bases, with random-length; at most 26, so 4^L stays exact. Must be at least 1 and at most 26. Optional.
The calculation
The method's equations, constants and worked example.
Equation 1
labelContext is echoed, and an empty labelContext is refused as the kit's INVALID_STRING
| Symbol | Meaning |
|---|---|
lam | molecules per label |
n | molecules within one label context |
m | labels available |
Source 1.
Equation 2
fraction of labels used = k/m
| Symbol | Meaning |
|---|---|
k | expected distinct labels |
Source 1.
Equation 3
Fu et al. state an efficiency of about 0.99 at n/m of about 0.01, a quoted statement and not a case: the model gives 0.995 at exactly 0.01, and their 480-on-960 statement (about 0.79) is the worked case
| Symbol | Meaning |
|---|---|
k/n | counting efficiency |
Source 1.
Equation 4
| Symbol | Meaning |
|---|---|
n - k | expected molecules sharing a label with another |
Source 1.
Equation 5
m = 4^L for a random label of L bases (a convention, not Fu et al.'s)
| Symbol | Meaning |
|---|---|
L | random label length in bases |
Source not recorded.
Conventions
- labelSpace = stated-count: m is the caller's stated number of labels, as Fu et al.'s 960
- labelSpace = random-length: m = 4^L for a random label of L bases, a convention, not Fu et al.'s
A model of nature: it predicts a measurement and can be wrong for your sample. No prediction error is available.
Worked example
Worked example: one case of ngs-umi-capacity@1.0.1, 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
- molecules = 4
- labelSpace = stated-count
- labelContext = per start position and strand
- labelCount = 4
Steps
- lam = 1, from molecules, labelCount; by equation 1; gives result.moleculesPerLabel.
- k = 2.5284822, from labelCount, lam; by equation 2; gives result.model.expectedDistinctLabels.
- eff = 0.63212056, from k, molecules; by equation 3; gives result.model.countingEfficiency.
- c = 1.4715178, from molecules, k; by equation 4; gives result.model.expectedCollidingMolecules.
The working, as the case writes it:
m = 4
n/m = 1
k = m(1 - e^(-n/m)) = 2.528482235314230713617904919354156530217
Answer
result.moleculesPerLabel = 1
result.model.expectedDistinctLabels = 2.5284822
result.model.countingEfficiency = 0.63212056
result.model.expectedCollidingMolecules = 1.4715178
Where these values came from: our own exact-arithmetic script and a hand-worked case; Worked by hand by Drybench on 11 November 2026 (ruling 14). This is not an independent check.
At build the tool returned this answer within the tolerance the file states: every value relative 1e-14 (near zero: absolute 1e-24 below 1e-9); statuses, codes, units, texts and withheld rules exact.
Sources
Fu GK, Hu J, Wang PH, Fodor SPA (2011), Counting individual DNA molecules by the stochastic attachment of diverse labels, PNAS 108(22):9026-9031, doi 10.1073/pnas.1017621108
Used for: Expected distinct labels for molecules on a label set, as a Poisson model. At: equation Eq. 1 (an image, read as one) and the paragraph after it (Results).
Read in full, 14 November 2026
How it is checked
- Level
Calculation fully checked; model error not measured.
- Checked against
Our own exact-arithmetic script and a hand-worked case; the source's own worked example, CPython standard library (fractions, decimal), 3.13.18.
- Cases
No case set is linked to this version.
- Not checked
Measured label use against the model (none found in Fu et al. 2011 yet); synthesis bias; UMI sequencing and PCR errors; the exact finite-m occupancy; an inverse estimate of molecules from observed labels.
What this project's records still lack1 thing
- The source's location for each equation for ngs-umi-capacity@1.0.1.
Changes to its methods0 changes
No change is logged for these method versions.