A Joint Spatiotemporal Differential Expression Modeling of Exposure Effects in Spatial Transcriptomics Data
Abstract
This work presents a framework that identifies DEGs in spatial transcriptomics by incorporating spatial information through a hierarchical network-based model. This approach accounts for spatial confounding and leverages tissue architecture to align biological signals across conditions. The framework was validated through simulation studies and comparative benchmarks with existing popular methods.
Full text
A Joint Spatiotemporal Differential Expression Modeling of Exposure Effects in Spatial Transcriptomics Data Osafu Augustine Egbon1,2 and Benedict Anchang1,2 1National Institute of Environmental Health Sciences (NIEHS/NIH), Durham, NC 27709, United States 2National Cancer Institute, Bethesda, MD 20892, United States Abstract Differential expression analysis in spatial transcriptomics data is important for identifying localized biological processes and spatially structured gene regulation. While numerous methods have been developed for identifying differentially expressed genes (DEGs) in conventional single-cell RNA-seq data, approaches that explicitly account for spatial and temporal context remain scarce. A major challenge in spatial DEG analysis is the spatial misalignment between tissue sections under control and perturbed conditions, which renders coordinate-based comparisons unreliable. To address this gap, we developed SpatialDENet, a framework that identifies DEGs in spatially structured single-cell data by incorporating spatial information through a hierarchical network-based model. This approach accounts for spatial confounding and leverages tissue architecture to align biological signals across conditions. We validated SpatialDENet through simulation studies and comparative benchmarks with existing popular methods. Our findings demonstrate that SpatialDENet provides a powerful and interpretable alternative for spatial transcriptomics analysis and may inform the development of targeted therapies. Key Words: Bayesian inference, Network model, Differential expression analysis, Gaussian Markov Random Field, Zero-inflation. 1 Introduction Spatial transcriptomics technologies are increasingly popular for investigating the spatial architecture of tissues, uncovering cell-cell interactions, and analyzing gene expression patterns in situ with high resolution1,2. However, conducting Differential Expression (DE) analysis to identify differentially expressed genes (DEG) between two biological conditions on spatial transcriptomics data presents significant challenges due to its high dimensionality, noise, sparsity, and spatial structure. Methods for DE analysis in studying biological variations at the single-cell level are emerging quickly. For instance, the popularly used methods include DESeq23, EdgeR4, Lima5, MAST6, Zinbwave7, among others. However, most of these methods do not account for spatial variation, an important source of biological and technical variability that can confound differential expression analysis results8. Existing statistical and computational methods8β13 for analyzing spatially resolved 1
single-cell data are particularly designed to identify spatially variable genes (SVGs), and no adequate attention has been given to identifying DEGs between control and treatment scenarios in spatially resolved single-cell data. To address this concern, we proposed a statistical framework, SpatialDENet (Sptial Differential Expression Analysis through Network), to identify differential expression genes between control and perturbed conditions while correcting for spatial confounding (SC). SpatialDENet addresses three main analytical concerns in spatially resolved single-cell data. Firstly, SpatialDENet adjusts for the SC issue through spatial hierarchical modeling. This method allows the accurate estimation of the impact of a specific treatment on cells after controlling for the spatial effects. Secondly, spatially resolved single-cell data is associated with spatial misalignment due to the non-longitudinal and nonhomologous nature of the data across samples. That is, the spatial coordinates change from tissue samples to samples. To address this concern, SpatialDENet leverages network models to map cellular spatial neighborhoods between multiple tissues unto a latent space, creating a unified spatial field for adjusting for SC and identifying DEGs. Lastly, SpatialDENet accounts for the sparsity in the expression data. The zeros due to sparsity can arise from technical limitations in the sequencing process or reflect true biological absences of gene expression for specific cells. Distinguishing between these two sources of zeros is critical for accurate interpretation. SpatialDENet utilizes a two-part (count and activation) zero-inflated model to account for excess zeros. The remainder of this paper is organized as follows. We first briefly describe the statistical framework of SpatialDENet and its extension to accommodate zero-inflated data. We then benchmark the framework with popularly used differential expression analysis methods through a simulation study. Finally, we conclude with a summary of our contributions and potential directions for future research. 2 Statistical Framework 2.1 Background of differential analysis framework In single-cell DE analysis, the general framework adopted by existing methods can be described as follows. Let πππ be the observed expression level (e.g., read count) for gene πin cell π , where π=1, . . . , πΊ and π =1, . . . , π. A generalized linear model (GLM) is typically used to model gene expression as: πππ βΌNB(πππ , ππ),(1) where NB denotes a Negative Binomial distribution, πππ is the expected expression level of gene π in cell π ,ππis a gene-specific dispersion parameter. The parameter πππ is then linked to covariates 2
through a log-linear model given as log(πππ )=π½π0+log(ππ ) +ππ π½π1+xβ€ π π·π,(2) where ππ is a size factor or library size normalization for cell π ,π½0is the model intercept, ππ β {0,1} is the treatment indicator, with effect size π½1,xπ is a vector of covariates to adjust for observed confounding variables, and π·πis a corresponding vector of regression coefficients for gene π. To test for differentially expressed genes between control and treatment conditions, we define the hypothesis (Hypothesis 1) for a specific gene πas π»0:π½π1=0vs. π»1:π½π1β 0,(3) where π½π1is the coefficient corresponding to the condition of interest. In single-cell spatially resolved data with genes exhibiting spatial variation and zero inflation, Hypothesis 1 becomes problematic and inappropriate for finding differential expression genes in single-cell analysis. 2.2 SpatialDENet: The proposed framework To address the above concern, we proposed a unified framework that addresses spatial confounding, spatial misalignment, the temporal evolution of gene expression, and zero-inflation problems in single-cell spatially resolved data. 2.2.1 Response model Consider a scenario where we have pre-processed single-cell expression data collected over time. Let πππ π‘, π =1,2, ..., π;π=1,2, ..., πΊ,π‘=1,2, ..., π be a gene expression count at spatial location denoted by π at time π‘for gene π.πis the total number of spots/cells across all tissues. Note here that the cell index π previously defined as a cell is now redefined as a spot index π in spatial transcriptomics data. We assume that πππ π‘ |π½π0, π½π1,π·πβΌNB(πππ π‘ , ππ), log(πππ π‘)=π½π0+log(ππ π‘ ) +ππ π‘ π½π1+xβ€ π π‘ π·π+πππ π‘, (4) where πππ π‘ is a spatiotemporal latent variation used to adjust for spatial confounding in the gene expression data, ππ π‘ is the size factor, ππ π‘ β {0,1}is the condition indicator of spatial point π at time π‘. The differential genes are then identified using Hypothesis 1. In standard spatial statistical modeling, where the spatial location domain remains fixed, πππ π‘ in Equation (4) can be easily estimated by assuming a Gaussian Markov random field (GMRF) prior distribution. However, in single-cell analysis, the spatial domain (tissue sample) dissociates during data collection and thus, different tissues are used in the treatment and control conditions, 3
causing spatial misalignment due to non-homologous tissue samples. To address this challenge, we model πππ π‘ using a Network-Based-GMRF prior distribution, which is discussed in the subsequent subsection. 2.2.2 Deriving network-based-GMRF To define a network-based Gaussian Markov Random Field (GMRF) prior for modeling spatiotemporal latent effects, we introduce a framework that constructs a dynamic cell-neighborhood network over a spatial domain, informed by gene expression summaries14. Let Ddenote a regular spatial domain for a specific tissue sample, such that π β D. For each time π‘or a specific tissue sample, the domain Dπ‘β D is non-linearly partitioned into non-overlapping spatial regions π·ππ‘ ,π=1,2, ..., πΌ, called a node, such that Dπ‘= πΌπ‘ Γ π=1 π·ππ‘ , π·ππ‘ β©π·πβ²π‘=β
for πβ πβ².(5) For each partition π·ππ‘ , we calculate a representative centroid using a summary statistic, such as the mean expression of the principal components (PCs) derived from the gene expression data. Suppose the reduced gene expression space consists of 10 PCs; for each partition π·ππ‘ , we compute the mean value of each PC across all cells within that partition. Consequently, each π·ππ‘ is represented by a vector of 10 mean values, corresponding to the 10 PCs. The number of nodes is chosen to result in optimal precision. We then define a cell-neighborhood network Tby connecting each node π·ππ‘ to its π-nearest neighbors based on centroid proximity. Formally, define an undirected graph T=(G,E), where Gis the set of nodes (partitions across all π‘) and Eis the set of edges, such that (π, π‘)βΌ(π, π‘β²) if and only if π·ππ‘β²is among the πnearest neighbors of π·ππ‘ based on centroid distance. For example, if there exists a total of 1000 non-overlapping partitions of D, the network Twill have 1000 nodes (#G=1000), indicating that each cell/spot belongs to only one of the 1000 nodes. Given the nodes in G, the Network Tis used to incorporate the spot/cell interaction and dependencies informed by the relationship between the cellβs expression status across all the genes. To obtain the network-based GMRF, suppose network Thas πnodes, with ππππ‘ βRrepresenting the node latent effect for node πat time π‘. Let πππ‘ =(ππ1π‘, ππ2π‘, ..., ππππ‘ )πand ππ= (ππ1,ππ2, ..., πππ )π. We assumed a Gaussian Markov Random Field (GMRF) on the latent variables ππππ‘ , which captures the network structure. Let Nπbe the collection of all the index sets of nodes having an edge with node πon network T, then the network-based GMRF is defined as ππππ‘ |πβπ π,NπβΌπξΓπβNπππ ππ‘ #Nπ ,1 #Nπππξ,(6) where #Nπis the total number of nodes connected to node π.πβπ πis ππbut excluding component ππππ‘ from the vector. Equation (6) shows that the expected value of the latent variable in node πis 4
the average of the values of the latent variables representing the nodes connected to node π, and the variance is scaled by the number of edges of node π. The equation captures the dependency between the nodes across the network. For example consider a network T=(G,E) such that the node set is G={1,2,3,4,5}and edge set E={1βΌ3,1βΌ2,2βΌ3,2βΌ4,3βΌ4,3βΌ5}, where πβΌπindicates that node πis connected to node πon the network. Therefore, N1={2,3},N2={1,3,4},N3= {1,2,4,5},N4={2,3},N5={3}. The joint distribution of the network-based-GMRF for the latent variable ππ|ππβΌπ(0,πΊ(ππ)), where πΊ(ππ)=(ππQ)β1and Qis a structured matrix that captures the spatial structure given in Equation (6), which is defined as πππβ²=ο£±       ο£³ |Nπ|,if π=πβ², β1,if πβ Nπ, 0,otherwise. (7) 2.2.3 Zero-Inflation joint model A serious concern with single-cell data is its sparsity. The expression contains excessive zeros that can bias most modeling approaches, especially interpretable models. As a result, it is important to account for these zeroes in the modeling framework to differentiate between true zeroes and biological zeros. To address this concern, we adopted a βtwo-part" modeling technique. In the first part, we model the activation process of gene πthrough a logistic model. We model the probability that a specific gene is activated (expressed) or not. In the second step, the extent of activation is modeled through a different standard probability model. Mathematically, define a new variable πππ π‘ such that πππ π‘ =(1if πππ π‘ >0, 0otherwise. (8) Thus, for a given gene π, we assume that πππ π‘ βΌBernoulli(πππ π‘), where πππ π‘ denotes the probability of observing non-zero expression. Moreover, we define another variable πππ π‘ =πππ π‘ only if πππ π‘ =1, and πππ π‘ is modeled using a zero-truncated negative binomial distribution. We define ππππ‘ as the latent effect associated with node πat time π‘. Each spot π is assigned to a node π(π ), and thus the spot-level effect is given by πππ π‘ =ππ,π(π ),π‘ . The full model for the SpatialDENet is given as 5
πππ π‘ |.βΌBernoulli(πππ π‘), log ξπππ π‘ 1βπππ π‘ ξ=πΌπ0+ππ π‘ πΌπ1+xπ π π‘ πΆπ+ππππ‘ , π βnode π πππ π‘ |.βΌNegativeBinomial(πππ π‘, ππ), log(πππ π‘ )=π½π0+log(ππ π‘ ) +ππ π‘ π½π1+xπ π π‘ π·π+ππππ‘ , ππβΌπξ0,πΊ(ππ)ξ, (πΌπ0, πΌπ1,πΆπ, π½π0, π½π1,π·π)πβΌπππ(0,104I), π²βΌπ(π²), (9) where πππ π‘ is the probability that a specific gene πis biologically activated. Each spot π belongs to a node π(π ). Thus, in the linear predictor term, ππππ‘ is included through ππ,π(π )π‘, which is shared between the binary and the count components. As previously defined, ππππ‘ adjusts for the spatial confounding in the activation component of the model using the network-based-GMRF. π²is a vector of hyperparameters, π²=(ππ, ππ)πand π(π²)is the prior distribution for π². We assigned loggamma prior for ππ,log(ππ) βΌ πππ βπΊππππ(1,0.00005). We adopted the PC prior distribution for ππ, which is among the most widely used prior distributions due to its robustness. The PC prior distribution for π=ππis given as π(π)=π 2πβ3/2exp ξβπ πβ1/2ξ,for π > 0,(10) where π=βlog πΌ π’, such that π(1 βπ> π’)=πΌ. The prior is fully specified if π’and πΌare fixed or known, which can be informatively derived from the empirical data. 3 Simulation study We conducted a simulation study to benchmark SpatialDENet with commonly used methods in the literature. To simulate the gene expression data, we adopted a zero inflated negative binomial distribution. To simulate the spatially random error, we adopted a Gaussian bump model. The data generation model is given as xcoord βΌuniform(0,1) ycoord βΌuniform(0,1) ππ(π , π‘)=exp ξβ2π‘((xcoord β0.5)2+ (ycoord β0.5)2)ξ log(πππ π‘)=π½π0+ππ π‘ π½π1+ππ(π , π‘) πππ π‘ βΌBernoulli(πππ π‘) πππ π‘ =(0if πππ π‘ =0, NB(πππ π‘ , ππ)if πππ π‘ =1. (11) 6
where xcoord and ycoord represent the spatial coordinates of each location, and ππ(π , π‘)denotes the spatially varying error term, which can potentially confound the estimation of π½π1. The error is higher towards the center of the domain and fades away towards the edges. We assumed an effect size of π½π1=[2,4], π =1,2, ..., πΊ between the treatment and control conditions. We deliberately introduced this spatial error to evaluate how effectively the network-based model captures spatial structure, without directly simulating from the network-based GMRF. To simulate the differentially expressed genes, we set ππ π‘ =1in the treatment condition and ππ π‘ =0in the control condition. To simulate non-differentially expressed genes, we set π½π1=0for both treatment and control. In the simulation, πππ π‘ =0.6,βπ, π , π‘.π½0was fixed to 1and the dispersion parameter ππ=ππ=1,βπ. Given the simulated data, we compare SpatialDENet with commonly used differential analysis methods in the literature. Specifically, we considered DESeq23, EdgeR4, Limma5, MAST6, and monocle315. Figure 1a shows the randomly selected spatial location with the spatial domain (0,1)2. Using π(π , π‘), the figure shows that the spatial pattern exhibits higher intensity moving closer to the center of the spatial domain. This indicates that genes that are more expressed in the center region tend to be relatively more affected by spatial confounding issues. Using the spatial effect π(π , π‘)in the stochastic representation in Equation (11), differentially and non-differentially expressed genes are simulated. Figure 1b shows the SpatialDENet representation of the spatial domain. Each node is a cluster of neighboring points, and the size of the network determines the number of neighboring spatial locations present in the data. Larger nodes have a higher number of spatial locations. The graph is colored by the node-averaged simulated spatial effect. (a) (b) SpatialDENet EdgeR DESeq2 MAST Monocol3 False Discovery Rate Power (c) Figure 1: Simulation study: (a) The simulated spatial confounding variable distributed across (0,1) in both x and y axes. (b) The network representation of the simulated spatial region. (c) The power against false discovery rates of the competing models. We simulated 1000 genes in total. Of those, 100 (10%) differentially expressed genes between control and treatment conditions were simulated. The plot of the power against the false discovery rate between Monocle 3, MAST, DESeq2, EdgeR, and spatialDENet is shown in Figure 1c. The 7
power and the FDR were computed using Power =π π ππ +πΉπ ,FDR =πΉπ ππ +πΉπ ,(12) where ππ is true positive, πΉπ is false positive, and πΉπ is false negative. The results showed that DESeq2 achieved a power of 0.80 at an FDR of 0.005, performing relatively well compared to other methods. However, spatialDENet outperformed DESeq2, attaining a power of over 0.82 at an FDR of 0.01 and exceeding 0.90 at an FDR of 0.02. In contrast, DESeq2 reached only 0.81 power at the same FDR level of 0.02. These findings highlight the importance of accounting for spatial confounding effects when identifying differentially expressed genes. We further conducted 30 independent simulation runs to compare spatialDENet with other competing models using FDR and power as primary evaluation metrics. For each simulation scenario, we calculated the FDR, power, and the corresponding composite metrics, F1 score, and Youdenβs J statistic, to assess the overall performance of the models comprehensively. The F1 score and Youdenβs J statistic are defined as F1 =2(1βFDR)Power (1βFDR) +Power,Youdenβs J =Power βFDR.(13) Both the F1 score and Youdenβs J statistic integrate power and FDR to provide a unified measure of a methodβs true performance. Methods that achieve higher values for these metrics are considered to perform better overall, as they effectively balance sensitivity and false discovery control. 8
YoudenJ F1 FDR Power (a) (b) (d) (c) Figure 2: Benchmarking analysis in synthetic data: (a) False discovery rate, (b) Power, (c) unified F1 score, (d) Youdenβs J statistic. Figure 2a & b show the box plot of the FDR and power of DESeq2, EdgeR, Limma, MAST, Monocle, and SpatialDENet. Findings showed that DESeq2 and SpatialDENet had similar levels of FDR, which is better than other competing models. However, judging by the power, SpatialDENet outperformed DESeq2 and other competing models (Figure 2b). Moreover, Monocle had the highest 9