Unmixing Sequencing Batches: Cross-Contamination as a Leakage Problem

When dozens of patient samples are prepared on one plate and sequenced together, a little of each sample's genetic material ends up in its neighbours. The routes include splashes between wells, aerosols, and reads that get tagged with the wrong sample barcode. In metagenomic next-generation sequencing (mNGS), which reads all DNA or RNA in a specimen without targeting any particular organism, this leakage produces false pathogen calls. It is also hard to remove by simple cutoffs, because real infections can be diagnosed from as little as a single microbial read (Adjunctive Diagnosis of Mycobacterium gordonae Pneumonia by Metagenomic Next-Generation Sequencing in an Immunocompetent Patient: A Case Report and Literature Review). Brain-recording researchers have faced the same structure for decades. Each EEG or MEG sensor (scalp electrodes or magnetic sensors that record brain activity) picks up a weighted mixture of many brain sources, because electrical fields spread through head tissue. This spread is called volume conduction. The field has learned to treat it as a mixing matrix to be inverted rather than a nuisance to be thresholded away.

We propose to model a sequencing batch the same way. Each sample's observed reads are treated as a non-negative mixture of every sample's "own" material. The mixing weights are constrained by physical plate geometry and barcode sharing. The weights are identified by a signature that leaked material cannot hide: it carries an exact copy of its source sample's variant profile and of its duplicated sequencing fragments. The model estimates the leakage matrix and each sample's own pathogen content jointly. It then asks whether a detection survives after the estimated leakage is subtracted. This replaces rule-based contamination flags with a likelihood test. It should matter most in the cases current tools assume away: contamination arriving from several wells at once, or from a sample that is not the batch's highest-count carrier.

Core Claim

The transferable idea from volume conduction is not phase lag itself. It is the logic behind it: a passive copy of a signal is a scaled, undistorted replica of its source, while an independent signal carries its own structure. In EEG, a volume-conducted copy arrives with zero time delay, which is why the phase lag index discards phase differences at 0 and π. In a sequencing batch, the leaked copy of a virus in well $j$ has the same allele frequencies at polymorphic sites as the source well $k$, and it shares identical duplicated fragments with it. An independent infection of the same species in well $j$ has its own variant spectrum. Our claim is that combining this "replica signature" with a physically structured mixing prior makes the leakage matrix identifiable from the batch itself. A joint estimate of leakage and true content should then separate infection from contamination better than Cont-ID, the closest existing method, especially at low read counts and with multiple contamination sources.

The Model

For taxon $t$ and variant class $h$ (an allele at a polymorphic site, or a duplicate-fragment cluster), let $C_{ith}$ be the read count observed in sample $i$. We model

$$C_{ith} \sim \text{Poisson}\Big(d_i \sum_k M_{ik} S_{kth}\Big),$$

with the terms defined as follows. $d_i$ is sample $i$'s sequencing depth. $S_{kth} \ge 0$ is sample $k$'s own (uncontaminated) content. $M_{ik} \ge 0$ is the fraction of sample $k$'s material appearing in sample $i$, with $M_{ii}=1$.

The off-diagonal leakage is parameterised as $M_{ik} = \alpha_i\, g(\text{plate distance}_{ik}, \text{shared barcode}_{ik})$. Here $\alpha_i$ is a per-sample susceptibility and $g$ is a small learned kernel. This mirrors how the lead-field matrix in MEG is fixed by head geometry rather than fit freely, as in the joint state-space MEG model. The external alien control that Cont-ID already uses supplies one column of $M$ with known content, which anchors the scale of $\alpha$. Fitting is by expectation-maximisation, in the form of non-negative factorisation with fixed structure. A detection of taxon $t$ in sample $i$ is called "own" if a likelihood-ratio test rejects $S_{it\cdot}=0$ against the fitted leakage alone.

Relation to Prior Work

Two electrophysiology papers supply the method. The symmetric multivariate leakage correction removes all instantaneous mixing among brain regions at once instead of pair by pair. That paper reports that the multivariate version is both more accurate and faster (70 s versus 2000 s) than pairwise correction. Cont-ID likewise reasons about sample pairs, and we keep the multivariate lesson. However, that correction assumes continuous Gaussian signals and removes all zero-lag dependence, so we replace it with a count likelihood. JEDI-MEG motivates estimating sources and interactions jointly, after showing that two-step pipelines inflate false-positive connections. The mNGS analogue of a two-step pipeline is "call taxa, then flag contamination," which is what current tools do.

Cont-ID is the direct competitor. It classifies each detection using normalized abundance, a deduplication ratio, and an alien control, combined through three thresholds. It also assumes contamination comes from the highest-count sample in the batch. Our model keeps its two signals but uses them as evidence inside a mixing model rather than as threshold inputs. It also allows any number of sources. CAMI II motivates the need for automatic, reproducible calls: only 3 of 10 clinical-challenge submissions found the causal virus, and none were reproducible, because of manual threshold tuning. Bin-level decontamination tools such as Deepurify and BASALT address a different problem: foreign contigs within a single genome bin, not leakage between samples. They are not competitors here.

Neuroscience also supplies a constraint. Removing all zero-lag dependence deletes real zero-lag synchrony. Our analogue is genuine shared infection: epidemiologically linked patients carrying the same strain look exactly like contamination by the replica signature. The plate prior is what separates them. Linked patients in non-adjacent wells with different barcodes should not be explained by $M$, and the experiments test this directly.

One caveat. We could only search the supplied literature. Models of well-to-well leakage may exist in amplicon decontamination work outside it. Before building anything, we will do a targeted literature check, and if such models exist we will add them as baselines.

Research Program

We will build three things. The first is the batch-mixing model with three components: the variant and duplicate-fragment replica features, the plate-and-barcode kernel, and the alien-control anchor. The second is an in silico contamination simulator. It takes real clean datasets and injects leakage with known $M$, varying leakage rate, number of sources, the source's rank in read count, and whether a true co-infection of the same species with a distinct or identical haplotype is present. The third is an analysis of when the model is identifiable. We will characterise how few polymorphic sites and reads are needed before replica features stop discriminating; this is the sequencing analogue of signal-to-noise limits in MEG simulations.

Baselines

The naive reference is a fixed read-count cutoff applied per detection. This is the "do nothing beyond thresholding" practice that the CAMI II clinical challenge results argue against. We will sweep the cutoff and report the best value on the evaluation set, which flatters this baseline. A second naive reference is subtraction of negative extraction blanks, which captures reagent contamination but not cross-sample transfer.

The strongest existing method is Cont-ID. On its 273-dataset benchmark spanning 68 viral species, it reports 91% global classification accuracy and about 90% average accuracy across datasets. We will run it on the same datasets with its published thresholds, and again with thresholds retuned on the same training folds our model uses, so the tuning budget is equal. Beating it means higher accuracy than 91% on the full benchmark under identical folds. More importantly, it means a clear margin on the subsets where its assumptions fail: multi-source batches and non-maximal sources. Equal overall accuracy with no subset gain would count as failure.

A strong learned competitor is a gradient-boosted classifier trained on Cont-ID's features plus our replica features, with no mixing model. Ablations isolate the key ingredients. The first removes variant and duplicate replica features and uses taxon counts only, which tests whether identifiability really comes from the replica signature. The second replaces the plate kernel with a free $M$. The third restricts sources to the single highest-count sample, recreating Cont-ID's assumption inside our model. All methods share the same data splits and compute.

Why not just…?

Why not just tune a read-count threshold per batch? Real pathogens appear at single-read levels in sterile sites (M. gordonae pneumonia). Contaminant counts also scale with the titer of neighbouring wells, which a single threshold cannot follow. The threshold sweep in our baselines measures this directly. We expect it to lose most where true and leaked counts overlap.

Why not just improve Cont-ID's thresholds or add rules? This is a fair option, and the retuned Cont-ID baseline gives it the same tuning budget we use. Its structural limit is the single-source assumption. The simulator's multi-source and non-maximal-source conditions will show whether that limit matters in practice. If it does not, the mixing model's advantage reduces to the replica features alone.

Why not just train a classifier on per-detection features? This is the real threat. A boosted classifier with replica features may match the mixing model on the real benchmark. The test that settles it is distribution shift. We will train on one library protocol (for example, total RNA) and test on another (small RNA or dsRNA), and also test on batch layouts unseen in training. A physically structured model should transfer across these, while a classifier trained on per-detection features may not. If the classifier transfers equally well, we will report that and recommend it, keeping the mixing model only for estimating leakage rates.

Proposed Experiments

The primary evaluation uses the Cont-ID benchmark, with accuracy, AUROC per detection, and false-positive rate at matched sensitivity, broken down by library protocol and read-count bin. The simulator provides ground truth for $M$. On it we report recovery error of the leakage matrix and detection performance as leakage sources multiply and as the source's count rank drops. We will also apply the model to the CAMI II clinical pathogen dataset as a reproducibility check, since that challenge's failure mode was manual intervention. No reported per-method accuracy is found on Lacuna for this dataset beyond the 3-of-10 submission count. Our model runs without hand-tuned parameters.

The decisive checks are three. First, the replica-feature ablation must lose clearly, or the core claim is wrong. Second, gains over Cont-ID must concentrate in multi-source and non-maximal-source batches. Third, the model must keep linked true infections in non-adjacent wells while still flagging identical haplotypes in adjacent wells. Failing the third check would show that we have imported volume conduction's known flaw, the loss of real zero-lag synchrony, along with its fix.