Multi-granularity clustering method and system for cross-batch single-cell spatial omics data

By employing a triplet alignment method based on a dual-path parallel graph encoder and online pseudo-label generation, the problems of multi-scale clustering and cross-batch integration in spatial omics data were solved. This enabled self-driven discovery and robust integration of multi-granular cellular and tissue structures, improving the accuracy of cellular heterogeneity characterization and data integration.

CN122135793AActive Publication Date: 2026-06-02SHANDONG UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANDONG UNIV
Filing Date
2026-05-08
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Existing spatial omics methods cannot simultaneously reveal macroscopic organizational structure and fine-grained cellular niches in cluster analysis, and fine-grained information is lost during cross-batch integration, making it difficult to preserve biologically significant cellular heterogeneity.

Method used

A dual-path parallel graph encoder is used to model molecular expression and spatial structure separately. Combined with online pseudo-label generation and spatial topology-aware triplet alignment, unsupervised discovery and robust cross-batch integration of multi-granularity cellular tissue structures are achieved.

Benefits of technology

Without external annotation, we achieved multi-scale clustering discovery from coarse-grained tissue domains to fine-grained cellular niches, preserving fine-grained biological heterogeneity within samples and improving the accuracy of cellular heterogeneity characterization and the reliability of cross-batch data integration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122135793A_ABST
    Figure CN122135793A_ABST
Patent Text Reader

Abstract

This invention belongs to the field of spatial omics data analysis technology, and particularly relates to a multi-granularity clustering method and system for cross-batch single-cell spatial omics data. It includes acquiring raw spatial omics data and constructing spatial neighborhood maps and molecular feature similarity maps; constructing a dual-path parallel graph encoder to independently model the molecular feature similarity map and spatial neighborhood map, obtaining two modality-specific cell graph embeddings, and fusing the cell graph embeddings into a unified joint embedding; progressively refining the geometric structure of the joint embedding to achieve self-driven discovery of multi-granularity cell and tissue structures; and obtaining multi-level clustering results including cell type classification, spatial domain classification, and cell niche classification based on the two modality-specific cell graph embeddings and the refined joint embedding. This invention overcomes the limitations of single-view methods in characterizing cellular heterogeneity by modeling and fusing two types of biological signals: molecular expression and spatial structure, separately.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of single-cell spatial omics data analysis technology, and particularly relates to a multi-granularity clustering method and system for cross-batch single-cell spatial omics data. Background Technology

[0002] Space omics technology offers unprecedented resolution for studying tissue development, disease progression, and cellular microenvironment heterogeneity by simultaneously measuring the molecular characteristics and spatial location of cells in tissue sections. However, existing computational methods face fundamental technical bottlenecks in translating spatial molecular information into biological insights, severely limiting their application value.

[0003] Existing methods generally employ a single fixed resolution for cluster analysis of spatial omics data in spatial graph embedding, leading to an irreconcilable contradiction between coarse-grained tissue domain segmentation and fine-grained cellular niche identification. While obtaining macroscopic tissue structure, they inevitably obscure fine-grained spatial heterogeneity with key functional significance, such as tumor immune boundaries and fibrous matrix barriers.

[0004] Therefore, the core problem that needs to be solved is how to obtain multi-scale clustering results from single-cell spatial omics data without any external annotation. Summary of the Invention

[0005] To overcome the shortcomings of the prior art, this invention provides a multi-granularity clustering method and system for cross-batch single-cell spatial omics data. It designs a unified deep learning framework that combines a dual-path parallel graph encoder, online pseudo-label metric learning, and cross-slice neighboring triplet alignment, aiming to simultaneously achieve unsupervised discovery and robust cross-batch integration of multi-granularity cellular and tissue structures from multimodal spatial omics data.

[0006] To achieve the above objectives, one or more embodiments of the present invention provide the following technical solutions: The first aspect of this invention provides a multi-granularity clustering method for cross-batch single-cell spatial omics data.

[0007] A multi-granularity clustering method for cross-batch single-cell spatial omics data includes the following steps: Acquire raw spatial omics data and construct spatial neighborhood maps and molecular feature similarity maps; A dual-path parallel graph encoder is constructed to independently model molecular feature similarity graphs and spatial neighborhood graphs, resulting in two modality-specific cell graph embeddings. The cell graph embeddings are then fused into a unified joint embedding. By generating online pseudo-labels and constructing spatial topology-aware triples, the geometric structure of joint embedding is gradually refined to achieve self-driven discovery of multi-granularity cellular and tissue structures. Based on two modality-specific cell graph embeddings and a refined joint embedding, multi-level clustering results including cell type classification, spatial domain classification, and cell niche classification are obtained.

[0008] A second aspect of the present invention provides a multi-granularity clustering system for cross-batch single-cell spatial omics data.

[0009] A multi-granularity clustering system for cross-batch single-cell spatial omics data, including: The graph construction module is configured to: acquire raw spatial omics data and construct spatial neighborhood graphs and molecular feature similarity graphs. The graph embedding acquisition module is configured to: construct a dual-path parallel graph encoder, independently model molecular feature similarity graphs and spatial neighborhood graphs to obtain two modality-specific cell graph embeddings, and fuse the cell graph embeddings into a unified joint embedding; The joint embedding optimization module is configured to: gradually refine the geometric structure of the joint embedding through online pseudo-label generation and spatial topology-aware triplet construction, thereby achieving self-driven discovery of multi-granularity cellular and tissue structures; The multi-level clustering module is configured to obtain multi-level clustering results, including cell type division, spatial domain division, and cell niche division, based on two modality-specific cell graph embeddings and refined joint embeddings.

[0010] The above one or more technical solutions have the following beneficial effects: This invention provides a multi-granularity clustering method and system for cross-batch single-cell spatial omics data. It proposes a dual-path parallel graph encoder architecture, which models and fuses two types of biological signals, molecular expression and spatial structure, respectively. It retains modality-specific discriminative structures in a unified embedding space, providing an information-rich representation basis for multi-granularity analysis and overcoming the limitations of single-view methods in characterizing cellular heterogeneity.

[0011] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0012] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.

[0013] Figure 1 This is a diagram showing the overall execution steps of Example 1.

[0014] Figure 2 This is a flowchart of the method in Example 1. Detailed Implementation

[0015] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0016] It should be noted that the terminology used herein is for the purpose of describing particular implementations only and is not intended to limit the exemplary implementations of the present invention.

[0017] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.

[0018] Overall invention concept: This invention provides a multi-granularity clustering method and system for cross-batch single-cell spatial omics data based on multi-view representation learning. The core problem to be solved is: (1) Difficulty in resolving multi-scale spatial heterogeneity: Existing spatial omics methods use fixed resolution to divide tissues into spatial domains, which cannot simultaneously reveal macroscopic tissue structure and fine-grained cellular niches, thus obscuring the essence of multi-level functional tissues within tissues.

[0019] (2) Loss of fine-grained information in cross-batch integration: Existing batch correction methods mainly use global representation alignment, which tends to eliminate all differences between samples, resulting in biologically significant fine-grained cellular heterogeneity being over-smoothed during integration.

[0020] To address the aforementioned technical issues, the method provided by this invention first preprocesses the raw spatial omics data, constructing spatial neighborhood maps and molecular feature similarity maps respectively. Subsequently, a dual-path parallel graph convolutional encoder is used to independently model molecular expression information and spatial structure information, and then merges the two into a unified joint embedding space. Furthermore, an online pseudo-label generation mechanism based on the Leiden clustering algorithm is utilized, combined with a spatial topology-aware triplet positive and negative sample construction strategy and dynamic weight metric learning, to achieve multi-scale clustering discovery from coarse-grained organizational domains to fine-grained cellular niches without any external annotation.

[0021] In multi-slice scenarios, robust batch effect elimination is achieved by cross-slice mutual nearest neighbor identification and neighborhood-level enhanced representation construction, combined with the second-order statistical alignment term of the Gram matrix, while preserving fine-grained biological heterogeneity within the sample.

[0022] The innovation of this invention in the field of space omics computational analysis is mainly reflected in the following three aspects: (1) Multi-view joint embedding framework: Unlike existing methods that rely on a single view to embed cells, this invention constructs a dual-path parallel graph encoder that models molecular expression features and spatial neighborhood structures separately, and merges the two into a unified joint embedding space. This enables the model to simultaneously possess the ability to perceive cell similarity at the molecular level and neighborhood structure at the spatial level, significantly improving the accuracy of characterizing cell heterogeneity.

[0023] (2) Self-driven multi-granularity metric learning for spatial topology awareness: This invention proposes an online triplet metric learning strategy based on Leiden clustering pseudo-labels. By selecting positive samples with dual constraints and mining hard negative samples in boundary regions, it achieves progressive multi-scale clustering discovery from coarse-grained tissue domains to fine-grained cellular niches without any external annotations, breaking through the limitations of single-resolution clustering in existing methods.

[0024] (3) Batch correction strategy for neighborhood-level microenvironment alignment: This invention proposes a mutual nearest neighbor cross-slice triplet correction method based on enhanced neighborhood representation, which elevates batch alignment from isolated cell point matching to the local cellular microenvironment structure level, and introduces a second-order statistical alignment term of the Gram matrix to apply constraints at both the point level and the distribution level, thereby effectively protecting fine-grained biological heterogeneity while eliminating technical batch effects.

[0025] The method provided by this invention can be implemented in the fields of computational biology and spatial omics data analysis, and is particularly suitable for complex scenarios such as tumor microenvironment analysis, identification of fine brain region structures, and joint analysis of multiple samples in spatial omics. Using the method provided by this invention, researchers can simultaneously obtain multi-granularity cellular spatial organization atlases without manual annotation, and retain the true biological cellular state differences in the integration of multiple batches of data, which has high practical application value for precision medicine research.

[0026] Example 1 This embodiment discloses a multi-granularity clustering method for cross-batch single-cell spatial omics data.

[0027] like Figure 1 As shown, the multi-granularity clustering method for cross-batch single-cell spatial omics data includes the following steps: Acquire raw spatial omics data and construct spatial neighborhood maps and molecular feature similarity maps; A dual-path parallel graph encoder is constructed to independently model molecular feature similarity graphs and spatial neighborhood graphs, resulting in two modality-specific cell graph embeddings. The cell graph embeddings are then fused into a unified joint embedding. By generating online pseudo-labels and constructing spatial topology-aware triples, the geometric structure of joint embedding is gradually refined to achieve self-driven discovery of multi-granularity cellular and tissue structures. Based on two modality-specific cell graph embeddings and a refined joint embedding, multi-level clustering results including cell type classification, spatial domain classification, and cell niche classification are obtained.

[0028] The method provided in this embodiment aims to solve two core challenges in space omics data analysis: multi-scale cellular heterogeneity resolution and cross-batch data integration. Overall: (1) The first technical problem to be solved in this embodiment is how to identify multi-scale spatial organizational structures of cell type classification, coarse-grained tissue domains and fine-grained cell niches from spatial omics data without any external annotation.

[0029] Existing methods typically cluster the spatial embeddings of tissue slices at a single resolution, only presenting macroscopic tissue region divisions. Attempts to re-run clustering at a finer granularity often lack hierarchical consistency with coarse-grained results, and the results rely on manual parameter selection, resulting in poor reproducibility. Furthermore, existing methods lack effective discriminative constraints in unlabeled scenarios, blurring the boundaries between different cell types and functional states within the embedding space, making it difficult for fine-grained niches to emerge spontaneously from the embeddings.

[0030] To address this issue, this invention constructs a dual-path parallel graph encoder that models molecular expression features and spatial neighborhood structures separately, and merges them into a unified joint embedding. Based on this, an online triplet metric learning mechanism based on Leiden clustering pseudo-labels is introduced. Through a spatial topology-aware positive and negative sample construction strategy, the embedding geometry is simultaneously refined at different resolution levels, thereby enabling self-driven, progressive multi-scale discovery from coarse-grained organizational domains to fine-grained cellular niches.

[0031] (2) The second technical problem to be solved by the present invention is how to effectively eliminate the batch effect of technology in multi-slice or cross-platform joint analysis scenarios, while preserving the fine-grained cellular heterogeneity with biological significance among samples.

[0032] Significant systematic biases exist in spatial omics data generated from different batches, individuals, or sequencing platforms, making it difficult to establish correspondences across cell types in different samples. Existing batch correction methods typically force cross-batch embeddings closer together at the isolated cell level. On the one hand, this is highly sensitive to sequencing noise, and random fluctuations in single-cell embeddings can easily lead to erroneous correspondences. On the other hand, it tends to eliminate all differences between batches, erasing fine-grained differences in cell state with real biological significance, thus losing important scientific information.

[0033] To address this issue, this embodiment proposes a neighborhood-level enhanced representation construction strategy based on mutual nearest neighbors (MNN). It replaces single-point embeddings with neighborhood aggregation features containing the mean and standard deviation as cross-batch correspondence units, significantly improving robustness to noise. Furthermore, it introduces a second-order statistical alignment term of the Gram matrix into the triplet batch correction loss, enabling batch correction to be performed simultaneously at both the point-level correspondence and distribution-level statistical levels. This effectively protects fine-grained biological heterogeneity within the sample while eliminating technical batch bias.

[0034] Next, we will combine the appendix Figure 2 The technical solution of this embodiment will be explained in detail. Figure 2 As shown, the method in this embodiment includes the following steps: S101, Data Preprocessing and Cell Map Construction.

[0035] In this step, raw spatial omics data is acquired, gene filtering, normalization, and high-variability gene screening are performed, and spatial neighborhood maps and molecular feature similarity maps are constructed to provide multimodal graph structure input for subsequent coding modules.

[0036] The specific implementation method of step S101 is as follows: S1011, gene filtering and expression normalization.

[0037] Obtain the feature expression matrix of spatial transcriptome data ,in Cell count, The feature dimension is used. Genes expressed in fewer than 5 cells are filtered out, the original counts are normalized to library size and logarithmically transformed, and the top 3000 hypervariable genes are selected to construct a counting matrix.

[0038] S1012, Spatial Neighborhood Graph Construction.

[0039] based on The nearest neighbor relationship transforms the physical spatial coordinates of a cell into an undirected neighborhood graph. , by adjacency matrix This means that if and only if the node For nodes of When neighbors Otherwise, it is 0. This represents an element in the adjacency matrix, which defines the pair of nodes in the organization's physical space. Are there any edges connecting them? Indicates the first Each cell node Indicates the first Each cell node; Indicates by the first The cell and the first Cell pairs consisting of individual cells.

[0040] S1013, Molecular feature similarity map construction.

[0041] based on Nearest neighbor relationships calculate the pairwise similarity of gene expression between cells in the gene expression feature space, connecting each cell. Calculate the nearest neighbors to construct a molecular similarity map independent of physical distance. , by adjacency matrix express.

[0042] S102, dual-path parallel graph coding and joint embedding fusion.

[0043] In this step, a dual-path parallel graph encoder is constructed to independently model signals at different levels based on feature maps and spatial maps, and then merge them into a unified joint embedding space. At the same time, the original molecular expression is reconstructed through a decoder to constrain the embedding to retain key biological information.

[0044] The specific implementation method of step S102 is as follows: S1021, dual-path parallel graph encoding.

[0045] Using a depth map convolutional network as the backbone encoder, the feature map and spatial map are encoded separately to obtain context-aware cell embeddings:

[0046]

[0047] in, and For modality-specific graph convolutional encoders, This represents the encoder used to learn the feature map embeddings. This represents the encoder used to learn spatial graph embeddings; The scrambled feature matrix; Here is the perturbation adjacency matrix used for self-supervised contrastive learning. This represents the adjacency matrix of the feature map after shuffling the node order. This represents the adjacency matrix of the spatial graph after the node order has been shuffled. and These are cell embeddings of the perceptual feature map and the spatial neighborhood map context, respectively; and This represents the perturbation graph embedding, used for subsequent self-supervised contrastive learning; This represents the perturbation feature map adjacency matrix modeled by the feature map encoder. The resulting perturbation feature map is then embedded and represented. This represents the perturbation spatial graph adjacency matrix modeled by the spatial graph encoder. The resulting perturbation space graph is then embedded and represented.

[0048] In this embodiment, a deep graph convolutional network is used as the backbone encoder. In other embodiments, a graph attention network (GAT) can be used to dynamically learn the aggregation weights between different cells using an attention mechanism; or variants such as graph sampling aggregation network (GraphSAGE) or graph isomorphic network (GIN) can be used. The purpose of the alternatives in the above other embodiments is to establish a nonlinear mapping from the original molecular signal to a low-dimensional discriminative embedding.

[0049] S1022, the graph comparison represents learning.

[0050] By maximizing the mutual information of positive sample pairs and minimizing the mutual information of negative sample pairs, the model captures both local neighborhood dependencies and global structural patterns between cells.

[0051]

[0052] in, For the discriminator, The global summary vector is obtained by activating the mean of all cell embeddings with sigmoid. This represents the contrastive learning loss used for the feature map. This represents the contrastive learning loss used for the spatial graph. This means sampling from all possible combinations of real cell representation vectors and real location locations in the feature map adjacency matrix. This indicates sampling from all possible combinations of real cell representation vectors and real positions in the spatial graph adjacency matrix. Represents the global summary vector of the feature map. Represents the global summary vector of the spatial graph. This indicates sampling from all possible combinations of perturbed cell representation vectors and noise locations in the adjacency matrix of the perturbed feature map. This indicates sampling from all possible combinations of perturbation cell representation vectors and noise location positions in the perturbation space graph adjacency matrix. This indicates that a discriminator is used to score the combination of feature map embeddings and feature map summaries; This indicates that a discriminator is used to score the combination of spatial graph embedding and spatial graph summary; This indicates that a discriminator is used to score the combination of perturbation feature map embeddings and feature map summaries; This indicates that a discriminator is used to score the combination of perturbation spatial graph embedding and spatial graph summary.

[0053] Ultimately, graph contrastive learning loss Defined as:

[0054] S1023, Joint Embedding Fusion and Reconstruction.

[0055] The two embedded paths are mapped by their respective projectors and then stitched together. Finally, they are fused using two layers of multilayer perceptrons to obtain a unified joint embedding. :

[0056] in and For modally specific projection heads, This represents the encoder used for feature map embedding projection. This indicates the encoder used for spatial map embedding projection. For multilayer perceptron fusion networks, This indicates a feature splicing operation.

[0057] With joint embedding As input, it is processed by two independent decoders. , Jointly reconstruct the original molecular expression profile and calculate the reconstruction loss. :

[0058] in, This represents the decoder used for feature map embedding to reconstruct the feature matrix. This represents the decoder used to reconstruct the feature matrix from the spatial graph embedding. This represents the squared term of the L2 norm. This indicates that the representation matrix is ​​reconstructed using joint embedding and feature maps; This indicates that the representation matrix is ​​reconstructed using joint embedding and spatial graph.

[0059] S103, Unsupervised triplet metric learning based on online pseudo-label generation.

[0060] In this step, the geometric structure of the joint embedding is gradually refined through online pseudo-label generation and spatial topology-aware triple construction, thereby achieving self-driven discovery of multi-granular cellular and tissue structures.

[0061] The specific implementation method of step S103 is as follows: S1031, Online pseudo-tag generation.

[0062] In each iteration, modality-specific graph embedding is performed. and Based on the Leiden algorithm, respectively on the resolution parameter Perform periodic clustering to generate a set of pseudo-labels. , :

[0063]

[0064] in, This refers to the Leiden unsupervised clustering algorithm; Two sets of pseudo-labels are generated from different modal spaces: cell type clustering and spatial domain division. These labels drive different levels of metric learning objectives, enabling progressive refinement of multi-scale structures from tissue domains to cell niches.

[0065] Subsequently, the two sets of pseudo-tags were intersected and fused. For cells... Only when it is and When pairs of elements belong to the same category, assign a unified label to that category pair to obtain a unified pseudo-label for subsequent triple construction. :

[0066] in, The cluster pseudo-label representing cell i, The pseudo-label representing the clustering of cell j; "Subjected to" is an abbreviation used to display constraints. This represents the clustering label of cell i in the feature map embedding. This represents the clustering label of cell j in the feature map embedding. This represents the clustering label of cell i in the spatial graph embedding. This represents the clustering label of cell j in the spatial graph embedding.

[0067] That is, only when the cell With cells Only when both the molecular expression view and the spatial structure view are classified into the same category will they be marked as the same type in the unified pseudo-label; otherwise, they will be considered different types and will not participate in the construction of triples in the current iteration.

[0068] This dual-view intersection strategy filters out pseudo-class pairs introduced by single-modal noise, enabling pseudo-labels to possess both molecular semantic consistency and spatial structural consistency, thus providing a more reliable weak supervision signal for subsequent triple construction. The pseudo-labels are periodically updated as the embedding evolves, serving as dynamic weak supervision signals rather than absolute category labels, guiding the model to progressively transition from coarse-grained organizational domains to fine-grained cellular niches.

[0069] In this embodiment, the Leiden algorithm is used to generate multi-granularity pseudo-labels at different resolutions. In other embodiments, clustering algorithms such as K-means and DBSCAN can be used to generate pseudo-labels; alternatively, a hierarchical clustering strategy can be used to directly prune branches from the clustering tree to obtain multi-granularity results. The purpose of the alternative solutions in the above embodiments is to provide weakly supervised signals to drive metric learning in the absence of external annotations.

[0070] S1032, Spatial Topology-Aware Triple Construction.

[0071] Triples with spatial topology awareness are constructed based on pseudo-labels. The selection of the first positive sample must simultaneously satisfy the following dual constraints: (1) Pseudo-label consistency That is, they are classified into the same class by the Leiden algorithm; (2) Spatial nearest neighbor constraint: That is, the positive sample is located in the anchor cell in physical space. Within the nearest neighboring steps. The pseudo-label representing the first positive sample. Specifically refers to the p-th first positive sample. Represents anchor cells Nearest neighbor set.

[0072] The dual constraints ensure that the first positive sample possesses both semantic consistency and true spatial relevance, avoiding the "same-label cross-domain" phenomenon caused by experimental noise. For cells... A first positive sample cell is randomly sampled from the candidate set that satisfies the dual constraints. :

[0073] The first positive sample embedding is directly taken from the joint embedding vector of that cell. , The first positive sample embedding representation of cell i is given. This represents the feature embedding representation of the first positive sample cell.

[0074] The first negative sample uses an adaptive hard negative sample mining strategy, prioritizing boundary regions that are spatially adjacent but have different pseudo-labels. Selected:

[0075] in For indicator functions, This represents candidate negative sample regions that are physically close to the anchor cell but have different pseudo-labels; This is the first set of negative samples; This represents a mathematical operation that takes the maximum value when the pseudo-label of cell i is different from that of cell j for cell j; This indicates taking the maximum value.

[0076] The first negative sample embedding is , The first negative sample embedding representation of cell i. The feature embedding representation of the first negative sample cell is shown. This strategy preferentially penalizes spatially adjacent but functionally dissimilar cell pairs, significantly enhancing the model's accuracy in recognizing tissue boundaries.

[0077] To distinguish them from the following description, the positive samples obtained in the above steps will be referred to as the first positive samples and the negative samples as the first negative samples.

[0078] It can be understood that in this embodiment, a triplet with spatial topology awareness is constructed, and the triplet includes: The joint embedding represents the anchor cell in the representation space, the first positive sample cell in the feature map embedding space that is consistent with the pseudo-label of the anchor cell, and the first negative sample cell in the feature map embedding that is inconsistent with the pseudo-label of the anchor cell. Alternatively, it may include anchor cells in the joint embedding representation space, first positive sample cells in the spatial graph embedding space that are consistent with the pseudo-labels of anchor cells, and first negative sample cells in the spatial graph embedding that are inconsistent with the pseudo-labels of anchor cells.

[0079] S1033, Spatial Local Attraction Regularization.

[0080] Assuming cells to Given a spatial neighborhood graph with connecting edges, we define a soft attraction weight based on cosine similarity. :

[0081] in, This represents the feature vector of cell i in the feature map embedding. This represents the feature vector of cell j in the feature map embedding. This represents the cosine function.

[0082] Local attraction loss Defined as:

[0083] in Indicates the total number of sides; Let i represent the feature vector of cell i in the spatial graph embedding. This represents the feature vector of cell i in the spatial graph embedding. This term keeps spatially adjacent cells with similar expressions close together in the embedding space, suppressing the oversmoothing problem.

[0084] S1034, unsupervised triplet loss metric.

[0085] Introducing dynamic space weights The loss contribution is adaptively adjusted based on the variance of gene expression in the local neighborhood of the anchor cell:

[0086] in, For temperature parameters; Represents variance. This represents the gene expression vector of the set of neighboring cells of cell i.

[0087] Combining intra-class distribution normalization constraints, triplet loss is measured. Defined as:

[0088] in As a pseudo-cluster center, Within-class variance; This represents the feature representation of cell i in the joint embedding. This represents the regularization parameter. The loss is calculated using dynamic weights. The model adaptively reduces weights in highly heterogeneous noise regions and forces cells within the same pseudo-class to cluster towards the cluster center through intra-class normalization, thereby progressively refining the joint embedding geometry and enabling the model to gradually transition from coarse-grained tissue domain resolution to fine-grained cellular niche resolution.

[0089] By combining joint optimization graph contrastive representation learning loss, joint embedding reconstruction loss, spatial local attraction regularization loss, and unsupervised triplet metric loss, end-to-end multi-objective optimization of the joint embedding space is achieved without external annotation. The model can simultaneously possess global structure awareness, local neighborhood consistency preservation, and multi-granularity discriminative structure refinement capabilities.

[0090] in , , For regularization parameters; This represents the total loss of the model in a single-slice scenario.

[0091] S104, cross-slice mutual nearest neighbor batch correction.

[0092] In multi-slice or cross-platform joint analyses, data from different batches, individuals, or sequencing platforms exhibit significant systematic technical biases. Existing batch correction methods primarily rely on global feature alignment, tending to eliminate all batch-to-batch differences. This results in the simultaneous loss of fine-grained cellular state differences with real biological significance, severely impacting the reliability and comprehensiveness of downstream analyses.

[0093] Therefore, how to effectively eliminate the batch effect of technology while preserving the fine-grained biological heterogeneity within the sample to the greatest extent is another core problem that needs to be solved in this embodiment.

[0094] In this step, in a multi-slice / multi-sample scenario, robust batch effect elimination is achieved by identifying the neighbor relationships between cells across batches, replacing single-point matching with neighborhood-level enhanced representation, and combining Gram matrix alignment terms.

[0095] The specific implementation method of step S104 is as follows: S1041, cross-slice mutual nearest neighbor identification.

[0096] For each pair of slices, cosine similarity between cells in the joint embedding is calculated. Cell pairs that are nearest neighbors (MNNs) are identified as MNN anchors, providing cross-batch biological correspondences independent of shared annotations. For cells in slice A... and cells in slice B ,like yes In slice B, the nearest neighbor is determined based on cosine similarity, and At the same time The nearest neighbor in slice A will then be the cell pair. Mark cross-slice mutual nearest neighbor anchor pairs as follows:

[0097] in, Represents the set of mutually nearest neighbor anchor pairs; This represents the j'-th cell; Let represent the representation vector of cell i in the joint embedding of slice A. This represents the representation vector of cell j' in the joint embedding of slice B; This represents the i'-th cell. Let represent the representation vector of cell i' in the joint embedding of slice A. Let represent the representation vector of cell j in the joint embedding of slice B.

[0098] gather Each anchor pair in the dataset provides a reliable cross-batch biological correspondence without the need to share annotation information.

[0099] S1042, Enhanced neighborhood feature representation construction.

[0100] Using the MNN anchor point as the center, select within the target slice The most similar neighboring cells are used to form the second positive sample set. :

[0101] in, Indicates before selection The most similar neighboring cells; Let i represent the second set of positive samples for cell i. This represents the k nearest neighbor cells.

[0102] We then define an enhanced neighborhood feature representation that includes the mean and standard deviation:

[0103] in It is a cell Local neighbors within its own slice, Represents cells Enhanced neighborhood feature representation, The mean value is used to describe the average state of the neighborhood. The standard deviation describes the degree of dispersion within a neighborhood. Let represent the joint embedding representation vector of the i-th local neighbor.

[0104] Second positive sample neighborhood aggregation representation for:

[0105] Represents cells Enhanced neighborhood representation; This indicates the number of the second positive sample.

[0106] Similarly, for anchor cells Randomly sample from slice B and Non-overlapping, distant cells constitute the second negative sample set. :

[0107] in As a similarity threshold, ensure that the second negative sample is far away from the anchor cell in the embedding space; Indicates before random selection One cell; Let i represent the second set of positive samples for cell i.

[0108] Second negative sample neighborhood aggregation representation for:

[0109] S1043, batch correction loss for cross-slice triplet.

[0110] Based on narrowing the distance between the second positive samples across slices and widening the distance between the second negative samples across slices, a Gram matrix alignment term is introduced to capture the second-order statistical differences between batches. :

[0111] in, express( , , The total number of triples, Let represent the joint embedding representation vector of the i-th cell sample; The square of the F-norm between the Gram matrices of source slice A and target slice B is represented. , The Gram matrices representing the local neighborhood embeddings of source slice A and target slice B, respectively. The Gram matrix alignment term ensures consistent global distribution across different batches through second-order moment matching.

[0112] S1044, multi-slice joint optimization objective.

[0113] Joint optimization objective for multi-slice batch elimination It can be defined as:

[0114] in , , , This is the regularization parameter.

[0115] In this embodiment, Nearest Neighbor (MNN) is used to identify cross-batch cell correspondences, and an enhanced neighborhood representation is used instead of single-point matching. In other embodiments, cross-batch correspondences can also be established using optimal transport or graph-based matching strategies; the neighborhood representation can further incorporate attention-weighted aggregation instead of simple mean / standard deviation concatenation. The aim of these alternative embodiments is to preserve intra-sample biological differences while eliminating technical batch effects.

[0116] S105, multi-granularity clustering output.

[0117] After training, the joint embeddings Modality-specific graph embedding and Clustering is performed at different resolution parameters, and multi-level clustering results are output. Specifically: In feature map embedding Cell type classification is obtained by clustering. Embedded in spatial map Spatial domain partitioning is obtained by clustering. In joint embedding Fine-grained cellular niche segmentation obtained by clustering Multiple clustering results provide multi-scale cellular and tissue references for downstream spatial statistical analyses such as pseudo-temporal trajectories, receptor-ligand interactions, and cell communication.

[0118] Traditional spatial omics analysis methods rely on spatial domain division of tissues using a single fixed resolution in spatial graph embedding. While this can reveal macroscopic tissue structures, it cannot simultaneously characterize fine-grained cellular niches. Moreover, in unlabeled scenarios, it lacks effective discriminative constraints, and the boundaries between different cell types and functional states in the embedding space are blurred, making it difficult for fine-grained niches to emerge spontaneously. On the other hand, existing multi-sample integration methods mainly rely on global alignment of single-point features, which is highly sensitive to sequencing noise and tends to eliminate all batch-to-batch differences, erasing the fine-grained cellular state differences that are of true biological significance. To address this, this embodiment proposes a unified deep learning framework that combines a dual-path parallel graph encoder, online pseudo-label metric learning, and cross-slice nearest neighbor triplet alignment. This framework aims to simultaneously achieve unsupervised discovery and robust cross-batch integration of multi-granular cellular and tissue structures from multimodal spatial omics data.

[0119] This embodiment provides: (1) Multi-view joint embedding framework: A dual-path parallel graph encoder architecture is proposed, which models two types of biological signals, molecular expression and spatial structure, respectively and then fuses them. In a unified embedding space, modality-specific discriminative structures are preserved at the same time, providing an information-rich representation basis for multi-granularity analysis.

[0120] (2) Self-driven multi-granularity metric learning with spatial topology awareness: An online triplet metric learning strategy based on Leiden clustering pseudo-labels is proposed. Combining dual-constraint positive sample selection and adaptive hard negative sample mining, progressive multi-scale clustering discovery from coarse-grained organizational domains to fine-grained cellular niches is achieved without any external annotation.

[0121] (3) Batch correction strategy for neighborhood-level microenvironment alignment: A triplet correction method based on enhanced neighborhood representation is proposed to elevate batch alignment from isolated point matching to the local cellular microenvironment structure level, and introduce a second-order statistical alignment term of Gram matrix to eliminate batch effects while protecting fine-grained biological heterogeneity.

[0122] The method provided in this embodiment has the following technical advantages: (1) Multi-scale clustering discovery breaks through the limitations of single resolution.

[0123] This embodiment utilizes an online pseudo-label-driven triplet metric learning mechanism. Through dual-constraint positive sample selection and adaptive hard negative sample mining, it achieves multi-scale clustering discovery from coarse-grained cell type and spatial domain to fine-grained cell niche without relying on any external annotations, breaking through the paradigm limitations of single resolution in existing methods.

[0124] (2) Multimodal feature fusion enhances the ability to characterize cell heterogeneity.

[0125] This embodiment uses a dual-path parallel graph encoder to independently model molecular expression information and spatial structure information, thereby overcoming the limitations of single-view methods in characterizing cellular heterogeneity by unifying and embedding spatially complementary biological signals.

[0126] (3) Dynamic weighting mechanism to enhance the robustness of complex boundary regions.

[0127] This embodiment introduces spatial local attraction regularization to express perception, through dynamic weights. Adaptively reducing constraint strength in highly heterogeneous regions effectively suppresses the oversmoothing problem caused by spatial proximity, thereby improving the model's recognition accuracy in complex organizational boundary regions.

[0128] (4) Neighborhood-level batch correction preserves fine-grained biological heterogeneity.

[0129] This embodiment elevates batch alignment from isolated point matching to the local cellular microenvironment structure level by using cross-slice mutual nearest neighbor recognition and neighborhood-level triplet batch correction strategies. It combines Gram matrix alignment terms to achieve joint matching of first-order and second-order statistics, effectively eliminating technical batch effects while preserving fine-grained biological heterogeneity within the sample.

[0130] This embodiment addresses two key bottlenecks in existing methods for multi-scale clustering discovery and cross-batch integration within the intersection of multi-view representation learning and spatial omics analysis. Compared to existing single-view spatial domain recognition methods that rely on fixed-resolution clustering and cannot simultaneously output multi-granularity results, this embodiment achieves consistent clustering output across three levels—cell type, spatial domain, and cell niche—within a single training framework through a dual-path parallel graph encoder and online pseudo-label generation-driven triplet metric learning. Compared to existing batch calibration methods that use isolated cell points as alignment units and easily eliminate the real biological differences between batches, this embodiment replaces single-point embedding with local cellular microenvironment aggregation features and introduces second-order statistical alignment terms of the Gram matrix. It applies constraints at both the point-level correspondence and distribution-level statistics levels, effectively distinguishing between technical noise and biological heterogeneity.

[0131] The unified framework of "multi-view online metric learning and neighborhood-level batch correction" proposed in this embodiment can collaboratively achieve three tasks in a single end-to-end training: multimodal feature fusion, unsupervised multi-granularity clustering refinement, and robust cross-batch integration, avoiding the error accumulation problem caused by independent optimization in multiple steps in existing processes. Compared with traditional methods, this embodiment significantly improves the resolution upper limit of spatial omics data analysis and the reliability of cross-sample integration, demonstrating significant technological advancements in the fields of computational biology and precision medicine.

[0132] Example 2 This embodiment discloses a multi-granularity clustering system for cross-batch single-cell spatial omics data.

[0133] A multi-granularity clustering system for cross-batch single-cell spatial omics data, including: The graph construction module is configured to: acquire raw spatial omics data and construct spatial neighborhood graphs and molecular feature similarity graphs. The graph embedding acquisition module is configured to: construct a dual-path parallel graph encoder, independently model molecular feature similarity graphs and spatial neighborhood graphs to obtain two modality-specific cell graph embeddings, and fuse the cell graph embeddings into a unified joint embedding; The joint embedding optimization module is configured to: gradually refine the geometric structure of the joint embedding through online pseudo-label generation and spatial topology-aware triplet construction, thereby achieving self-driven discovery of multi-granularity cellular and tissue structures; The multi-level clustering module is configured to obtain multi-level clustering results, including cell type division, spatial domain division, and cell niche division, based on two modality-specific cell graph embeddings and refined joint embeddings.

[0134] Those skilled in the art will understand that the modules or steps of the present invention described above can be implemented using general-purpose computer devices. Optionally, they can be implemented using computer-executable program code, thereby allowing them to be stored in a storage device for execution by a computer device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. The present invention is not limited to any particular combination of hardware and software.

[0135] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.

Claims

1. A multi-granularity clustering method for cross-batch single-cell spatial omics data, characterized in that, Includes the following steps: Acquire raw spatial omics data and construct spatial neighborhood maps and molecular feature similarity maps; A dual-path parallel graph encoder is constructed to independently model molecular feature similarity graphs and spatial neighborhood graphs, resulting in two modality-specific cell graph embeddings. The cell graph embeddings are then fused into a unified joint embedding. By generating online pseudo-labels and constructing spatial topology-aware triples, the geometric structure of joint embedding is gradually refined to achieve self-driven discovery of multi-granularity cellular and tissue structures. Based on two modality-specific cell graph embeddings and a refined joint embedding, multi-level clustering results including cell type classification, spatial domain classification, and cell niche classification are obtained.

2. The multi-granularity clustering method for cross-batch single-cell spatial omics data as described in claim 1, characterized in that, The specific methods for constructing spatial neighborhood maps and molecular feature similarity maps include: based on Nearest neighbor relationships transform the physical spatial coordinates of a cell into a spatial neighborhood graph. , by adjacency matrix express; based on Nearest neighbor relationships are used to calculate pairwise similarity of gene expression between cells in the gene expression feature space, connecting each cell. Calculate the molecular feature similarity map based on the nearest neighbors, independent of physical distance. , by adjacency matrix express.

3. The multi-granularity clustering method for cross-batch single-cell spatial omics data as described in claim 1, characterized in that, Two modality-specific cell map embeddings were obtained as follows: ; ; in, and For modality-specific graph convolutional encoders, This represents the encoder used to learn the feature map embeddings. This represents the encoder used to learn spatial graph embeddings; and These are cell embeddings of the context of the similarity map of perceived molecular features and the spatial neighborhood map, respectively; An adjacency matrix representing a molecular feature similarity graph; The adjacency matrix represents the spatial neighborhood graph; The feature expression matrix representing spatial transcriptome data.

4. The multi-granularity clustering method for cross-batch single-cell spatial omics data as described in claim 3, characterized in that, The cell map embeddings are fused into a unified joint embedding, specifically including: Based on the expression matrix of the original spatial omics data, the shuffled feature matrix is ​​determined, and then the perturbation adjacency matrix for self-supervised contrastive learning is determined, and the perturbation graph embedding is obtained. Based on perturbation graph embedding, graph contrastive representation learning is used to capture local neighborhood dependencies and global structural patterns between cells by maximizing the mutual information of positive sample pairs and minimizing the mutual information of negative sample pairs. The two modality-specific cell images are embedded, mapped by their respective projectors, and then spliced ​​together. Finally, they are fused through two multilayer perceptrons to obtain a unified joint embedding.

5. The multi-granularity clustering method for cross-batch single-cell spatial omics data as described in claim 1, characterized in that, Online pseudo-label generation and spatial topology-aware triple construction, specifically including: Clustering methods are used to generate corresponding pseudo-label sets for the two modality-specific cell graph embeddings; Perform intersection fusion processing on the two sets of pseudo-labels; Based on the generated set of pseudo-labels, construct triples with spatial topology awareness: The selection of the first positive sample satisfies both the pseudo-label consistency constraint and the spatial nearest neighbor constraint. The first negative sample adopts an adaptive hard negative sample mining strategy, which prioritizes selection from boundary regions that are spatially adjacent but have different pseudo-labels.

6. The multi-granularity clustering method for cross-batch single-cell spatial omics data as described in claim 5, characterized in that, The two sets of pseudo-labels are subjected to intersection fusion processing, specifically including: When a cell belongs to the same category in two sets of pseudo-labels, this same category pair is assigned a unified label to obtain a unified pseudo-label for triple construction. The selection of the first positive sample satisfies both the pseudo-label consistency constraint and the spatial nearest neighbor constraint, specifically including: Pseudo-label consistency constraint: determining cells and cells The corresponding unified pseudo-tag If cells are present ,cell The corresponding unified pseudo-tag Then the cell Satisfy the pseudo-label consistency constraint; Spatial nearest neighbor constraint: determining the cell of Nearest neighbor, positive samples are physically located within the cell. Within the nearest neighboring steps.

7. The multi-granularity clustering method for cross-batch single-cell spatial omics data as described in claim 1, characterized in that, By employing joint optimization graph contrastive representation learning loss, joint embedding reconstruction loss, spatial local attraction regularization loss, and unsupervised triplet metric loss, the geometric structure of the joint embedding is progressively refined, achieving self-driven discovery of multi-granularity cellular and tissue structures. Specifically, this is represented as follows: ; in, This represents the total loss of the model in a single-slice scenario. The graph contrast represents the learning loss. Indicates the joint embedding reconstruction loss, This represents the spatial local attraction regularization loss. This indicates that the loss is measured using unsupervised triples. , , This is the regularization parameter.

8. The multi-granularity clustering method for cross-batch single-cell spatial omics data as described in claim 1, characterized in that, It also includes a neighborhood-level enhanced representation construction strategy based on mutual nearest neighbor MNN in multi-slice or cross-platform joint analysis scenarios. This strategy replaces single-point embedding with neighborhood aggregation features containing mean and standard deviation as cross-batch correspondence units, and introduces a second-order statistical alignment term of Gram matrix in triplet batch correction loss to eliminate batch bias and protect fine-grained biological heterogeneity within the sample.

9. The multi-granularity clustering method for cross-batch single-cell spatial omics data as described in claim 8, characterized in that, The neighborhood-level enhanced representation construction strategy based on mutual nearest neighbor MNN specifically includes: Determine the source slice and target slice, calculate the cosine similarity between cells in the joint embedding of the source slice and the joint embedding of the target slice, and identify the cell pairs that are the nearest neighbor MNNs as MNN anchors; Using the MNN anchor point as the center, select within the target slice The most similar neighboring cells are used to form a second positive sample set; Define an enhanced neighborhood feature representation that includes mean and standard deviation to obtain the second positive sample neighborhood aggregation representation; Randomly sample distant cells from the target slice that do not overlap with the second positive sample to form the second negative sample set, and obtain the neighborhood aggregation representation of the second negative sample; Based on the second positive sample neighborhood aggregation representation and the second negative sample neighborhood aggregation representation, combined with the Gram matrix alignment term, the cross-slice triplet batch correction loss is obtained; A multi-slice joint optimization objective, including cross-slice triplet batch correction loss, is determined to eliminate multi-slice batch bias.

10. A multi-granularity clustering system for cross-batch single-cell spatial omics data, characterized in that, include: The graph construction module is configured to: acquire raw spatial omics data and construct spatial neighborhood graphs and molecular feature similarity graphs. The graph embedding acquisition module is configured to: construct a dual-path parallel graph encoder, independently model molecular feature similarity graphs and spatial neighborhood graphs to obtain two modality-specific cell graph embeddings, and fuse the cell graph embeddings into a unified joint embedding; The joint embedding optimization module is configured to: gradually refine the geometric structure of the joint embedding through online pseudo-label generation and spatial topology-aware triplet construction, thereby achieving self-driven discovery of multi-granularity cellular and tissue structures; The multi-level clustering module is configured to obtain multi-level clustering results, including cell type division, spatial domain division, and cell niche division, based on two modality-specific cell graph embeddings and refined joint embeddings.