Harreman#
Harreman [Arrastoa et al., 2025] (scviva.tl.harreman) is a framework for inferring metabolic exchanges and cell-cell communication in tissues using spatial transcriptomics data.
The advantages of Harreman include:
Inference of spatially-resolved metabolic gene programs using local autocorrelation.
Identification of cell-cell metabolic communication and ligand-receptor interactions using spatial proximity graphs.
Support for multiple spatial technologies (Visium, Slide-seq, and others).
Scalability to large spatial datasets.
Support for both parametric and non-parametric significance testing.
The limitations of Harreman include:
Requires spatial coordinates to be available in
adata.obsm["spatial"].Cell communication inference requires a ligand-receptor or metabolite transporter database.
Overview#
Harreman operates in three main steps:
Spatial graph construction (
compute_knn_graph()): Builds a spatial proximity graph from cell coordinates, supporting both k-nearest neighbors and radius-based neighborhoods, with optional Gaussian kernel weighting.Local autocorrelation (
compute_local_autocorrelation()): Identifies spatially variable genes using the local autocorrelation statistic from the Hotspot algorithm (DeTomaso and Yosef, Cell Systems, 2021), supporting DANB, Bernoulli, and normal count models.Cell communication (
compute_cell_communication()): Infers spatially-resolved metabolic exchanges and ligand-receptor interactions between neighboring cells using HarremanDB and CellChatDB.
Generative process#
At the coarsest level, Harreman partitions the tissue into modules of different metabolic functions based on enzyme co-expression. In the next stage, Harreman formulates hypotheses about which metabolites are exchanged across the tissue or within each spatial zone. Finally, at a finer resolution, Harreman can also infer which specific cell subsets participate in the exchange of distinct metabolic activities within each zone.
For proteins composed of multiple subunits, Harreman computes either an arithmetic or geometric mean of the expression values of the corresponding genes:
Test statistic 1: Spatial autocorrelation#
Spatially variable genes are identified using the following autocorrelation statistic:
where \(w_{ij}\) represents the communication strength between neighboring cells, computed using a Gaussian kernel:
Significance is assessed by converting \(H_a\) to a Z-score and adjusting p-values using the Benjamini-Hochberg procedure.
Test statistic 2: Spatial co-localization#
Pairwise spatial correlation between genes is computed as:
This statistic is used to group genes into spatial modules and to identify cell-type-agnostic metabolic exchange events.
Test statistic 3: Metabolite autocorrelation#
Gene-pair results are integrated at the metabolite level:
where \(m\) is a metabolite exchanged by genes \(a\) and \(b\).
Usage#
from scviva import tl
harreman = tl.harreman
# 1. Build spatial KNN graph
harreman.tl.compute_knn_graph(adata, compute_neighbors_on_key="spatial", n_neighbors=10)
# 2. Identify spatially variable genes
harreman.hs.compute_local_autocorrelation(adata, model="danb")
# 3. Compute pairwise local correlation
harreman.hs.compute_local_correlation(adata)
# 4. Infer cell-cell communication
harreman.tl.compute_cell_communication(adata)
API#
Please see scviva.tl.harreman and scviva.pl.harreman for the full API reference.