Token gating generative refinement model for high fidelity spatial transcriptomics analysis and robust spatial domain clustering
By using a token-gated generative refinement model, combined with graph convolutional networks and diffusion models, the problems of sparse data processing and long-range spatial dependency capture were solved, achieving higher-precision spatial transcriptomics data analysis and improving the effectiveness of tissue heterogeneity and tumor microenvironment research.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-04-03
AI Technical Summary
Existing spatial transcriptomics analysis methods struggle to effectively handle sparse data, fail to efficiently capture long-range spatial dependencies, and do not adequately encode relative location information, resulting in insufficient accuracy and robustness in data analysis.
We employ a token-gated generative refinement model, combining a graph convolutional network with a joint loss function of a zero-inflated negative binomial distribution. We utilize a diffusion model architecture with UGate as the backbone and a similarity-guided mean reconstruction method, integrating gated linear attention and rotational position encoding to achieve denoising of sparse data and capture of long-range spatial dependencies.
It improves the accuracy and robustness of spatial transcriptomics data analysis, enables more accurate identification of spatial domains, enhances the ability to analyze tissue heterogeneity and study the tumor microenvironment, and has broad application potential.
Smart Images

Figure CN121789795A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of bioinformatics, specifically to a token-gated generative refinement model for high-fidelity spatial transcriptomics analysis and robust spatial domain clustering. Background Technology
[0002] Spatial transcriptomics technology can measure gene expression levels while preserving the spatial structure of tissues, providing crucial information for research on tissue structure, tumor microenvironment, and developmental biology. Currently, mainstream spatial transcriptomics sequencing platforms include 10×Visium, Slide-seq, and Stereo-seq, which are based on spatial barcode capture technology. The core idea is to capture mRNA in situ from tissue sections by deploying oligonucleotide probes with spatial barcodes on a chip or substrate, and then combine this with high-throughput sequencing technology to analyze the spatial distribution patterns of gene expression.
[0003] Computational analysis of spatial transcriptome data primarily employs two strategies. One approach involves constructing spatial neighborhood graphs and combining them with graph neural networks for feature learning; representative tools include SpaGCN, STAGATE, DeepST, GraphST, and SEDR. The other approach utilizes single-cell analysis frameworks such as Seurat to integrate spatial information. In recent years, diffusion-based generative methods have also been introduced into this field, such as DiffusionST, which combines graph convolutional networks with a zero-inflated negative binomial distribution model for joint denoising and imputation. However, existing methods still have three limitations. First, spatial transcriptome data generally contains a large number of zero values due to low mRNA capture efficiency and sequencing depth limitations, making it difficult for existing methods to effectively handle such sparse data. Second, the computational complexity of traditional self-attention mechanisms increases quadratically with the number of spatial points, failing to efficiently model long-range spatial dependencies. Finally, most methods encode spatial locations in a relatively simple way, failing to fully utilize relative positional information and limiting the accuracy of spatial domain identification. Therefore, developing a computational framework that simultaneously processes sparse data, efficiently captures spatial dependencies, and fully encodes positional information is imperative. Therefore, there is an urgent need to develop a new computational framework that can effectively handle sparse data, efficiently capture long-range spatial dependencies, and fully encode relative positional information in order to improve the accuracy and robustness of spatial transcriptomics data analysis. Summary of the Invention
[0004] The purpose of this invention is to address the above-mentioned problems by providing a token-gated generative refinement model for high-fidelity spatial transcriptomics analysis and robust spatial domain clustering.
[0005] To achieve the above objectives, the present invention employs the following technical solution: a token-gated generative refinement model for high-fidelity spatial transcriptomics analysis and robust spatial domain clustering, comprising the following steps: S1. Data Acquisition: Acquiring transcriptome data; S2. Data preprocessing: Using the Scanpy software package and its seurat_v3 method, highly variable genes were selected from the collected transcriptome dataset and their expression profiles were normalized. S3. Model Construction: The extracted features are reconstructed through three core modules: a joint loss function based on graph convolutional networks and zero-inflated negative binomial distribution, a diffusion model architecture with UGAt as the backbone, and a mean reconstruction method based on similarity guidance. S4. Performance Evaluation and Optimization.
[0006] In step S1, the transcriptome data includes human dorsolateral prefrontal cortex (DLPFC), breast cancer tissue sections (CID4465), and human breast cancer dataset (Block A, Section 1).
[0007] In step S2, the number of features selected for the hypervariable gene is 4096, and the normalization process includes the following steps: S21. Adjust the library size of each spatial point to a count of 10,000; S22. Perform a natural logarithmic transformation (pseudo-count is 1) and rescale to unit variance without zero centralization; S23. Truncate expression values greater than 10; S24. Spatial transcriptomics data are input into the DenoiseST framework for representation learning.
[0008] The joint loss function based on graph convolutional networks and zero-inflated negative binomial distribution specifically includes the following steps: S411, Model Application: Graph Convolutional Networks aggregate information about each spatial point and its neighboring spatial points; S412. Use a zero-inflated negative binomial model to characterize the sparsity of the data; S413. The returned output is the denoised gene expression matrix x_0; The denoised expression vector of each spatial point in x_0 is reshaped into a 64×64 matrix as a grayscale pseudo-image, with each pixel representing the expression level of a certain gene.
[0009] The diffusion model architecture approach based on UGate includes the following steps: S421. The pseudo-image obtained in step S413 is further enhanced by a diffusion model to generate the denoised gene expression matrix x_0. S421-1. Reshape the expression vector of each spatial point into a 64×64 grayscale pseudo-image block, where each pixel corresponds to the expression level of a gene. S421-2, Input-gated diffusion model is used to capture long-range spatial dependence and the intrinsic structure of gene expression.
[0010] The diffusion model architecture based on UGate includes a forward diffusion process and a backward denoising process; among them, the approximate posterior of the diffusion process... Fixed to a Markov chain, which is scheduled according to variance. Gradually add Gaussian noise; for the gene expression matrix Each step of the diffusion process generates a noise data point, and the entire diffusion process forms a Markov chain, as shown in the following formula: ; ; Here, the variance sequence for each time step is denoted as: The value ranges from 0 to 1. In the diffusion model, this sequence is called the "variance schedule," and in practice, a setting that increases with time steps is used. This allows for the injection of stronger noise in later steps; A key characteristic of the forward diffusion process is that it is based on raw data. Direct sampling at any time step noise data ;get ; For the above transfer equation, first define and , Represented as: ; Secondly, using reparameterization techniques, the cumulative noise is recursively represented. This derivation ultimately yields a non-recursive closed-form solution, and the final form of the closed-form solution is as follows: ; Finally, through inverse reparameterization, we obtain In the form of.
[0011] The inverse denoising process is represented as a Markov chain consisting of a series of Gaussian distributions, whose parameters are predicted by a neural network; therefore, the following formula is obtained: ; in, , Indicates a given hour The joint probability distribution; furthermore, It is a parameterized Gaussian distribution, whose mean and variance are determined by training the network. and Output; The diffusion model, as a latent variable model, has a marginal log-likelihood. Allowing for a variational lower bound, we use its optimization as the training objective; the derivation process is as follows: ; By applying Jensen's inequality, the training objective of the network becomes a negative variational lower bound: ; The training objectives are further broken down as follows: .
[0012] The UGate diffusion model architecture integrates gated linear attention and rotation position encoding modules. The rotation position encoding module implements rotation position encoding through two key operations: applying a rotation embedding operation and a rotation operation. Rotation operations are represented as linear transformations ,in This represents a 90-degree counterclockwise rotation matrix in a 2D plane. The rotation embedding operation integrates sinusoidal position information into the feature representation by performing complex rotations in each embedding subspace. The mathematical representation of the rotation embedding operation in the rotation position encoding module is as follows: ; Given an input feature map, Q, K, and V are generated using a shared 1×1 convolution, and a transformation is applied to both Q and K. The attention output corresponding to the i-th query token is represented as follows: ; The numerator represents the interaction between the kernelized query and the weighted key value buffer, while the denominator provides normalization to maintain numerical stability. To enhance the rank of the key-value buffer, a soft-weighting scheme is introduced: ; in, Represents the aggregate buffer, coefficient Measure the first The context importance of each token is calculated as follows: ; Introducing a token-aware modulation mechanism: ; in, Represents linear projection. It is the element-wise Hadamard product.
[0013] In step S3, the similarity-guided mean reconstruction method includes the following steps: S31. Calculate the similarity between each spatial point pseudo-image generated by the diffusion model and the corresponding pseudo-image before denoising. S32. Select the two pseudo-images with the highest similarity and perform a weighted average to replace the original expression vector; S33. Obtain the gene expression matrix after double denoising and enhancement, which can be used for subsequent spatial domain identification.
[0014] In step S4, the performance evaluation and optimization methods include: ① Adjust the RAND Corporation index; ② Normalized mutual information; ③Fowlkes-Mallows index; The adjusted RAND index ranges from -1 to 1, where 1 represents perfect agreement, 0 corresponds to random assignment, and negative values indicate a worse result than random assignment. The formulas for calculating the RAND index and the adjusted RAND index are as follows: ; ; In the formula: This represents the number of point pairs that have the same category label and belong to the same cluster; This represents the number of point pairs with different category labels that belong to different clusters; n represents the total number of points; This represents the total number of point pairs that can be formed from these n points, and its calculation formula is: , This represents the expected value of the RAND index under random cluster assignment; The normalized mutual information ranges from 0 to 1, where 1 represents complete agreement and 0 represents no correlation. The formula for calculating normalized mutual information is: ; In the formula: This represents the mutual information between clustering results U and V; and Let U and V represent the entropy of the clustering results, respectively. The Fowlkes-Mallows index ranges from 0 to 1, where 1 indicates perfect clustering performance and 0 indicates a complete mismatch. The formulas for calculating the Fowlkes-Mallows index are as follows: ; In the formula: TP (True Positive) represents the number of sample pairs that belong to the same cluster as both the true label and the predicted label. FP (false positive) represents the number of sample pairs that belong to the same cluster as the predicted label but have different actual labels; FN (False Negative) represents the number of sample pairs that belong to the same cluster as the true label but have different predicted labels.
[0015] Compared with the prior art, the advantages of the present invention are as follows:
[0016] (1) TOGAR provides a unified and powerful new model for denoising, enhancement and structural identification of spatial transcriptomics data. It has shown excellent performance in clustering accuracy, imputation performance and spatial structure characterization, and has broad application potential in tissue heterogeneity analysis, tumor microenvironment research and spatial gene regulatory network modeling.
[0017] (2) TOGAR demonstrates excellent cross-resolution generalization performance while recovering the denoised spatial pattern and classifying biologically significant domains such as immune activity and tumor progression.
[0018] (3) On 12 benchmark datasets, TOGAR consistently outperforms the current state-of-the-art methods in terms of clustering accuracy, stability and imputation quality.
[0019] (4) TOGAR successfully depicted fine-grained tumor heterogeneity and clinically relevant immunophenotypes in breast cancer, highlighting its potential to advance precision oncology. Attached Figure Description
[0020] Figure 1 is a flowchart of the method of the present invention; wherein: (A) Select highly variable genes and denoise them by combining a GCN autoencoder with spatial structure and counting distribution with ZINB; (B) The denoised matrix is reconstructed into a pseudo-image and optimized using a UGate-based gated diffusion model and gated linear attention to simulate spatial gene expression distribution. (C) A pseudo-image average repair matrix guided by similarity and unsupervised clustering to identify spatial structural domains; Figure 2 This is a refined clustering and structural annotation diagram of the DLPFC region in this invention; wherein: (A) The box plot shows the adjusted RAND Index (ARI) scores obtained by the seven clustering methods on the DLPFC dataset; (B) Histological images and corresponding hand-annotated images of the original study in DLPFC dataset slice 151676; (C) Clustering results of 151,676 slices of the DLPFC dataset, using a variety of spatial transcriptomics methods, including SpaGCN, STAGATE, DeepST, GraphST, SEDR, DiffusionST, and TOGAR; (D) Comparison of TOGAR with seven other spatial clustering algorithms using normalized mutual information (NMI) scores; Figure 3 This is a schematic diagram illustrating the spatial expression enhancement of layer marker genes in the DLPFC dataset after denoising, as presented in this invention; wherein: (A) Spatial maps of six cortical marker genes in part DLPFC 151673, showing the original data, data after TOGAR denoising and data after STAGATE denoising; (B) Violin diagram of the original expression distribution of marker genes; (C) Violin plot of expression distribution of marker genes in the same layer after TOGAR noise reduction; the cortical regions corresponding to the marker genes in the layer are marked with red boxes; Figure 4 This is a spatial anatomical diagram of the tumor region in a CID4465 slice of breast cancer in this invention; wherein: (A) Visium data for CID4465, including pathologist annotations and outputs from DiffusionST, STAGATE, GraphST, and TOGAR; (B) Bubble diagram of marker gene expression in the three tumor subdomains; (C) Gene ontology enrichment results, purple indicates terms enriched in domain 4, blue indicates terms enriched in domain 1, and p-value is labeled next to each bar. (D) Summarize the heatmap of immune-related ligand-receptor signals in each domain; Figure 5 This is a schematic diagram of the spatial domain spectral analysis of breast cancer tissue with fine resolution in this invention; wherein: (A) Visualization of breast cancer spatial transcriptome data annotated by pathologists, DiffusionST, STAGATE, GraphST, and TOGAR; (B) Visualization of marker gene expression in regions 2, 8 and 11. Detailed Implementation
[0021] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.
[0022] like Figure 1-5 As shown, a token-gated generative refinement model for high-fidelity spatial transcriptomics analysis and robust spatial domain clustering includes the following steps: S1. Data Acquisition: Acquiring transcriptome data; S2. Data preprocessing: Using the Scanpy software package and its seurat_v3 method, highly variable genes were selected from the collected transcriptome dataset and their expression profiles were normalized. S3. Model Construction: The extracted features are reconstructed through three core modules: a joint loss function based on graph convolutional networks and zero-inflated negative binomial distribution, a diffusion model architecture with UGAt as the backbone, and a mean reconstruction method based on similarity guidance. The entire workflow is as follows: Figure 1 As shown.
[0023] S4. Performance Evaluation and Optimization.
[0024] In step S1, the transcriptome data includes human dorsolateral prefrontal cortex (DLPFC), breast cancer tissue sections (CID4465), and human breast cancer dataset (Block A, Section 1).
[0025] This method was developed based on a publicly available spatial transcriptome dataset—provided by the 10×Visium platform. The data can be downloaded from: http: / / research.libd.org / spatialLIBD / ; https: / / drive.google.com / drive / folders / 1qgn2UKpu4q14ysCoCKjWYVEHXIzHNoqq; https: / / github.com / JinmiaoChenLab / SEDR_analyses / tree / master / data / BRCA1 / V1_Human_Breast_Cancer_Block_A_Section_1.
[0026] In step S2, the number of features selected for the hypervariable gene is 4096, and the normalization process includes the following steps: S21. Adjust the library size of each spatial point to a count of 10,000; S22. Perform a natural logarithmic transformation (pseudo-count is 1) and rescale to unit variance without zero centralization; S23. Truncate expression values greater than 10; S24. Spatial transcriptomics data are input into the DenoiseST framework for representation learning.
[0027] These preprocessing steps ensure comparability between spatial points and mitigate the impact of extreme expression values on downstream analysis.
[0028] The joint loss function based on graph convolutional networks and zero-inflated negative binomial distribution specifically includes the following steps: S411, Model Application: Graph Convolutional Networks aggregate information about each spatial point and its neighboring spatial points; S412. Use a zero-inflated negative binomial model to characterize the sparsity of the data; S413. The returned output is the denoised gene expression matrix x_0; The denoised expression vector of each spatial point in x_0 is reshaped into a 64×64 matrix as a grayscale pseudo-image, with each pixel representing the expression level of a certain gene.
[0029] These pseudo-images are then fed into a gated diffusion module for enhancement.
[0030] The diffusion model architecture approach based on UGate includes the following steps: S421. The pseudo-image obtained in step S413 is further enhanced by a diffusion model to generate the denoised gene expression matrix x_0. S421-1. Reshape the expression vector of each spatial point into a 64×64 grayscale pseudo-image block, where each pixel corresponds to the expression level of a gene. S421-2, Input-gated diffusion model is used to capture long-range spatial dependence and the intrinsic structure of gene expression.
[0031] The diffusion model architecture based on UGate includes a forward diffusion process and a backward denoising process; among them, the approximate posterior of the diffusion process... Fixed to a Markov chain, which is scheduled according to variance. Gradually add Gaussian noise; for the gene expression matrix Each step of the diffusion process generates a noise data point, and the entire diffusion process forms a Markov chain, as shown in the following formula: ; ; Here, the variance sequence for each time step is denoted as: The value ranges from 0 to 1. In the diffusion model, this sequence is called the "variance schedule," and in practice, a setting that increases with time steps is used. This allows for the injection of stronger noise in later steps; If the scheduling design is reasonable and the number of diffusion steps is sufficient, the cumulative product of the "retention coefficients" at each step will approach zero, and the final state will be close to pure noise, thus essentially losing all discernible information about the original data; an important characteristic of the forward diffusion process is that it is based on the original data Direct sampling at any time step noise data ;get ; For the above transfer equation, first define and , Represented as: ; Secondly, using reparameterization techniques, the cumulative noise is recursively represented. This derivation ultimately yields a non-recursive closed-form solution, and the final form of the closed-form solution is as follows: ; Finally, through inverse reparameterization, we obtain In the form of.
[0032] The denoising process performed by the reverse chain is transferred from the accurate posterior. It can be seen that obedience is possible. pure noise Starting with iterative sampling Noise is gradually removed and data is restored to ultimately generate true samples. Therefore, the reverse process achieves data generation. Neural networks can be used to estimate the actual distribution. The inverse denoising process is expressed as a Markov chain consisting of a series of Gaussian distributions, whose parameters are predicted by a neural network; therefore, the following formula is obtained: ; in, , Indicates a given hour The joint probability distribution; furthermore, It is a parameterized Gaussian distribution, whose mean and variance are determined by training the network. and Output; Unlike variational autoencoders, diffusion models introduce the influence of observed data. Potential trajectories with the same dimension .
[0033] The encoder is a fixed forward diffusion process. The noise scheduling is pre-set and requires no training; it can be viewed as a Markov chain. The diffusion model, as a latent variable model, has a marginal log-likelihood. Allowing for a variational lower bound, we use its optimization as the training objective; the derivation process is as follows: ; By applying Jensen's inequality, the training objective of the network becomes a negative variational lower bound: ; The training objectives are further broken down as follows: .
[0034] In other words, the model no longer directly predicts the mean, but learns to predict each... noise item Given that noise shares the same dimension as the input data, UGate is used as the noise prediction network. UGate follows an encoder-decoder architecture, where the encoder progressively samples feature maps, while the decoder symmetrically recovers spatial resolution. To mitigate gradient vanishing and preserve semantic details, a cross-layer skip connection is introduced between the encoder and decoder stages. Structurally, UGate is a variant of the U-Net architecture, enhancing dual residual blocks at each stage, followed by a gated self-attention module that strengthens long-range dependency modeling. Temporal embeddings are injected into each residual block, allowing the model to dynamically adapt to different denoising steps and enabling the reuse of a single architecture across all time steps, thus improving parameter efficiency. To enhance representation capabilities, a multi-head attention mechanism replaces the original single-head attention. Eight parallel attention heads are configured, increasing feature diversity and improving the model's ability to capture multi-scale patterns.
[0035] The UGate diffusion model architecture integrates gated linear attention and rotation position encoding modules on top of the U-Net architecture. The rotation position encoding module implements rotation position encoding through two key operations: applying rotation embedding and rotation. These operations together facilitate the effective integration of relative position information into the model's representation space. The following sections detail these two operations. Specifically: Rotation operations are represented as linear transformations ,in This represents a 90-degree counterclockwise rotation matrix in a 2D plane. The rotation embedding operation integrates sinusoidal position information into the feature representation by performing complex rotations in each embedding subspace. Mathematically, this operation can be expressed as an element-wise combination of the original tensor and its rotated counterpart, modulated by sine and cosine position components. The mathematical representation of the rotation embedding operation in the rotation position encoding module is as follows: ; Gated self-attention modules are proposed as an enhanced linear attention mechanism, improving the computational efficiency and representational power of vision-based transformer architectures. In our framework, the standard linear attention layers in the encoder and decoder blocks of the U-Net backbone are replaced in the gated linear attention module.
[0036] The gated self-attention module integrates two key innovations. First, a token-based gating mechanism modulates the attention output by embedding local features. Second, a rank-enhanced linear attention scheme addresses the low-rank problem commonly found in kernelized attention methods.
[0037] Given the input feature maps, Q, K, and V are generated using a shared 1×1 convolution. To construct a positive smooth kernel function, we apply a transformation to both Q and K. By design, this kernel selection ensures non-negativity and smoothness, thereby promoting stable attention-based computation.
[0038] In this configuration, the attention output corresponding to the i-th query token is represented as follows: ; The numerator represents the interaction between the kernelized query and the weighted key value buffer, while the denominator provides normalization to maintain numerical stability. To enhance the rank of the key-value buffer, a soft-weighting scheme is introduced: ; in, Represents the aggregate buffer, coefficient Measure the first The context importance of each token is calculated as follows: ; This globally weighted formula amplifies informational tokens and improves the diversity of buffer representations.
[0039] Nevertheless, the final output It still exhibits a finite rank, especially when κ(Qi) lacks variation; where This is a normalization term. To alleviate this problem, a token-aware modulation mechanism is introduced: ; in, Represents linear projection. It is an element-wise Hadamard product. This step re-injects token-specific information, increasing the output rank and local expressiveness.
[0040] In step S3, the similarity-guided mean reconstruction method includes the following steps: S31. Calculate the similarity between each spatial point pseudo-image generated by the diffusion model and the corresponding pseudo-image before denoising. S32. Select the two pseudo-images with the highest similarity and perform a weighted average to replace the original expression vector; S33. Obtain the gene expression matrix after double denoising and enhancement, which can be used for subsequent spatial domain identification.
[0041] In step S4, the performance evaluation and optimization methods include: ① Adjust the RAND Corporation index; ② Normalized mutual information; ③Fowlkes-Mallows index; The adjusted RAND index measures the similarity between two clustering results and adjusts for the impact of random consistency. It is based on pairwise comparisons of data points, evaluating whether sample pairs are assigned to the same or different clusters in two clustering schemes. The adjusted RAND index ranges from -1 to 1, where 1 represents perfect consistency, 0 corresponds to random labeling, and a negative value indicates a worse result than random partitioning. The formulas for calculating the RAND index and the adjusted RAND index are as follows: ; ; In the formula: This represents the number of point pairs that have the same category label and belong to the same cluster; This represents the number of point pairs with different category labels that belong to different clusters; n represents the total number of points; This represents the total number of point pairs that can be formed from these n points, and its calculation formula is: , This represents the expected value of the RAND index under random cluster assignment; The Random Integrity (RI) measures cluster consistency by the proportion of correctly matched point pairs (including those within the same cluster and those from different clusters) to the total number of point pairs. The adjusted RAND index normalizes the RI score, taking into account the expected value of the RI score when clusters are randomly assigned, thus correcting for the influence of random clustering and making the evaluation results more reliable.
[0042] Normalized mutual information (MFI) measures the correlation between cluster assignments and true labels, but does not include correction for random consistency. It captures the normalized cross-dependency between two clustering results. The value of MFI ranges from 0 to 1, where 1 represents perfect consistency and 0 represents no correlation. The formula for calculating MFI is: ; In the formula: This represents the mutual information between clustering results U and V; and Let U and V represent the entropy of the clustering results, respectively. Normalized mutual information eliminates the influence of entropy differences by normalizing mutual information, making comparisons between different datasets and clustering results more reasonable.
[0043] The Fowlkes-Mallows index is a geometric mean of precision and recall in pairwise classification. It assesses whether pairs of samples are correctly grouped into the same or different clusters. The Fowlkes-Mallows index ranges from 0 to 1, where 1 indicates perfect clustering performance and 0 indicates no match. The formulas for calculating the Fowlkes-Mallows index are as follows: ; In the formula: TP (True Positive) represents the number of sample pairs that belong to the same cluster as both the true label and the predicted label. FP (false positive) represents the number of sample pairs that belong to the same cluster as the predicted label but have different actual labels; FN (False Negative) represents the number of sample pairs that belong to the same cluster as the true label but have different predicted labels.
[0044] The Fowlkes-Mallows index, as the geometric mean of precision and recall, comprehensively evaluates the accuracy and completeness of clustering results in identifying the true cluster structure.
[0045] like Figure 2 As shown, in comparative experiments with other mainstream models, the TOGAR model achieved the highest ARI scores on seven datasets and tied for first place with DiffusionST on one dataset. The ARI distribution visualization results highlight TOGAR's superior clustering stability and accuracy; its lowest ARI score exceeds the highest value achievable by Seurat, a widely used tool in this field. Overall, these results demonstrate that TOGAR excels in modeling spatial dependencies in transcriptomics data, generating more accurate and stable clustering results compared to existing methods. Its stronger ability to preserve spatial relationships highlights its practical value in spatial domain identification and downstream biological interpretation.
[0046] like Figure 3As shown, the genes compared in this study include ATP2B4, RASGRF2, NEFH, NTNG2, LAMP5, and B3GALT2. Using TOGAR to denoise the highly variable genomes in the DLPFC dataset, the model clearly reveals the spatial distribution of gene expression. For example, for the LAMP5 gene, compared to the results of STAGATE, TOGAR denoising reveals a differentially expressed second layer, while the spatial expression in the original data is completely chaotic. Furthermore, TOGAR also plays a role in denoising other layers. Comparing the original expression with the TOGAR-denoised expression using violin plots shows that TOGAR can enhance the spatial patterns of layer-marked genes. Overall, these results demonstrate that TOGAR can reduce noise and enhance spatial expression patterns, further proving its advantages in imputation efficiency and preservation of spatial expression patterns.
[0047] like Figure 4 As shown, this study benchmarked TOGAR on the CID4465 dataset of breast cancer slides. Despite the poor sample quality, TOGAR still achieved the highest ARI score, generating partitions consistent with pathologist labels and with clearer boundaries, outperforming STAGATE, GraphST, and DiffusionST. The model identified four distinct transcriptomic subdomains in the tumor region, distributed along two main axes: extracellular matrix remodeling and immune activity. Extracellular matrix remodeling markers (SPP1, MMP1, MMP7) were enriched in domain 4, while immune infiltration markers (HLA-DPB1, IGHG4, IGHA1) were enriched in domain 1. GO enrichment analysis showed that domain 4 emphasized tissue remodeling and cell adhesion, while domain 1 emphasized immune recognition and antigen presentation. Intercellular communication analysis indicated that domain 4 had higher immune signal intensity, reflecting progression-oriented tumor features, while domain 1 showed significant immune involvement.
[0048] like Figure 5As shown, TOGAR's performance was further validated on another breast cancer dataset. The results showed that TOGAR not only highly matched expert pathology annotations but also outperformed methods such as STAGATE, GraphST, and DiffusionST in delineating tumor structures. TOGAR achieved more refined spatial segmentation in the tumor region, successfully identifying four distinct domains in the invasive ductal carcinoma (IDC) region. Immune-related gene expression analysis revealed that in domain 8, the expression of CXCL9, HLA-A, and HLA-DRA genes was significantly downregulated, while the expression of LINC00052 gene was significantly upregulated. This expression characteristic suggests that the tumor in this domain has stronger invasiveness. Decreased CXCL9 indicates impaired immune cell recruitment, while decreased HLA-A and HLA-DRA reflect weakened antigen presentation capabilities. Increased LINC00052 is associated with enhanced tumor cell proliferation and invasion. All these factors indicate that the tumor microenvironment in this region is developing towards more malignant characteristics and immune escape capabilities.
[0049] In summary, the principle of this embodiment is to propose a novel computational framework called TOGAR, which can effectively handle sparse data, efficiently capture long-range spatial dependencies, and fully encode relative positional information, thereby improving the accuracy and robustness of spatial transcriptomics data analysis. This innovative model is a token-gated generative refinement model that integrates denoising, spatial enhancement, and clustering functions, specifically designed for spatial transcriptomics analysis. Firstly, by combining graph convolutional network loss with a loss function based on a zero-inflated negative binomial distribution, the model effectively reduces noise in sparse count data and enhances signal clarity. Based on this, the model adopts a UGate-based diffusion backbone network architecture, which deeply integrates token gating, gated linear attention, and rotational positional encoding techniques to achieve high-quality generative spatial refinement. Furthermore, by performing similarity-guided averaging along the diffusion trajectory, the model can provide robust site-level estimation and generate well-defined spatial domains when clustering the refined representations, thus laying a solid foundation for subsequent in-depth analysis.
[0050] With the continuous enrichment of spatial transcriptome data, this invention can be extended to larger-scale spatial transcriptome data to further improve the model's generalization ability. It can also be further developed into a bioinformatics tool or online platform to realize real-time analysis and spatial domain identification of spatial transcriptome data, providing auxiliary support for tumor heterogeneity research, precision medicine, and clinical diagnosis.
[0051] The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to substitute them, without departing from the spirit of the invention or exceeding the scope defined by the appended claims.
Claims
1. A token-gated generative refinement model for high-fidelity spatial transcriptomics analysis and robust spatial domain clustering, characterized in that, Includes the following steps: S1. Data Acquisition: Acquiring transcriptome data; S2. Data preprocessing: Using the Scanpy software package and its seurat_v3 method, highly variable genes were selected from the collected transcriptome dataset and their expression profiles were normalized. S3. Model Construction: The extracted features are reconstructed through three core modules: a joint loss function based on graph convolutional networks and zero-inflated negative binomial distribution, a diffusion model architecture with UGAt as the backbone, and a mean reconstruction method based on similarity guidance. S4. Performance Evaluation and Optimization.
2. The token-gated generative refinement model for high-fidelity spatial transcriptomics analysis and robust spatial domain clustering according to claim 1, characterized in that, In step S1, the transcriptome data includes human dorsolateral prefrontal cortex (DLPFC), breast cancer tissue sections (CID4465), and human breast cancer dataset (Block A, Section 1).
3. The token-gated generative refinement model for high-fidelity spatial transcriptomics analysis and robust spatial domain clustering according to claim 1, characterized in that, In step S2, the number of features selected for the hypervariable gene is 4096, and the normalization process includes the following steps: S21. Adjust the library size of each spatial point to a count of 10,000; S22. Perform a natural logarithmic transformation (pseudo-count is 1) and rescale to unit variance without zero centralization; S23. Truncate expression values greater than 10; S24. Spatial transcriptomics data are input into the DenoiseST framework for representation learning.
4. The token-gated generative refinement model for high-fidelity spatial transcriptomics analysis and robust spatial domain clustering according to claim 1, characterized in that, The joint loss function based on graph convolutional networks and zero-inflated negative binomial distribution specifically includes the following steps: S411, Model Application: Graph Convolutional Networks aggregate information about each spatial point and its neighboring spatial points; S412. Use a zero-inflated negative binomial model to characterize the sparsity of the data; S413. The returned output is the denoised gene expression matrix x_0; The denoised expression vector of each spatial point in x_0 is reshaped into a 64×64 matrix as a grayscale pseudo-image, with each pixel representing the expression level of a certain gene.
5. The token-gated generative refinement model for high-fidelity spatial transcriptomics analysis and robust spatial domain clustering according to claim 4, characterized in that, The diffusion model architecture method based on UGate includes the following steps: S421. The pseudo-image obtained in step S413 is further enhanced by a diffusion model to generate the denoised gene expression matrix x_0. S421-1. Reshape the expression vector of each spatial point into a 64×64 grayscale pseudo-image block, where each pixel corresponds to the expression level of a gene. S421-2, Input-gated diffusion model is used to capture long-range spatial dependence and the intrinsic structure of gene expression.
6. The token-gated generative refinement model for high-fidelity spatial transcriptomics analysis and robust spatial domain clustering according to claim 5, characterized in that, The diffusion model architecture based on UGate includes a forward diffusion process and a backward denoising process; wherein, the approximate posterior of the diffusion process... Fixed to a Markov chain, which is scheduled according to variance. Gradually add Gaussian noise; for the gene expression matrix Each step of the diffusion process generates a noise data point, and the entire diffusion process forms a Markov chain, as shown in the following formula: ; ; Here, the variance sequence for each time step is denoted as: The value ranges from 0 to 1. In the diffusion model, this sequence is called "variance scheduling," and in practice, a setting that increases with time steps is used. This allows for the injection of stronger noise in later steps; A key characteristic of the forward diffusion process is that it is based on raw data. Direct sampling at any time step noise data ;get ; For the above transfer equation, first define and , Represented as: ; Secondly, using reparameterization techniques, the cumulative noise is recursively represented. This derivation ultimately yields a non-recursive closed-form solution, and the final form of the closed-form solution is as follows: ; Finally, through inverse reparameterization, we obtain In the form of.
7. The token-gated generative refinement model for high-fidelity spatial transcriptomics analysis and robust spatial domain clustering according to claim 6, characterized in that, The inverse denoising process is described as a Markov chain consisting of a series of Gaussian distributions, whose parameters are predicted by a neural network; therefore, the following formula is obtained: ; in, , Indicates a given hour The joint probability distribution; furthermore, It is a parameterized Gaussian distribution, whose mean and variance are determined by the training network. and Output; The diffusion model, as a latent variable model, has a marginal log-likelihood. Allowing for a variational lower bound, we optimize this lower bound as the training objective; the derivation process is as follows: ; By applying Jensen's inequality, the training objective of the network becomes a negative variational lower bound: ; The training objectives are further broken down as follows: 。 8. The token-gated generative refinement model for high-fidelity spatial transcriptomics analysis and robust spatial domain clustering according to claim 7, characterized in that, The UGate diffusion model architecture integrates gated linear attention and rotational position encoding modules; the rotational position encoding module implements rotational position encoding through two key operations: applying a rotational embedding operation and a rotation operation; wherein: Rotation operations are represented as linear transformations ,in This represents a 90-degree counterclockwise rotation matrix in a 2D plane. The rotation embedding operation integrates sinusoidal position information into the feature representation by performing complex rotations in each embedding subspace. The mathematical representation of the rotation embedding operation in the rotation position encoding module is as follows: ; Given an input feature map, Q, K, and V are generated using a shared 1×1 convolution, and a transformation is applied to both Q and K. The attention output corresponding to the i-th query token is represented as follows: ; The numerator represents the interaction between the kernelized query and the weighted key value buffer, while the denominator provides normalization to maintain numerical stability. To enhance the rank of the key-value buffer, a soft-weighting scheme is introduced: ; in, Represents the aggregate buffer, coefficient Measure the first The context importance of each token is calculated as follows: ; Introducing a token-aware modulation mechanism: ; in, Represents linear projection. It is the element-wise Hadamard product.
9. The token-gated generative refinement model for high-fidelity spatial transcriptomics analysis and robust spatial domain clustering according to claim 8, characterized in that, In step S3, the similarity-guided mean reconstruction method includes the following steps: S31. Calculate the similarity between each spatial point pseudo-image generated by the diffusion model and the corresponding pseudo-image before denoising. S32. Select the two pseudo-images with the highest similarity and perform a weighted average to replace the original expression vector; S33. Obtain the gene expression matrix after double denoising and enhancement, which can be used for subsequent spatial domain identification.
10. The token-gated generative refinement model for high-fidelity spatial transcriptomics analysis and robust spatial domain clustering according to claim 9, characterized in that, In step S4, the performance evaluation and optimization methods include: ① Adjust the RAND Corporation index; ② Normalized mutual information; ③Fowlkes-Mallows index; The adjusted Rand index ranges from -1 to 1, where 1 represents perfect agreement, 0 corresponds to random labeling, and a negative value indicates a worse result than random assignment. The formulas for calculating the Rand index and the adjusted Rand index are as follows: ; ; In the formula: This represents the number of point pairs that have the same category label and belong to the same cluster; This represents the number of point pairs with different category labels that belong to different clusters; n represents the total number of points; This represents the total number of point pairs that can be formed from these n points, and its calculation formula is: , This represents the expected value of the RAND index under random cluster assignment; The normalized mutual information ranges from 0 to 1, where 1 represents complete consistency and 0 represents no correlation; the formula for calculating the normalized mutual information is: ; In the formula: This represents the mutual information between clustering results U and V; and Let U and V represent the entropy of the clustering results, respectively. The Fowlkes-Mallows index ranges from 0 to 1, where 1 indicates perfect clustering performance and 0 indicates a complete mismatch. The formulas for calculating the Fowlkes-Mallows index are as follows: ; In the formula: TP (True Positive) represents the number of sample pairs that belong to the same cluster as both the true label and the predicted label. FP (false positive) represents the number of sample pairs that belong to the same cluster as the predicted label but have different actual labels; FN (False Negative) represents the number of sample pairs that belong to the same cluster as the true label but have different predicted labels.