Pathway Enrichment Tests on Space-Time Tissue Graphs

Spatial transcriptomics measures which genes are active at each spot of a tissue slice. Because measuring a slice destroys it, a developing or regenerating tissue is recorded as a handful of snapshots, for example seven slices of axolotl brain taken 2 to 60 days after injury. Biologists want to know which pathways switch on, where, and when. Pathways are curated groups of interacting genes, such as a signaling cascade from KEGG, a database of hand-drawn molecular wiring diagrams. Today the usual answer comes from functional enrichment analysis, a family of statistical tests that ask whether a gene group is changing more than chance would predict. These tests run separately on each slice or on pooled cells. They ignore where the cells sit, how slices connect in time, and, in the simplest versions, how the genes in a pathway interact.

We propose one hypothesis test that uses all three structures at once. We borrow the representation that event-camera vision uses for asynchronous pixel events: each measurement becomes a node in a space-time graph, with edges to neighbors within a spatial and temporal radius. We connect spots within a slice by physical proximity and across adjacent time points by an alignment. We then take the product of this tissue graph with the pathway's gene-interaction graph. On that joint graph we test whether the change in expression between time points is non-zero. The test adapts to how smooth the change is along the gene network and along the tissue. The output is a calibrated p-value per pathway, and for significant pathways, a map of where in space and time the change sits.

Core Claim

A pathway that is truly reorganizing during regeneration should produce changes that are coherent along two graphs at once. Interacting genes should move together, and nearby spots in adjacent slices should move together. An adaptive test on the product of these two graphs should detect such changes with more power than tests that use only one of them, at the same false-positive rate. Examples of single-graph tests are per-slice gene-set tests, or spot-level pathway scores smoothed in space.

The statistical backbone comes from Combined Hypothesis Testing on Graphs. That paper builds an adaptive statistic $T_{max}=\max_\lambda T_\lambda$. It interpolates between a $\chi^2$ test, which suits scattered signals, and a likelihood-ratio test aligned with the gene-graph Laplacian, which suits smooth signals. It proves the statistic is minimax optimal across smoothness classes and shows it keeps at least 85.7% of the power of an idealized z-test and 61.2% of a $\chi^2$ test in adverse regimes. The paper works only on a gene graph with dissociated samples. We add a second, spatiotemporal graph and a second smoothness knob.

Where This Sits

Three recent models fit continuous dynamics to spatial transcriptomics, and all three stop short of pathway-level inference.

  • ChronoTILE learns continuous velocity fields by multi-marginal flow matching over a cell-to-niche-to-tissue Transformer. It is evaluated by distances between distributions, not by pathway enrichment.
  • STORIES learns a differentiation potential. It aligns slices with Fused Gromov-Wasserstein transport, which is optimal transport that also preserves physical distances between cells, and validates on single driver genes.
  • STODE couples a variational autoencoder to a potential-guided neural ODE and reports individual morphogenetic genes.

These papers motivate the proposal because they show spatial position changes cell fate. STORIES reports that progenitors with the same expression profile diverge by distance to the injury. They also supply a method: we reuse STORIES-style alignment to build the temporal edges.

We deliberately do not test on data generated by these models, for reasons given below.

On the enrichment side, three papers each drop part of the structure we need:

  • netgsa tests pathways using network topology. It uses a fast moment estimator and block-diagonal clustering, which cut runtime from 167.83 to 4.60 minutes on TCGA cohorts, but it assumes static bulk samples.
  • DeepGSEA tests single-cell enrichment through distances to learned prototypes. It is more sensitive than ssGSEA, AUCell and similar tools on Splatter simulations, but it never sees coordinates.
  • Classical overrepresentation analysis, used in studies like the Populus salt-stress transcriptome, ignores both gene topology and space.

On the graph-representation side, Bi et al. and AEGNN supply the radius-graph construction over $(x,y,t)$. They also supply a warning we take seriously: building the graph and running neighborhood queries is the bottleneck. This is part of why we exploit the product structure rather than materialize the joint graph.

Research Program

Building the tissue graph. Within a slice, each spot connects to spots within spatial radius $R$. Across consecutive time points, each spot connects to its transport partners under a Fused Gromov-Wasserstein alignment. We keep only couplings above a threshold, so the temporal edges stay sparse and local, like event-graph edges. This gives a tissue Laplacian $L_S$.

Building the gene graph. Each KEGG pathway, retrieved through the graphite interface that the netgsa package uses, gives a gene Laplacian $L_G$.

Defining the signal. For pathway genes $g$ and aligned spot pairs $s$, the observation $z_{s,g}$ is the standardized difference in expression along the temporal edge. It is residualized against library size and slice-level technical effects.

The test statistic. The statistic is

$$T(\lambda_g,\lambda_s)=z^\top\big(I+\lambda_g\,L_G\otimes I+\lambda_s\,I\otimes L_S\big)^{-1}z,$$

where $\otimes$ is the Kronecker product, so the bracketed Laplacian is that of the Cartesian product graph. Each $T$ is standardized by its null mean and variance, and the test takes the maximum over a grid of $(\lambda_g,\lambda_s)$. Setting both smoothness weights to zero recovers the $\chi^2$ test. Large values favor signals that are smooth on genes, on tissue, or on both.

Computation. Eigenvectors of a Cartesian product graph are Kronecker products of the factor eigenvectors, and its eigenvalues are sums of the factor eigenvalues. The statistic is therefore a weighted sum of squared joint spectral coefficients, and only the factor graphs need to be decomposed. The gene graph is small, 20 to 200 nodes. For the tissue graph, we use a truncated Lanczos basis or Chebyshev polynomial filters, which avoid decomposing the tens of thousands of spots.

Calibration. This is the hard part. Spatial transcriptomics rarely has replicate slices per time point, so a self-contained null that permutes samples is not available. Our primary null is competitive: random gene sets drawn from the interactome, matched for size and edge density. Each random set carries the same spatial autocorrelation of noise, so smoothing in space alone cannot produce false hits. We add a spatial-rotation null that rotates one slice's coordinates relative to its alignment partner. This checks that significance depends on where the signal sits, not only on the fact that it exists.

Localization. For significant pathways, the joint-graph smoothed signal gives a space-time map. We threshold this map with a spatial-cluster correction to report where and when the pathway moves.

Baselines

Naive reference. The do-nothing reference is the current standard: per-slice-pair differential expression, overrepresentation analysis by Fisher's exact test against KEGG, then a post hoc comparison of p-value rankings across time. It is run on the same aligned slices, with the same gene universe and multiple-testing correction. Beating it means higher power at matched empirical type I error. The file does not quantify this test's loss on spatial data. The graph-testing paper shows gene-set tests that ignore topology lose power for coordinated signals on KEGG pathways, but gives no spatial numbers.

Strongest simple competitor. This is spot-level pathway scoring followed by spatial smoothing and regression on time. We score each spot with AUCell or ssGSEA, smooth scores over the same within-slice radius graph, and test the time effect in a spatial mixed model. We regard it as the most dangerous baseline because it already uses space and time, and differs from our method only in ignoring gene topology and how genes are combined. It gets the same graphs, the same alignment, and the same competitive null, so any gap is attributable to the statistic.

Strongest existing enrichment method. This is $T_{max}$ from Combined Hypothesis Testing on Graphs applied per slice pair, treating aligned spots as exchangeable samples. It is the closest published statistic, and our method reduces to it when $\lambda_s=0$. Its reported number is the relative power figure quoted above, on simulated KEGG pathways hsa00051, hsa00140 and hsa00230. We also run netgsa on pseudobulk niches, and DeepGSEA with time point as the phenotype. For all of these methods there is no reported result found on Lacuna on the axolotl Stereo-seq, MOSTA, or zebrafish data, so we run them ourselves under identical inputs and null procedures.

Ablations isolating the key ingredient. The first sets $\lambda_s=0$, removing the tissue graph. The second sets $\lambda_g=0$, removing the gene graph. The third keeps the joint form but uses a degree-preserving shuffled KEGG graph. The fourth replaces transport-based temporal edges with nearest neighbors after rigid registration.

What counts as success. The claim holds only if the full model beats both single-graph ablations when the signal is jointly smooth. It must not lose more than the minimax guarantee allows when the signal is scattered.

Why not just…?

Why not just run standard enrichment on each time point and compare? Because that treats slices as disjoint bins and each gene as an independent draw from an urn. The graph-testing paper shows the urn assumption costs power when signals follow the network. Per-slice testing also cannot tell a pathway moving coherently near the injury from scattered noise across the tissue. This baseline is in our comparison. If it matches us on the semi-synthetic benchmark, the added structure is not worth it.

Why not just score pathways per spot and smooth them in space and time? This is a real threat, and we treat it as the main competitor. Collapsing a pathway into a single score discards which genes move and how they connect. We expect it to lose power when only a connected sub-module of a large pathway responds, since the score dilutes the change. It should do about as well when the whole pathway shifts uniformly. The semi-synthetic sweep over sub-module fraction settles this directly. If the score-based method stays within noise of ours across the sweep, we will report that the gene graph adds nothing in spatial data.

Why not just interpolate intermediate states with ChronoTILE or STODE and run enrichment on them? Generated cells are fit to the same slices one would test on. Testing on them reuses the data twice, and p-values lose their meaning. We run this pipeline and measure its empirical false-positive rate under null spike-ins; we expect inflation. The comparison with transport models is also less favorable than the research file's summary suggests. In STODE's Table 1 on the anisotropic growth simulation, entropic transport has the lowest errors (gene MSE 0.21, spatial RMSE 0.35), better than STODE's 0.62 and 1.05. This is why we use transport alignment only to define temporal edges, and do not use a learned vector field.

Why not just add coordinates to DeepGSEA? DeepGSEA's prototype test compares distributions of cells. It has no mechanism for expressing that the change is localized in contiguous space. We include it as a baseline, but we expect its advantage to lie in scattered, cell-type-driven changes rather than niche-localized ones.

Proposed Experiments

Semi-synthetic power and calibration. We start from real axolotl telencephalon Stereo-seq slices and MOSTA E9.5–E11.5 slices, and spike changes into chosen KEGG pathways. Injecting into real counts keeps real noise and real spatial autocorrelation. We vary three factors independently:

  • the fraction of the pathway involved, and whether the involved genes form a connected module or a random subset;
  • the spatial extent of the change, from a compact niche to diffuse;
  • the time of onset.

Metrics are empirical type I error at nominal 0.05 under null spike-ins, power curves, area under the precision-recall curve for ranking the true pathway, and Dice overlap between the reported space-time region and the injected one.

We also extend the anisotropic growth simulation from STODE with pathway-structured feedback, which gives a known ground truth under tissue expansion.

Held-out time point check on real data. Following the ChronoTILE protocol of withholding 10 and 30 days post-injury, we run the test on the remaining slices. We then ask whether pathways and regions called significant across the gap are confirmed when the held-out slice is reinserted. A method that finds real biology should replicate; one that overfits noise should not.

Biological concordance. We check the calls against spatial patterns reported by the prior papers. ChronoTILE finds a shift from injury-associated immune niches around day 5 to differentiation niches by day 30. STORIES reports distance-dependent fates of progenitors. We expect immune and inflammatory pathways localized near the wound early, and differentiation-associated pathways later and farther out.

Falsification criteria. The central claim fails if either of two things happens. The full product-graph test may fail to beat both single-graph ablations and the score-smoothing baseline in the jointly smooth regime, at matched empirical false-positive rate. Or its calls may fail to replicate at held-out time points more often than the baselines' calls do.