Technology

Optimal transport: an objective yardstick for immune change

At the core of CogniMune is a mathematically rigorous approach leveraging regularized optimal transport, enabling unbiased comparisons of high-dimensional cytometry datasets — and a clearer view of rare immune-cell subsets that may reflect therapy-induced changes.

Optimal transport between two distributions A baseline histogram of marker intensity above, an on-therapy histogram below, and the flows of the optimal transport plan that moves one into the other. Illustrative shapes. μ · BASELINE (TIME 1) ν · ON THERAPY (TIME n) marker intensity → W₁(μ, ν) = 1.08
Explained for clinicians

How much has a patient's immune system changed — and where?

A 40-color measurement describes each blood sample as millions of cells spread over a high-dimensional marker space. Comparing two such samples is hard: established computational methods for dimensionality reduction and clustering are acceptable and widely used, but they can sometimes oversimplify the data or create groupings that, while mathematically valid, lack biological relevance.

Optimal transport (OT) asks a simple question instead: what is the least amount of “work” needed to turn one sample's distribution of cells into the other's? The answer is a distance — zero when nothing has changed, larger when more cells have shifted further — and a transport plan that shows which cells moved where.

Classical OT solvers can be computationally intensive. CogniMune uses the Sinkhorn distance, a regularized Wasserstein distance that adds entropy for computational efficiency, and summarizes each sample as a low-resolution graph of immune-cell populations — a fingerprint that can be compared across visits.

Step 1

Each sample is a distribution

How the patient's cells are spread across marker expression — here, one marker in a few intensity bins.

Step 2

Find the cheapest way to move one into the other

Mass moved × distance traveled, minimized over every possible plan.

Step 3

Distances become a fingerprint

Distances between populations define a graph; distances between graphs track change over time.

Unbiased comparisons

OT Sinkhorn distances quantify immune-profile changes objectively, eliminating the subjective interpretation variability that limits current approaches.

Interpretable

Graph edit operations name the cell populations and relationships that contribute to a change; layouts follow phenotype similarity.

Rare subsets in view

Comparing whole distributions provides a clearer view of rare immune-cell subsets that may reflect therapy-induced immunological changes.

Interactive

Live Sinkhorn demo

Two histograms stand in for one marker’s intensity distribution at baseline (μ) and on therapy (ν). The demo runs the log-domain Sinkhorn–Knopp algorithm in your browser and compares the result with the exact one-dimensional Wasserstein distance W₁.

Transport between two distributions

Illustrative distributions
Preset shapes
0.01 · sharp, slower10 · blurred, fast
μ — baseline (time 1)
ν — on therapy (time n)

Drag across the bars to reshape a distribution, or focus a histogram and use ← → to pick a bin and ↑ ↓ to change it. Bars are normalized to total mass 1; empty bins are allowed. The ground cost between bins i and j is |i − j|.

Sinkhorn plan P (darker = more mass) Exact optimal plan Diagonal: no movement
Sinkhorn cost Sε
—
⟨P, C⟩ in intensity bins
Exact W₁
—
closed form in 1-D
Difference
—
—
Iterations
—
—

Accuracy versus speed

Entropy makes the problem smooth: a larger ε blurs the plan and converges in very few iterations, while a smaller ε approaches the exact optimal transport at the price of more iterations. The log-domain (stabilized) iterations used here, as in the CogniMune engine, stay numerically safe even for very small ε and for empty bins.

Each iteration costs one pass over the n × m cost matrix — the ~O(n²) per iteration cited in the proposal.

Next step · two dimensions

Cloud Distance Lab

Drag two point clouds and compare the Sinkhorn distance with the exact earth mover’s distance and six other measures: Euclidean distance between centers, 1-D EMD on PC1, Jensen–Shannon, Bhattacharyya, energy distance and MMD.

Open the lab
Sub-Aim 3-1 · Data fingerprinting

The mathematics

The methodology follows a recent manuscript from the Purdue research partners. Notation as in the proposal; bold symbols are vectors and matrices.

1 · Optimal transport

The classic OT problem

For probability distributions μ∈ℝn and ν∈ℝm with ∑i=1nμi=1, ∑j=1mνj=1 and cost matrix C∈ℝn×m:

W(μ,ν)= minP ∑i=1n ∑j=1m cijPij subject to P1m=μ, P⊤1n=ν, P≥0

Pij is the mass moved from bin or population i to j; cij the cost of moving it.

2 · Entropic regularization

The Sinkhorn distance

Entropy regularization εH(P) with ε>0 makes the problem smooth and fast to solve:

H(P)=− ∑i=1n ∑j=1m Pijlog⁡Pij Sε(μ,ν)= ∑i=1n ∑j=1m cijPijε Pε= argminP ∑cijPij −εH(P)

subject to the same constraints. As ε → 0 the Sinkhorn plan approaches the exact optimal plan (see the demo above).

3 · Algorithm

Sinkhorn–Knopp iterations

With the Gibbs kernel and scaling vectors u∈ℝn, v∈ℝm:

K=exp⁡(−C/ε) u(k+1)= μKv(k) , v(k+1)= νK⊤u(k+1) P=diag(u)Kdiag(v)

Divisions are element-wise. Each update is a matrix–vector product; the demo and the CogniMune engine run the same updates in the log domain for numerical stability.

4 · Cost

From intensive to practical

Classical OT solvers can be computationally intensive and challenging to implement. The Sinkhorn–Knopp algorithm reduces the cost per iteration and achieves rapid convergence on high-parameter flow cytometry data, based on current test data (per the proposal).

O(n3log⁡n)
classical OT, roughly
∼O(n2)
per Sinkhorn–Knopp iteration
5 · Populations

Distance matrix and embedding

For cell-population distributions {μ1,μ2,…,μn}, a pairwise distance matrix:

D∈ℝn×n: Dij=Sε(μi,μj), Dii=0 B=−12JD(2)J, J=I−1n11⊤

Classical multidimensional scaling converts D into the similarity matrix B (double-centring of squared distances) and takes k-dimensional embeddings from its leading eigenvectors — the layout used for the fingerprint graphs.

6 · Graph

The immune fingerprint graph

𝒢=(𝒱,ℰ,W,V), Wij=Sε(μi,μj) ℰ={(vi,vj)∣ Ψ(μi,μj)≤τ,i≠j}

Nodes vi correspond to population distributions μi, edge weights are Sinkhorn distances and node weights V are the cell-population proportions. Optional biological distance thresholding at τ keeps only close relationships.

7 · Comparison

Spectral distance

Lnormalized=I− D−1/2WD−1/2 , Dii=∑jWij+(V)ii dspectral(𝒢1,𝒢2)= (∑i=1k(λi(1)−λi(2))2)1/2

Here D is the degree matrix, λi(1) and λi(2) the eigenvalues of the two normalized Laplacians, and k=min(|𝒱1|,|𝒱2|).

8 · Comparison

Graph edit distance (GED)

GED(𝒢1,𝒢2)= min(e1,…,ek)∈𝒫 ∑i=1kc(ei)

The minimum total cost over edit paths 𝒫 — sequences of node and edge insertions, deletions and substitutions — that transform 𝒢1 into 𝒢2. The operations themselves name the cell populations and relationships that contribute to a change.

Both metrics apply to annotated graphs (labeled populations) or raw graphs (statistical clusters).

Visualization

Layouts derived from phenotype similarity

CogniMune represents immune-cell populations and their relationships as a graph with biologically meaningful layouts derived from phenotype similarity, making interpretation intuitive for clinicians and cytometry practitioners.

The panel's leaf populations, arranged by expected phenotype

Illustrative · not patient data

Select a population in the graph.

Nodes are the 30 mutually exclusive (leaf) populations measured by the panel, colored by lineage. They are placed by classical MDS of their reference marker signatures (40% of the variance in two dimensions), then gently spaced apart so labels stay legible; each node is linked to its two nearest phenotypes. In a patient fingerprint, node size and edge weights come from the measured proportions and Sinkhorn distances. Hover a node for its definition; scroll or pinch to zoom.

Population list
PopulationLineage
Mature neutrophilsGranulocytes
Immature neutrophilsGranulocytes
BasophilsGranulocytes
Classical monocytesMonocytes
Intermediate monocytesMonocytes
Non-classical monocytesMonocytes
cDC2 (CD1c+ CD11c+ DC)Dendritic cells
Plasmacytoid DCDendritic cells
CD56bright NK cellsNK cells
CD56dim CD16+ NK cellsNK cells
Innate lymphoid cellsILC
NKT-like cellsUnconventional T
γδ T cells (CD27+)Unconventional T
Effector/memory γδ T cellsUnconventional T
Naive CD4 T cellsCD4 T cells
Central memory CD4 T cellsCD4 T cells
Effector memory CD4 T cellsCD4 T cells
CD4 TEMRACD4 T cells
Regulatory T cellsCD4 T cells
Activated / terminally differentiated TregCD4 T cells
Naive CD8 T cellsCD8 T cells
Stem-cell memory CD8 T cellsCD8 T cells
Central memory CD8 T cellsCD8 T cells
Effector memory CD8 T cellsCD8 T cells
CD8 TEMRACD8 T cells
Naive B cellsB cells
Transitional / regulatory B cells (Breg)B cells
IgD+ memory B cells (unswitched)B cells
IgD− memory B cells (switched)B cells
PlasmablastsB cells
Figure 7

The automated data-processing workflow

After patient evaluation, each visit produces blood for cytometry and MRI imaging. Every cytometry acquisition becomes a graph; inter-graph distances identify quantitative metrics of ARIA progression, with GED operations specifying the contributing cell populations and relationships.

Patient evaluation
Immune system CNS

The peripheral immune system is read out from blood; the central nervous system through MRI.

Time 1
Blood→ cytometry
MRIimaging
Graph 1
Time 2
Blood→ cytometry
MRIimaging
Graph 2
Time n
Blood→ cytometry
MRIimaging
Graph n

Adapted from proposal Figure 7, “The general workflow for implementation and usage of automated data processing system.”

Sub-Aim 3-2 · Data management and health informatics

Built for protected health information from the start

For future commercial data processing, the project selected Amazon Web Services (AWS), with robust HIPAA compliance through its Business Associate Agreement (BAA). Its capability to handle protected health information while adhering to strict security and compliance standards makes it an ideal foundation for a flow cytometry data-processing system.

The system will perform the computationally intensive tasks:

Spectral unmixing Optimal transport across cell populations Graph building and matching

Phase I · de-identified research data

Blood samples are de-identified biobank samples, and the Phase I research portal stores study codes and study weeks only — no names, dates of birth or record numbers.

Phase II · cloud platform

A user-friendly interface where clinicians upload cytometry files, OT-based summaries are computed automatically, and immunologic shifts are visualized without requiring familiarity with the underlying mathematics.

HIPAA compliance

AWS services covered by the Business Associate Agreement provide the security and compliance foundation for handling protected health information.

What goes into each fingerprint

The 40-color panel measures 39 immune markers plus a viability dye — the populations that become the nodes of every graph.