Skip to main content
Computational and Structural Biotechnology Journal logoLink to Computational and Structural Biotechnology Journal
. 2025 Nov 28;27:5537–5548. doi: 10.1016/j.csbj.2025.11.062

Immune and non-immune cell fencing of tumor cells is a widespread and functionally relevant spatial pattern in solid cancers

Giuseppe Giuliani a,b, Dhruv Chavan b, Rushil Gaddam b, William C Stewart c, Zihai Li e,f, Ciriyam Jayaprakash a, Jayajit Das b,d,e,⁎
PMCID: PMC12722985  PMID: 41446806

Abstract

Solid tumors are characterized by a spatially heterogeneous mixture of cancer cells, immune cells and other non-tumor cells. Recent characterization of the heterogeneity at the single cell level has revealed spatial patterns of different cell types often lacking a simple geometric structure associated with cancer progression. Here we investigated the occurrence of physical “fencing” of tumor cells by specific immune and non-immune phenotypes in the tumor microenvironment (TME) and the association of these clusters to cancer progression in a wide range of solid tumors formed in different organs. We analyzed published datasets providing patient tumor progression data coupled with imaging mass cytometry (IMC) data obtained from tumor tissues to characterize the presence of fencing clusters of various cell types and their association with differing patient outcomes. The six datasets spanned patients with triple-negative breast cancer (279 patients), lung cancer (416 patients), melanoma (30 patients), colorectal cancer (9 patients), glioma (185 patients), and head and neck cancer (139 patients). Devising and employing simple mechanistic and stochastic spatially-resolved computational models we examine two potential mechanistic hypotheses regarding the pro- and anti-tumor roles of a fencing cluster via physical blocking and chemokine gradient in the local environment, respectively. The fencing structures formed by non-tumor cells in the TME can be important for connecting microscopic cellular patterns to tumor progression and treatment responsiveness to immunotherapy in solid cancers.

Keywords: Spatial mechanisms, Multi-cancer analysis, Solid cancers

Graphical Abstract

graphic file with name ga1.jpg

1. Introduction

A tumor is a spatially heterogeneous tissue composed of tumor cells, various immune cells, connective tissues, blood and lymphatic vessels, and extracellular materials like collagen. Spatial profiling of solid tumors using proteomics and transcriptomics experiments show wide variations of spatial co-organization of tumor and immune cells across length scales of 10μm to over several millimeters spanning the entire tumor [8]. Although our understanding of tumor spatial heterogeneity and its impact on progression is still emerging [8], [9], [1] several recurrent features have been linked to clinical outcomes. Tertiary lymphoid structures (TLS), where T and B cells co-cluster over 50–200 μm, occur in many solid cancers such as breast, lung, and skin and are associated with favorable prognosis [10]. Similarly, an ‘inflamed’ immunophenotype, characterized by lymphocyte infiltration into the tumor rather than accumulation at the boundary (‘excluded’ phenotype), correlates with improved responses to immunotherapy [10]. These spatial features may serve as spatial biomarkers in some cancers. However, their mechanistic roles in tumor growth and patient prognosis remain poorly characterized.

Computational models such as agent-based models (ABMs) aim to causally connect specific spatial organizations of tumor and immune cells in the TME to tumor growth [1], [11], [12]. In ABMs agents describe individual components of the tumor microenvironment (TME) such as tumor and immune cells which interact via specific rules and evolve the system with time. Our agent-based modeling of IMC data obtained from melanoma patients, TMAs of areas ≤ 1 mm2 showed ‘fencing’ of tumor cells by exhausted CD8+ T or Tex cells in our model simulations [1]. This fencing was also observed in single cell CyCIF imaging of melanoma tumors in patients [13], [14]. In the fencing pattern, tumor cells are surrounded by clusters of Tex cells. The Tex cells potentially generate a physical barrier for immune cells such as cytotoxic CD8+ T cells that can lyse the tumor thus playing a pro-tumor role. The fences composed of cells are unlike barriers such as those generated by the extracellular matrix (ECM) because these may actively interact and respond to cells and extracellular small molecules (e.g., chemokines) in the TME. Thus, fencing of tumor cells by immune and non-immune cells could play variable functional roles depending on the cell phenotype and the other constituents of the TME.

Motivated by the presence of fencing of tumor cells by Tex cells in our ABM and melanoma tissues in patients, we investigated if fencing of tumor cells by different immune cells occurs in different solid cancers and if it is associated with survival or patient response to immunotherapy. We analyzed published IMC datasets of TMAs obtained from six different solid cancers (skin, colorectal, lung, brain, breast, and head and neck) to determine the presence of fencing structures composed of different immune and non-immune cells and then evaluated their association with patient response and survival. We observed with statistical significance that fences composed of immune cells such as T, myeloid and NK cells, and non-immune cells such as fibroblasts are present in the solid tumors examined here. In addition, for several cancers, we found statistically significant associations of such fencing structures with functional outcomes in patients such as response to immune checkpoint therapy and survival. Finally, we used a spatially-resolved mechanistic ABM to assess the functional impact of fence formation and simple in silico mechanistic models to test potential pro- and anti-tumor roles of fencing structures via physical blockade and chemokine-driven immune cell attraction at the tumor–immune boundary.

2. Results

2.1. Fencing of tumor cells by immune and non-immune cells is observed in solid tumors of various organs

We investigated the existence of fencing structures formed by non-tumor cells in the tumor microenvironment in the following way. We represented the single cells in the IMC dataset as nodes of a graph where we connected a pair of single cells (or nodes) by an edge if the spatial distance between the pair ≤rc=30μm. We defined a spatial cell cluster as a group of ≥NF(=3) number of immune or non-immune cells of the same phenotype (e.g. CD8+ T cell) connected by a continuous path of edges (Fig. 1a). The sensitivity analysis of the above chosen values of rc and NF have been described in the Materials and Methods section and the supplementary material (Table S2). A fencing cluster is then a spatial cluster in which at least one of the (non-tumor) cells has an edge connecting it with a tumor cell.

Fig. 1.

Fig. 1

Fencing of tumor cells by immune and non-immune cells is found in solid tumors of various organs. (a) A schematic displaying a fencing cluster composed of CD8+ T cells on the tumor periphery. The positions of the cell nucleus’s centroids are provided in the patient slide data. Two cells are in contact if their centroids are within 30μm of each other and are connected by black edges. When at least three cell nodes corresponding to cells of the same phenotype are connected by a continuous path of edges, they form a cluster. If at least one of the cells in a cluster is in contact with at least one cancer cell, the cluster (not including the cancer cell) is a fencing cluster. (b) A schematic displaying how non-cancer cells are permuted to build new randomized configurations of a patient slide. Two possible individual permutations are denoted with reciprocal arrows. Applying the permutation on the right (left), we form the top (bottom) new distribution. We can generate randomized configurations, as discussed in 1 of Results, using such permutations. (c) The number of cancer patients from which IMC slides were produced of their tumor for each solid cancer type. Clockwise, the cancer types are lung (adenocarcinoma), triple negative breast cancer (TNBC), colorectal cancer, head and neck cancer (HNC), melanoma, and brain cancer (glioma and brain metastases) (d) Snapshots of the TME generated from IMC data from patients with fencing of three different cell phenotypes in three different solid cancer types: M1-like monocyte-derived macrophages (MDMs) in a metastasis to the brain, CD4+ T cells in lung cancer and CD79a+ plasma cells in triple-negative breast cancer (TNBC). Each slide displays points representing the centroid of each cell in the system. The purples cells (points) are other non-cancer cells which are not the same phenotype as the fencing cells in that slide. The white boxes outline one region in each slide where the chosen cell phenotype forms fencing clusters on the boundary of the cancer cells. (e) A table showing the fraction of slides which display fencing significantly more than random for each non-cancer cell phenotype in each cancer dataset. Each box falls within a column designating a general cell grouping (e.g., CD8+ T, APC) and a row designating the solid cancer type. Within each tumor type and cell group combination, there may be 0 (white spaces with no box outline) or more cell types depending on the dataset. Each subregion of a box represents an individual cell phenotype within the cell group. The shade of the subregion, in reference to the color bar (right), demarks the percentage of slides which display significant (controlled at p < 0.05) fencing of that specific cell phenotype. Boxes with more than one cell phenotype have numbers which may be used as reference when reading table S1, which explicitly states each cell phenotype and the corresponding percentage of slides which display statistically significant fencing. Tregs (in positions 2, 2, 3, 2, and 3 in lung, brain, melanoma, colorectal and breast cancers respectively) only form fencing clusters very rarely except for in colorectal cancer. See subsection 1 of Results for a more detailed discussion.

We analyzed IMC datasets obtained from TMAs for a wide variety of solid cancers (Fig. 1c) to determine how often different cell types give rise to fencing clusters across patients in a statistically significant manner. The datasets considered span triple-negative breast cancer (TNBC) [4], lung adenocarcinoma cancer [2], melanoma [5], colorectal cancer (CRC) [6], glioma (primary glioma and brain metastases) [3] and head and neck cancer (HNC) [7] (Fig. 1c). For each solid cancer, we analyzed IMC data yielded from patient TME slides to identify fencing clusters for a variety of immune and non-immune cells (Fig. 1d). To determine if these clusters could have occurred by chance we proceeded as follows. For each cell phenotype g (e.g., CD8 + T cell), we calculated the probability that the g-cell fencing clusters found in the data could occur in a random spatial distribution of all the non-tumor cells (including g-cells) present in the TMA. To do this, we generated an ensemble of spatial configurations by randomly exchanging the cell phenotype of all g-cells with any of the other non-tumor single cells (including other g-cells).

The permuted configuration preserves the spatial structure of the tumor cells and non-tumor cells but randomly shuffles the positions of all individual g-cells (a subset of which form fencing clusters) into the population of non-tumor cells. This can lead to fragmentation, dissolution, or enlargement of the original fencing clusters (Fig. 1b). We generated over 1000 permuted configurations for each TMA slide and evaluated the probability of there being at least as many g-cells observed in fencing clusters in the original configuration given the spatial distribution of the non-tumor and tumor cells in the original slide. This probability is a p-value for the occurrence of the observed fencing clusters in each slide (see Materials and Methods for details). We control for a p-value ≤ 0.05 to determine if a patient slide contains fencing clusters formed by a cell phenotype g. We finally obtain the fraction or frequency of occurrence, fp, of the patient slides in which the fencing clusters of cell phenotype g occur significantly.

We aggregated the frequencies of occurrence for fencing clusters composed of various individual cell types across the different cancers (Fig. 1e, Table S1). Among immune cells, we find CD8+ and CD4+ T cells and different subtypes of the T cells, such as regulatory CD4 + T cells (CD4+ FOXP3+), activated (CD8+GZMB+) and exhausted (CD8+ PD1+) CD8+ T cells do occasionally form fencing structures in all the solid tumors investigated. Almost all the patient slides in melanoma, HNC, and colorectal cancers show fencing clusters formed by CD8+ or CD4+ T cells and their subtypes. The TMAs for the lung, glioma, and the breast cancers show a lower occurrence frequency of T cell (CD4+/CD8+, not Tregs) fencing with < 70 % patients as compared to melanoma, HNC and CRC. In lung cancer, glioma, HNC, and CRC patients, fencing of CD4+ T cells (not including Tregs) occurred more often than CD8+ T cell fencing. Regulatory T cell (Treg) fencing clusters are less likely to form fencing clusters as Treg fencing clusters are only found in ≤25% of patients with the exception of in CRC. The lymphocyte B cells gave rise to fencing clusters in a large fraction (≥75 %) of the patients for the lung cancer, melanoma, HNC, and CRC, and in a smaller fraction (<48 %) patients for glioma and TNBC. NK cells were the least likely to give rise to fencing clusters, present only in a small fraction of patients (<26 %) in lung and TNBC.

2.2. Fencing of tumor cells by immune and non-immune cells is associated with patient response

We investigated if increased participation of a non-tumor cell type in fencing clusters is associated with patient clinical outcomes such as response to cancer therapy, patient survival or cancer progression. We made use of both the IMC data (Fig. 1c,d) from individual patients as well as their corresponding clinical outcomes and Kaplan-Meier survival data. The cancer therapies applied to these patients included immune checkpoint blockage (ICB) therapy, chemotherapy, and combinations of chemotherapy and ICB therapy. In brain cancer, we investigated if the increased participation of non-tumor cells in the fencing clusters is associated with the origin of the tumor, namely primary origin (e.g., glioblastoma) or brain metastasis. We quantified the increased participation of non-tumor cells in fencing clusters in the following way.

The fencing participation metric is constructed to capture the propensity of g-cells to occur in fencing clusters in a patient slide as compared to when the cells in the patient slide are permuted randomly. The fencing participation metric (FPM) is defined by FPM=fd−<fr>fd where the numerator is the difference between the number of g-cells in fencing structures in a patient slide, fd, and the ensemble average number of g-cells in fencing structures across the randomized cell configurations of the slide or <fr>. The normalization by fd is chosen so that the metric is one when a patient shows g-cell fencing structures, but the randomized slides show no g-cells in fencing structures. It decreases to zero when the average number of g-cells in the fencing structures in the randomized slides increases to the be the same or a larger than the number found in the original patient slide. The FPM is defined to first capture whether there is fencing or not. If there is fencing, it reports the degree to which it exceeds what is expected in a random distribution. When more cells are found in the fencing structures in the random distribution of non-cancer cells as compared to the original slide, the FPM is negative. Since, our focus here is not the degree to which cells do not show fencing, we mapped these cases to the single value of zero. This does not capture fence avoidance as we would like to focus on to what extent a fence occurs, when it does, as compared to random occurrence. We evaluate the FPM for each fencing cell phenotype g for each patient slide with at least 50 g-cells and 50 cancer cells. Comparing the distributions of the FPM between patient clinical outcomes, such as response or no response to therapy, yields significant relationships between the FPM and patient tumor progression (See Materials and Methods for more details). As the FPM of a given cell type depends on the spatial distribution of cells in the TME, it innately has a dependence on that cell’s density. We checked that the correlations that the FPM has with patient clinical outcome are not solely due to its dependencies on cell densities rather than more complex spatial relationships. We confirmed that the FPM not only provides additional information about patient clinical outcome as compared to cell densities but can have a stronger correlation with patient clinical outcome than cell densities (See Materials and Methods for more details). We also performed a comparison of the FPM to a more common spatial analysis tool in cancer, Ripley’s K function [15], [16], and found that the FPM is uniquely equipped to evaluate fencing as compared to Ripley’s K functions (See Materials and Methods for more details).

We compared the distributions of the FPM evaluated across the patient slides for various cell types between patient clinical outcomes to find statistically significant differences. In HNC, the average FPM values for adaptive lymphocytes such as CD8+ or CD4+ T cells, and B cells, and myeloid cells such as macrophages and granulocytes show higher magnitudes in responders to therapy compared to non-responders (Fig. 2a). Using a similar comparison, we found increased participation in fencing clusters by non-immune cells, such as fibroblasts and cells forming lymph vessels, is associated with responders as opposed to non-responders to therapy. Next, we compared the association of the survival of the patients with FPM for the immune and non-immune cells. We found increased values of FPM are associated with improved survival in the HNC patients (Fig. 2d-f). In TNBC, responders to therapy exhibit lower average FPMs for GZMB+CD8 + T cell, PD1+CD4+ T cell, Treg, CD79a+ plasma cell, PDL1+ APC and myofibroblast (Fig. 2b). In contrast, the average FPM for TCF1+CD4+ T cells and neutrophils in responder slides are larger as compared to non-responders to therapy. This points to different types fences mechanistically playing pro- or anti-tumor roles depending on which cell phenotypes compose them. We will investigate possible mechanisms with which fencing structures can induce pro- and anti- tumoral effects in the next section. In brain cancer, we found that the average FPM of CD4+ T cells, M1-like monocyte-derived macrophages (MDM) and other (not CD8 + or CD4+) T cells is higher in primary gliomas as compared to in brain metastases. The opposite is true for non-classical (non-cl.) monocytes and M1-like microglia (Fig. 2c). Patients with lower endothelial cell FPM are associated with improved survival (Fig. 2g). We found no statistically significant associations (p ≤ 0.05) of the FPM with patient response to therapy, tumor progression, or survival in lung cancer, melanoma, and colorectal cancers. The melanoma and colorectal cancer datasets had a small number of patients (30 and 9 respectively), which could contribute to the absence of any statistically significant association with the patient response or metastatic status. In summary, these correlations imply that the formation of fencing structures from various cell types could influence tumor progression. Next, we consider theoretical models to elucidate possible effects of fencing on the progression of the TME.

Fig. 2.

Fig. 2

Fences formed by immune and non-immune cells are associated with patient responses. We compared the distributions of the fencing participation metric of any given cell type between responders (R) and non-responders (NR) to therapy for (a) HNC, (b) TNBC, and between metastatic tumors (M) to primary gliomas (P) for (c) brain cancer. In particular, we display the average fencing participation metrics (shaded with reference to scale bars) across responses for cell types whose average fencing participation metrics were found to differ significantly (p < 0.05). Note that each cancer type has its own scale bar. In HNC, responders showed an increased average fencing participation across many cell types. In TNBC, we particularly found that a higher average fencing participation metric of TCF1 + CD4 + T cells in responders. We also observed that non-responders have a higher average PDL1 + APC fencing participation metric than responders. Finally in brain cancer, we observed that primary gliomas have higher CD4 + T cell and M1-like MDM fencing participation metrics on average than in brain metastases. (d-f) For HNC, we found that the survival curves of patients with high (above average) and low (below average) fencing participation metric calculated for certain cell types differ significantly (using the log-rank test, p < 0.05). Here we showed the survival curves for those cell types, the p-values separating the curves and the number of patients which contribute to each curve. Higher FPM across all of these cell type corresponds to better survival outcomes. (g) In primary glioma, the survival curves of patients with high (above average) and low (below average) endothelial cell fencing participation metric differ significantly. Patients with a lower endothelial cell FPM are associated with better survival.

In this section, we found that fences composed of specific cell phenotypes are present in different solid tumors and may be associated with different clinical outcomes such as response to therapy. However, the underlying mechanisms remain unknown. In the next section, we employ minimal spatially resolved mechanistic models to quantitatively investigate two potential specific pro- and anti-tumor roles of fencing clusters.

2.3. Fencing of tumor cells by immune and non-immune cells could positively or negatively impact tumor progression

Given the experimental evidence for fences of different phenotypes being associated with differing clinical outcomes (e.g. response and non-response to therapy) in certain cancers, in this section we investigate two simple computational models that illustrate pro- and anti-tumor effects of fencing quantitatively. Due to the lack of detailed, dynamical, in vivo data, we built and studied simple computational models to uncover how fencing clusters affect the progression of the TME.

We employed a stochastic agent-based model (ABM), interacting cell system (ICS) model, that we developed previously in the context of melanoma [1] to test the whether fences have an effect on the cancer cell population. The ICS model simulates stochastic time evolution of immune and tumor cells in the TMA that have been studied by IMC by modeling cell motility, cancer proliferation and cell-cell interactions such as activated CD8+ T cell exhaustion, cancer lysis and activated CD8+ T cell proliferation (Fig. 3a) (See Materials and Methods for more details).

Fig. 3.

Fig. 3

A stochastic ABM for melanoma characterizes the pro-tumor role of fencing. (a) The ABM consists of activated CD8 + T cells, non-tumor cells in the implanted fences, tumor associated macrophages (TAMs) and cancer cells interacting on a lattice (top left). The cells are initially positioned (except the fences) as they are found in patient data. The activated CD8 + T cells and TAMs move on the lattice but their movement is spatially restricted by the other cells on the lattice (including the cells constituting the fences). Cancer cells and activated CD8 + T cells proliferate. Some of the cell-cell interactions include cancer cell lysis and activated CD8 + T cell exhaustion by either cancer cells or TAMs. When activated CD8 + T cells are exhausted, they are removed from the system. (b) The original slide 06RD corresponding to a patient with melanoma who responded to ICI therapy. (c) The same patient slide with implanted fences of comparable size and density as those found in our analysis of TNBC. (d) Cancer cell population trajectories through time (2.5 days) when simulating the progression of the slides with (c) and without (b) the added fences with the modified ICS model (Results 3). Each initial condition is simulated 300 times. Here we plot a subset of the trajectories (100/300) in the interest of clarity as well as their ensemble average trajectories. As the model is stochastic, there is variation in the outcome for each trajectory. The final ensemble average cancer cell population for the system with the fences is 7 % larger than that for the original slide.

We studied the effect of fixed, impenetrable fences, roughly matching the average size (∼50μm diameter) and density of non-cytotoxic fences (20mm−2) found across the datasets, implanted into a patient slide by hand (Fig. 3b-c). The fence is composed of non-specific and inactive cells which only interact with other cells through spatial exclusion. We created this fence to test is to evaluate if fences formed in a TME might affect tumor progression solely due to spatial exclusion. We first modified our earlier ICS model by removing exhausted CD8 + T cells to aid in the interpretation of results by avoiding the confounding effects of fences formed dynamically by Tex cells (as shown in the earlier referenced work). Two cases were studied to investigate the effect of the fence: (1) the control, where the initial configuration of cells are obtained from an IMC slide corresponding to a responder patient to immunotherapy and (2) the fence alternative, where we modified the IMC slide from case #1 by implanting fences of non-tumor cells as described above.

As our model includes stochastic fluctuations in the processes considered, the kinetics of the tumor and non-tumor cells vary across different simulation runs even when started from the same initial configuration of cells. Therefore, to obtain the mean kinetics of the tumor and non-tumor populations, we average the populations across 300 simulation runs. The progression of average tumor and non-tumor cells over 2.5 days in the control and fence alternative were compared (Fig. 3d). We found the average of the cancer cell population at 2.5 days is 7 % higher than that of the control case. The reduction of the access of activated CD8+ T cell to cancer cells due to the implanted fences resulted in an increase in cancer cell population growth.

To further clarify the effect of a fencing clusters in reducing the access of motile immune cells to cancer cells, we constructed a minimal two-dimensional spatially-resolved diffusion model (Fig. 4a) which can be analyzed analytically or numerically. The minimal model considers a two-dimensional grid where a linear fence formed by a specific phenotype of immobile non-tumor cells resides on the tumor boundary represented by the bottom edge of the two-dimensional grid (Fig. 4a) A different type of non-tumor cell which is motile is initially placed in the two-dimensional region. The motile non-tumor cell moves diffusively in the region. Once the motile cell reaches the tumor boundary it is taken out of the model, i.e., we impose an absorbing boundary condition. The fence acts as a barrier reflecting the diffusing cell thus blocking access to the tumor boundary. In order to isolate the effect of the fence on the accessibility of the cancer to non-tumor cells, we ignored cell proliferation and lysis in the model. Since the movement of the motile cell is stochastic in nature, the time the cell spends to access the tumor boundary starting from the same initial position can vary for different realizations of the kinetics. To quantify the effect of the fence in hindering the access of the motile cell to the tumor boundary, we computed the distribution of the time the motile non-tumor cell spends before reaching the tumor boundary across many realizations of the kinetics. This time distribution is also known as a first-passage time (FPT) distribution in probability theory. We found that, when a fixed fence is introduced, the FPT distribution becomes substantially broader compared to when the fence is absent, increasing the average time the motile cell takes to reach the tumor boundary (Fig. 4b). This broadening is partly brought about by the change in distance between the initial position and the closest accessible portion of the tumor boundary (Fig. 4b). However, the above FPT distribution depends on the initial position of the motile cell, the total time duration T over which the kinetics are studied, and the length of the fence. These variables are also relevant in the TME, as the motile cell (e.g., CD8 + T cell) can start in different positions, the size of the fence can vary, and fence might dissociate after a finite time τfence. To account for the above dependencies, we average over the kinetics of motile non-tumor cells starting from positions throughout the system (Fig. 4a). We defined the tumor access ratio as the ratio comparing the number of the diffusing cells which reach the tumor boundary within a time duration T when a fence of length b is present to those that reach the tumor boundary when the fence absent, i.e.,

Rb(T)=#cellsthathittumorboundarywithfencewithinT#cellsthathittumorboundarywithoutfencewithinT

Fig. 4.

Fig. 4

Stochastic and spatial minimal models quantify anti- and pro- tumor roles of fencing. (a) The initial spatial distribution of the simple model with periodic boundary conditions along the horizontal direction described in Materials and Methods. The green pixels represent the tumor boundary, the pink pixels represent starting positions, and the red pixels represent the cells in a fence of length 90μm fence in a system of width 230μm(b) The first-passage time (FPT) distributions generated by 5000 simulations of the simple cell diffusion model (Results subsection 3) from a single point to the tumor boundary with (red) and without (teal) a fence. The initial point is directly above (two lattice spacings away) or20μm and centered on the fence. The green line corresponds to the analytic solution for the FPT distribution of the system without a fence. When a cell is centered directly above a fence, it has lower probability of reaching the tumor boundary in a given time T, and it takes longer on average to reach the boundary. (c) Plot of tumor access ratio for different fence lengths at various times. Dots correspond to tumor access ratio, RbT, calculated from simulations of the simple fence model. The ratio decreases from 1 (full access) with no fence to 0 (no access) when the fence covers the entire tumor boundary. The black curve is the tumor access ratio calculated for T = 2.5 days for multiple fence lengths as described in (d). (d) The number of cell trajectories which reach the tumor boundary within T after reflecting off the fence at least once (red) is obtained from the simulation. The number of trajectories which reach the boundary directly (green) is calculated analytically (see text). The black curve in (c) is obtained by adding the contributions of these two types of trajectories. (e) The simulation box with an added chemokine gradient. Starting positions (not shown) are identical to those in (a). (f) The tumor access ratio calculated using the simple chemotaxis model plotted for varying fence length and time periods for the fence which induces cell chemotaxis. Cells in the region y≤40μm (see (e)) drift towards the tumor boundary at a constant speed determined by the length of the fence. Outside this region, the cells diffuse. The tumor access ratio is unity with no fence as there is no chemotaxis with no fence present. With increasing fence length, as chemotaxis drift rates increase, the metric first increases but then decreases as the fence begins to cover more of the boundary decreasing physical access.

A tumor access ratio of unity implies the fence does not affect the tumor access and the ratio is reduced as the fence increasingly hinders the access of the motile non-tumor cells to tumor cells. We computed the ratio using analytical calculations and stochastic simulations (see Materials and Methods). Our calculations showed that for a fixed fence of length of 70μm, which is a common fence length found in the IMC data, motile cell access to the tumor is reduced by over 10 % over 2.5 days (Fig. 4c). In the ABM described earlier (Fig. 3), the motile cells are cytotoxic CD8 + T cells. The 10 % decrease in the tumor access ratio in the simple diffusive model due to fencing is comparable to the average 7 % increase in the average cancer cell population in the larger ABM. The tumor access ratio also depends on the simulation time, T. The fence remains fixed during the simulation, thus different values of T probe the effects of fences with different lifetimes τfence ≈ T. We evaluate Rb(T) for a range of T up to the typical timescale over which a tumor cell replicates once (∼2.5 days).

The full fencing metric is shown in Fig. 4c. Rb(T) is close to 1 when b < < L and goes to zero as b approaches L. We find that, as T is reduced from 2.5 days, the tumor access ratio collapses onto a diagonal line displaying a linear relationship between the fence length and the tumor access ratio (Fig. 4c). We can explain this as follows: each diffusing cell generates a trajectory through the lattice in time and each of these cell trajectories can be separated into three groups. One subset consisting of Nnr trajectories that never reflect off the fence but reach the tumor boundary in T, another subset of Nr trajectories that reflect off the fence of length b at least once before reaching the tumor boundary within T, and the remainder of the trajectories that never reach the tumor boundary (Fig. 4d). The tumor access ratio is given by RbT=Nnr+NrNnf where Nnf is the number of cells that reach the tumor boundary when there is no fence. The first term, NnrNnf, can be calculated analytically and is given by L−bL. This corresponds to the linear dependence in Fig. 4c. We compute the second term in RbT, NrNnf, numerically as explained in the Materials and Methods which leads to the full expression of RbT seen in Fig. 4c. When T is small, it is less likely for trajectories to reflect off the fence and subsequently reach the tumor boundary within T; i.e., Nr≪Nnr and RbT becomes linearly dependent on b.

The full nonlinear dependence of RbT on the fence length arises from the trajectories that reflect off the fence at least once then reach the tumor boundary. To uncover how fences affect the tumor access ratio further, we investigated how cells which reflect off of the fence contribute to the FPT distribution of the cells averaged over all the initial positions used to calculate RbT. For a 90μm fence, the cells which never reflect off the fence but reach the tumor boundary with T=2.5 days, Nnr, represent 69 % of all trajectories which reach the tumor boundary with T. The other 31 % of trajectories which contribute to the FPT reflect off the fence at least once. Generally, the higher the number of reflections off of the fence the smaller the number of cells which reach the tumor boundary after that number of reflections. In fact, we found that the fraction of all trajectories which reach the tumor boundary within time T which reflect off of the fence n times decreases exponentially with n.

The fence structures found in the IMC data are often not linear in nature. In general, they form chains of irregular shapes and the uneven geometry may have an appreciable effect on tumor access. To evaluate this effect, we constructed models each with “hairy” fences of different lengths. To generate a hairy fence of a certain length in the minimal context, we would take a linear fence structure and randomly choose half of the cells in the fence and push them up, orthogonally to the tumor boundary, by one pixel (10μm). We simulated the cytotoxic immune cell diffusion and calculated the tumor access ratio with a similar approach with the linear fences. We found the tumor access ratio with hairy fences is generally slightly reduced as compared to linear fences, especially at longer times (Figure S2).

In this section, we have presented a quantitative characterization of the access of cytotoxic cells to cancer cells that determines the immune response for different values of the fence length and different durations in simple geometries.

Next we investigated how, in some cases, fencing clusters can increase immune control of cancer cells in the TME. In our analysis we found that responders to therapy have on average greater formation of fencing clusters by TCF1+CD4 + T cells and CD4+ T cells in TNBC and HNC respectively (Fig. 2a,b). As some immune cells such as CD4+ T cells can recruit cytotoxic immune cells using chemokines, fences formed by these cells may enhance immune response. They could introduce a gradient of chemokines such as CCL3/4 and attract cytotoxic immune cells toward the tumor boundary [17]. To investigate this, we calculated the increase of the tumor access ratio with the addition of cytotoxic cell chemotaxis to the simple diffusion model from earlier.

To do this, we first modified our original simplified fencing model adding a region in which the cytotoxic cell executes biased diffusion toward the tumor boundary as a simple method to account for chemotaxis (Fig. 4e). The constant chemotactic drift rate of the motile cell increases with the fence length. This means that as the fence increases in size, the motile cell’s access to the tumor boundary is augmented with an increased drift rate but is diminished by the physical blockage of the tumor boundary. We calculate the tumor access ratio comparing the system with the fence generating chemotaxis to a system with no fence and therefore no chemotaxis (Fig. 4f). With no chemotactic fence in place, the tumor access ratio is 1. As the fence is added and increases in length, the ratio first increases due to the effect of the drift. Ultimately, the ratio must decrease to 0 as the fence length spans the entirety of the system width. With the addition of chemotaxis-inducing fences, with T=12h, the tumor access ratio reaches roughly 2 demonstrating an increase in cytotoxic cell access to the tumor boundary. This describes a mechanism by which tumor fencing benefits immune access and response in the TME.

3. Discussion

The TMEs in solid tumors shows spatially heterogeneous organization of tumor and non-tumor cells. Spatial patterns of tumor and non-tumor cells in the TME that persist across patients and regulate tumor progression have been being widely investigated at the single cell level. Here, instead of pursuing a data driven discovery of spatial patterns associated with patient prognosis [2], [3], [4], we focused on investigating the presence of a spatial pattern with simple geometric structure described by the fencing of tumor cells by diverse non-tumor (immune and non-immune) cells in the TME which could mechanistically regulate tumor growth with clear underlying potential mechanisms. We found the statistically significant occurrence of fencing clusters formed by a variety of immune cells such as CD4+ /CD8+ T cell subtypes, B cells, NK cells, macrophages, granulocytes, and non-immune cells such as fibroblasts in the TME of lung, HNC, breast, brain, skin, and colorectal cancers. The frequency of occurrence of the fences depended on the cell type and the cancer type. For example, B cells formed fencing structures in over 75 % of the 416 lung cancer patients whereas Tregs formed fences in < 20 % of the patients in the same cohort. Given the common presence of fencing structures across solid tumors it is possible that these structures, at the tumor-immune boundaries, arise due to some common interplay between tumor and non-tumor cells in the TME. The local environment at the tumor-immune boundary could support increased proliferation of immune and non-immune cells (e.g., fibroblasts) which could potentially give rise to fencing clusters of the non-tumor cells. Previous investigations have shown that tumor cells are more transcriptionally active and there is increased localized production of IFNγ at the tumor immune boundary [18]. Fencing clusters could also be generated through chemotactic aggregation as has been shown in ex vivo tumoroid models. Naïve CD8+ T cells which reach a tumoroid target chemotactically attract more CD8+ T cells in a feedback loop generating clusters of CD8+ T cells on the tumoroid boundary [19]. We investigated association of fencing structures with patient response and survival by developing a fencing participation metric, FPM. The FPM quantifies the participation of specific phenotypes of non-tumor cells to the fencing structures, i.e., the larger the value of FPM, the greater the fraction of the total number of a non-tumor cell type participates in forming the fencing structures. The FPM was constructed to specifically measure fencing and may appear to be contradictory with results found with different spatial metrics. We compared the FPM to Ripley’s K function and showed that the FPM encapsulates quantitative information about fencing structures that are not included in other measures. Note that a high FPM of some cell phenotype does not suggest that there is elevated contact between cells of that phenotype and cancer cells as the definition of a fencing cluster only requires contact of the cluster with a single cancer cell. Hence, an elevated FPM of cytotoxic CD8+ T cells does not imply elevated killing of cancer cells. The FPM for several non-tumor cell types showed statistically significant differences across patients responding or not responding to therapy. In TNBC, we found that non-responders to therapy (chemotherapy or ICI+chemotherapy) have on average a higher value of FPM for fences formed by GzMB+CD8+ T cells. This is in agreement with Hammerl et al. [10] who found that greater penetration of effector T cells to the deep tumor as opposed to building up on the tumor boundary (fences) indicated better prognosis. Wang et al. [4] analyzed the same dataset using a metric they defined, cell-cell interaction metrics, and found that the number of cancer cells in contact with the average GzMB+CD8 + T cell is higher in responders as compared to non-responders to therapy. This may be explained by singlets and doublets of GZMB+CD8+ T cells in contact with cancer cells which do not contribute to the FPM. For HNC, we found that higher values of FPM for CD8+ T cells, macrophages, and lymph vessels are associated with responders and increased survival. The formation of fencing structures could lead to an enhanced immune response on the tumor immune boundary. For instance, non-tumor cells in fencing structures could generate chemokines or cytokines at the tumor boundary. We also found that increased FPM for M1-like microglia and non-classical monocytes in brain metastasis than primary brain tumors (glioma). There were several cancers where the FPM did not correspond to any statistically significant differences in patient outcomes. In lung cancer (lung adenocarcinoma), the FPM for B cells did not show any difference between responders and non-responders, whereas Sorin et al. [2], using the same dataset showed increased B cells in the cellular neighborhood is associated with greater survival. However, Sorin et al. [2] also found in lung cancer, in agreement with our results, that cellular neighborhoods at the tumor boundaries, where fences are likely to form, are not associated with patient survival in a statistically significant manner. Therefore, in a range of solid cancers the spatial statistics of non-tumor cells (e.g., fencing structures) in physical contact with tumor cells appear to be relevant for tumor progression and patient prognosis. The fencing structures formed by non-tumor cells can be useful for analyzing spatial data for solid cancers.

Finally, we theoretically explored the dynamics of fencing and its effects on tumor progression. Using an ABM we developed previously to describe ICI response in melanoma patients [1], we showed that the average cancer cell population growth is increased by the presence of fixed fences due to reduced access of cytotoxic cells to cancer cells. We characterized this mechanism with a simple computational model which displayed that cytotoxic cell access to cancer cells is decreased by fences. Such a variation in cytotoxic cell access may play a role in the progression of patient TME which leads to response or non-response to therapy. We also constructed a simple computational model including chemotaxis to explore possible mechanisms by which fencing structure may benefit cytotoxic cell tumor access. This simple model showed that cytotoxic cell access to cancer cells may be augmented by chemotaxis driven by cells in a fencing structure. We have highlighted and investigated two mechanisms by which fences affect the progression of the tumor in silico. Ultimately, our models provide a framework with which we can draw conclusions about the effects of fencing as our understanding of physical and biochemical interplay between cells in the TME advances.

3.1. Limitations of analysis

While the effects of fencing are not small, we do not expect fencing to be sole determinant of tumor clinical outcome. Several factors including other clinical confounding factors such as age and co-morbidity factors can affect clinical outcomes. The 1mm2 regions in tumor microarrays probed via IMC are too small relative to full tumors (∼cm) to provide the degree of inflammation (inflamed vs non-inflamed) of a tumor or some tissue-level features which may be associated with tumor progression. Thus, it is challenging to determine any correlation between our FPM with characteristics such as the inflammatory status of the tumor. A direct experimental validation of the proposed pro- and anti-tumor roles of the fencing structures are also required and is an exciting future direction. In addition, some of our datasets contained relatively small number of patients (e.g., CRC) which may preclude the determination of fencing occurrence by rare cell types. The tumors are three dimensional structures and fencing clusters found in two dimensional TMAs may underestimate those clusters formed in three dimensions . Finally, statistical multiple-testing adjustments to our FPM p-value results render some of our results insignificant (p > 0.05). A larger sample size may be required to produce statistically significant conclusions. These limitations specific to the datasets can be overcome as the scientific community produces more and larger spatial tumor-imaging datasets. Experimental techniques which enable the imaging of many different cell phenotypes across entire tumor cross sections as well as in three-dimensions have recently been developed [14], [20], [21].

In our simple computational models, we chose to simulate linear fences on linear tumor boundaries though fences and tumor boundaries manifest in a diverse array of shapes. Though the simple setup is expected to recapitulate some of important effects of fences on immune cell access to cancer cells, the quantitative aspects of the results can be modified by the detailed shape and composition (e.g., tumor vasculature [22]) of the tumor boundaries, and the factors such as cytokines, different immune cell types not considered in the simple models. Other assumptions we make include the presence of a constant chemokine gradient, an implicit spatially homogeneous distribution of ECM in the ICS model, and that we do not need to explicitly account for the three dimensional structure of the TME. Finally, the models assume that the cells forming fences spatially exclude other cells inhibiting their passage. Our study of immune cell access to cancer cells in simple fencing models can be extended to real tumor structures utilizing fence and tumor cell distributions taken from data.

4. Materials and Methods

4.1. Fencing existence calculation details

For the calculation of the probability of the occurrence of fencing clusters made of cell phenotype g fencing clusters in slide data, we constrained our calculations to only the subset of patient slides with at least 50 cells of a given phenotype g and 50 cancer cells. As mentioned in Result 1, we generated for each slide a p-value corresponding to the probability of the slide displaying at least as many g-cells in fencing clusters as compared to randomized data. We randomize the patient slides by sequentially choosing each individual non-cancer cell A and randomly swapping its position with another non-cancer cell B. Once cell A has been swapped, no other cell may swap with it. These swaps are performed until no non-cancer cells may be swapped. This randomization maintains the spatial structure of the cells in the slide. For each randomized slide, we find the number of g-cells which participate in fencing clusters. Our randomization procedure may disrupt micro-tissue structures within the tumor microarrays, however, given the small size of the tumor microarrays, the slides containing such tissue boundaries expected to be small. We generate over 1000 randomized slides and calculate the fraction of these randomized slides which have at least as many g-cells in fencing clusters as in the original patient slide. This fraction is an estimate of the probability that the number of g-cells participating in fencing clusters in the data is more than expected from randomly distributed non-cancer cells while preserving the slide’s spatial structure. This probability is a p-value.

We calculate this p-value for each patient slide forming a distribution of p-values. Using the Benjamini-Hochberg procedure to control the false discovery rate at level p=0.05, we find the fraction of slides which display statistically significant tumor fencing.

For the lung cancer, HNC and brain cancer datasets, 10,000 randomized samples were generated per patient slide and per cell type to calculate both the p-value and the fencing participation metric. The number of random configurations used for the same calculations for the melanoma, breast cancer and colorectal cancer datasets were 6000, 5600 and 1000 respectively. For each dataset, the number of randomizations performed per slide is at or above the value such that the false discovery rate estimation could be controlled at at least p = 0.05.

4.2. Fencing participation metric for response prediction

We calculate the fencing participation metric (FPM) of phenotype g-cells for a patient slide with FPM=fd−<fr>fd, where fd is the number of g-cells found in fencing clusters in the patient slide, and <fr> is the average number of g-cells found in fencing clusters in the set of randomized slides. The set of randomized slides are obtained using the same process used to generate randomized slides for the p-value calculation in the last section. The FPM, as defined so far, can take on negative values which all correspond to slides with fewer cells in fences than found on average in the randomized slides. We are only interested in discovering which slides display fencing and how much fencing. Because of this, we map any negative FPM values to zero. Given a cell phenotype, we produce one FPM for each patient. If we split the patients into two cohorts such as responders and non-responders to therapy, we can then compare their FPM distributions. To compare the average FPMs between the patient cohorts, we utilize the t-test. For the datasets in which patient survival data was available, we also compared the survival curves of patient groups with high versus low cell phenotype FPM for each non-cancer cell phenotype. To separate patients into two groups of high and low FPM of cell phenotype g, we first found the average g-cell FPM across all patients. We then split the patients into those with equal or greater FPM (high) or smaller FPM (low) as compared to the average FPM across all patients. All survival curve comparisons shown differ with p < 0.05 by log-rank test.

The FPM of a cell phenotype g in a patient slide has dependence on the density of cell type g as well as the densities of other cells in the patient slide. For example, when the system is filled with only cancer cells and g-cells (the density of other non-cancer cell types is 0), randomly generated configurations of g-cells are assured to reproduce any fencing structures found in the data. This means that the FPM will be 0 denoting that there is no evidence of fencing greater than expected from a random distribution of non-cancer cells. We also expect that, with a constant density of g-cells forming some fencing clusters, as the density of other cells which are not forming fencing structures increases (total non-cancer cell density increases), the FPM increases.

It has been found that patient tumor progression correlates with the increased or decreased densities of particular cell phenotypes in the TME [10]. As the FPM depends on the density of the cells in the patient slide, a natural question is whether the FPM correlates with response only because of its dependence on cell density. We use the fencing and density of GZMB+CD8+ T cells in TNBC as the central point of our analysis on the interdependencies of cell fencing with cell density for predicting patient response.

First, we calculate the density of GZMB+ CD8 + T cells, σA, in each patient slide which has at least 50 GZMB+ CD8 + T cells and 50 cancer cells (so we may calculate the FPM as well). Each patient slide was assigned either a responder or non-responder to therapy status in the TNBC study. We assign responders a value of 1 and non-responders a value of 0 for the purpose of calculating correlations between density or FPM and response to therapy. GZMB+ CD8 + T cell density is positively correlated with response to therapy in TNBC with a Pearson correlation of 0.18. The GZMB+ CD8 + T cell FPM, M, calculated for the same patient slides correlates with response to therapy with a Pearson correlation of 0.14. To make sure that the FPM does not only correlate with response to therapy due to its dependency on cell density, we build a modified metric. We combine these two metrics into c(r)=(1−r)σAσmax−rM, where σmax is the maximum density of GZMB+ CD8 + T cells across all slides so that σAσmax≤1. When r is 0, c has the same correlation with response as the cell density. When r is 1 it has the same correlation with response as the FPM. Because M ranges from 0 to 1, c ranges from −1–1. Plotting the Pearson correlation of c with patient response against r, we find if the addition of the FPM increases the correlation with response. If the FPM provides the same information on patient response to therapy as the cell density, we expect the correlation of c with response to monotonically decrease with increasing r. As we can see (Figure S3a), the correlation with response increases with the addition of the FPM up to the ratio of 0.2 after which it begins to descend to 0.14. For some cell types, the FPM has a stronger correlation with response as compared to the same cell’s density (Figure S3b). This shows that the cell FPM supplies information of response independent of the cell density.

A common metric used to evaluate clustering of cells in spatial TME data is Ripley’s K cross function [15], [16]. Given two cell phenotypes, a and b, Ripley’s K cross function measures the average number of b neighbors an a cell has at some given radius and normalizes it by the spatially averaged density (over the patient slide) of b cells, λb. Ripley’s K cross function may be defined

Rka,b;rc=λb−1∑i,jI(dai,bj≤rc)Na.

The function dai,bj returns the distance between any two cells ai and bj where i and j span all a and b cells respectively, I(bool) returns 1 when bool= =True and 0 otherwise, Na is the total number of a cells, and rc is the radius within which two cells are considered in contact (rc=30μm in this study).

The FPM and Ripley’s K cross functions differ in what they analyze as the FPM is designed to unveil fences while Ripley’s K cross function the clustering between two cell types. As the fencing cluster definition for a given cell phenotype depends on both that cell’s clustering with cancer as well as with each other, the FPM encodes information found in both the Ripley’s K cross function between the given cells and cancer cells but also that between the given cell with themselves. Given a radius of contact, rc, the calculation of the FPM will include cell configurations which are much larger than those included in the Ripley’s K cross function averaging. Similarly, some of the configurations of cells averaged in Ripley’s K cross function are not considered fence clusters. Ultimately, some configurations identified in FPM are not identified by Ripley’s K and vice versa demonstrating how the spatial metrics differ intrinsically.

Let us consider the particular case of fencing of GZMB+CD8 + T cells, we will refer to them as Λ, on cancer cells, Ω, in the TNBC dataset. We want to explore the interdependencies of the FPM with Ripley’s K cross functions. As the FPM is dependent on the clustering of Λ cells with each other as well with Ω cells, we want to evaluate the relationship between the FPM with two Ripley’s K cross functions: a) between Λ and Λ, and b) between Ω cells and Λ cells. To evaluate the interdependencies between Ripley’s K cross function and the FPM, we first constructed a metric which is composed of a weighted average of the two Ripley’s K cross functions:

fRrc;ω=ωRkΛ,Λ;rcRk,maxΛ,Λ;rc+1−ωRkΛ,Ω;rcRk,maxΛ,Ω;rc,

where ω∈[0,1] is a variable weight and Rk,maxa,b;rc is the maximum Ripley’s K cross function of that type across all patients. We calculate the correlation of the FPM with the metric while varying the weight to find the maximum correlation (Figure S4). The maximum correlation is roughly 0.21 at ω=0.4. This shows that the FPM encodes information in kind with both of the Ripley K cross functions. The week correlation is because the FPM contains more information which is particular to fencing structures that the Ripley K cross functions do not evaluate.

4.3. Sensitivity of FPM to variation of parameters

The FPM depends on the contact radius between cells, rc, and the minimum number of fencing cells in continuous contact which may be considered a fencing cluster, NF. In this study, we calculated the FPM for a certain cell type in a patient slide using parameters rc=30μm and NF=3 cells. We evaluated the sensitivity of the relationships between patient average FPMs to variations of these FPM parameters by independently perturbing FPM parameters around their base values used in this study (Table S2). We increase and decrease the contact radius, rc, by ±5μm and the minimum cluster cell number, NF, by ±1 cell. In Results 2, we concerned ourselves with the difference in average FPM of particular cell types between different patient groups such as responders and non-responders to therapy. We consider the comparisons between responders and non-responders to therapy in TNBC in two different cell phenotypes: GZMB +CD8 + T cells and TCF1+CD4+ T cells. The difference between average responder and non-responder patient FPMs varies from 2 % to 40 %.

4.4. Simple fence computational model details

The setup of the simple computational model is as follows. We simulate the diffusive motion of a single cell on a two-dimensional lattice (lattice constant a=10 μm, corresponding to the cell size). Periodic boundary conditions are imposed along the width of the simulation box which is chosen to be roughly the average distance between fencing clusters in the TNBC data (230 μm) (Fig. 4). The length of the simulation box extends in the range of y≥0. The lower boundary, y=0 or the x-axis, is the upper edge of the tumor region and is the tumor boundary for the diffusing cell. The cell diffuses at a rate given by D=2.5μm2min starting from its initial position. We place a fence of other cells with a specified length, b, just above and along the tumor boundary; it acts as a barrier reflecting the diffusing cell thus blocking access to the tumor boundary. We are interested in the ratio of the number of cells that reach the tumor boundary with the fence to that without, in a time T. We simulated 5000 samples and counted the fraction of samples in which the cell crossed the boundary in a time T, ranging from 0.5 to 2.5 days and for different fence lengths, including b=0, i.e., no fence. The maximum value of T was chosen to match the time scale at which a cancer cell proliferates. The initial position of the cell was chosen to vary over a grid of points (see Fig. 4a) chosen so that a cell has at least a 50 % chance of reaching the boundary in 2.5 days when there is no fence. At a distance of 90 μm from the tumor boundary the cell has a 50 % chance of reaching the boundary and so all the grid points were within 90μm. The simulation box is restricted by y=1500μm, since any cell that reaches that distance has almost no chance of reaching the tumor boundary.

We can utilize the diffusive currents (the number of cells reaching the tumor boundary between times t and t+dt for a small time dt) into the entirety of the tumor boundary from the ensemble of initial conditions to calculate the tumor access ratio. It is defined in terms of the diffusive currents into the tumor boundary with a fence, If(t), and without a fence, Iwf(t), the ratio is defined

RbT=∫0TdtIft∫0TdtIwft

The denominator of this expression may be calculated analytically. First we calculate the exact solution for the first passage time distribution of a cytotoxic cell starting from a single starting position (at coordinates (x0,y0)=(0,y0), with arbitrary y0) with no fence. We start by constructing the probability density distribution P(x,y,t|0,y0,t=0). Integrating this probability density over some area A yields the probability that the cell (started at (0,y0)) is found within that region at some time t, Probcell is in A,t=∬APx,y,t|0,y0,t=0dA. Using the diffusive Green’s function [23], we superpose the probability distribution generated by a source at (x,y)=(0,y0) and a negative mirror source at (x,y)=(0,−y0) to satisfy the absorbing boundary condition at y = 0. Adding these, we construct the cell probability density function

Px,y,t|x0,y0,t=0=14πDte−x24Dt(e−y−y024Dt−e−y+y024Dt)

Going forward, when Px,y,t is written, is assumed conditional on starting at position x0,y0 at t=0. We integrate this function over the half plane (x > 0) to find the probability that the cell does not reach the x-axis by time t. The negative derivative of this integral with respect to time is the first passage time distribution FPTwf(t). Note that this first passage time is equivalent to the probability density current into the cancer region from a single initial condition, Iwf(t|y0,t=0). This current is independent of the starting position of the cell due to translational symmetry of the system along the x-axis.

Iwf(t|y0,t=0)=ddt∫0∞dy∫−∞∞dxPx,y,t=y04πDt3e−y024Dt

With this expression in hand, to produce the denominator, DM=∫0TdtIwft, of the tumor access ratio, we average over all initial positions, yi, and integrate over the period, T

DM=∫0TdtIwft=14πD∫0TdtS∑yiyit−32e−yi24Dt

where S=5000 is the number of samples simulated from each initial condition.

4.5. Minimal model with chemotaxis

The simple computational chemotaxis model simulates the drift-diffusive motion of a single cell on a two-dimensional lattice (lattice constant a=10 μm, corresponding to the cell size) similar to that of the previous simple cell diffusion model. Periodic boundary conditions are imposed along the width of the simulation box which is chosen to be roughly the average distance between fencing clusters in the TNBC data (230 μm) (Fig. 4). The length of the simulation box extends in the range of y≥0. The lower boundary, y=0 or the x-axis, is the upper edge of the tumor region and is the tumor boundary for the diffusing cell. The cell diffuses at a rate given by D=2.5μm2min. The cytokine gradient induced by the fence is included simply by the addition of a drift if the cells is within 50μm from the tumor boundary, a typical chemokine decay distance [24]. The drift which cytotoxic cells experience is directed towards the tumor boundary. The rate at which the cytotoxic cell chemotaxes (drifts) towards the tumor boundary linearly increases with the length of the CD4 + T cell fence from 0 to the maximum rate (5μmmin) when the CD4 + T cell fence reaches 150μm. Drift rates of this magnitude have been observed in CD8 + T cells [25]. The drift rate is assumed constant with further increases in fence length past 150μm. For the simple fence chemotaxis model, the same method of calculating the tumor access ratio in the diffusion model is used. It compares the number of motile cells which reach the tumor boundary within T with a fence to the number of motile cells which reach the tumor boundary within T without a fence and therefore without chemotactic drift.

4.6. Modified Interacting Cell System (ICS) Model

The computational model applied to find the effect of fencing on tumor progression in silico is a modified version of the Interacting Cell System (ICS) model [1]. The primary modifications to the ICS model are the following: i) We implant a few fences consisting of a new type of non-tumor cells to the initial configuration of the tumor and the immune (T-cells and macrophages) cells considered earlier. The non-tumor cells in the fence do not interact with tumor or T cells and macrophages; nor do they proliferate, die, or move during the simulation. ii) When activated CD8+ T cells are converted to Tex cells they immediately removed from the system. This rule is implemented to make sure the effect of our implanted fencing barriers are not affected by fences formed by Tex cells. The other details of the ICS model are similar to that described in ref. [1]. Below we briefly describe main features of the modified ICS model.

The Interacting Cell System (ICS) model is a kinetic Monte Carlo simulation implemented on a 100×100 square lattice with spacing 10 μm representing the 1 mm×1 mm TMAs taken from each patient. We customized SPPARKS Kinetic Monte Carlo Simulator (distributed at spparks.github.io) code to build this agent-based model. The references supporting model rules and parameter values can be found in ref. [1]. The physical extent of the cells constrains the number of cells in each chamber that corresponds to a 10 μm×10μm square. The model considers four types of cells in the system: tumor cells, activated CD8+ T cells, TAMs, and non-tumor cells in the implanted fences. Activated CD8+ T cells occupy a fourth of a chamber while tumor cells and macrophages each fill half a chamber. These occupation rules reflect the limits of occupation in the original IMC slides. A chamber with a fence cell is fully occupied. Two cells are considered in contact if they are in the same chamber or in adjacent chambers that share an edge.

The initial state of the system is obtained from the patient’s TMA by discretizing the cell positions in the IMC data for a patient TMA. Over time, cell positions and numbers change: First, tumor cells proliferate (rate kC) with the location of the daughter depending on the availability of space in progressively larger neighboring regions. The new cell is placed in the same chamber as the proliferating cell if space is available, if not then the surrounding 8 chambers, next the adjacent layer of 16 chambers and finally the third layer of 24 chambers are checked for available space. If space cannot be found in the 49-cell neighborhood, even by expelling CD8+ T cells, then proliferation does not occur. When multiple chambers are available in a layer, one is chosen randomly.

Activated CD8+ T cells proliferate [26] into the same chamber they occupy if the chamber is not already full. The rate at which activated CD8+ T cells proliferate is limited by CD8+ T cell competition for resources and space in the TME. We include this competition by enforcing a maximum number (or carrying capacity) of the CD8+ T cell population, Ncc. Given the number of activated CD8+ T cells, NTC, and exhausted CD8+ T cells, NTe, the total CD8+ T cell population is NTC+NTe. The carrying capacity is incorporated in the rate of proliferation and recruitment with a logistic term (1−NTC+NTeNcc) which is 1 when there are no CD8+ T cells and 0 when the population reaches the carrying capacity. The rates at which activated CD8+ T cells proliferate and recruit to the TME also depend on the number of recently killed cancer cells [27], [28]. As the number of tumor cells killed in the previous 12 h (effective immune system memory span, Tm), DC, increases, the proliferation and recruitment rates grow until they reach their maximum values. We employ a Michaelis-Menten functional form to capture this saturation of the proliferation and recruitment rates at maximum values: DCD12+DC where D12 is the Michaelis constant, i.e., when DC=D12, the rate is halved. The more tumor cell death, the greater the probability of neoantigens being created invigorating activated CD8 + T cell proliferation and recruitment by way of antigen-presenting cells (APCs). This constitutes a positive feedback for activated CD8+ T cell population. APCs are not explicitly modeled by our ICS model but their effects on CD8+ T cell proliferation and recruitment are included. Putting these together, we have

Activated CD8+T cell proliferation rate=kpro×1−NTC+NTeNcc×DCD12+DC

where kpro is the maximum proliferation rate of activated CD8+ T cells.

Activated CD8 + T cells are recruited at a rate with the same dependencies on CD8+ T cell carrying capacity and killed tumor cells as the activated CD8 + T cell proliferation rate,

Activated CD8+T cell recruitment rate=r×1−NTC+NTeNcc×DCD12+DC

where r is the maximum recruitment rate of activated CD8+ T cells. When recruited, activated CD8+ T cells are randomly placed in a chamber with available space for the cell to occupy. TAMs are recruited at a constant rate, rM, and are similarly placed randomly in a lattice chamber with enough space to accommodate the TAM. TAMs die at a constant rate γM.

In the model, activated CD8+ T cells are exhausted by tumor cells and TAMs with which they are in contact. Once exhausted, they are removed from the system. In vivo, tumor cells express PDL1 and PDL2 [29], [30], [31] and chronic PD1 activation in CD8+ T cells leads to exhaustion [32]. TAMs express PDL1 and PDL2 in the TME [31] and may directly inhibit activated CD8+ T cells [33], [34], [35], [36]. In CD8+ T cells, PD1 and CTLA4 expression upregulates upon TCR engagement [37], [38]. These interactions lead CD8+ T cells to lose cytotoxic and proliferative ability [39].

We account for cell motility in the TMA by allowing CD8 + T cells and TAMs to diffuse on the lattice. A motile cell may move into one of the four nearest neighbor chambers if there is sufficient space for the cell to occupy. The diffusion rate of CD8+ T cells is reduced when in contact with TAMs from Dmot by a factor of 33. This is a coarse-grained approximation to the myriad of complex processes that promote contact between CD8+ T and tumor cells. We apply periodic boundary conditions on our lattice which may be viewed as cell migration to and from other regions of the TME not shown in the data. When crossing a lattice boundary, CD8+ T cells have a 50 % chance of being removed from the system.

CRediT authorship contribution statement

Ciriyam Jayaprakash: Writing – review & editing, Writing – original draft, Supervision, Project administration, Methodology, Investigation, Conceptualization. Zihai Li: Writing – review & editing. William C. Stewart: Methodology. Rushil Gaddam: Formal analysis. Dhruv Chavan: Formal analysis. Giuseppe Giuliani: Writing – review & editing, Writing – original draft, Visualization, Validation, Software, Resources, Methodology, Investigation, Formal analysis, Data curation, Conceptualization. Jayajit Das: Writing – review & editing, Writing – original draft, Visualization, Supervision, Project administration, Methodology, Funding acquisition, Conceptualization.

Statement of significance

New experimental techniques, such as imaging mass cytometry, have been developed which produce two-dimensional images of cancer tissues unveiling the positions of cells as well as their respective phenotypes. Using this spatial data, we discover and characterize a spatial fence pattern formed by cells in the tumor and show that these fence structures appear in patient tumors across six different solid cancer types. The occurrence of cell fence structures in patient tumors shows correlations with patient responses to therapy. We investigated mechanisms by which these cell fence structures can potentially regulate tumor progression. Our findings uncover a well-defined simple spatial pattern in the tumor microenvironment of solid tumors that can potentially affect tumor progression and patient response to immunotherapy.

Declaration of Competing Interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Acknowledgments

We thank the Abigail Wexner Research Institute at the Nationwide Children’s Hospital for funding.

Footnotes

Appendix A

Supplementary data associated with this article can be found in the online version at doi:10.1016/j.csbj.2025.11.062.

Appendix A. Supplementary material

Supplementary material

mmc1.docx (689.1KB, docx)

Data Availability

Data used to generate all figures may be found at https://doi.org/10.5281/zenodo.15817184. Further ICS model description, and instructions and code to build and execute ICS model simulations can be found at in our previous paper [1] and at https://github.com/gdag458/Melanoma_ICS. The patient datasets containing all patient IMC slides are made available in the public domain by the authors of the published manuscripts [2], [3], [4], [5], [6], [7].

References

  • 1.Giuliani G., Stewart W., Li Z., Jayaprakash C., Das J. Spatial organization and stochastic fluctuations of immune cells impact clinical responsiveness to immunotherapy in melanoma patients. PNAS Nexus. 2024;3 doi: 10.1093/pnasnexus/pgae539. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 2.Sorin M., et al. Single-cell spatial landscapes of the lung tumour immune microenvironment. Nature. 2023;614:548–554. doi: 10.1038/s41586-022-05672-3. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 3.Karimi E., et al. Single-cell spatial immune landscapes of primary and metastatic brain tumours. Nature. 2023;614:555–563. doi: 10.1038/s41586-022-05680-3. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 4.Wang X.Q., et al. Spatial predictors of immunotherapy response in triple-negative breast cancer. Nature. 2023;621:868–876. doi: 10.1038/s41586-023-06498-3. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 5.Moldoveanu D., et al. Spatially mapping the immune landscape of melanoma using imaging mass cytometry. Sci Immunol. 2022;7 doi: 10.1126/sciimmunol.abi5072. [DOI] [PubMed] [Google Scholar]
  • 6.Küçükköse E., et al. Stromal localization of inactive CD8(+) T cells in metastatic mismatch repair deficient colorectal cancer. Br J Cancer. 2024;130:213–223. doi: 10.1038/s41416-023-02500-x. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 7.Wu Z., et al. Graph deep learning for the characterization of tumour microenvironments from spatial protein profiles in tissue specimens. Nat Biomed Eng. 2022;6:1435–1448. doi: 10.1038/s41551-022-00951-w. [DOI] [PubMed] [Google Scholar]
  • 8.Jing S.-y, et al. Quantifying and interpreting biologically meaningful spatial signatures within tumor microenvironments. NPJ Precis Oncol. 2025;9:1–14. doi: 10.1038/s41698-025-00857-1. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 9.Ding D.Y., et al. Quantitative characterization of tissue states using multiomics and ecological spatial analysis. Nat Genet. 2025:1–12. doi: 10.1038/s41588-025-02119-z. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 10.Hammerl D., et al. Spatial immunophenotypes predict response to anti-PD1 treatment and capture distinct paths of T cell evasion in triple negative breast cancer. Nat Commun. 2021;12:5668. doi: 10.1038/s41467-021-25962-0. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 11.Hickey J.W., et al. Integrating multiplexed imaging and multiscale modeling identifies tumor phenotype conversion as a critical component of therapeutic T cell efficacy. Cell Syst. 2024;15:322–338. doi: 10.1016/j.cels.2024.03.004. e325. e325. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 12.Mi H., et al. Computational methods and biomarker discovery strategies for spatial proteomics: a review in immuno-oncology. Brief Bioinforma. 2024;25 doi: 10.1093/bib/bbae421. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 13.Nirmal A.J., et al. The spatial landscape of progression and immunoediting in primary melanoma at single-cell resolution. Cancer Discov. 2022;12:1518–1541. doi: 10.1158/2159-8290.CD-21-1357. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 14.Lin J.-R., et al. Highly multiplexed immunofluorescence imaging of human tissues and tumors using t-CyCIF and conventional optical microscopes. elife. 2018;7 doi: 10.7554/eLife.31657. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 15.Roemer M.G.M., et al. Multi-scale spatial modeling of immune cell distributions enables survival prediction in primary central nervous system lymphoma. iScience. 2023;26 doi: 10.1016/j.isci.2023.107331. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 16.Kermany D.S., et al. Multiscale 3D spatial analysis of the tumor microenvironment using whole-tissue digital histopathology. Cancer Commun (Lond) 2025;45:386–390. doi: 10.1002/cac2.12655. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 17.Castellino F., et al. Chemokines enhance immunity by guiding naive CD8+ T cells to sites of CD4+ T cell–dendritic cell interaction. Nature. 2006;440:890–895. doi: 10.1038/nature04651. [DOI] [PubMed] [Google Scholar]
  • 18.Keren L., et al. A structured tumor-immune microenvironment in triple negative breast cancer revealed by multiplexed ion beam imaging. Cell. 2018;174:1373–1387. doi: 10.1016/j.cell.2018.08.039. e1319. e1319. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 19.Galeano Niño J.L., et al. Cytotoxic T cells swarm by homotypic chemokine signalling. Elife. 2020;9 doi: 10.7554/eLife.56554. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 20.Koivuholma A., et al. A pilot study comparing three-dimensional models of tumor histopathology and magnetic resonance imaging. Sci Rep. 2025;15:1888. doi: 10.1038/s41598-025-85478-1. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 21.Lee S.S.-Y., Bindokas V.P., Kron S.J. Multiplex three-dimensional optical mapping of tumor immune microenvironment. Sci Rep. 2017;7 doi: 10.1038/s41598-017-16987-x. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 22.Franses J.W., Baker A.B., Chitalia V.C., Edelman E.R. Stromal endothelial cells directly influence cancer progression. Sci Transl Med. 2011;3 doi: 10.1126/scitranslmed.3001542. 66ra65. 66ra65. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 23.Feller W. I. Wiley; Oxford, England: 1950. (An introduction to probability theory and its applications. Vol. I, An introduction to probability theory and its applications). pp. xii, 419-xii, 419. [Google Scholar]
  • 24.Oyler-Yaniv A., et al. A tunable diffusion-consumption mechanism of cytokine propagation enables plasticity in cell-to-cell communication in the immune system. Immunity. 2017;46:609–620. doi: 10.1016/j.immuni.2017.03.011. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 25.Torres D.J., et al. Quantitative analyses of T cell motion in tissue reveals factors driving T cell search in tissues. eLife. 2023;12 doi: 10.7554/eLife.84916. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 26.Huang A.C., et al. A single dose of neoadjuvant PD-1 blockade predicts clinical outcomes in resectable melanoma. Nat Med. 2019;25:454–461. doi: 10.1038/s41591-019-0357-y. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 27.Brown S.D., et al. Neo-antigens predicted by tumor genome meta-analysis correlate with increased patient survival. Genome Res. 2014;24:743–750. doi: 10.1101/gr.165985.113. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 28.Schumacher T.N., Schreiber R.D. Neoantigens in cancer immunotherapy. Science. 2015;348:69–74. doi: 10.1126/science.aaa4971. [DOI] [PubMed] [Google Scholar]
  • 29.Mandalà M., Merelli B., Massi D. PD-L1 in melanoma: facts and myths. Melanoma Manag. 2016;3:187–194. doi: 10.2217/mmt-2016-0013. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 30.Dong H., et al. Tumor-associated B7-H1 promotes T-cell apoptosis: a potential mechanism of immune evasion. Nat Med. 2002;8:793–800. doi: 10.1038/nm730. [DOI] [PubMed] [Google Scholar]
  • 31.Obeid J.M., et al. PD-L1, PD-L2 and PD-1 expression in metastatic melanoma: correlation with tumor-infiltrating immune cells and clinical outcome. Oncoimmunology. 2016;5 doi: 10.1080/2162402X.2016.1235107. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 32.Bengsch B., et al. Bioenergetic insufficiencies due to metabolic alterations regulated by the inhibitory receptor PD-1 are an early driver of CD8+ T cell exhaustion. Immunity. 2016;45:358–373. doi: 10.1016/j.immuni.2016.07.008. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 33.Kersten K., et al. Spatiotemporal co-dependency between macrophages and exhausted CD8+ T cells in cancer. Cancer Cell. 2022;40:624–638. doi: 10.1016/j.ccell.2022.05.004. e629. e629. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 34.Kryczek I., et al. B7-H4 expression identifies a novel suppressive macrophage population in human ovarian carcinoma. J Exp Med. 2006;203:871–881. doi: 10.1084/jem.20050930. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 35.Zou W., Wolchok J.D., Chen L. PD-L1 (B7-H1) and PD-1 pathway blockade for cancer therapy: Mechanisms, response biomarkers, and combinations. Sci Transl Med. 2016;8 doi: 10.1126/scitranslmed.aad7118. 328rv324-328rv324. 328rv324-328rv324. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 36.Boldajipour B., Nelson A., Krummel M.F. Tumor-infiltrating lymphocytes are dynamically desensitized to antigen but are maintained by homeostatic cytokine. JCI Insight. 2016;1 doi: 10.1172/jci.insight.89289. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 37.Agata Y., et al. Expression of the PD-1 antigen on the surface of stimulated mouse T and B lymphocytes. Int Immunol. 1996;8:765–772. doi: 10.1093/intimm/8.5.765. [DOI] [PubMed] [Google Scholar]
  • 38.Egen J.G., Allison J.P. Cytotoxic T lymphocyte antigen-4 accumulation in the immunological synapse is regulated by TCR signal strength. Immunity. 2002;16:23–35. doi: 10.1016/s1074-7613(01)00259-x. [DOI] [PubMed] [Google Scholar]
  • 39.Blank C.U., et al. Defining ‘T cell exhaustion. Nat Rev Immunol. 2019;19:665–674. doi: 10.1038/s41577-019-0221-9. [DOI] [PMC free article] [PubMed] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

Supplementary material

mmc1.docx (689.1KB, docx)

Data Availability Statement

Data used to generate all figures may be found at https://doi.org/10.5281/zenodo.15817184. Further ICS model description, and instructions and code to build and execute ICS model simulations can be found at in our previous paper [1] and at https://github.com/gdag458/Melanoma_ICS. The patient datasets containing all patient IMC slides are made available in the public domain by the authors of the published manuscripts [2], [3], [4], [5], [6], [7].


Articles from Computational and Structural Biotechnology Journal are provided here courtesy of AAAS Science Partner Journal Program

RESOURCES