PACE#
A hierarchical empirical Bayes framework for proximity-associated changes in expression — how a cell’s gene expression shifts near specific neighbouring cell types — in imaging-based spatial transcriptomics (Xenium, CosMx).
Overview#
PACE quantifies how proximity to specific neighbouring cell types reshapes a cell’s gene expression. It fits hierarchical negative binomial mixed models with partial pooling across cell types, corrects for transcript contamination between adjacent cells with a per-cell ambient term, and decomposes expression variance into cell-type identity, spatial cell state, contamination and residual components. A per-gene driver score ranks the genes that mediate each focal–neighbour relationship.
Input and output follow AnnData conventions:
a single call to pace_fit() returns a PaceFit, read out with
neighbour_slopes(), variance_decomposition() and
top_drivers().
import pace
fit = pace.pace_fit(adata, cell_type="cell_type")
pace.top_drivers(fit, "Macrophage", "Tumour").to_dataframe().head()
Installation#
PACE needs a C++ compiler and Eigen 3.4 for the contamination-correcting solver. Installing a released wheel avoids both.
pip install pace-spatial
This is the Python implementation. PACE is also an R/Bioconductor package; both compile the same C++ core, so a fit is the same fit in either language.