Multi-sample and multi-group spatial colocalization analysis using PANORAMIC Authors: Jacob Chang, Almudena Espín Pérez, Perla Molina, Rohit Khurana, Weiruo Zhang, Lu Tian, Sylvia K Plevritis, Virginie Uhlmann Published: 2026 ABSTRACT AbstractMotivationSpatial omics studies compare cell–cell organization across samples, but most methods model between-sample variability while treating sample-level spatial estimates as error-free. Overlooking within-sample uncertainty can distort inference in heterogeneous cohorts, motivating methods that explicitly quantify and propagate this uncertainty into cohort-level analyses.ResultsWe present Pooled ANalysis Of VaRiance-Aware Modeling and Inference of Colocalization (PANORAMIC), a hierarchical framework for spatial colocalization analysis that uses edge-corrected neighborhood enrichment to estimate local cell-type colocalization, spatial bootstrapping to quantify within-sample uncertainty, and multilevel random-effects meta-analysis to propagate this uncertainty across samples, patients, and conditions. In simulations, PANORAMIC improved recovery of within-sample uncertainty and between-sample heterogeneity relative to naive estimators across diverse spatial settings and progressive data degradation. Applied to a colorectal cancer tissue microarray profiled by multiplexed immunofluorescence imaging, PANORAMIC identified stronger B- and T-cell colocalization in tumors with Crohn’s-like reaction than in tumors with diffuse inflammatory infiltration, together with tighter higher-order immune organization consistent with immune aggregates. These findings were missed using standard methods, showing that propagating within-sample spatial uncertainty can improve cohort-level inference in spatial omics studies.Availability and implementationPANORAMIC is released as an open-source R package at https://github.com/plevritis-lab/panoramic and archived on Zenodo at https://doi.org/10.5281/zenodo.19927197. 1 Introduction Spatially resolved single-cell technologies are transforming the study of tissue architecture by providing molecular, phenotypic, and positional measurements for thousands of cells within intact tissues (Giesen et al. 2014, Chen et al. 2015, Codeluppi et al. 2018, Goltsev et al. 2018, Wang et al. 2018, Keren et al. 2019, Rodriques et al. 2019, He et al. 2021, Janesick et al. 2023). These technologies make it possible to quantify not only which cell types are present in a tissue, but also how they are spatially organized. A central analysis task in spatial omics has been to measure spatial colocalization between cell types, which can serve as a proxy for cellular interaction, a distinct microenvironment, and coordinated tissue organization (Schapiro et al. 2017, Janesick et al. 2023). For example, the spatial organization of cytotoxic T cells relative to tumor cells is a clinically relevant feature of the tumor immune microenvironment (Giraldo et al. 2019), while organized lymphoid aggregates involving B cells, T cells, and antigen-presenting cells are characteristic of tertiary lymphoid structures that have been linked to favorable prognosis and immunotherapy response (Sautès-Fridman et al. 2019, Helmink et al. 2020). These and related findings demonstrate that cell-type spatial relationships encode biologically and clinically meaningful aspects of tissue organization. Despite the value of colocalization analysis, rigorous statistical comparison of colocalization across samples remains challenging. Each tissue sample can be regarded as a distinct realization of a high-dimensional stochastic spatial process, with thousands of spatially correlated cells nested within samples, samples nested within patients, and patients grouped by clinical condition or phenotype. Treating cells as independent experimental units can lead to pseudoreplication and inflated evidence in single-cell studies (Squair et al. 2021, Zimmerman et al. 2021). In spatial omics, this challenge is compounded by local spatial heterogeneity: different regions of the same tissue section may exhibit distinct cellular neighborhoods, densities, and spatial association patterns. Thus, differential colocalization analysis must account for multiple layers of variability, including within-sample spatial uncertainty, between-sample biological and technical heterogeneity, and repeated sampling from the same patient. Several recent methods address important components of this problem. SpicyR summarizes pairwise cell-type localization at the image level, and uses regression or mixed-effects models to test for differential spatial relationships, including settings with multiple images per subject and heterogeneous cell counts (Canete et al. 2022). SpaceANOVA represents cell-type co-occurrence as a distance-indexed spatial interaction function and applies functional ANOVA to compare groups over spatial scales (Seal et al. 2024). Other spatial association statistics, such as the colocation quotient and related point-pattern summaries, have also been used to quantify pairwise cell-type spatial relationships in tissue (Leslie and Kronenfeld 2011, Zhang et al. 2022, Yeh et al. 2024). However, to our knowledge, existing approaches do not explicitly combine spatial bootstrap estimates of within-sample uncertainty with multilevel random-effects pooling across samples and patients. This distinction is consequential for clinical spatial omics studies, which often involve small cohorts, substantial biological heterogeneity, and multiple tissue regions or cores per patient. We present Pooled ANalysis Of VaRiance-Aware Modeling and Inference of Colocalization (PANORAMIC), a statistical framework for pooled inference of cell-type colocalization across spatial omics samples. PANORAMIC estimates sample-specific colocalization statistics and their uncertainty using spatial bootstrapping, which preserves local spatial dependence while quantifying within-sample variability (Loh 2008, 2010). These sample-level estimates and variances are then propagated through a multilevel random-effects meta-analysis fit by restricted maximum likelihood (REML), allowing PANORAMIC to pool colocalization estimates across samples while modeling heterogeneity across patients and repeated samples and estimating differences between biological conditions (Borenstein et al. 2009, Raudenbush 2009, Viechtbauer 2010, Konstantopoulos 2011). This yields a hierarchical approach that respects both spatial dependence within tissue samples and heterogeneity across samples, patients, and clinical groups. Although we use edge-corrected neighborhood enrichment as the default colocalization statistic, PANORAMIC is statistic-agnostic: any sample-level spatial statistic for which bootstrap replicate estimates can be computed, such as Ripley’s K- and L-functions, may be propagated through the same hierarchical framework. To evaluate PANORAMIC, we apply it to simulated spatial point-process data with known generative structure and estimands, benchmark its uncertainty calibration, heterogeneity recovery, and robustness to sample degradation. We then demonstrate its utility on multiplexed immunofluorescence (mIF) imaging datasets from colorectal cancer (CRC) and head and neck squamous cell carcinoma (HNSCC) tissue microarrays (TMAs). In CRC, Schürch et al. (2020) used mIF imaging to identify conserved cellular neighborhoods at the invasive tumor front and showed that Crohn’s-like reaction (CLR) tumors, compared with diffuse inflammatory infiltration (DII) tumors, exhibit organized immune hubs associated with favorable prognosis (Schürch et al. 2020). When applied to this dataset, PANORAMIC systematically tests directional cell-type pair colocalizations while propagating spatial uncertainty. We further apply PANORAMIC to a HNSCC TMA from Haist et al. (2026), who used spatial profiling of primary tumors and paired tumor-draining lymph nodes to study lymph node colonization and metastatic immune remodeling (Haist et al. 2026). Across simulations and real datasets, PANORAMIC provides a practical framework for pooling spatial information within a biological condition, comparing spatial organization across conditions, and ultimately summarizing higher-order tissue organization through networks of differential colocalization. 2 Materials and methods 2.1 Overview of the PANORAMIC workflow PANORAMIC performs pooled inference for cell-type colocalization across spatial omics samples. For each sample, cell-type pair, and specified spatial radius, PANORAMIC first computes an edge-corrected neighborhood enrichment statistic that measures whether one cell type is enriched around another cell type relative to its sample-wide cell density. PANORAMIC then estimates within-sample uncertainty using a block-based spatial bootstrap that resamples local tissue regions rather than individual cells. The resulting sample-level estimates and bootstrap variances are used as inputs to multilevel random-effects meta-analysis models, which pool colocalization effects and test for differences between groups while modeling heterogeneity across patients and repeated tissue samples (Fig. 1). Overview of the PANORAMIC framework. (A) Calculation of colocalization and within-sample variance for each sample. (i) Spatial omics input data (cell type annotations and coordinates) formatted as a list of SpatialExperiment objects. (ii) For each sample k and cell type pair p, compute colocalization and estimate within-sample variance using spatial bootstrapping. (B) Multi-sample pooling. For each cell type pair p, pool samples within a group via multilevel random-effects meta-analysis. Forest plots show individual sample estimates with within-sample variance and pooled group means (gray diamonds). (C) Differential testing and network analysis. (i) Pooled means and standard errors are used to perform hypothesis testing for colocalization differences between groups A and B. (ii) Statistically significant cell type pairs visualized via volcano plot. Each point represents a cell type pair p. (iii) Colocalization matrix is constructed, populated by Z-scores between cell type pairs from the differential testing step. (iv) Network clustering is performed to identify higher-order colocalization subnetworks. 2.2 Colocalization using edge-corrected neighborhood enrichment For each sample, PANORAMIC quantifies pairwise cell-type colocalization using an edge-corrected neighborhood enrichment statistic. For an ordered pair a→b, PANORAMIC asks whether cells of type a are enriched in the local neighborhoods surrounding cells of type b, relative to the sample-wide density of type a. For each anchor cell i of type b, we define a circular neighborhood of radius r. Let ni,a(r) denote the number of neighboring cells of type a, and let ni,·(r) denote the total number of neighboring cells of any type within radius r. Anchors with no neighboring cells within radius r are excluded. The observed local proportion of type-a cells around anchor i is To account for tissue boundaries, we then compute the area of the radius-r disk around anchor i that lies inside the observed tissue region, where xi is the spatial coordinate of anchor i, B(xi,r) is the radius-r disk centered at xi, and W denotes the observed tissue window. Assuming homogeneity, the edge-corrected expected number of neighboring type-a cells around anchor i is where λ^a is the sample-wide density of cells of type a, calculated as the total number of cells of type a divided by the area of the observed tissue region. PANORAMIC then defines the anchor-level edge-corrected neighborhood enrichment score as Positive values indicate that cells of type a are enriched within radius r of cells of type b, relative to the sample-wide density of type a and after accounting for boundary truncation. Negative values indicate depletion. The factor of 100 places the statistic on a percentage-point-like scale relative to the observed local neighborhood size. For each sample k, radius r, and ordered pair a→b, PANORAMIC summarizes colocalization by averaging the anchor-level scores over all valid type-b anchors in the sample: where Vk,b(r) is the set of type-b anchor cells with at least one neighbor within radius r. This sample-level statistic is the effect size used in the downstream spatial bootstrap and multilevel meta-analysis. Thus, an effect size of 4 for a→b at radius r means that, on average, type-a cells are enriched by approximately four percentage points in the radius-r neighborhoods around type-b anchor cells, relative to the edge-corrected expected count for type-a cells in that sample. Notably, this statistic is directional because neighborhoods are centered on one cell type and evaluated for enrichment of another. A high value of a→b means that type-a cells are enriched around type-b cells; it does not necessarily imply that type-b cells are enriched around type-a cells. Additional details on the edge-corrected neighborhood enrichment are provided in Methods 1, available as supplementary data at Bioinformatics online. 2.3 Spatial bootstrapping and within-sample uncertainty A single sample-level colocalization estimate can mask substantial within-sample spatial variability. In some tissues, spatial organization is relatively homogeneous and the estimate is stable across regions. In others, tissue compartmentalization, boundary effects, or localized cellular architecture can make the estimate sensitive to which regions of the tissue are sampled. PANORAMIC therefore treats each sample-level spatial statistic as an estimate with uncertainty, rather than as an error-free value. To quantify within-sample uncertainty while preserving local spatial dependence, PANORAMIC uses an overlap-weighted block-based spatial bootstrap adapted from Loh-style spatial resampling (Loh 2008, 2010). For each sample, the tissue window Wk is covered by a regular grid of square tiles. Each tile receives the overlap weight where q indexes tiles. Tiles which do not overlap with the tissue window are excluded, and the remaining tissue-overlapping tiles define the bootstrap sampling frame. Retained tiles are sampled with replacement using probabilities proportional to their overlap weights, so that tiles only partially contained in the observed tissue region are downweighted relative to tiles which fall completely within the observed tissue region (Methods 2, available as supplementary data at Bioinformatics online) in the resampling. For each directional cell-type pair colocalization f in sample k at radius r, PANORAMIC first computes anchor-level neighborhood enrichment scores and assigns each valid anchor to a retained spatial tile. Within each tile, anchor-level scores are summarized to obtain tile-level means. A bootstrap replicate is then formed by sampling tissue-overlapping tiles with replacement and averaging the sampled tile-level summaries. This yields bootstrap replicate statistics where B is the number of bootstrap replicates. PANORAMIC estimates the sample-level effect as the mean of the bootstrap replicate statistics, and the within-sample variance as When B is big, μ^fk(r) is expected to be close to the corresponding colocalization summary θ^k,f(r) given earlier. These quantities define the sample-level estimate and the corresponding within-sample variance estimate used in downstream multilevel meta-analysis. Consequently, PANORAMIC allows samples with unstable or spatially heterogeneous colocalization patterns to contribute less to pooled inference of a cell-type pair’s colocalization across samples and patients. 2.4 Multilevel meta-analysis To summarize colocalization within and between groups of samples, PANORAMIC fits feature-wise multilevel random-effects meta-analytic models using the metafor R package (Viechtbauer 2010). Here, f indexes a directional cell-type pair colocalization evaluated at a specified radius. For each cell-type pair f and sample k, the spatial bootstrap provides a sample-level effect estimate yfk and a corresponding within-sample variance estimate vfk. Let c(k)∈{1,…,C} denote the biological group or condition of sample k, and let m(k)∈{1,…,M} denote the patient from which sample k was obtained. For group-level estimation, PANORAMIC models where βfc is the expected colocalization level for feature f in group c, is a patient-level random effect capturing between-patient heterogeneity, and represents the estimated within-sample uncertainty from the spatial bootstrap. When multiple samples or tissue cores are available from the same patient, PANORAMIC can include an additional sample-level random effect nested within patient: where s(k) denotes the sample or tissue region corresponding to patient k and is the sample-level random effect capturing the additional between-sample heterogeneity within a patient. This hierarchical random-effects structure is selected according to the sampling design and the number of repeated samples per patient. This type of random-effects model can be fit using either moment- or likelihood-based method. The REML estimator is a common choice. In the end, estimators for group-level summary βfc and variance components τfc2 can be obtained along with their standard errors as the primary output of PANORAMIC. For two-group comparisons, PANORAMIC estimates a contrast between the two group-specific pooled means, The Wald statistic is where β^fdiff is the estimator of βfdiff from PANORAMIC. Two-sided P-values are computed using the standard normal reference distribution, and Benjamini–Hochberg correction is applied across all tested cell-type pairs. This framework allows PANORAMIC to propagate spatial bootstrap uncertainty into group-level inference while also modeling heterogeneity across patients and repeated tissue samples. Additional details on the multilevel meta-analysis implementation are available in Methods 3, available as supplementary data at Bioinformatics online. When sample-level clinical or demographic covariates are available and the number of biological replicates is sufficient, they can be included through meta-regression terms in the design matrix. However, as in standard meta-analysis, covariate-adjusted models require adequate sample size, and some variance components may not be identifiable for all covariate structures. 2.5 Simulation studies We evaluated PANORAMIC using two simulation studies designed to assess within-sample uncertainty estimation and multilevel inference under heterogeneous and progressively degraded sampling. First, we evaluated whether the spatial bootstrap captures within-sample uncertainty in sample-level colocalization estimates. We simulated marked spatial point patterns in a 600 μm × 600 μm observation window under three spatial regimes: (i) spatially uniform cell types, (ii) cell types arranged with opposing spatial gradients, and (iii) clustered organization of cell types A–B (Fig. 2). Simulations included five cell types, with overall cell densities scaled to match the average cell counts observed in the CRC TMA. For each simulated sample, PANORAMIC computed edge-corrected neighborhood enrichment at radius r = 25 μm and estimated within-sample uncertainty using a spacial bootstrap with square tiles of side length 62.5 μm. Bootstrap variance estimates were compared with a benchmark, which is the empirical variation of colocalization summaries across a large number of independently simulated samples. Additional simulation details are provided in Methods 4.1, available as supplementary data at Bioinformatics online. Validation of within-sample variance estimation via spatial bootstrapping. (A) Three spatial point process configurations were used for simulation: (i) uniform point pattern (complete spatial randomness), (ii) opposing gradient point pattern (spatial segregation with two cell types localized to opposite regions), and (iii) cluster point pattern (offspring occurring around parent cells). Cell types A, B, C are abundant; Rare 1 and Rare 2 represent low-frequency populations, distributed randomly. (B) For each configuration, 300 independent realizations were generated to establish ground truth within-sample variance. Spatial bootstrapping (100 iterations) was applied to each individual realization, and Pearson correlation between bootstrap-derived variance and ground truth was computed across all cell type pairs (25 ordered pairs). Violin plots show distribution of correlations across 300 realizations, with median values labeled. Spatial bootstrapping shows high concordance for uniform (median r = 0.88) and cluster (r = 0.91) point patterns, indicating accurate variance recovery for these spatial configurations. Concordance is moderate for the opposing gradient point pattern (r = 0.67). Second, we evaluated PANORAMIC in a nested sampling setting with both patient-level and sample-level heterogeneity, variable numbers of samples per patient, and progressive sample degradation (Fig. 3). We simulated clustered A–B spatial point patterns in which patient-specific latent effects modulated cluster intensity, abundance, and spread, with additional variation among repeated samples from the same patient. This clean nested simulation was used to assess recovery of the pooled mean μ and patient-level heterogeneity τ2 across patient-count regimes. We then extended the same nested simulation framework to include ordered degradation scenarios ranging from a clean baseline to increasingly severe contamination and quality-related distortion, including cell thinning, directional cell-type bias, and additional sample-level heterogeneity. The multilevel random-effects meta-analysis based on sample-level estimates and bootstrap variances was conducted, and the performance was summarized by comparing PANORAMIC and naive estimates of μ and τ2 across patient-count and degradation regimes. Additional simulation details can be found in Methods 4.2, available as supplementary data at Bioinformatics online. Validation of between-sample variance estimation using PANORAMIC. (A) Hierarchical simulation framework produces multiple samples per patient, selected via a negative binomial distribution. Three example patients shown here. (B) Progressive degradation of patient samples is performed to study the benefits of PANORAMIC under varying degrees of noise. (C) RMSE for the pooled mean μ and patient-level heterogeneity τ2 across patient-count settings npatients=10,…,50. Confidence intervals are formed from 5 repeated simulations. 2.6 CRC TMA data processing and analysis The colorectal cancer (CRC) tissue microarray (TMA) data were obtained from Schürch et al. (2020). The authors used multiplexed immunofluorescence (mIF) imaging to profile tissue regions from the invasive front of advanced-stage CRC tumors, with patient-level annotations including Crohn’s-like reaction (CLR) and diffuse inflammatory infiltration (DII) immune patterns. The original study profiled 140 tissue regions from 35 patients using 56 protein markers and identified conserved cellular neighborhoods associated with antitumoral immune organization and clinical outcome (Schürch et al. 2020) (Fig. 8.1, available as supplementary data at Bioinformatics online). For PANORAMIC analysis, we used the released single-cell table containing cell-type annotations and spatial coordinates. Spatial coordinates were converted from pixels to microns using the conversion factor reported for this dataset. We removed cells with undefined cell-type labels and excluded rare cell types that were absent from >20% of images, following the filtering strategy used for this dataset in the spicyR analysis (Canete et al. 2022). The resulting processed dataset contained 12 retained cell types (Methods 5.1, available as supplementary data at Bioinformatics online). For CLR patients, one core annotated as containing lymphoid aggregate architecture was randomly selected when available; for DII patients, one diffuse-infiltration core was randomly selected (Methods 5.2, available as supplementary data at Bioinformatics online). Pairwise colocalization was quantified using the edge-corrected neighborhood enrichment statistic at radius r = 25 μm. Within-sample uncertainty was estimated using the spatial block bootstrap with B=100 bootstrap replicates and square tiles of side length 62.5 μm, corresponding to 2.5×r. Cell-type pairs were evaluated only when the relevant cell types had at least five cells in a given sample. Sample-level estimates and bootstrap variances were then propagated into feature-wise multilevel random-effects meta-analysis. For the comparison of CLR and DII tumors, PANORAMIC used patient-level random effects, group-specific fixed-effect means, group-median variance flooring, and REML estimation (Fig. 4). PANORAMIC identifies significantly differentially colocalized cell type pairs in CLR versus DII colorectal cancer. (A) Volcano plot showing differential colocalization between colorectal cancer phenotypes CLR and DII at 25 μm. Each point represents a cell-type pair, with the effect size on the x-axis defined as the difference in pooled colocalization means (DII-CLR) and y-axis as the P-values from PANORAMIC’s Wald test. Points are colored by significance. Thirteen cell type pairs show significant colocalization differences across groups (3 in CLR, 10 in DII) after multiple testing correction. (B) Representative CLR and DII tissue cores for (i) B cell → CD8+ T cell colocalization and (ii) CD68+ CD163+ macrophage → CD8+ T cell colocalization. The selected cores were chosen from samples closest to their respective pooled group mean from the meta-analysis. Colored points highlight the relevant cell type populations; gray points denote other cell types. (C) Forest plots display the sample-level colocalization estimates (white squares) and the uncertainty estimated through the bootstrap (red and blue horizontal bars). The pooled estimate from meta-analysis for each group is indicated by the red and blue diamonds. 2.7 Differential network and spatial compactness analysis Pairwise differential colocalization identifies specific cell-type relationships that differ between conditions, but it does not directly reveal whether multiple cell types reorganize as a coordinated spatial module. PANORAMIC therefore uses differential colocalization statistics to construct weighted cell-type colocalization networks. In the CRC colocalization network analysis, we visualized the CLR-enriched network, representing cell-type pairs with stronger colocalization in CLR than in DII. Nodes represent cell types, and edges represent significant differential colocalization relationships. For visualization, the network was rendered as an undirected graph and partitioned using Leiden clustering (Traag et al. 2019) (Fig. 5). Colocalization network reveals coordinated immune subnetworks in CLR. (A) Differential colocalization network constructed from PANORAMIC Z-scores for CLR-enriched associations. Edges are weighted by the magnitude of Wald Z-scores from differential testing between CLR and DII groups, and Leiden clustering identifies three subnetworks. (B) For cluster 1 (green), spatial compactness scores of the relevant cell types were computed for each sample. CLR samples have significantly lower relative compactness scores than DII samples, indicating tighter spatial organization of the selected cell-type set (p≈0.003, one-sided t-test). (C) Representative CLR and DII cores illustrate compact immune clustering in a sample from a CLR patient (i) versus a sample from a patient with DII (ii). The chosen samples were those closest to the median compactness score per group. To complement the graph visualization with a sample-level spatial summary, we performed a spatial compactness analysis on the cell-type set highlighted by the CLR-enriched network, For each sample, we considered all cells whose labels belonged to T. For each such source cell, we computed the nearest-neighbor distance to each cell type in T, excluding the source cell itself when the source and target types were the same. Distances were capped at 25 μm, matching the radius used in the primary colocalization analysis. These distances were then averaged across the target cell types in T, producing a per-cell within-set spacing summary. o account for differences in overall cell density across samples, we normalized each per-cell within-set spacing summary by the nearest-neighbor distance from the same source cell to any other cell in the sample. The resulting relative spatial compactness values were averaged across cells to produce one spatial compactness score per sample. Smaller values indicate that the selected cell types are more tightly co-organized relative to the local cellular density baseline (Methods 5.5, available as supplementary data at Bioinformatics online). Sample-level spatial compactness scores were compared between CLR and DII using Welch t-tests. The primary spatial compactness analysis used the mean relative spatial compactness score and tested whether CLR samples had lower relative compactness than DII samples. This analysis provides an independent sample-level summary of whether the cell types highlighted by the differential colocalization network are more tightly co-organized in CLR tumors. 2.8 HNSCC TMA analysis To assess whether PANORAMIC generalizes beyond colorectal cancer, we applied the workflow to a head and neck squamous cell carcinoma TMA cohort from Haist et al. (2026). Haist et al. used spatial proteomics, spatial transcriptomics, and experimental models to study lymph node colonization in head and neck cancer, reporting that nodal colonization is associated with tissue remodeling, interferon-γ signaling, enrichment of immunosuppressive myeloid cells and cancer-associated fibroblasts, and spatially organized fibroblast–myeloid niches linked to T cell dysfunction and Treg activation (Haist et al. 2026). We used this cohort as a second real-data application to evaluate PANORAMIC in a setting with repeated tissue regions per patient and biologically distinct lymph node compartments. Specifically, we compared benign lymph node samples from node-negative patients with tumor-adjacent lymph node regions from patients with lymph node metastasis (Fig. 9.1, available as supplementary data at Bioinformatics online). This comparison tests whether PANORAMIC can identify reproducible spatial reorganization associated with nodal metastatic involvement while accounting for multiple tissue regions from the same patient. The HNSCC analysis used the same primary edge-corrected neighborhood enrichment statistic and spatial bootstrap design as the CRC analysis, with radius r = 25 μm, B=100 bootstrap replicates, square tiles of side length 62.5 μm, and minimum cell-type counts of five cells per sample. Group comparisons were performed using feature-wise multilevel random-effects meta-analysis with patient-level or sample-level random effects selected according to the repeated-sampling structure. 3 Results 3.1 Intrasample simulations validate sample-level uncertainty estimation We first evaluated whether PANORAMIC’s bootstrap variances track empirical within-sample variability. We simulated marked spatial point patterns under three regimes designed to represent distinct tissue organizations: spatially uniform cell types, opposing spatial gradients, and clustered A–B organization (Fig. 2A). For each regime, independent realizations were generated to estimate empirical variance for each ordered cell-type pair. PANORAMIC was then applied to individual realizations using B=100 bootstrap replicates. Bootstrap-estimated variances were strongly correlated with empirical variances in the uniform and clustered settings, with median correlations of 0.88 and 0.91, respectively (Fig. 2B). The opposing-gradient setting showed weaker, but still good, agreement, with a median correlation of 0.67. These results indicate that the spatial bootstrap provides informative within-sample uncertainty estimates across multiple spatial regimes, with the strongest performance in settings where variability is driven by local spatial organization. The reduced agreement in the opposing-gradient setting suggests that broad tissue-scale compartmentalization is more difficult for local tile resampling to capture. This suggests that, when large-scale tissue domains dominate the spatial signal, users should consider pathologist-defined regions, tissue masks, or stratified analyses rather than relying on a single global tissue window. 3.2 Intersample simulations show improved recovery of heterogeneity We next evaluated PANORAMIC in hierarchical multi-sample simulations designed to assess recovery of the pooled mean colocalization and between-patient heterogeneity under progressive degradation. These simulations introduced patient-level variation, sample-level variation, variable numbers of samples per patient, and a degradation ladder ranging from baseline through mild, moderate, severe, and extreme contamination or quality distortion (Fig. 3B and C). Across patient-count and degradation regimes, PANORAMIC and naive estimation produced broadly similar recovery of the pooled mean μ, particularly as the number of patients increased. The clearer and more persistent advantage of PANORAMIC was in recovery of patient-level heterogeneity. In the breakpoint stress test, the naive estimator increasingly conflated within-sample noise and degraded sample variation with true between-patient heterogeneity, whereas PANORAMIC maintained substantially better recovery of τpatient2, with scenario-specific root mean squared error (RMSE) reductions that were largest under severe and extreme degradation (Fig. 3C). These simulation results support the central statistical motivation for PANORAMIC: sample-specific uncertainty should be propagated into the level of the model where group and patient heterogeneity are estimated. This distinction is most important in heterogeneous, degraded, or small-to-moderate cohort settings, which are common in spatial omics studies. 3.3 PANORAMIC identifies enriched B- and T-cell colocalizations in CRC tumors with Crohn’s-like reaction We applied PANORAMIC to the colorectal cancer TMA cohort from Schürch et al. comparing tumors with Crohn’s-like reaction (CLR) against tumors with diffuse inflammatory infiltration (DII). The primary analysis used one randomly selected core per patient to avoid treating multiple TMA cores from the same patient as independent biological replicates. At r = 25 μm, PANORAMIC tested 144 directional cell-type pairs and identified 13 differential cell-type pair colocalizations after Benjamini–Hochberg correction (Fig. 4; Table 8.3, available as supplementary data at Bioinformatics online). The strongest CLR-enriched signals involved B-cell and T-cell organization, including B cell → B cell, B cell → CD8+ T cell, and B cell → CD4+ CD45RO + T cell colocalization. These findings are consistent with tighter B- and T-cell organization in CLR tumors and align with the expected tertiary-lymphoid-like immune architecture described in this phenotype. Selected macrophage- and tumor-associated colocalizations were stronger in DII; e.g. CD68+ CD163+ macrophage → CD8+ T cell colocalization was higher in DII. To support interpretation, we visualized representative TMA cores closest to the group-level colocalization means for selected cell-type pair colocalization, rather than visually extreme examples (Fig. 4B). We also generated forest plots for selected features to show sample-level estimates, bootstrap-derived uncertainty, and pooled group effects (Fig. 4C). These plots illustrate a practical benefit of PANORAMIC: the same analysis reports both the estimated colocalization effect and its uncertainty across samples and patients. 3.4 Differential colocalization network reveals coordinated CLR organization Pairwise colocalization analyses identify individual cell-type relationships, but do not directly show whether multiple cell types reorganize as a coordinated spatial module. To summarize higher-order structure, we constructed a weighted differential colocalization network from the CRC contrast statistics and focused on the CLR-enriched component. The resulting undirected network contained 12 nodes, 21 edges, and 3 Leiden clusters (Fig. 5A). One cluster highlighted a CLR-associated immune/stromal module involving B cells, CD8+ T cells, CD4+ CD45RO + T cells, and stroma. To test whether this network signal corresponded to tighter spatial organization at the sample level, we performed a compactness analysis on this cell-type set. CLR samples had lower relative compactness values than DII samples (Fig. 5B). The one-sided Welch test for the alternative CLR < DII yielded P = .00285. Representative CLR and DII samples near their respective group means showed the same qualitative pattern: the selected immune/stromal cell types appeared more tightly organized in CLR and more dispersed in DII (Fig. 5C). Together, the network and spatial compactness analyses suggest that the CLR-associated colocalization signal is not limited to isolated pairwise associations, but is consistent with broader coordinated immune organization. 3.5 Sensitivity analyses support scale stability and contextualize benchmark performance We evaluated the scale sensitivity of the CRC results by rerunning PANORAMIC across radii from 25 to 150 μm. Several leading differential features persisted across multiple radii, whereas others were significant only at a subset of spatial scales (Fig. 8.5, available as supplementary data at Bioinformatics online). These results indicate that the CLR–DII contrast is not driven solely by a single arbitrary neighborhood radius, while also showing that the strength and composition of the signal depend on spatial scale. We also compared PANORAMIC with spicyR and two-sample Welch t-tests for every cell-type pair (Tables 8.6 and 8.7, available as supplementary data at Bioinformatics online). In the CRC benchmark, PANORAMIC recovered a broader set of biologically coherent B- and T-cell-associated CLR signals than the benchmark workflows. As an additional diagnostic, we examined empirical P-value distributions across tested cell-type pairs (Fig. 8.8, available as supplementary data at Bioinformatics online). The PANORAMIC histogram showed an approximately uniform background with enrichment of small P-values consistent with the pattern from a small number of non-zero differences among a large number of nulls, whereas benchmark workflows showed less interpretable distributions. 3.6 HNSCC analysis demonstrates portability to a second TMA cohort We then applied PANORAMIC to a head and neck squamous cell carcinoma tissue microarray cohort from Haist et al. (2026). This analysis compared benign lymph node samples from node-negative patients with tumor-adjacent lymph node regions from patients with lymph node metastasis. Unlike the primary CRC analysis, this setting included repeated tissue regions per patient and therefore evaluated PANORAMIC in a nested sampling design. At r = 25 μm, PANORAMIC tested 324 directional cell-type pairs and identified one cell-type pair colocalization at the 5% FDR-significance level, NK cells → γδ T cells (Table 9.2, available as supplementary data at Bioinformatics online). This analysis shows that the workflow transfers to a second mIF TMA cohort with a different tissue context, comparison structure, and repeated-sampling design. 4 Discussion Spatial omics studies increasingly compare tissue organization across patients, tissue regions, and clinical conditions, but many analysis workflows still treat sample-level spatial summaries as error-free quantities. This can obscure the distinction between uncertainty within a tissue sample and biological heterogeneity across patients or samples. PANORAMIC addresses this gap by combining an interpretable local colocalization statistic, spatial bootstrap estimation of within-sample uncertainty, and multilevel random-effects meta-analysis. The resulting framework allows each tissue sample to contribute both an estimated spatial effect and an uncertainty estimate, while the cohort-level model accounts for heterogeneity across patients and repeated tissue regions. Three features of PANORAMIC are most important for interpretation. First, the default statistic used here, edge-corrected neighborhood enrichment, measures local deviation from expected cell-type composition around anchor cells. It should be interpreted as a local spatial enrichment statistic, not as proof of direct cell–cell interaction. Second, the spatial bootstrap estimates sample-specific uncertainty by resampling local tissue regions rather than individual cells. This preserves local spatial dependence and accounts for boundary truncation conditional on the supplied tissue region. Third, the multilevel meta-analysis propagates these sample-specific uncertainty estimates into group-level fixed effect estimates, differential tests, and heterogeneity estimates. Together, these components make PANORAMIC most useful when the scientific question concerns reproducible spatial organization across samples rather than cell-level associations within a single image. The simulation studies support two complementary conclusions. The first is a calibration conclusion: bootstrap-derived within-sample uncertainty estimates were strongly aligned with empirical variance in uniform and clustered local spatial regimes, but less strongly aligned when broad opposing gradients dominated the tissue architecture. This indicates that local tile resampling is informative for many neighborhood-scale spatial patterns, while also highlighting the need for tissue masks, region definitions, or stratified analyses when large-scale tissue compartments drive the signal. The second is a heterogeneity-estimation conclusion: PANORAMIC gave its clearest advantage over naive estimators for estimating patient-level heterogeneity, especially under contamination and sample-degradation scenarios. This distinction is important because the main value of PANORAMIC is not only generating an efficient point estimate of colocalization, but separating within-sample spatial uncertainty from between-patient variability. In the CRC TMA application, PANORAMIC identified differential colocalization patterns that distinguish CLR from DII tumors and are consistent with the known immune architecture of the dataset. B-cell enriched and B/T-cell colocalization patterns were stronger in CLR, consistent with organized lymphoid aggregate biology, whereas selected macrophage- and tumor-associated patterns were stronger in DII. The representative tissue cores and forest plots illustrate a practical benefit of PANORAMIC: the analysis reports group-level effects while retaining information about sample-level variability and uncertainty. The differential network and compactness analyses further suggest that the CLR-associated signal is not limited to isolated pairwise associations, but is consistent with broader coordinated immune/stromal organization. The supplementary benchmark analyses provide context for interpreting these findings. Comparisons with spicyR and Welch t-test baselines should not be interpreted as feature-identical comparisons because the methods use different spatial summaries and uncertainty models. However, under matched CRC analysis settings, PANORAMIC recovered a broader set of CLR-enriched B- and T-cell-associated signals and produced empirical distributions of P-values consistent with a mixture of null and strong alternative signals. These diagnostics do not prove formal false discovery rate control, but they support the empirical calibration and biological coherence of the CRC results. The HNSCC TMA analysis further demonstrates that the same workflow can be applied to a second mIF cohort with repeated tissue regions per patient, although we interpret that analysis primarily as a portability and nested-design demonstration rather than as a comprehensive biological study of metastatic lymph node remodeling. PANORAMIC has several limitations. First, while it propagates uncertainty for a chosen spatial statistic, it does not remove the need to select a biologically appropriate definition of colocalization. Different statistics capture different spatial features, and results should be interpreted relative to the statistic and radius used. Second, radius choice remains biologically important and affects the construction of tiles resampled in the spatial bootstrap. Multi-radius analyses can assess scale stability, but they cannot replace prior knowledge about the spatial scale of the biological process. Third, PANORAMIC depends on accurate cell-type annotations and tissue-window definitions. Highly irregular, perforated, necrotic, or compartmentalized tissues may require careful tissue masks or stratified analyses using pathologist-defined regions. Fourth, computational cost increases with the number of cell types, tested radii, bootstrap replicates, samples, and random-effects complexity. Finally, as with any meta-analytic approach, small effective sample sizes limit the precision of between-patient heterogeneity estimates even when within-sample uncertainty is modeled correctly. Despite these limitations, PANORAMIC provides a practical framework for cohort-level spatial colocalization analysis. By carrying forward both sample-level effects and uncertainty estimates, PANORAMIC supports pooled estimates, heterogeneity summaries, forest plots, differential tests, and differential colocalization networks that are more transparent than sample-level point estimates alone. Future work can extend this uncertainty-propagation principle to additional spatial summaries, covariate-adjusted meta-regression, and broader spatial omics settings, including spatial transcriptomic and multimodal workflows where cell types, cell states, or spatial domains can be represented as marked point patterns. Supplementary Material Contributor Information Jacob Chang, Department of Biomedical Data Science, Stanford University, CA 94305, United States. Almudena Espín Pérez, Department of Biomedical Data Science, Stanford University, CA 94305, United States. Perla Molina, Department of Biomedical Data Science, Stanford University, CA 94305, United States. Rohit Khurana, Department of Biomedical Data Science, Stanford University, CA 94305, United States. Weiruo Zhang, Department of Biomedical Data Science, Stanford University, CA 94305, United States. Lu Tian, Department of Biomedical Data Science, Stanford University, CA 94305, United States; Department of Statistics, Stanford University, CA 94305, United States. Sylvia K Plevritis, Department of Biomedical Data Science, Stanford University, CA 94305, United States; Department of Radiology, Stanford University, CA 94305, United States. Author contributions Jacob Chang (Conceptualization [equal], Data curation [lead], Formal analysis [lead], Investigation [lead], Methodology [lead], Software [lead], Validation [lead], Visualization [lead], Writing—original draft [equal], Writing—review & editing [equal]), Almudena Espín Pérez (Conceptualization [supporting], Methodology [supporting]), Perla Molina (Methodology [supporting]), Rohit Khurana (Conceptualization [supporting], Methodology [supporting]), Weiruo Zhang (Methodology [supporting]), Lu Tian (Conceptualization [equal], Investigation [supporting], Methodology [equal], Project administration [supporting], Supervision [equal], Validation [equal], Writing—original draft [supporting], Writing—review & editing [supporting]), and Sylvia K. Plevritis (Conceptualization [equal], Formal analysis [equal], Funding acquisition [lead], Investigation [equal], Methodology [equal], Project administration [lead], Resources [lead], Supervision [lead], Validation [equal], Writing—original draft [equal], Writing—review & editing [equal]) Supplementary material Supplementary material is available at Bioinformatics online. Conflicts of interest None declared. Funding Warren Alpert Scholarship in Computational Biology (314868), NCI U54CA274511, and NLM T15LM007033. Data availability The colorectal cancer tissue microarray data analyzed in this study were previously published by Schürch et al. (2020). The released single-cell CODEX data and associated metadata are available from the original data repository (https://data.mendeley.com/datasets/mpjzbtfgfr/1). The head and neck squamous cell carcinoma tissue microarray data analyzed in the supplementary application were previously published by Haist et al. (2026) and are available through the data resources associated with that publication (https://data.mendeley.com/datasets/t4k5kj3cxr/1). No new experimental data were generated for this study. Code availability The PANORAMIC framework is released as an open-source R package at https://bioconductor.org/packages/devel/bioc/html/panoramic.html and archived on Zenodo with DOI: 10.5281/zenodo.19927197. All scripts used to preprocess data, run simulations, conduct the CRC and HNSCC analyses, perform benchmarking, and generate manuscript figures are available at https://github.com/chang-jacob/panoramic-paper. The analysis repository includes the code needed to reproduce the results from the publicly available input datasets. References Associated Data Supplementary Materials Data Availability Statement The colorectal cancer tissue microarray data analyzed in this study were previously published by Schürch et al. (2020). The released single-cell CODEX data and associated metadata are available from the original data repository (https://data.mendeley.com/datasets/mpjzbtfgfr/1). The head and neck squamous cell carcinoma tissue microarray data analyzed in the supplementary application were previously published by Haist et al. (2026) and are available through the data resources associated with that publication (https://data.mendeley.com/datasets/t4k5kj3cxr/1). No new experimental data were generated for this study.