WorksMathematics
CASPER: Discovering Spatially Resolved Causal Cell-Cell Communications
Abstract
Spatial transcriptomics can reveal where ligands and receptors are expressed together. A harder question is whether exposure to a ligand changes pathway activity in nearby cells, since the same tissue environment can influence both ligand expression and pathway activity. We introduce CASPER, a Bayesian structural equation model that adjusts for receptor expression and represents the shared tissue environment with a Gaussian Markov random field. We show that the ligand-exposure effect is identifiable when the spatial covariance is known and distinguishable from independent noise, the coefficients are constant, and the structural errors are independent and homoskedastic. In simulations, CASPER reduced the bias seen in ordinary regression and in a regression that accounted for spatial dependence only in the outcome. We compared CASPER with CellPhoneDB in four public Xenium datasets. In ovarian cancer, CellPhoneDB found evidence of ligand–receptor expression enrichment for both IL6 and VEGFA. CASPER found greater support for a positive effect of fibroblast IL6 on the inflammatory-response score of ciliated epithelial cells than for an effect of fibroblast VEGFA on the angiogenesis score of endothelial cells. Code accompanies the Supplementary Materials and is available at https://github.com/nySTAT/casperCCC.
Introduction
Cell-cell communication (CCC) is fundamental to tissue development, immune defense, and disease progression. A ligand released by a sender cell can bind a receptor on a nearby cell and activate a downstream signaling pathway (Figure 1A and B). Spatial transcriptomics measures the expression of the ligand, receptor, and downstream genes in the same tissue. The question is whether changing ligand exposure would change pathway activity in the receiver cell.

Figure 1. A sender cell releases a ligand that can bind a receptor on a nearby cell (A) and trigger a change in downstream gene expression (B). Nearby senders contribute more to a receiver’s exposure than distant senders do, and a shared tissue environment can influence both exposure and response (C). Generative AI was used in producing this illustration.
Single-cell RNA sequencing and spatial transcriptomics have given rise to tools that prioritize candidate interactions using ligand–receptor co-expression, enrichment, spatial proximity, or target-gene expression ([12, 16, 15, 9, 25, 10, 19] (Browaeys et al. 2020)). A shared tissue environment can produce the same patterns. For example, an inflammatory niche may induce cytokine expression in sender cells and independently activate an inflammatory program in nearby receiver cells (Figure 1C). Methods for inferring directional communication have also been proposed ([6, 11]). Our interest is in estimating the effect of ligand exposure when an unmeasured feature of the tissue can influence both exposure and response.
We propose CASPER, a Bayesian structural equation model (SEM) for this problem. For a specified ligand, receptor, and pathway, CASPER relates pathway activity to ligand exposure from neighboring senders while adjusting for receptor expression. A shared Gaussian Markov random field represents the influence of the local tissue environment on all three measurements.
The ligand–receptor mechanism suggests a direction of effect, from ligand exposure to pathway activity in the receiver cell. The difficulty is estimating the size of that effect when the same local environment influences both measurements. Work on spatial confounding has shown that the spatial scale and covariance of an unmeasured process can affect a regression estimate [21, 14, 18, 13].
CASPER uses the difference between the spatial covariance of the shared field and the independent variation in each measurement to identify the ligand-exposure effect. Irregular cell locations can provide this information through differences in marginal variances. Correlation between cells can also be informative when the marginal variances are constant. We examine these two sources of information in simulations and compare CASPER with CellPhoneDB across four tissue types. Two ovarian examples illustrate how the evidence for a pathway response can differ even when both ligand–receptor pairs show expression enrichment.
Method
For a given sender and receiver cell type, we use prior biological knowledge to specify a sender ligand, a receiver receptor, and a downstream pathway. For example, if fibroblasts are the senders and tumor cells are the receivers, one possible triplet is
fibroblast ligand — receptor — pathway inflammatory response
Here the hypothesis is that exposure to fibroblast IL6 changes inflammatory pathway activity in tumor cells expressing IL6R. For receiver , let denote its ligand exposure, its receptor expression, and its pathway activity score. We center and scale each variable across receivers before fitting the model.
Ligand exposure via spatial kernel weighting. Let be the expression of the ligand in sender cell , and let be the Euclidean distance between receiver cell and sender cell . Define a nonnegative spatial kernel with bandwidth . The kernel-weighted exposure of receiver to the ligand is
In the applications, is normalized ligand abundance on the linear scale. We use a Gaussian kernel restricted to nearby sender cells and center and scale to obtain . § 4 gives the neighborhood and bandwidth rules.
Pathway activity score. We summarize pathway activity by the mean log-normalized expression of its measured genes. Other possible scores include AUCell (Aibar et al., [5]) and UCell (Andreatta and Carmona, [7]).
The proposed SEM. Figure 2 shows how the proposed model links ligand exposure, receptor expression, and pathway activity in a receiver cell. Let denote unmeasured conditions in the neighborhood of receiver . The structural equations are

Figure 2. Structural model for a receiver cell. Ligand exposure () and receptor expression () affect pathway activity (). The shared spatial field () influences all three measurements.
The first two equations describe how ligand exposure and receptor expression vary across receivers with local tissue conditions. Exposure is calculated from ligand expression in nearby senders, and receptor expression is measured in the receiver itself. The third equation relates pathway activity to ligand exposure and receptor expression through and , respectively. It also allows the same local conditions to influence pathway activity directly through .
The errors are mutually independent across cells and equations and independent of the latent field. For each receiver, , , and .
Let denote the pathway score that receiver would have if its exposure and receptor expression were set to and , with the tissue geometry and latent background held fixed. Under Equation (1), the expected change from increasing exposure by at fixed is $\mathbb{E}{Y_i(x+\Delta,z) -】【。 . To relate this contrast to a change in sender expression, write , where collects the ligand abundances of the senders. Changing to can alter the exposure of several receivers at once. If this change acts on receiver through its exposure summary alone, then at fixed receptor abundance and background conditions the expected change in its pathway score is .
Let denote all the model parameters.
Modeling spatial confounding. Unmeasured neighborhood conditions are represented by a receiver-indexed latent field. Let be the symmetrized, Gaussian-weighted adjacency matrix of the -nearest-neighbor graph on the receivers (), and let be the diagonal matrix of weighted degrees. The edge bandwidth is the median positive distance from a receiver to one of its nearest receiver neighbors. Adding to each diagonal entry of the graph Laplacian gives a positive definite precision matrix . This defines a proper Gaussian Markov random field (GMRF) [23] with density
so with . The exposure kernel describes which senders contribute ligand to each receiver. The receiver graph describes how background conditions covary across receivers. The physical range of each therefore depends on the distances between the cells it connects.
The covariance scale is fixed because multiplying and dividing its three loadings by the same constant leaves their products unchanged.
Identifiability. The known spatial covariance allows the model to distinguish variation shared across cells from variation due to independent errors. The following proposition makes this distinction precise.
Proposition 1 (Causal Identifiability). Suppose is known and positive definite, and are linearly independent, , and , with mutually independent homoskedastic errors independent of . Then all SEM parameters are identifiable from the joint distribution of .
Reversing the signs of and all three of its loadings preserves their products in Equation (1). The condition selects one of these two equivalent representations. To see the source of identification, write , , and . Then and . Linear independence of and uniquely separates their coefficients, identifying , , , and . The remaining covariance blocks identify the other parameters, as shown in Appendix A.
On an irregular tissue graph, the marginal variance of the field, , can differ across receivers. Two distinct values of suffice for the linear independence in Proposition 1, because a scalar multiple of has a constant diagonal. Differences in marginal variance can therefore identify the effect through heteroskedasticity [22]. Even when all receivers have the same marginal variance, any nonzero covariance between distinct receivers also gives linear independence.
Priors. We assign a spike-and-slab prior to the ligand-exposure coefficient ,
where , , and is a point mass at zero. The posterior inclusion probability (PIP), , measures support for a nonzero exposure effect. Even a small effect can have a high PIP when it is precisely estimated. To assess magnitude, we report the model-averaged posterior mean and 95% credible interval and the posterior probability that exceeds 0.05, 0.10, or 0.20. An effect of 0.10 corresponds to a change of one-tenth of a pathway-score standard deviation per standard deviation of exposure. The remaining coefficients have independent normal priors,
with by default. The error variances have independent inverse-gamma priors,
Posterior Computation and Diagnostics
We sample the coefficients, error variances, inclusion indicator, and latent field jointly using a blocked Gibbs sampler. Conditional on the coefficients and error variances, the three structural equations add only diagonal terms to the field precision matrix. The matrix therefore remains sparse, and hence we can sample the field for all receivers jointly by sparse Cholesky factorization. Appendix B gives the complete algorithm, including two Metropolis–Hastings moves used in the real-data fits.
The independent exposure variance measures how much exposure variation remains after accounting for the shared field. A posterior concentrated near zero, or a strong posterior association between and the outcome loading , can signal difficulty separating the exposure effect from the influence of the field. The sampler allows either sign for . To assess this association after sampling, we pair in each retained draw with , the outcome loading under the sign convention of Proposition 1. Sensitivity to the coefficient priors and neighborhood choices provides a further check. We assess the constant-variance sufficient condition by examining squared standardized residuals across receivers grouped by (Appendix § 8.3.§ 3).
Real Data Analysis
We compared CASPER and CellPhoneDB in four public 10x Genomics Xenium datasets, each representing one sample, from ovarian cancer (10x Genomics, 2024b), melanoma (10x Genomics, 2024c), breast cancer (10x Genomics, 2024a), and renal carcinoma (10x Genomics, 2025). We first asked how often the same candidates showed both ligand–receptor expression enrichment and evidence of an exposure effect on the receiver pathway. We then examined two examples in the ovarian tissue.
Data Preprocessing and Screening
We normalized raw counts to 10,000 per cell and applied the transformation . Normalization used 5,101 genes in ovarian cancer and 405 in renal carcinoma. For melanoma and breast cancer it used 2,158 and 2,188 genes, respectively, drawn from Hallmark, ligand–receptor, and marker sets. We assigned broad cell types using dataset annotations and canonical markers. Each candidate specifies a ligand in the sender cell type, together with a receptor and a pathway in the receiver cell type. The ovarian examples use the Hallmark inflammatory-response and angiogenesis gene sets ([17]). Some renal pathway gene sets were adapted to the smaller panel (Appendix § 8.3.§ 1).
Receptor expression is the log-normalized receptor abundance. Pathway activity is the mean log-normalized abundance of measured pathway genes, excluding the ligand and receptor. Before centering and scaling, ligand exposure is
where is normalized ligand abundance on the linear scale and comprises the 32 nearest sender cells. The bandwidth is the median positive distance among all retained sender–receiver neighbor distances for that candidate.
We considered pairs of distinct cell types with at least 100 cells of the sender type and 500 of the receiver type. We required log-normalized ligand and receptor expression above 0.1 in at least 5% of their respective cell types, a product of their mean expressions of at least 0.01, and at least five measured downstream pathway genes after excluding ligand and receptor. In total, 2,229 candidates met these criteria. For ovarian, melanoma, and breast tissue, we ranked candidates using marginal correlation, spatial variation, and prior knowledge about the cell types and pathway. We used a specified list of eligible candidates for the renal panel. Appendix § 8.3.§ 1 gives the selection rules.
Of the eligible candidates, 222 entered the comparison. We fitted CASPER using up to 3,000 receivers per candidate. For the two detailed ovarian analyses, we used all senders and receivers. The cancer-associated fibroblast VEGFA–FLT1 example belonged to the comparison set. The fibroblast IL6–IL6R example came from a separate exploratory search among other eligible ovarian candidates (Appendix § 8.3.§ 3).
We ran CellPhoneDB with 1,000 cell-label permutations, a 5% expression threshold, and up to 3,000 cells per relevant type (Appendix § 8.3.§ 2). We used PIP to identify candidates with high posterior support for a pathway effect and a nominal permutation to identify expression enrichment. A candidate could be undetectable in CellPhoneDB if its interaction was missing from the database or a required gene product was absent from the input.
Results
Cross-dataset comparison. CellPhoneDB found expression enrichment for 151 of the 204 candidates it could test. CASPER gave high posterior support to a pathway effect for 14 of the 222 screened candidates (Table 1). Nine of those 14 also showed expression enrichment. Of the remaining five, three involved WNT5A from keratinocyte/epithelial senders and one of three receptors (LRP6, FZD3, or FZD6) on melanoma mast cells. CellPhoneDB tested these three interactions and found no enrichment. The other two high-PIP candidates involved VEGFB–KDR in melanoma, for which the matched CellPhoneDB complex required FLT1, a component absent from the processed input.
| Dataset | Candidates | CellPhoneDB tested | CASPER high | CellPhoneDB positive | Both |
| Breast | 20 | 20 | 2 | 13 | 2 |
| Melanoma | 89 | 79 | 6 | 55 | 1 |
| Ovarian | 92 | 92 | 3 | 70 | 3 |
| Renal | 21 | 13 | 3 | 13 | 3 |
Table 1. Comparison of CASPER and CellPhoneDB by tissue. CASPER-high denotes PIP for an effect on the receiver pathway. CellPhoneDB-positive denotes ligand–receptor expression enrichment at a nominal permutation . The final column counts candidates meeting both criteria.
Ovarian IL6–IL6R pathway response. We examined whether IL6 from 35,459 fibroblasts was associated with inflammation in 559 ciliated epithelial receivers. The score averaged 144 measured Hallmark inflammatory-response genes, and CASPER adjusted for receiver IL6R expression. The marginal correlation between exposure and pathway score was −0.077. CellPhoneDB found enrichment of fibroblast IL6 and the epithelial IL6R/IL6ST receptor complex, with no exceedances in 1,000 permutations.
CASPER assigned the IL6 effect a PIP of 0.924. A one-standard-deviation increase in exposure corresponded to an estimated increase of 0.708 standard deviations in pathway score under model averaging (95% credible interval [0, 1.443]). The interval includes zero because the posterior assigns 7.6% probability to an exactly zero effect. Among draws with a nonzero effect, the 95% interval was [0.205, 1.456]. The posterior probability that the absolute effect exceeded 0.10 was 0.917 (Table S2).
| Posterior summary | IL6–IL6R | VEGFA–FLT1 |
| Inclusion probability | 0.924 | 0.053 |
| Model-averaged mean | 0.708 | |
| Model-averaged 95% CrI | ||
| 95% CrI given inclusion | ||
| 0.921 | 0.019 | |
| 0.917 | 0.003 | |
| 0.903 | 0.000 |
Table S2. Posterior summaries for the ovarian examples. Effects are in pathway-score standard deviations per exposure standard deviation. Model-averaged means and 95% credible intervals use all draws. Conditional intervals use draws with . is the posterior probability that .
Expression of FOXJ1, CDHR4, and TEKT1 supported the ciliated epithelial annotation. IL6R has been localized to human fallopian-tube epithelial cilia (Shao et al., [24]), and IL6 exposure affects ciliary activity in human tubal explants (Papathanasiou et al., [20]). These observations make a response to IL6 plausible in this cell type. The score used here captures a broad inflammatory transcriptional response.
Ovarian VEGFA–FLT1 small-effect example. Our second example involved 33,990 cancer-associated fibroblasts and 2,794 angiogenic endothelial cells. We assessed exposure to fibroblast VEGFA and the activity of 21 measured angiogenesis genes in the receivers, adjusting for FLT1 expression. CellPhoneDB found enrichment for VEGFA–FLT1, with no exceedances in 1,000 permutations. The marginal exposure–pathway correlation was 0.010. CASPER assigned the effect a PIP of 0.053 and a model-averaged mean of −0.0007 (95% credible interval [−0.0181, 0]). The posterior probability of an absolute effect larger than 0.10 was 0.003. Thus the two pairs showed similar evidence of expression enrichment and markedly different evidence for a pathway response.
Diagnostics and sensitivity. Across the 36 receiver graphs used in the four-tissue comparison, the coefficient of variation of the marginal latent variances ranged from 0.56 to 4.65 (Table S1). In the ovarian IL6 analysis, none of the three equations showed a clear linear trend in mean squared standardized residuals across ten groups of receivers ordered by (Appendix § 8.3.§ 3). When we shuffled IL6 exposure across receivers, the five control PIPs ranged from 0.043 to 0.283, and all five model-averaged intervals included zero.
| Tissue | Receiver cell type | Median [Q1, Q3] | CV |
| Ovarian | Angiogenic endothelial | 4.17 [2.58, 8.93] | 1.59 |
| Ovarian | CAF | 0.93 [0.69, 1.34] | 3.61 |
| Ovarian | Cycling epithelial or unknown | 0.95 [0.73, 1.35] | 2.99 |
| Ovarian | Cycling tumor epithelial | 0.87 [0.72, 1.21] | 3.02 |
| Ovarian | Endothelial | 0.88 [0.71, 1.18] | 3.23 |
| Ovarian | Fibroblast | 0.76 [0.52, 1.30] | 3.40 |
| Ovarian | Hypoxic tumor or stress | 1.43 [1.06, 2.23] | 2.92 |
| Ovarian | Inflammatory fibroblast | 1.13 [0.91, 1.70] | 3.27 |
| Ovarian | Macrophage | 0.90 [0.68, 1.49] | 1.77 |
| Ovarian | Mesothelial | 2.13 [1.49, 4.07] | 2.43 |
| Ovarian | Myeloid | 0.80 [0.59, 1.16] | 4.19 |
| Ovarian | Pericyte | 3.72 [2.17, 7.32] | 1.82 |
| Ovarian | Tumor epithelial | 0.96 [0.79, 1.29] | 3.40 |
| Melanoma | B cell | 1.06 [0.92, 1.50] | 1.59 |
| Melanoma | Endothelial | 1.59 [1.00, 2.81] | 1.89 |
| Melanoma | Fibroblast CAF | 0.68 [0.56, 1.06] | 3.01 |
| Melanoma | Keratinocyte epithelial | 0.60 [0.55, 0.73] | 3.25 |
| Melanoma | Mast cell | 0.75 [0.60, 1.24] | 2.83 |
| Melanoma | Melanoma melanocytic | 0.65 [0.55, 0.83] | 4.65 |
| Melanoma | Myeloid | 0.79 [0.61, 1.07] | 2.92 |
| Melanoma | Perivascular smooth muscle | 0.62 [0.54, 0.87] | 2.61 |
| Melanoma | Plasma cell | 0.89 [0.66, 2.05] | 2.34 |
| Melanoma | Proliferating melanoma | 0.71 [0.60, 0.90] | 4.33 |
| Melanoma | T NK cell | 0.88 [0.59, 1.77] | 2.28 |
| Renal | B plasma | 1.37 [0.90, 4.13] | 2.42 |
| Renal | B plasma mixed | 1.20 [0.86, 2.12] | 2.74 |
| Renal | Endothelial | 0.69 [0.60, 0.82] | 0.56 |
| Renal | Stromal | 0.67 [0.53, 1.06] | 1.39 |
| Renal | Stromal mixed | 0.68 [0.51, 1.00] | 0.83 |
| Renal | T cell | 0.91 [0.70, 1.20] | 0.91 |
| Renal | T cell mixed | 0.73 [0.62, 0.89] | 1.15 |
| Breast | Endothelial | 0.68 [0.56, 0.90] | 2.68 |
| Breast | Mast cell | 0.76 [0.61, 1.03] | 3.59 |
| Breast | Perivascular | 0.85 [0.71, 1.24] | 2.37 |
| Breast | Plasma cell | 0.92 [0.68, 1.36] | 3.35 |
| Breast | Tumor epithelial | 1.17 [0.79, 1.96] | 2.60 |
Table S1. Distribution of the marginal latent variance within each of the 36 receiver graphs. Each graph contains up to 3,000 cells. Q1 and Q3 denote the 25th and 75th percentiles. The coefficient of variation (CV) is the standard deviation divided by the mean.
The estimated IL6 effect was larger under a wider coefficient prior. The VEGFA estimate remained close to zero across the priors examined. Appendix § 8.3.§ 3 reports the sensitivity analyses, and Table S2 summarizes the ovarian fits.
Simulations
We used simulations to examine how well CASPER estimates the ligand-exposure effect under different sources of spatial confounding. We compared CASPER with ordinary regression of on , a spatial outcome-only regression with the same receiver graph and spike-and-slab prior, and an oracle regression that also observes the true confounder(s).
Design
We first examined how each method performed under the reference model as sample size and the true ligand-exposure effect varied. At each sample size (, 3,000, or 10,000 receivers), we simulated a null effect (), a small effect (0.05), and a moderate effect (0.30). We generated the data from Equation (1) with all three confounder loadings set to 0.6, a receptor effect of 0.3, and independent errors of variance one. We sampled cell locations uniformly on a 10 10 domain and scaled the precision of the proper GMRF so that the mean marginal variance of the latent field was one.
We then fixed and examined departures from the reference model. We weakened or strengthened confounding by multiplying all three loadings by 0.5 or 1.5, respectively. We also examined two independent spatial fields with different ranges and nonproportional loadings, a quadratic term in the outcome equation, and independent variance-matched Laplace errors. Three additional settings assessed the effect of error variances that change with . The exposure error variance increased in one setting and decreased in another. In the third setting, all three error variances increased. The ratio of the larger to the smaller variance was 1.5 across the interquartile range of . Finally, we compared the irregular cell locations of the reference model with regular and jittered grids. We studied each of these variations at and 0.30. In each setting, we fitted all four methods to the same 100 independently generated datasets (Appendix § 9).
CASPER and the spatial regression select an effect at PIP . Ordinary and oracle regressions select it when the 95% confidence interval excludes zero. We evaluated how often each method selected the effect and how accurately it estimated its size. For bias and root mean squared error (RMSE), we transformed model-averaged Bayesian estimates back to the generating scale. For the posterior probabilities of exceeding an effect threshold, we used standardized coefficients.
Results
At under the reference model, CASPER selected a null effect in 3% of replicates, compared with 42% for spatial outcome-only regression, 93% for ordinary regression, and 6% for the oracle. For a true effect of 0.30, CASPER selected 97% of replicates and had RMSE 0.071. The corresponding RMSEs were 0.142 for the spatial regression, 0.185 for ordinary regression, and 0.045 for the oracle. As the sample size increased to 3,000 and 10,000, CASPER detected the moderate effect in every replicate, and its RMSE fell to 0.022 and 0.013. The null selection rate was zero at both larger sample sizes.
The smaller effect of 0.05 illustrates how sample size can increase support for inclusion even when the estimated effect remains small. CASPER selected this effect in 3%, 14%, and 62% of replicates at the three sample sizes. At , the mean PIP was 0.727, while the mean posterior probability of an absolute standardized effect above 0.10 was 0.001.
At , CASPER detected a true effect of 0.30 in 97–98% of replicates under the two-field, mildly nonlinear, and Laplace scenarios, with absolute bias at most 0.018. Bias was greater when all three error variances increased with . In that setting, CASPER underestimated the effect by 0.049 on average, its RMSE rose to 0.109, and it selected the effect in 85% of replicates. Increasing the confounding multiplier from 0.5 to 1.5 also raised RMSE, from 0.056 to 0.098, and reduced selection from 100% to 88%.
On a regular periodic grid, the marginal latent variances were constant and the field still exhibited correlation between cells. CASPER selected the moderate effect in 91% of replicates on this grid, in 88% after jittering the locations, and in 97% on irregular locations. The corresponding RMSEs were 0.090, 0.086, and 0.071. Figure 3 shows selection rates under the reference model. Table S3 gives the results across simulation settings.
Figure 3. Selection rates across 100 replications under the reference model, with 95% Wilson intervals for Monte Carlo uncertainty. CASPER and spatial outcome-only regression select an effect when the PIP is at least 0.7. Ordinary and oracle regressions select it when the 95% confidence interval excludes zero.
| Setting | Effect | Method | Selection | Mean PIP | Bias | RMSE |
| Reference model | ||||||
| 0.00 | CASPER | 0.03 | 0.101 | 0.001 | 0.027 | |
| Spatial | 0.42 | 0.540 | 0.078 | 0.103 | ||
| Ordinary | 0.93 | — | 0.169 | 0.177 | ||
| Oracle | 0.06 | — | -0.003 | 0.048 | ||
| 0.05 | CASPER | 0.03 | 0.147 | -0.036 | 0.047 | |
| Spatial | 0.75 | 0.822 | 0.096 | 0.118 | ||
| Ordinary | 1.00 | — | 0.161 | 0.171 | ||
| Oracle | 0.22 | — | -0.004 | 0.045 | ||
| 0.30 | CASPER | 0.97 | 0.968 | -0.001 | 0.071 | |
| Spatial | 1.00 | 1.000 | 0.134 | 0.142 | ||
| Ordinary | 1.00 | — | 0.179 | 0.185 | ||
| Oracle | 1.00 | — | 0.009 | 0.045 | ||
| 0.00 | CASPER | 0.00 | 0.041 | 0.000 | 0.004 | |
| Spatial | 1.00 | 1.000 | 0.137 | 0.138 | ||
| Ordinary | 1.00 | — | 0.198 | 0.199 | ||
| Oracle | 0.03 | — | 0.000 | 0.016 | ||
| 0.05 | CASPER | 0.14 | 0.284 | -0.029 | 0.041 | |
| Spatial | 1.00 | 1.000 | 0.136 | 0.138 | ||
| Ordinary | 1.00 | — | 0.201 | 0.202 | ||
| Oracle | 0.74 | — | -0.002 | 0.020 | ||
| 0.30 | CASPER | 1.00 | 1.000 | -0.001 | 0.022 | |
| Spatial | 1.00 | 1.000 | 0.137 | 0.138 | ||
| Ordinary | 1.00 | — | 0.200 | 0.201 | ||
| Oracle | 1.00 | — | -0.001 | 0.018 | ||
| 0.00 | CASPER | 0.00 | 0.028 | 0.000 | 0.001 | |
| Spatial | 1.00 | 1.000 | 0.144 | 0.144 | ||
| Ordinary | 1.00 | — | 0.209 | 0.209 | ||
| Oracle | 0.05 | — | 0.001 | 0.010 | ||
| Setting | Effect | Method | Selection | Mean PIP | Bias | RMSE |
| 0.05 | CASPER | 0.62 | 0.727 | -0.010 | 0.026 | |
| Spatial | 1.00 | 1.000 | 0.142 | 0.142 | ||
| Ordinary | 1.00 | — | 0.207 | 0.207 | ||
| Oracle | 1.00 | — | 0.000 | 0.010 | ||
| 0.30 | CASPER | 1.00 | 1.000 | 0.002 | 0.013 | |
| Spatial | 1.00 | 1.000 | 0.144 | 0.144 | ||
| Ordinary | 1.00 | — | 0.208 | 0.208 | ||
| Oracle | 1.00 | — | 0.001 | 0.010 | ||
| CASPER under perturbations at | ||||||
| Weaker confounding | 0.00 | CASPER | 0.01 | 0.087 | -0.001 | 0.015 |
| 0.30 | 1.00 | 0.993 | -0.004 | 0.056 | ||
| Stronger confounding | 0.00 | 0.00 | 0.087 | 0.000 | 0.010 | |
| 0.30 | 0.88 | 0.906 | -0.021 | 0.098 | ||
| Two spatial fields | 0.00 | 0.00 | 0.085 | 0.002 | 0.011 | |
| 0.30 | 0.98 | 0.983 | 0.001 | 0.057 | ||
| Nonlinear outcome | 0.00 | 0.00 | 0.082 | -0.001 | 0.015 | |
| 0.30 | 0.97 | 0.971 | -0.002 | 0.068 | ||
| Laplace errors | 0.00 | 0.01 | 0.111 | 0.002 | 0.020 | |
| 0.30 | 0.97 | 0.967 | -0.017 | 0.066 | ||
| Increasing error variance | 0.00 | 0.00 | 0.092 | -0.002 | 0.015 | |
| 0.30 | 0.92 | 0.939 | -0.027 | 0.082 | ||
| Decreasing error variance | 0.00 | 0.00 | 0.076 | 0.001 | 0.006 | |
| 0.30 | 0.97 | 0.979 | 0.006 | 0.066 | ||
| Increasing error variance in all three equations | 0.00 | 0.04 | 0.134 | -0.004 | 0.040 | |
| 0.30 | 0.85 | 0.886 | -0.049 | 0.109 | ||
| Regular grid | 0.00 | 0.00 | 0.122 | -0.001 | 0.028 | |
| 0.30 | 0.91 | 0.911 | -0.020 | 0.090 | ||
| Jittered grid | 0.00 | 0.02 | 0.118 | 0.005 | 0.031 | |
| 0.30 | 0.88 | 0.911 | -0.022 | 0.086 |
Table S3. Selection and estimation in 100 replicates per setting. CASPER and spatial outcome-only regression select effects at posterior inclusion probability (PIP) . Ordinary and oracle regression use a 95% confidence interval excluding zero. Bias and root mean squared error (RMSE) are on the generating scale.
Spatial-scale sensitivity. We refitted the same null and moderate-effect reference datasets at to examine sensitivity to the assumed spatial covariance. In separate fits we changed the number of receiver neighbors from eight to six or ten at the reference bandwidth, or we decreased or increased the bandwidth by 20% at eight neighbors. Each covariance was scaled to unit mean marginal variance. Null selection remained between 2% and 3%. For the moderate effect, selection ranged from 90% to 100%, compared with 97% at the reference settings, and the absolute shift in the mean effect estimate was at most 0.024 (Table S4).
| Fitted graph | Selection | (MCSE) | Selection | (MCSE) |
| 0.03 | 0.003 (0.001) | 1.00 | 0.023 (0.001) | |
| 0.02 | -0.003 (0.001) | 0.90 | -0.018 (0.002) | |
| 0.03 | 0.002 (0.000) | 1.00 | 0.017 (0.001) | |
| 0.03 | -0.001 (0.000) | 0.93 | -0.011 (0.001) |
Table S4. Table S4: Sensitivity to the fitted receiver graph in 100 datasets per generating effect. Selection is the proportion of fits with PIP . At eight neighbors and bandwidth , the selection rates were 0.03 () and 0.97 (). For each alternative, is the average within-dataset change in the model-averaged exposure effect from this reference fit, on the generating scale. Parentheses give its Monte Carlo standard error.
Discussion
CASPER estimates how a change in ligand exposure affects a receiver-cell pathway score at fixed receptor abundance. Modeling exposure, receptor expression, and pathway activity jointly allows the shared spatial field to explain variation in all three measurements. Under the linear model, independent homoskedastic errors and a known spatial covariance distinguishable from independent noise identify the effect.
The simulations illustrate both the value and the limits of spatial adjustment. Under the reference model, CASPER reduced the bias that persisted in ordinary and spatial outcome-only regressions. The bias remained small when the data were generated with two fields, a mild nonlinear effect of the confounder, or Laplace errors. Stronger confounding and error variances that increased with the marginal latent variance made estimation more difficult. The regular-grid experiment shows how correlation between cells can carry information even when their marginal variances are equal.
The ovarian examples illustrate the distinction between ligand–receptor expression enrichment and a response in the receiver pathway. CellPhoneDB found enrichment for both IL6 and VEGFA. CASPER gave considerably greater support to an effect of fibroblast IL6 on the ciliated epithelial inflammatory-response score than to an effect of fibroblast VEGFA on the endothelial angiogenesis score.
The causal interpretation depends on how well a single spatial field captures shared neighborhood conditions within a receiver population. It also depends on the choice of exposure and pathway score. A negative coefficient means that greater exposure corresponds to a lower measured score after adjustment. The composition of the gene set or residual spatial confounding could contribute to such a result. Establishing that a particular receptor mediates a response would require additional biological evidence.
Future work could allow the ligand-exposure effect to vary across receiver subpopulations, with a hierarchical model borrowing information within a broader cell type. Joint models for exposures from several sender populations could help distinguish their contributions and examine competition or synergy through interaction terms. Propagating uncertainty in cell-type assignments through exposure construction and effect estimation would also address annotation error. These extensions raise further identification questions, particularly when sender exposures are strongly correlated or when effects vary across receivers.
References
Supplementary Material
A Proof of Proposition 1
The joint distribution of determines all of their covariances. Whenever one of these covariances has the form , it determines and separately because and are known and linearly independent. Consider first the exposure and receptor equations. By independence of the field and the errors,
The coefficients of give the two error variances. By the sign assumption, is the positive square root of the coefficient of in . The cross-covariance then determines , including its sign.
To recover the two direct effects on pathway activity, consider the residual . At and , the outcome equation gives . Its covariances with exposure and receptor expression are therefore both proportional to . Conversely, suppose both cross-covariances are proportional to for some and . The outcome equation gives
In the cross-covariances of this residual with and , the coefficients of are and , respectively. Both coefficients must vanish. Since the error variances are positive, this forces and . Thus the joint law determines the two direct effects.
For the residual , independence of the outcome error gives
The first identity gives because is known and positive. The only unknown in the second identity is then , which completes the proof.
Variation in the diagonal entries is sufficient for linear independence. With a constant diagonal, any nonzero off-diagonal covariance also gives linear independence. For the marginal variance , a narrow range of makes the slope harder to distinguish from the intercept. The full likelihood also uses the off-diagonal entries of . Appendix § 9 examines estimation on graphs with varying degrees of regularity.
B Posterior Computation
The sampler updates the shared spatial field, the regression coefficients, the inclusion indicator for the exposure effect, and the three error variances. The conditional distribution of the spatial field is Gaussian. We use sparse Cholesky factorization to draw from this distribution under the receiver-graph precision in § 2 or the simulation precisions in Appendix § 9.
Blocked outcome update. Conditional on and , let and , with and . Included outcome coefficients have independent priors with by default. Appendix § 8.3.§ 3 examines how the ovarian estimates change with this common variance. For define
Apart from constants common to both models, the integrated log likelihood is
With prior inclusion probability 0.5, the posterior conditional probability of is . Given the sampled value of , the included coefficients have distribution . When , .
Remaining conjugate updates. For , the loading has a normal full conditional with variance and mean , where denotes the corresponding observed vector and by default. Conditional on the other variables,
where , , and . In the real-data analyses, we update the exposure variance after integrating out the field, as detailed below.
Additional updates for the real-data analyses. Two updates improve mixing when the data provide limited information about the scale of the field and its loadings. The first samples the exposure variance after integrating out . Write . Given the data and the equation parameters, the conditional distribution of the field has precision and mean , where
For , the marginal log conditional density, up to an additive constant, is
where, writing ,
A Metropolis–Hastings step uses a symmetric normal random-walk proposal for , with the proposal scale adapted during warm-up. We then draw from its conditional distribution at the resulting value of .
The second update rescales the field and all three loadings together. For a proposed log-scale change , the field is multiplied by and each loading by . These changes preserve their products in the likelihood. Writing for the vector of three loadings, the log acceptance ratio is
where the last term is the log Jacobian.
Posterior summaries. Simulation fits used one chain with 1,000 warm-up iterations and 2,000 retained draws, saving every second draw. The four-tissue comparison used one chain per candidate with 1,500 warm-up iterations and 2,000 retained draws without thinning. Each detailed ovarian fit used four independent chains and 3,000 warm-up iterations per chain. We retained 16,000 subsequent draws per chain for IL6–IL6R and 4,000 for VEGFA–FLT1.
The posterior inclusion probability (PIP) is the fraction of draws with . Model-averaged 95% credible intervals use the empirical 2.5th and 97.5th percentiles of all draws, including the zeros. Conditional intervals use only draws with . At each threshold , we estimate by the fraction of all draws whose absolute value exceeds . Before computing convergence diagnostics for the field loadings, we multiply all three loadings in each retained draw by .
Real-Data Methods
Candidate Screening
We first identified ligand–receptor pairs for which both genes and a downstream pathway could be measured in the relevant cell types. A candidate linked two distinct cell types with at least 100 sender cells and 500 receiver cells. Log-normalized abundance had to exceed 0.1 in at least 5% of the respective cells for both the ligand and the receptor. The product of mean sender ligand abundance and mean receiver receptor abundance had to reach 0.01, and at least five measured pathway genes had to remain after excluding the ligand and receptor.
Of the 2,229 eligible candidates, we ranked the 300 ovarian candidates with the largest (breaking ties by pathway size) and all eligible melanoma and breast candidates. We calculated the screening scores from the transformed measurements before standardizing them for model fitting. Four rankings allowed us to include candidates with strong marginal association, substantial spatial variation, prior biological support, or a spatial pattern despite weak marginal association. Write for the marginal exposure–pathway correlation, for the number of measured pathway genes, and , , for Moran’s of exposure, receptor abundance, and pathway activity among receivers. With , the rankings use
The four scores, in order, were , , , and . The screening code specifies the biological weights by pathway, genes, and sender–receiver pairing. The fourth ranking was restricted to . The union of the top 50 candidates per ranking in ovarian tissue and melanoma and the top 10 in breast tissue gave 92, 89, and 20 distinct candidates, respectively. A specified list of 21 eligible renal candidates brought the total to 222. The analysis code provides the genes defining each pathway outcome, including panel-adapted gene sets for the renal tissue.
Table S1 summarizes the quartiles and the coefficient of variation of the marginal latent variances for each of the 36 receiver graphs used in the comparison. The coefficients of variation ranged from 0.56 to 4.65.
CellPhoneDB Comparison
CellPhoneDB compares expression of a ligand–receptor interaction in a cell-type pair with its expression under permuted cell-type labels [12]. We used version 5.0.1 with database v5.0.0, 1,000 label permutations, and a 5% expression prevalence threshold. Each tissue analysis used all retained RNA genes and up to 3,000 cells per relevant annotated type.
We matched ligand and receptor genes to opposite sides of a database interaction in either orientation. Matches could involve an exact pair or a complex containing a candidate gene. A complex could be tested only if all required components were present. Among multiple matches, we gave priority to tested interactions, then to exact pairs, breaking ties by database identifier. We recorded missing components and absent database matches separately. Candidates with the same ligand, receptor, and cell types share a CellPhoneDB result across pathways. We used a nominal permutation for enrichment. The comparison describes candidates selected using expression and spatial information from the same tissues.
Ovarian Follow-up
The two ovarian examples had different origins. VEGFA–FLT1 was part of the four-tissue comparison. IL6–IL6R arose in a separate exploratory search among expression-eligible ovarian cytokines. For that search, we profiled the exposure covariance . We fitted the joint model for candidates whose profile had an interior maximum and whose estimated independent exposure variance was at least 0.05 on the standardized scale.
Both follow-ups used all cells of the designated sender and receiver types. The sender-exposure and receiver-graph bandwidths were 111 and 134 micrometers, respectively, for IL6 and 49 and 47 micrometers for VEGFA. We standardized exposure, receptor abundance, and pathway score within each receiver population. Only 94 of 559 ciliated epithelial receivers had positive fibroblast IL6 exposure before centering. Across all 559 IL6 receivers, the median was 2.60 (interquartile range 2.06–4.80), compared with 4.17 (2.58–8.93) for the VEGFA receivers. Table S2 gives the posterior summaries. Across the two fits, the largest rank-normalized split for continuous parameters was 1.008. The smallest bulk and tail effective sample sizes were 473 and 1,047. The Monte Carlo standard errors of the PIPs were 0.0039 for IL6 and 0.0019 for VEGFA.
Residual variance in the IL6 analysis. We examined whether residual variance changed with in any of the three equations. At each of the 64,000 retained draws, let and be the conditional mean and variance of given the data and parameters, as in Appendix B. Write , , and . The conditional expected squared standardized residual for equation was
We averaged this quantity over draws for each receiver, then within ten groups of nearly equal size ordered by (55 or 56 cells, with ties resolved by receiver order). For each equation we regressed the ten group averages on group mean with an intercept. Per receiver-level standard deviation of (9.05), the estimated slopes were −0.029 for IL6 exposure (), 0.154 for IL6R expression (), and 0.003 for the inflammatory-response score ().
Exposure-permutation controls. We randomly reassigned the standardized IL6 exposures across the 559 receivers five times, holding receptor abundance, pathway scores, coordinates, and the receiver graph fixed. Each fit used the original priors and chain lengths. All five model-averaged 95% intervals included zero, and the PIPs ranged from 0.043 to 0.283. These controls assess how the result for this candidate depends on the spatial alignment of exposure with receiver cells.
Sensitivity to coefficient priors. We refitted both examples with common normal coefficient variance 0.25 or 4 in place of 1, including the slab variance for . Each alternative used four chains with 16,000 retained draws per chain. As the variance increased from 0.25 to 4, the IL6 PIP rose from 0.823 to 0.951 and the posterior mean conditional on inclusion rose from 0.453 to 1.136. Across all three priors the conditional intervals were positive and the model-averaged intervals included zero. For VEGFA the PIP ranged from 0.027 to 0.098 and the conditional intervals remained close to [].
Simulation Generators
Simulation Design
The reference experiment asks how well the methods recover a known exposure effect when exposure, receptor expression, and pathway activity share a spatial cause. The remaining experiments change the strength or form of that confounding, the error variances, or the geometry of the tissue. Under the reference model, , , and , with independent unit-variance Gaussian errors. The weak- and strong-confounding settings multiply the three latent loadings by 0.5 and 1.5, respectively. Table S3 summarizes the simulations.
The reference locations were sampled uniformly from a square. To set the scale of the Gaussian field, we started with the receiver-graph precision , where is the weighted adjacency matrix and the diagonal matrix of weighted degrees. The scaled precision is , with . This gives mean marginal variance one. We calculated from the exact diagonal for and estimated it at using the mean squared norm of 64 draws from , divided by . Below, collects the marginal variances .
In the two-field experiment, independent and have unit average marginal variance. The first graph uses the reference Gaussian bandwidth , the median positive distance among receiver-neighbor pairs, and the second uses . Their contributions to , , and are respectively
CASPER fits a single field using the first precision. The oracle observes both fields. The mild nonlinear experiment changes only the direct confounding contribution to , to
where the square is elementwise and . The oracle includes both and the quadratic term. The Laplace experiment replaces each error by an independent random sign times an exponential variable with rate , preserving variance one.
For heteroskedasticity, define
and normalize the resulting to have mean one. Multiplying the corresponding errors by scales their variances by . In two settings, the variance in the exposure equation increased or decreased with . In a third, the error variance in all three equations increased with . CASPER assumed constant error variances in each fit.
The regular graph has 500 cells on a periodic lattice, with eight neighbors and symmetrized Gaussian weights. Its marginal variances are constant to numerical precision. Jitter adds independent uniform coordinate offsets up to 20% of the corresponding lattice spacing and wraps coordinates periodically. The irregular comparator is the reference random point pattern. The periodic graph retains off-diagonal spatial covariance even when the diagonal is constant. Regression estimates include an intercept. Bayesian fits use centered, standardized variables, and we back-transform effect estimates to the generating scale to calculate bias and root mean squared error.
Sensitivity to the fitted spatial covariance
We varied the receiver graph used to fit CASPER while holding each dataset, including its exposure, fixed. For each generating effect ( or 0.30), we refitted 100 reference datasets at . At the reference bandwidth we changed the number of neighbors from eight to six or ten. With eight neighbors we used or . Each fitted covariance had mean marginal variance one. Table S4 shows how these changes affected selection and the estimated exposure effect.
Table S3: Selection and estimation in 100 replicates per setting. CASPER and spatial outcome-only regression select effects at posterior inclusion probability (PIP) . Ordinary and oracle regression use a 95% confidence interval excluding zero. Bias and root mean squared error (RMSE) are on the generating scale.
References
- [5]S. Aibar, C. B. González-Blas, T. Moerman, V. A. Huynh-Thu, H. Imrichova, G. Hulselmans, F. Rambow, J.-C. Marine, P. Geurts, J. Aerts, et al. SCENIC: single-cell regulatory network inference and clustering. Nature Methods, 14:1083–1086, 2017.DOI
- [6]A. A. Almet, Y.-C. Tsai, M. Watanabe, and Q. Nie. Inferring pattern-driving intercellular flows from single-cell and spatial transcriptomics. Nature Methods, 21(10):1806–1817, 2024.DOI
- [7]M. Andreatta and S. J. Carmona. UCell: Robust and scalable single-cell gene signature scoring. Computational and Structural Biotechnology Journal, 19:3796–3798, 2021.DOI
- [9]S. Cabello-Aguilar, M. Alame, F. Kon-Sun-Tack, C. Fau, M. Lacroix, and J. Colinge. SingleCellSignalR: inference of intercellular networks from single-cell transcriptomics. Nucleic Acids Research, 48(10):e55–e55, 2020.
- [10]R. Dries, Q. Zhu, R. Dong, C.-H. L. Eng, H. Li, K. Liu, Y. Fu, T. Zhao, A. Sarkar, F. Bao, et al. Giotto: a toolbox for integrative analysis and visualization of spatial expression data. Genome Biology, 22(1):78, 2021.
- [11]L. Dupuis, O. Debeaupuis, F. Simon, and H. Isambert. CausalCCC: a web server to explore intracellular causal pathways enabling cell–cell communication. Nucleic Acids Research, 53(W1):W125–W131, 2025.DOI
- [12]M. Efremova, M. Vento-Tormo, S. A. Teichmann, and R. Vento-Tormo. CellPhoneDB: inferring cell–cell communication from combined expression of multi-subunit ligand–receptor complexes. Nature Protocols, 15(4):1484–1506, 2020.DOI
- [13]E. M. Hanks, E. M. Schliep, M. B. Hooten, and J. A. Hoeting. Restricted spatial regression in practice: Geostatistical models, confounding, and robustness under model misspecification. Environmetrics, 26(4):243–254, 2015.DOI
- [15]R. Hou, E. Denisenko, H. T. Ong, J. A. Ramilowski, and A. R. Forrest. Predicting cell-to-cell communication networks using NATMI. Nature Communications, 11(1):5011, 2020.DOI
- [16]S. Jin, C. F. Guerrero-Juarez, L. Zhang, I. Chang, R. Ramos, C.-H. Kuan, P. Myung, M. V. Plikus, and Q. Nie. Inference and analysis of cell-cell communication using CellChat. Nature Communications, 12(1):1088, 2021.DOI
- [17]A. Liberzon, C. Birger, H. Thorvaldsdóttir, M. Ghandi, J. P. Mesirov, and P. Tamayo. The molecular signatures database hallmark gene set collection. Cell Systems, 1(6):417–425, 2015.pubmed.ncbi.nlm.nih.gov/26771021
- [18]C. J. Paciorek. The importance of scale for spatial-confounding bias and precision of spatial regression estimators. Statistical Science, 25(1):107–125, 2010.DOI
- [19]G. Palla, H. Spitzer, M. Klein, D. Fischer, A. C. Schaar, L. B. Kuemmerle, S. Rybakov, I. L. Ibarra, O. Holmberg, I. Virshup, et al. Squidpy: a scalable framework for spatial omics analysis. Nature Methods, 19(2):171–178, 2022.DOI
- [20]A. Papathanasiou, O. Djahanbakhch, E. Saridogan, and R. A. Lyons. The effect of interleukin-6 on ciliary beat frequency in the human fallopian tube. Fertility and Sterility, 90(2):391–394, 2008. doi: 10.1016/j.fertnstert.2007.07.1379.DOI
- [21]B. J. Reich, J. S. Hodges, and V. Zadnik. Effects of residual smoothing on the posterior of the fixed effects in disease-mapping models. Biometrics, 62(4):1197–1206, 2006.pubmed.ncbi.nlm.nih.gov/17156295
- [22]R. Rigobon. Identification through heteroskedasticity. Review of Economics and Statistics, 85(4):777–792, 2003.
- [23]H. Rue and L. Held. Gaussian Markov random fields: theory and applications. Chapman and Hall/CRC, 2005.
- [24]R. Shao, M. Nutu, L. Karlsson-Lindahl, A. Benrick, B. Weijdegård, S. Lager, E. Egecioglu, J. Fernandez-Rodriguez, K. Gemzell-Danielsson, C. Ohlsson, J.-O. Jansson, and H. Billig. Down-regulation of cilia-localized IL-6Rα by 17β-estradiol in mouse and human fallopian tubes. American Journal of Physiology-Cell Physiology, 297(1):C140–C151, 2009. doi: 10.1152/ajpcell.00047.2009.DOI
- [25]Y. Wang, R. Wang, S. Zhang, S. Song, C. Jiang, G. Han, M. Wang, J. Ajani, A. Futreal, and L. Wang. iTALK: an R package to characterize and illustrate intercellular communication. bioRxiv, page 507871, 2019.DOI
