590 Base Calling

Every subsection above that touched a nucleotide sequence — the Ritz line lists, the single-cell counts, the ancient-DNA comparisons, the phylogenetic distances — began from a file of characters. This subsection asks where those characters come from.

Data. Ionic-current traces from the reference test file of the Oxford Nanopore POD5 format (nanoporetech/pod5-file-format, multi_fast5_zip_v3.pod5): ten reads, \(1.24\times 10^{5}\) samples in the first, sampled at \(4000\) Hz, sequencing kit SQK-LSK108, converted to picoamperes by the per-read calibration. Base calling with Dorado \(0.8.3\) and the three released R9.4.1 models [email protected], [email protected] and [email protected], on one GPU.

590.0.1 What the instrument records

A nanopore records current against time. The first trace spans \(3.0\) to \(115.1\) pA over \(123\,627\) samples. There are no characters in it and no discrete states; the discretisation is performed afterwards by a neural network trained to map current to sequence.

That network is trained on current traces from DNA of known sequence. The known sequence was itself determined by earlier sequencing. The mapping from current to letters is therefore fitted against the output of the procedure it replaces.

590.0.2 The same current, three models

Running the three released models on the identical file:

\[ \begin {array}{lrrrr} \text {model} & \text {reads} & \text {bases} & \text {median length} & \text {GC} \\ \hline \texttt {[email protected]} & 10 & 148\,485 & 15\,268 & 0.4253 \\ \texttt {[email protected]} & 10 & 150\,832 & 15\,501 & 0.4230 \\ \texttt {[email protected]} & 10 & 151\,551 & 15\,546 & 0.4248 \\ \end {array} \]

The three disagree on how many bases the sample contains by \(3066\), or \(2.1\%\). Aligning the reads pairwise by read identifier:

\[ \begin {array}{lrrr} \text {pair} & \text {identity} & \text {length ratio} & \text {indel \%} \\ \hline \texttt {fast}\ \text {vs}\ \texttt {hac} & 0.9183 & 0.984 & 5.72 \\ \texttt {fast}\ \text {vs}\ \texttt {sup} & 0.9146 & 0.980 & 6.04 \\ \texttt {hac}\ \text {vs}\ \texttt {sup} & 0.9510 & 0.996 & 3.39 \\ \end {array} \]

Between the fastest and the most accurate released model, \(8.5\%\) of positions differ, and \(6.0\%\) of alignment columns are insertions or deletions — that is, disagreement about whether a base is present at all, not merely about its identity.

590.0.3 What survives and what does not

The base composition is stable across models:

\[ \begin {array}{lrrrr} \text {model} & A & C & G & T \\ \hline \texttt {fast} & 31.43\% & 19.51\% & 19.07\% & 30.00\% \\ \texttt {hac} & 31.80\% & 19.53\% & 18.69\% & 29.98\% \\ \texttt {sup} & 31.76\% & 19.39\% & 18.86\% & 29.98\% \\ \end {array} \]
with GC content varying by \(0.0023\).

Two classes of quantity are thereby separated. Aggregate composition is insensitive to the choice of model. The identity of a base at a given position is not: it varies over \(8.5\%\) of positions among three models released by the same manufacturer for the same chemistry.

The \(k\)-mer distances belong to the first class. A single nucleotide polymorphism belongs to the second.

590.0.4 The number four

Nothing in the current requires four states. Constructing discretisations of the same trace without any training, from the \(4687\) current levels obtained by segmenting at the \(95\)th percentile of the first difference:

\[ \begin {array}{lrrr} \text {mapping} & k & \text {bits/symbol} & \text {gzip [B]} \\ \hline \text {quantile} & 2 & 1.000 & 805 \\ \text {quantile} & 3 & 1.585 & 1203 \\ \text {quantile} & 4 & 2.000 & 1505 \\ \text {quantile} & 6 & 2.585 & 1867 \\ \text {quantile} & 8 & 3.000 & 2160 \\ \text {quantile} & 16 & 4.000 & 2658 \\ \end {array} \]
The entropy follows \(\log _2 k\) exactly and the compressed size rises smoothly. There is no value of \(k\) at which the description becomes efficient, and in particular none at \(k=4\).
590.0.5 Four states is not one mapping

Fixing \(k=4\) and varying only where the boundaries are placed — quantiles, uniform intervals, \(k\)-means, a Gaussian mixture, rank quartiles — gives assignments that do not agree. Normalised mutual information between them:

\[ \begin {array}{lrrrrr} & \text {quantile} & \text {uniform} & k\text {-means} & \text {GMM} & \text {rank} \\ \hline \text {quantile} & 1.000 & 0.527 & 0.757 & 0.727 & 0.998 \\ \text {uniform} & 0.527 & 1.000 & 0.556 & 0.566 & 0.527 \\ k\text {-means} & 0.757 & 0.556 & 1.000 & 0.858 & 0.756 \\ \text {GMM} & 0.727 & 0.566 & 0.858 & 1.000 & 0.727 \\ \end {array} \]

Uniform binning shares only \(0.53\) of its information with quantile binning, on the same trace with the same number of states. The entropy of the uniform mapping is \(1.511\) bits against \(2.000\) for quantiles: the four states are not equally occupied, and how unequally is a property of the boundary rule rather than of the current.

590.0.6 Comparison without a mapping

Distances between reads can be computed without adopting any particular discretisation, and without a reference. Taking three-state trigram frequencies of the quartile-binned event levels, total-variation distances among eight traces range from \(0.051\) to \(0.192\), with the matrix separating the traces consistently.

No reference sequence, no trained model and no alphabet enters this computation.

590.0.7 Summary
\[ \begin {array}{ll} \text {measured} & \text {current against time} \\ \text {supplied} & \text {the number of states} \\ \text {supplied} & \text {where the boundaries lie} \\ \text {supplied} & \text {the current}\to \text {state mapping (trained on known sequence)} \\ \text {output} & \text {a string of characters} \\ \end {array} \]

A base call is the output of a network fitted against sequences produced by earlier sequencing. Three such networks, released together for the same chemistry, disagree on \(8.5\%\) of positions and on the total number of bases by \(2.1\%\). The statement that a given position carries a given base is a statement about which network was run.

Remark 590.1 (The mapping was learned from its own output). A basecaller is a trained map from ionic current to a four-letter string. The training set consists of currents recorded from DNA whose sequence was already established — by an earlier basecaller, or by a sequencing chemistry whose own calls rest on a reference assembly. The model is fitted to reproduce those strings, and its outputs are then deposited and become reference sequences in turn:

\[ \text {reference} \;\to \; \text {training} \;\to \; \text {model} \;\to \; \text {new current} \;\to \; \text {``sequence''} \;\to \; \text {reference}. \]

Two consequences follow. A sequence outside the training distribution is called less accurately, so what counts as novel is partly determined by what the model has seen; and accuracy is measured against reference assemblies, so the figure reports agreement between two outputs of the same chain rather than agreement with a sequence.

The structure is that of Alphafold, where predicted structures are scored against a database of fitted structures, with the current in place of the density map.

PIC