A method for extracting biomarkers from pathological images based on adaptive microenvironment construction

By generating multiple microenvironment clusters through an adaptive microenvironment construction method and explicitly modeling multi-cell collaborative interactions, this approach solves the problems of existing technologies being unable to adapt to tissue heterogeneity and lacking systematic extraction of biomarkers, thus achieving efficient and low-cost biomarker extraction and prognostic assessment.

CN123118562APending Publication Date: 2026-11-17NINGBO SHENWEI VISION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611363842.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-04
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing technologies cannot adapt to tissue heterogeneity when extracting spatial biomarkers from H&E-stained whole-section images, lack the ability to explicitly model multi-cell collaborative interactions, and lack systematicity and stability in biomarker extraction.

Method used

An adaptive microenvironment construction method was adopted, which generated multiple microenvironment clusters by using a region growth mechanism in which the dynamic similarity threshold increases with the size of the microenvironment cluster. Then, multi-cell collaborative interaction was explicitly modeled by subspace projection, and biomarkers were obtained by combining differential analysis.

Benefits of technology

The generated microenvironment clusters have better structural uniformity and spatial consistency, can adaptively capture tissue heterogeneity, retain fine-grained spatial information, discover biomarkers with stronger prognostic ability, and reduce research costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123118562A_ABST
    Figure CN123118562A_ABST
Patent Text Reader

Abstract

This invention discloses a method for extracting biomarkers from pathological images based on adaptive microenvironment construction. The method includes: obtaining the type probability distribution vectors of individual cells; constructing a cell graph structure based on the physical coordinates of all cells, and determining the neighborhood composition vector based on the type probability distribution vector; calculating the local purity score based on the neighborhood composition vector, and then selecting multiple seed cells; performing region growth using various daughter cells as growth starting points, with the dynamic similarity threshold increasing as the microenvironment cluster size increases, generating multiple microenvironment clusters; generating a microenvironment composition vector based on the cell composition of each microenvironment cluster, and then constructing spatial features; summarizing the spatial features of multiple pathological images for difference analysis to obtain biomarkers. This invention does not require a preset fixed radius, can adaptively capture tissue heterogeneity, retain fine-grained spatial information, explicitly model multi-cell collaborative interactions, and systematically discover statistically robust spatial and tissue-level biomarkers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of digital pathological image processing technology, and in particular to a method for extracting biomarkers from pathological images based on adaptive microenvironment construction. Background Technology

[0002] In the field of digital pathology, mining spatial biomarkers from H&E (hematoxylin-eosin) stained whole-slide images (WSI) is a key task for tumor microenvironment analysis and prognostic modeling. Currently, WSI-based spatial phenotypic analysis mainly employs the following three approaches: (I) Fixed-Scale Clustering Analysis Method. This approach uses a deep learning model to detect and classify cells in WSI (Wastewater Intake). Then, it constructs local microenvironments centered on each cell using circular neighborhoods with a fixed radius (e.g., 50 micrometers) or regularized patch segmentation. Finally, it performs statistical analysis on the cell composition within the local microenvironment, such as calculating the proportion and density of different cell types. Commonly used tools include Squidpy (based on spatial graphs and neighborhood enrichment analysis). However, the fixed scale of this approach cannot adapt to the heterogeneity of real tissues: the cell density, type distribution, and organizational structure vary greatly in different regions of real tissues. Fixed-radius circular neighborhoods may mix different spatial patterns in densely populated areas, and may fail to capture meaningful cell interactions in sparsely populated areas, leading to blurred microenvironment boundaries and the inability to accurately characterize complex spatial structures.

[0003] (II) Global Pattern Analysis Method Based on Heatmaps. This approach identifies potential functional microenvironment regions by generating saliency distribution maps or spatial pattern scores of whole slices or large-scale cell ensembles, and reveals overall trends through smoothing. However, this smoothing process loses fine-grained spatial information: heatmap-based and global scoring methods, through statistical smoothing, attenuate fine-grained spatial co-occurrence information between cells, failing to accurately capture biologically significant local cell synergies.

[0004] (III) Graph Neural Network (GNN) Based Approach. This approach treats cells as nodes in a graph and spatial relationships between cells as edges, using graph convolution and other operations to model higher-order interactions between cells. However, this approach lacks the ability to explicitly model multi-cell collaborative interactions: most existing methods remain at the level of modeling single-cell or pairwise cell relationships, making it difficult to directly learn biologically interpretable higher-order cell combination patterns from WSI.

[0005] Furthermore, the aforementioned methods share a common problem: a lack of systematic approach in the extraction of spatial biomarkers. Existing methods often employ simple statistical tests or fixed threshold screening strategies, lacking the ability to systematically analyze differences in distribution levels, resulting in insufficient stability and limited generalization ability of the extracted spatial biomarkers. Summary of the Invention

[0006] The technical problem to be solved by this invention is to provide a method for extracting biomarkers from pathological images based on adaptive microenvironment construction. This method can capture tissue heterogeneity through an adaptive region growth mechanism in which the dynamic similarity threshold increases with the size of the microenvironment cluster. It retains fine-grained spatial information based on cell-level neighborhood composition vectors and microenvironment composition vectors. It explicitly models multi-cell collaborative interaction through subspace projection and performs differential analysis by summarizing the spatial features of multiple pathological images to obtain spatial and tissue-level biomarkers with statistical robustness.

[0007] The technical solution adopted by this invention to solve the above-mentioned technical problems is as follows: a method for extracting biomarkers from pathological images based on adaptive microenvironment construction, characterized by comprising the following steps: Obtain the type probability distribution vectors of multiple cells in a pathological image; A cell graph structure is constructed based on the physical coordinates of all cells, and the neighborhood composition vector of each cell is determined based on the type probability distribution vector of each cell. Calculate the local purity score of each cell based on the neighborhood composition vector of each cell, and select multiple seed cells from all cells according to the local purity score of each cell; Starting with various daughter cells, each region independently grows within the cell graph structure, generating multiple microenvironment clusters. The growth process for any given microenvironment cluster is as follows: using the neighborhood composition vector of the corresponding seed cell as the initial centroid vector of the current microenvironment cluster; determining whether the similarity between the neighborhood composition vectors of the external neighboring cells of the current microenvironment cluster and the centroid vector is greater than a dynamic similarity threshold; in this case, all external neighboring cells meeting the condition are included in the current microenvironment cluster, and the centroid vector is updated. The dynamic similarity threshold increases with the size of the current microenvironment cluster. This process of determination, inclusion, and updating is repeated until the growth cessation condition is met, at which point region growth stops. Generate microenvironment composition vectors based on the cellular composition of each microenvironment cluster; Spatial features were constructed based on the component vectors of each microenvironment, and the spatial features of multiple pathological images were aggregated for differential analysis to obtain biomarkers.

[0008] Further specifying, the step of obtaining the type probability distribution vectors of multiple cells in the pathological image includes: The pathological image was segmented into multiple cells using a segmentation model based on a convolutional neural network. The morphological features of the cells were extracted using a pre-trained encoder; The morphological features are input into a pre-trained classifier to obtain the probability distribution vector of each cell type.

[0009] Further specifying, the step of determining the neighborhood composition vector of each cell based on the type probability distribution vector of each cell includes: For any given cell, the cell in the cell diagram structure centered on that cell and with a radius of r is... nei The cells other than the central cell within the circular neighborhood are considered as neighboring cells of the central cell; The type of each cell in the circular neighborhood is determined based on the probability distribution vector of the cell types within the circular neighborhood. Count the number of cells of each type within the circular neighborhood and calculate the percentage of each cell type. The neighborhood composition vector of the central cell is determined based on the proportion of various cell types.

[0010] Further specifying, the step of selecting multiple seed cells includes: Calculate the local purity fraction for each cell, where the local purity fraction is the reciprocal of the Shannon entropy: S j =1 / H(Ne j ), where S j H(Ne) represents the local purity fraction of the j-th cell. j ) represents Ne j Shannon entropy, Ne j Ne represents the neighborhood composition vector of the j-th cell. j =[N j,1 N j,2 ,……,N j,K ], N j,k The percentage of cells of the kth type is represented by Num, where 1 ≤ j ≤ Num, Num represents the total number of cells in the pathological image, and K represents the number of cell types. All cells are arranged in descending order of their local purity fraction. The unmasked cell with the highest local purity fraction is selected as the seed cell using non-maximum suppression iterative selection. The non-maximum suppression uses a spatial radius R. nms Used to mask the cells surrounding the selected seed cell.

[0011] Further specifying, the region growth step includes: For the centroid vector Z of the current micro-environment cluster with a size of n... C,n Obtain the external neighboring cells of the current microenvironment cluster, wherein the external neighboring cells are defined as those centered on any cell within the current microenvironment cluster and having a radius of r. neiFor cells within a circular neighborhood that do not belong to the current microenvironment cluster, determine the neighborhood composition vector of the external neighboring cells and its relation to Z. C,n Is the similarity between them greater than the dynamic similarity threshold? This formula serves as the inclusion condition, where n represents the size of the current microenvironment cluster, and cos(θ) represents the neighborhood composition vector of the external neighboring cells and Z. C,n The similarity between them, Ne neighbor T represents the neighborhood composition vector of the external neighboring cells. C,n T represents the dynamic similarity threshold when the size of the current microenvironment cluster is n. C,n T increases with the size n of the current microenvironment cluster. C,n = T base +δ×log(n), T base δ represents the base threshold, and δ represents the scaling factor. All external neighboring cells that meet the inclusion criteria are included in the current microenvironment cluster, and then processed according to the formula. Incrementally update the centroid vector, where m represents the number of newly added external neighboring cells to the current microenvironment cluster, and Ne... neighbor,i Z represents the neighborhood composition vector of the i-th newly included external neighboring cell. C,n+m This represents the centroid vector when the size of the current micro-environment cluster is n+m, i.e., the updated centroid vector; The growth cessation condition is: no external neighboring cells meet the condition, or the current microenvironment cluster reaches its maximum expansion radius R. hard_limit .

[0012] Preferably, the region growth step further includes cluster collision arbitration, specifically: When multiple microenvironment clusters compete for the same boundary cell during growth, calculate the overall score of the boundary cell relative to each participating microenvironment cluster: Where b represents a boundary cell, which is a cell simultaneously identified as meeting the inclusion criteria by at least two microenvironment clusters; C represents the competing microenvironment clusters; Score(b,C) represents the comprehensive score of boundary cell b relative to the competing microenvironment cluster C; ω represents the weighting coefficient; and D... M (b,C) represents the Mahalanobis distance between the boundary cell b and the competing microenvironment cluster C in phenotypic space, Sp b Sp represents the physical coordinates of the boundary cell b. top,C R represents the physical coordinates of the seed cell corresponding to the microenvironment cluster C participating in the competition. current,CThis represents the maximum coverage area of ​​the competing microenvironment cluster C, which is the maximum physical distance from all cells in the competing microenvironment cluster C to the corresponding seed cell. Boundary cells are assigned to the competing microenvironment clusters with the lowest overall scores.

[0013] Further specifying, the steps for generating the microenvironment composition vector are as follows: The number of cells of various types within the microenvironment cluster was counted, and the proportion of each type of cell was calculated. The microenvironment composition vector of the microenvironment cluster is determined based on the proportion of various cell types.

[0014] Further specifying, the step of constructing spatial features based on the component vectors of each microenvironment includes: For any microenvironment cluster, the microenvironment composition vector V C Iterate through a non-empty subset s of a set J consisting of K cell types, where each element in the non-empty subset s corresponds to a cell type; and use the subspace projection operator. From V C Extract the dimension corresponding to the cell type in the non-empty subset s to obtain V. C The projection result V onto the subspace corresponding to the non-empty subset s C,s V C,s =Pi s (V C ), where |s| represents the number of elements in the non-empty subset s; After traversing all non-empty subsets, we obtain V. C The corresponding set of low-dimensional subspace representations {V C,s |s∈P nonempty (J)}, using this subspace representation as the spatial characteristic of the microenvironment cluster, where P nonempty (J) represents the set of all non-empty subsets of set J, and the spatial features are represented in vector form in the spatial feature space.

[0015] Further specifying, the steps of the difference analysis include: Take any microenvironment cluster as the query microenvironment cluster. In the spatial feature space, with the spatial features of the query microenvironment cluster as the query center, search for the spatial features of microenvironment clusters that satisfy ||yq||≤h. This forms a scale-dependent neighborhood N(q,h) with radius h for the query microenvironment cluster, where N(q,h)={y|||yq||≤h}. The spatial feature space refers to the set of spatial features of all microenvironment clusters generated by multiple pathological images. The multiple pathological images correspond to different patients, and each pathological image is associated with a prognostic label of the corresponding patient. y represents any spatial feature in the spatial feature space, and q represents the spatial feature of the query microenvironment cluster, i.e., the query center. The scale-dependent neighborhood N(q,h) is divided into a good prognosis sub-neighborhood N0(q,h) and a poor prognosis sub-neighborhood N1(q,h) according to the prognosis label Y, where Y∈{0,1}, Y=0 represents a good prognosis and Y=1 represents a poor prognosis; Determine the difference trajectory function between N0(q,h) and N1(q,h): LogFC(q,h)=log2((|N0(q,h)|+ɛ) / (|N1(q,h)|+ɛ)), where LogFC(q,h) represents the difference trajectory function between N0(q,h) and N1(q,h), |N0(q,h)| represents the number of elements in N0(q,h), |N1(q,h)| represents the number of elements in N1(q,h), and ɛ is a constant; Analyze the curvature of the differential trajectories: Where Curv(q,h) represents the curvature of the difference trajectory; Determine the optimal radius: , where h * (q) represents the optimal radius; Statistical significance tests are performed within the scale-dependent neighborhood determined by the query center and the optimal radius. Spatial features that meet the preset effect size threshold and preset significance level threshold are selected as biomarkers. The biomarkers include spatial biomarkers and tissue-level biomarkers.

[0016] Compared with the prior art, the advantages of the present invention are as follows: This invention uses various daughter cells as growth starting points, independently performing regional growth within the cell diagram structure to generate multiple microenvironment clusters. The regional growth employs a dynamic similarity threshold that increases with the size of the current microenvironment cluster. This mechanism allows the microenvironment clusters to have a low threshold in the early stages of growth, readily accepting new cells, while in the mature stage, the threshold becomes high, accepting only highly homogeneous cells. This achieves adaptive growth without the need for a pre-set fixed radius. Experimental data shows that the intra-cluster entropy of this invention is 0.316, significantly better than existing methods, fully demonstrating that the microenvironment clusters generated by this method have superior structural uniformity and spatial consistency, and can adaptively capture tissue heterogeneity.

[0017] This invention determines the neighborhood composition vector of each cell based on the probability distribution vector of each cell type, and generates a microenvironment composition vector at the microenvironment cluster level. The entire process starts from cell-level data, does not perform global statistical smoothing, and preserves the precise local composition information around each cell. Experimental data show that this invention achieves an optimal balance between cross-slice consistency (median cosine similarity = 0.602) and stability (median NMI of Bootstrap refit = 0.915), fully demonstrating that it can faithfully capture spatial heterogeneity and cellular synergies without relying on a predefined scale, preserving fine-grained spatial information.

[0018] This invention's method summarizes spatial features from multiple pathological images for differential analysis. It combines scale-dependent neighborhood construction, differential trajectory calculation, curvature analysis (adaptively determining the optimal radius to avoid bias introduced by a fixed radius), and statistical significance testing, forming a systematic process from differential discovery to statistical validation. Experimental data show that the median significance p-value of this invention corresponds to -log10(p) of 2.107, significantly outperforming existing methods, fully demonstrating its ability to discover biomarkers with stronger prognostic discriminative power. Cross-center and cross-cancer type validation further demonstrates that the biomarkers (spatial and tissue-level) discovered by this invention can reliably capture prognostic heterogeneity, exhibiting good generalization ability across different independent cohorts and good statistical robustness.

[0019] This invention constructs spatial features based on the component vectors of each microenvironment. During this construction, a subspace projection mechanism is incorporated, traversing all cell type subsets to decompose the microenvironment component vectors into a set of low-dimensional subspace representations, explicitly modeling high-order collaborative interactions among multiple cell types. Experimental data show that the method of this invention exhibits high phenotypic consistency (mean cosine similarity > 0.87) with biomarkers discovered by existing methods, and can accurately delineate tumor nests, necrotic regions, and stromal boundaries with high local purity, demonstrating its ability to capture multi-cell synergistic interactions without relying on predefined scales.

[0020] The method of this invention is based entirely on conventional H&E staining images, without the need for additional multiplexed staining or molecular detection, which significantly reduces the cost and technical threshold of space biomarker research and has good prospects for clinical application.

[0021] In the selection of multiple seed cells, this invention calculates the local purity score of each cell using the reciprocal of Shannon entropy. A higher purity score indicates a more homogeneous composition of cells in the surrounding neighborhood. This mechanism enables the system to automatically identify all highly homogeneous regions in a tissue section without requiring manual specification of seed location or number, achieving fully data-driven seed selection. Non-maximum suppression (NMS) iteratively selects the unobstructed cell with the highest local purity score as the seed cell, using a spatial radius R. nms By masking the cells surrounding the selected seed cells, the spatial competition inhibition mechanism of NMS ensures that the selected seed cells maintain sufficient physical spacing, so that each seed cell represents an independent high-purity region. This mechanism avoids selecting multiple seed cells in the same high-purity aggregation area (such as a large tumor nest), while ensuring that regions with different biological significance (such as tumor nests, immune aggregation foci, and stromal regions) can be selected and represented, so that the seed cells can fully cover various spatial structures in the tissue section.

[0022] In the process of region growth, the method of this invention uses cosine similarity to determine the similarity between the neighborhood composition vector of neighboring cells and the centroid vector of the current microenvironment cluster. Cosine similarity measures the degree of proximity between two local resident composition patterns, rather than the type of the candidate cell itself. Therefore, even if a cell is an immune cell, it will still be included in the tumor microenvironment cluster as long as the composition pattern of its surrounding neighbors (such as 70% tumor cells + 20% immune cells) is highly similar to the centroid of the tumor cluster. This mechanism transforms region growth from "cell type driven" to "spatial composition pattern driven", which can more accurately reflect the true spatial structure of the tumor microenvironment. The dynamic similarity threshold monotonically increases with cluster size. This mechanism allows microenvironment clusters to have a low threshold in the initial stage (small scale), easily accepting new cells and possessing sufficient growth momentum; in the growth stage (large scale), the threshold is high, only accepting highly homogeneous cells, effectively preventing the cluster from over-expanding into heterogeneous regions. Since the growth rate of log(n) slows down with the increase of size n, the threshold change is faster in the early stage (rapidly filtering heterogeneous cells) and slower in the later stage (preserving expansion potential), achieving smooth adaptive stopping. This mechanism allows the boundary of the microenvironment cluster to be completely determined by the local tissue structure, without the need for a preset fixed radius, and can simultaneously adapt to the different growth needs of dense and sparse cell regions. Each time a new cell is included, the centroid vector of the current microenvironment cluster is updated incrementally. The centroid vector always represents the average value of the composition vectors of all cell neighborhoods within the current microenvironment cluster, ensuring that the microenvironment cluster always maintains its own phenotypic identity during growth, and subsequent judgments are always based on the latest and most accurate cluster features. This invention employs cluster collision arbitration, calculating a comprehensive score of boundary cells relative to each competing microenvironment cluster. This comprehensive score considers both phenotypic similarity (Mahavirandot distance) and spatial proximity (normalized Euclidean distance). Boundary cells are assigned to the microenvironment cluster with the lowest comprehensive score, achieving dual optimization of "most similar cell composition to the cluster" and "closest location to the cluster center," avoiding the unreasonable assignment problems caused by a single standard (only considering phenotypic or distance). Mahalanobis distance is used to measure the similarity between boundary cells and microenvironment clusters in phenotypic space. Mahalanobis distance automatically considers the variance differences and correlations between cell type dimensions, measuring phenotypic similarity more accurately than Euclidean distance—giving lower weights to dimensions with larger variance and higher weights to dimensions with smaller variance, avoiding the scaling effect caused by abundance differences between different cell types. The spatial distance term is normalized to the maximum coverage of the current microenvironment cluster, making the spatial distances of microenvironment clusters of different sizes comparable. When the size difference between two microenvironment clusters is large, the unnormalized absolute distance will cause the boundary cells to tend to belong to the larger microenvironment cluster. After normalization, the influence of the size of the microenvironment cluster on the spatial distance is eliminated, ensuring the fairness and reasonableness of the arbitration result.

[0023] In constructing spatial features based on the composition vectors of each microenvironment, the method of this invention decomposes the K-dimensional composition vector of each microenvironment cluster into a set of low-dimensional subspace representations by traversing all non-empty subsets s of the set J composed of K cell types, thus explicitly modeling high-order collaborative interactions among multiple cell types. Proper subset projection corresponds to spatial-level biomarkers—describing the co-localization patterns of specific cell type subsets and reflecting local multi-cell synergistic effects; global set projection corresponds to tissue-level biomarkers—describing the global composition features of the entire microenvironment cluster and reflecting tissue-scale structural organization. Biomarkers at both levels are uniformly modeled and discovered within the same subspace projection mathematical framework, eliminating the need to design different algorithms for different levels of biomarkers, and achieving multi-level spatial feature extraction from local cell configuration to tissue structure.

[0024] In the differential analysis process, this invention calculates the differential trajectory value at each radius by fixing the query center and gradually increasing the radius, forming a differential trajectory. This trajectory fully records how the difference in microenvironment abundance between the good and poor prognostic groups accumulates and changes with the expansion of the observation range (scale), providing complete information on the evolution of differential signals for subsequent adaptive radius optimization and avoiding the risk of "missing the optimal observation scale" under a single fixed scale. Through curvature analysis, the critical point where the differential trajectory transitions from rapid growth to stagnation is identified, and the position with the smallest absolute value of curvature is taken as the optimal radius. This mechanism is entirely data-driven, requiring no manual specification or trial of different radius values, thus avoiding subjective bias caused by fixed radius selection. The optimal radius simultaneously satisfies the dual requirements of "statistical reliability" (the radius is large enough to include enough microenvironment clusters to ensure the power of statistical tests) and "maximum discriminative power" (the radius is small enough to avoid including irrelevant signals that dilute the difference). This mechanism transforms differential analysis from "manual trial and error" to "data-driven adaptation," significantly improving the objectivity of biomarker discovery. By performing statistical significance tests within the neighborhood of the optimal radius, spatial features that meet the preset effect size threshold and preset significance level threshold are selected as biomarkers. The introduction of statistical tests ensures that the discovered biomarkers have statistically significant differences, rather than random noise. Attached Figure Description

[0025] Figure 1 This is a block diagram illustrating the overall implementation of the method of the present invention. Detailed Implementation

[0026] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments.

[0027] This invention proposes a method for extracting biomarkers from pathological images based on adaptive microenvironment construction, the overall implementation block diagram of which is shown below. Figure 1 As shown, it includes the following steps: S1. Collect at least one set of pathological images with good prognosis and at least one set of pathological images with poor prognosis, wherein each pathological image corresponds to a patient and each pathological image is associated with a prognostic label of the corresponding patient; then, for each pathological image, obtain the type probability distribution vector of multiple cells in the pathological image.

[0028] In step S1, the pathological image is defined as a whole-section image (WSI) stained with H&E (hematoxylin-eosin).

[0029] Furthermore, the steps for obtaining the type probability distribution vectors of multiple cells in a pathological image include: S11. Use a segmentation model based on a convolutional neural network to segment cells in the pathological image to obtain multiple cells.

[0030] Step S11 is the cell segmentation step. As an example, the segmentation model based on the convolutional neural network can be the existing Cellpose.

[0031] Considering the large size of WSI images, typically reaching 100,000 x 100,000 pixels, a sliding window strategy is first used for block processing before cell segmentation. Then, a segmentation model based on a convolutional neural network is used to segment cells within each block. It should be noted that the continuity between blocks should be ensured during block processing. Specifically, as a preferred implementation, the pathological image is first segmented into blocks using a sliding window strategy, where the size of the sliding window can typically be set to 64×64, 96×96, 128×128, etc. Then, a segmentation model based on a convolutional neural network is used to segment cells within each block, resulting in multiple cells for each block, and thus multiple cells for the pathological image.

[0032] S12. Use a pre-trained encoder to extract morphological features of cells.

[0033] Step S12 is the cell feature extraction step. As an example, the encoder uses ConvNeXt Tiny as the backbone network and is pre-trained on the STHELAR large-scale dataset (approximately 11 million cells with spatial transcriptomics annotation) to learn discriminative morphological features for cell type identification.

[0034] S13. Input the morphological features into the pre-trained classifier to obtain the type probability distribution vector of each cell.

[0035] Step S13 is the cell classification step. There are nine cell types: NK_T cells (cytotoxic lymphocytes), plasma cells, myeloid cells, blood vessels, fibroblasts / myofibroblasts, epithelial cells, specialized cells, melanocytes, and necrotic areas. The pre-trained classifier outputs a probability distribution vector representing the cell type for each cell type. The probability distribution vector P for the j-th cell type is... j =[p j,1 ,p j,2 ,……,p j,K ], where 1≤j≤Num, Num represents the total number of cells in the pathological image, K represents the number of cell types, i.e., K=9, p j,1 p represents the probability that the j-th cell belongs to type 1. j,2 p represents the probability that the j-th cell belongs to the second type. j,K This represents the probability that the j-th cell belongs to the k-th type.

[0036] S2. For each pathological image, construct a cell graph structure based on the physical coordinates of all cells, and determine the neighborhood composition vector of each cell based on the type probability distribution vector of each cell.

[0037] In step S2, the pathological image is represented as a cell graph structure. Constructing a cell graph structure is a fundamental operation widely used in digital pathology and computational pathology, typically involving two core steps: first, locating cells as nodes; and second, establishing edges between nodes to encode spatial relationships. Specifically, each cell is treated as a node in the cell graph structure, and the edges between nodes are determined based on the spatial distance between cells. For any given cell, an edge with radius r is defined as the center of the cell. nei Other cells within a circular neighborhood are considered neighboring cells of the given cell. Edges are established between the given cell and each neighboring cell to construct a complete cell graph structure. The search for neighboring cells can be accelerated using spatial indexing structures such as KD-Tree. nei The typical value is 50 to 80 micrometers.

[0038] In step S2, the physical coordinates of the cell refer to two-dimensional spatial coordinates.

[0039] Furthermore, the steps for determining the neighborhood composition vector of each cell based on the type probability distribution vector of each cell include: S21. For any cell, in the cell diagram structure, select the cell centered at that cell and with radius r. nei The cells other than the central cell within the circular neighborhood are considered as neighboring cells of the central cell.

[0040] Here, the central cell serves as the query center for neighboring cells, r nei The nearest query radius is a physical distance.

[0041] S22. Determine the type of each cell in the circular neighborhood based on the probability distribution vector of each cell type in the circular neighborhood.

[0042] In step S22, as an example, for any cell within a circular neighborhood, the type corresponding to the highest probability in the cell's type probability distribution vector is taken as the cell's type.

[0043] S23. Count the number of cells of each type in the circular neighborhood and calculate the proportion of each type of cell.

[0044] In step S23, the specific calculation method for the proportion of each cell type is as follows: the number of cells of a certain type is divided by the number of cells in the circular neighborhood. If the number of cells of a certain type is 0 (i.e., there are no cells of that type in the circular neighborhood), then the proportion of cells of that type is 0. The proportion of each cell type is a decimal between [0, 1.00].

[0045] S24. Based on the proportion of various cell types, determine the neighborhood composition vector of the central cell, and describe the neighborhood composition vector when the j-th cell is the central cell as Ne. j =[N j,1 , N j,2 ,……,N j,K ], N j,1 N represents the percentage of cells of type 1. j,2 N represents the percentage of the second type of cell. j,K This represents the percentage of cells of type K.

[0046] As an example: Suppose that a cell has 20 cells in its circular neighborhood, including 14 NK_T cells, 4 plasma cells, and 2 myeloid cells. Then the neighborhood composition vector of this cell is [0.70, 0.20, 0.10, 0, 0, ...] (the other dimensions are 0).

[0047] S3. For each pathological image, calculate the local purity score of each cell based on the neighborhood composition vector of each cell, and select multiple seed cells from all cells according to the local purity score of each cell.

[0048] Furthermore, the step of selecting multiple seed cells includes: S31. Calculate the local purity fraction of each cell, which is the reciprocal of the Shannon entropy: S j =1 / H(Ne j ), where S j H(Ne) represents the local purity fraction of the j-th cell. j ) represents Ne jShannon entropy is used to measure the uncertainty / mixture of composition. Ne j Ne represents the neighborhood composition vector of the j-th cell. j =[N j,1 , N j,2 ,……,N j,K ], N j,k S represents the percentage of cells of type k, 1≤j≤Num, where Num represents the total number of cells in the pathological image, and K represents the number of cell types, k=1,2,……,K. The local purity score of any cell is used as an indicator to measure the uniformity of cell composition within its circular neighborhood. j The larger the value, the more uniform the cell composition within the circular neighborhood of the corresponding cell, and the more suitable the corresponding cell is as the growth starting point of the microenvironment cluster.

[0049] S32. Sort all cells in descending order of local purity fraction. Iteratively select the unmasked cell with the highest local purity fraction as the seed cell using non-maximum suppression (NMS). The spatial radius R is used for non-maximum suppression. nms This is used to mask the cells surrounding the selected seed cell, ensuring spatial dispersion between seed cells.

[0050] In this embodiment, the spatial radius R is set. nms R is used to ensure that sufficient distance is maintained between the selected seed cells. nms A typical value is 500 pixels, approximately 50 micrometers. The seed cell is the cell selected as the center of the high-purity region, serving as the starting point for the growth of the microenvironment cluster. Occlusion represents the spatial radius R surrounding the selected seed cell. nms Cells within a range are marked as unselectable to prevent multiple seed cells from appearing in the same range.

[0051] Nonmaximum inhibition is a spatial competitive inhibition mechanism. Iterative selection of seed cells using nonmaximum inhibition is described in the following process: (1) Initialization: Mark all cells as unoccluded; create an empty seed cell list to store the selected seed cells.

[0052] (2) Iterative selection: Repeat the following operation until all cells are marked as occluded, or the preset seed cell limit is reached: (2.1) Among all the currently unmasked cells, select the cell with the highest local purity score as the seed cell and add it to the seed cell list.

[0053] (2.2) In the cell diagram structure, with the physical location of the seed cell as the center, R nmsWithin a circular space of radius R, mark all cells as occluded. nms A typical value is 500 pixels (approximately 50 micrometers), which determines the minimum physical spacing between selected seed cells, thus avoiding the selection of multiple seed cells in the same high-purity aggregate region.

[0054] (2.3) Return to step (2.1) and continue iteratively selecting from the remaining unmasked cells.

[0055] (3) After the iteration is completed, all the cells in the seed cell list are the final selected seed cells for subsequent adaptive region growth.

[0056] If NMS is not used, and instead the top few cells are selected as seed cells directly in descending order of local purity score, the following problems may occur: In a large tumor nest, cells in the central and peripheral regions may have high local purity scores, resulting in multiple seed cells being selected for the same tumor nest; while other smaller but equally biologically significant aggregation areas (such as small immune cell aggregation foci) may be ignored due to slightly lower local purity scores.

[0057] The spatial inhibition mechanism of NMS solves this problem: when a seed cell is selected, its surrounding R nms All cells within the radius are masked and no longer participate in subsequent selection. Cells within the same high-purity aggregation region are closely spaced and will be masked in one step; however, cells between different aggregation regions are farther apart and will not mask each other. Therefore, NMS can spatially and uniformly select seed cells representing different microenvironment regions across the entire tissue section.

[0058] S4. For each pathological image, using various daughter cells as the starting point for growth, region growth is performed independently in the cell map structure to generate multiple microenvironment clusters. The growth process for any current microenvironment cluster is as follows: the neighborhood composition vector of the corresponding seed cell is used as the initial centroid vector of the current microenvironment cluster. Under the centroid vector, it is determined whether the similarity between the neighborhood composition vector of the external neighboring cells of the current microenvironment cluster and the centroid vector is greater than the dynamic similarity threshold. All external neighboring cells that meet the condition are included in the current microenvironment cluster and the centroid vector is updated. The dynamic similarity threshold increases with the size of the current microenvironment cluster. The above judgment, inclusion and update process is repeated until the growth stopping condition is met and the region growth stops.

[0059] Furthermore, the steps of region growth include: S41. For the centroid vector Z of the current micro-environment cluster with a size of n. C,nObtain the external neighboring cells of the current microenvironment cluster. The external neighboring cells are defined as those centered on any cell within the current microenvironment cluster with a radius of r. nei For cells within a circular neighborhood that do not belong to the current microenvironment cluster, determine the neighborhood composition vector of the external neighboring cells and its relation to Z. C,n Is the similarity between them greater than the dynamic similarity threshold? This formula serves as the inclusion condition, where n represents the size of the current microenvironment cluster, i.e., the number of cells contained in the current microenvironment cluster. The initial value of n is 1, meaning that the current microenvironment cluster initially contains only seed cells. Z C,n The initial value is the neighborhood composition vector of the corresponding seed cell, and cos(θ) represents the neighborhood composition vector of the external neighboring cells and Z. C,n The similarity between them is specifically cosine similarity, with cos(θ) ranging from -1 to 1. Values ​​closer to 1 indicate greater similarity. neighbor Let Ne represent the neighborhood vector of the outer neighboring cells. "‖ ‖" is the L2 norm operator, used to calculate the magnitude of the vector. neighbor ·Z C,n Ne neighbor With Z C,n The dot product, i.e., the sum of the products of corresponding components, is T. C,n T represents the dynamic similarity threshold when the size of the current micro-environment cluster is n. C,n T increases with the size n of the current microenvironment cluster. C,n = T base +δ×log(n), T base T represents the base threshold. base The initial entry threshold is typically 0.90, where δ represents the scaling factor, controlling T. C,n The growth rate, typically 0.01, is used to ensure T. C,n The growth rate slows down as the scale increases, and the dynamic change of the dynamic similarity threshold means that as the current microenvironment cluster expands, the threshold for incorporating new cells becomes higher and higher, effectively preventing the current microenvironment cluster from over-expanding into heterogeneous regions.

[0060] S42. Include all external neighboring cells that meet the inclusion criteria into the current microenvironment cluster, and follow the formula. Incrementally update the centroid vector, where m represents the number of newly added external neighboring cells to the current microenvironment cluster, and Ne... neighbor,i Z represents the neighborhood composition vector of the i-th newly included external neighboring cell. C,n+m This represents the centroid vector when the size of the current micro-environment cluster is n+m, i.e., the updated centroid vector.

[0061] As a preferred approach, the growth cessation condition is: no external neighboring cells meet the condition, or the current microenvironment cluster reaches its maximum expansion radius R. hard_limit R hard_limit The typical value is 1500 pixels.

[0062] In this embodiment, the physical meaning of calculating cosine similarity is that cosine similarity measures the proximity of two vector directions, rather than their absolute numerical magnitude. It only cares about whether the composition patterns of two local inhabitants are similar, not about the specific number of cells. For example, an immune cell in the core region of a tumor, although it is an immune cell itself, will be included in the tumor microenvironment cluster because the composition of its surrounding inhabitants (70% tumor + 20% immune) is highly similar to the centroid vector of the tumor cluster.

[0063] In this embodiment, T C,n The physical meaning of the calculation formula is: as the size n of the current micro-environment cluster increases, log(n) also gradually increases, leading to a dynamic similarity threshold T. C,n The threshold is getting higher and higher. This means that the current microenvironment clusters have low barriers to entry in the early stages and easily accept new members, but in the growth stage, the threshold is high and they only accept highly homogeneous cells. This design effectively prevents the microenvironment clusters from over-expanding into heterogeneous regions.

[0064] As a preferred approach, the region growing step also includes cluster collision arbitration, specifically: When multiple microenvironment clusters compete for the same boundary cell during growth, calculate the overall score of the boundary cell relative to each participating microenvironment cluster: Where b represents the boundary cell, which is a cell that is simultaneously identified as meeting the inclusion criteria by at least two microenvironment clusters; C represents the competing microenvironment clusters; Score(b,C) represents the comprehensive score of boundary cell b relative to the competing microenvironment cluster C; the lower the comprehensive score, the more likely b should belong to C; ω represents the weighting coefficient, which controls the balance between phenotypic similarity and spatial proximity, and takes a value between 0 and 1, with a typical value of 0.5; D M (b,C) represents the Mahalanobis distance between the boundary cell b and the competing microenvironment cluster C in phenotypic space, considering variance and correlation across various dimensions. b Sp represents the physical coordinates of the boundary cell b. top,C R represents the physical coordinates of the seed cell corresponding to the microenvironment cluster C participating in the competition. current,C This represents the maximum coverage area of ​​the competing microenvironment cluster C, i.e., the maximum physical distance from all cells in the competing microenvironment cluster C to the corresponding seed cell, used to normalize Sp. b With Sp top,CThe distance between them.

[0065] Boundary cells are assigned to the competing microenvironment clusters with the lowest overall scores.

[0066] In this embodiment, during the parallel growth of multiple microenvironment clusters, when a cell is simultaneously determined by two or more microenvironment clusters to meet the inclusion criteria, the cell is a boundary cell, and its affiliation needs to be determined through a cluster collision arbitration mechanism.

[0067] Cluster collision arbitration uses a comprehensive score of boundary cells relative to each competing microenvironment cluster, considering two dimensions: first, how similar your cell composition is to our cluster, achieved through Mahalanobis distance; and second, how close you are to our center, achieved through spatial distance.

[0068] Based on cell graph structure, this invention starts from discrete cell-level prediction results and constructs multiple microenvironment clusters with spatial consistency and interpretable structure through the process of "seed cell selection - constrained region growth - cluster collision arbitration", without the need for predefined spatial scale.

[0069] S5. For each pathological image, generate a microenvironment composition vector based on the cellular composition of each microenvironment cluster.

[0070] Furthermore, the steps for generating the microenvironment composition vector are as follows: S51. Count the number of cells of various types within the microenvironment cluster and calculate the proportion of each type of cell.

[0071] S52. Based on the proportion of various cell types, determine the microenvironment composition vector of the microenvironment cluster, and describe the microenvironment composition vector of the microenvironment cluster as V. C =[V C,1 V C,2 ,……,V C,K ], V C,1 V represents the percentage of type 1 cells within the microenvironment cluster. C,2 V represents the proportion of the second type of cell within the microenvironment cluster. C,K This represents the percentage of the Kth cell type within the microenvironment cluster.

[0072] S6. For each pathological image, spatial features are constructed based on the composition vectors of each microenvironment. The spatial features of multiple pathological images (a set of pathological images with good prognosis and a set of pathological images with poor prognosis) are aggregated and differentially analyzed to obtain biomarkers. The biomarkers produced by this invention can be used in various downstream scenarios such as clinical prognosis analysis, drug development, and basic medical research.

[0073] Furthermore, the steps for constructing spatial features based on the component vectors of each microenvironment include: S61. For any microenvironment cluster, the microenvironment composition vector V C Iterate through a non-empty subset s of a set J consisting of K cell types, where each element in the non-empty subset s corresponds to a cell type; to capture the cooperative interaction patterns between cells, define a subspace projection operator. and through the subspace projection operator From V C Extract the dimension corresponding to the cell type in the non-empty subset s to obtain V. C The projection result V onto the subspace corresponding to the non-empty subset s C,s V C,s =Pi s (V C ), where |s| represents the number of elements in the non-empty subset s, Represents a K-dimensional real vector space. Let s represent a |s|-dimensional real vector space, and "→" denotes projection. When the non-empty subset s is the whole set, the projection result is equal to the original microenvironment composition vector, which retains the information of all cell types within the microenvironment cluster and reflects the global composition features. When the non-empty subset s is a proper subset, the projection result only retains the information of some cell types and reflects the co-localization pattern of a specific cell type subset.

[0074] S62. After traversing all non-empty subsets, we obtain V. C The corresponding set of low-dimensional subspace representations {V C,s |s∈P nonempty (J)}, using this subspace as the spatial characteristic of the microenvironment cluster, where P nonempty (J) represents the set of all non-empty subsets of set J, and the spatial features are represented in vector form in the spatial feature space.

[0075] In this embodiment, V C It is a K-dimensional vector, projected by the projection operator Pi. s You can keep only V C Let J be the components of those dimensions that belong to the non-empty subset s. J is the set consisting of NK_T cells, plasma cells, myeloid cells, blood vessels, fibroblasts / myofibroblasts, epithelial cells, specialized cells, melanocytes, and necrotic regions; s is {NK_T cells}, {plasma cells}, ..., {NK_T cells, plasma cells}, ..., {NK_T cells, plasma cells, myeloid cells}, ... C,s It is a low-dimensional vector. As an example, suppose V C=[0.6, 0.2, 0.1, 0.1, ...], where all dimensions are 0. The cell types corresponding to 0.6, 0.2, 0.1, and 0.1 are NK_T cells, plasma cells, myeloid cells, and blood vessels, respectively. If s is {NK_T cells, plasma cells}, then V C,s =[0.6, 0.2], retaining only the values ​​of NK_T cells and plasma cells. By traversing all non-empty subsets, the original high-dimensional vector V is obtained. C It is decomposed into a set of low-dimensional subspace representations, which can reveal the cooperative differences of certain cell combinations that may be masked in the global vector.

[0076] Furthermore, the steps of difference analysis include: S6a. Take any microenvironment cluster from all microenvironment clusters of multiple pathological images as the query microenvironment cluster. In the spatial feature space, with the spatial features of the query microenvironment cluster as the query center, find the spatial features of the microenvironment clusters that satisfy ‖yq‖≤h, forming a scale-dependent neighborhood N(q,h) with radius h for the query microenvironment cluster, N(q,h)={y|‖yq‖≤h}. Here, the spatial feature space refers to the set of spatial features of all microenvironment clusters generated by each of the multiple pathological images. The multiple pathological images correspond to different patients, and each pathological image is associated with the prognostic label of the corresponding patient. y represents any spatial feature in the spatial feature space, q represents the spatial feature of the query microenvironment cluster, i.e., the query center, ‖yq‖ represents the Euclidean distance between them, and h is a variable scale parameter, h>0. In practice, h is scaled by a certain step size (e.g., 0.01, 0.05). (or 0.1) Gradually increase from the minimum value to the maximum value. As a preferred example, the step size can be 0.05 or 0.1. The range of h is usually determined according to the distribution of pairwise Euclidean distances between vectors in the spatial feature space. As a preferred example, h can be 0.01 to 10.0.

[0077] S6b. Divide the scale-dependent neighborhood N(q,h) into a good prognosis sub-neighborhood N0(q,h) and a poor prognosis sub-neighborhood N1(q,h) according to the prognostic label Y, where Y∈{0,1}, Y=0 represents a good prognosis and Y=1 represents a poor prognosis.

[0078] S6c. Determine the difference trajectory function between N0(q,h) and N1(q,h): LogFC(q,h)=log2((|N0(q,h)|+ɛ) / (|N1(q,h)|+ɛ)), where LogFC(q,h) represents the difference trajectory function between N0(q,h) and N1(q,h), used to measure the abundance difference between good and bad prognostic sub-neighborhoods, |N0(q,h)| represents the number of elements in N0(q,h), |N1(q,h)| represents the number of elements in N1(q,h), and ɛ is a constant, a very small positive number used to prevent division by zero errors and ensure numerical stability, such as 10. -6 Here, when LogFC(q,h) is positive, it indicates that there are more micro-environment clusters with good prognosis in the scale-dependent neighborhood N(q,h), and when LogFC(q,h) is negative, it indicates that there are more micro-environment clusters with poor prognosis in the scale-dependent neighborhood N(q,h). In the formula LogFC(q,h)=log2((|N0(q,h)|+ɛ) / (|N1(q,h)|+ɛ)), q is fixed as the query center and h is used as a variable, forming a function with h as the independent variable. The sequence of values ​​of this function under different h values ​​constitutes a difference trajectory with h as the horizontal axis and the value of LogFC(q,h) as the vertical axis.

[0079] S6d. To mitigate the deviation caused by arbitrarily choosing a fixed radius, this invention analyzes the curvature of the differential trajectory to determine structural stability: Where Curv(q,h) represents the curvature of the difference trajectory, reflecting the rate of change of the growth rate of the difference signal, and d represents the derivative.

[0080] S6e. Determine the optimal radius: , where h * (q) represents the optimal radius, which is defined as the position where the absolute value of curvature is the smallest. Curvature close to zero means that the difference trajectory changes from rapid growth to stability. At this time, the corresponding neighborhood just covers the entire core area of ​​difference. If h is too small, the statistics will be unstable. If it is too large, the difference will be diluted. The optimal radius ensures that the neighborhood is both statistically reliable and has the greatest discriminative power. abs() is the absolute value function.

[0081] S6f, the scale-dependent neighborhood N(q, h) determined by the query center and the optimal radius. * Perform a statistical significance test within (q) and calculate the p-value and effect size for each spatial feature (abs(LogFC(q, h)). * (q)), and then select spatial features that meet the preset effect size threshold and preset significance level threshold as biomarkers. Biomarkers include spatial biomarkers and tissue biomarkers.

[0082] As an example, the statistical significance test uses the Mann-Whitney U test; the preset effect size threshold and the preset significance level threshold are both hyperparameters, with a typical value of 0.6 for the preset effect size threshold and a typical value of 0.05 for the preset significance level threshold; the specific selection criteria are spatial features that satisfy the p-value being less than the preset significance level threshold (i.e., 0.05) and the effect size being greater than the preset effect size threshold (i.e., 0.6).

[0083] Spatial biomarkers correspond to projections onto the subspace of non-empty true subsets, and are used to characterize the colocalization patterns of specific cell type subsets, reflecting local multicellular synergy. For example, "high-density colocalization of NK_T cells and epithelial cells" may indicate active immune infiltration.

[0084] Tissue-level biomarkers correspond to the projection results on the subspace corresponding to the whole set, and are used to characterize the overall composition characteristics of microenvironment clusters, reflecting the structural organization at the tissue scale. For example, "fibroblast-rich microenvironment clusters" may be associated with tumor invasiveness.

[0085] It should be noted that each spatial feature in the spatial feature space is itself a mathematical description of the composition pattern of the microenvironment. After differential analysis screening, those spatial features that show significant differences between the good prognosis group and the poor prognosis group are identified as biomarkers. In other words, biomarkers are spatial features with prognostic discriminative power selected from the spatial feature space.

[0086] In a preferred embodiment, this invention employs Kaplan-Meier survival analysis to assess the prognostic stratification of the discovered biomarkers. Specifically, based on the expression of spatial or tissue-level biomarkers (such as the frequency of occurrence of specific microenvironment clusters) in each patient sample, patients are divided into high-risk and low-risk groups. The survival rates of the two groups are estimated using the Kaplan-Meier method, and survival curves are plotted. The difference between the two survival curves is compared using the Log-rank test. If the p-value of the Log-rank test is less than the preset significance level (e.g., p < 0.05), it indicates that the biomarker (spatial or tissue-level biomarker) has a significant patient risk stratification ability. Furthermore, a Cox proportional hazards regression model can be used for multivariate analysis to assess whether the biomarker is an independent prognostic factor.

[0087] To further demonstrate the feasibility and effectiveness of the method of the present invention, experimental verification was conducted.

[0088] 1. Validation of the significant improvement in the quality of microenvironment cluster construction: Experiments were conducted on multiple public and private datasets (covering hepatocellular carcinoma, bladder cancer, and breast cancer). Intra-cluster entropy was used as an evaluation metric for the uniformity of microenvironment cluster structure, and the intra-cluster entropy was calculated using methods known in the art. Lower entropy values ​​indicate more uniform cell type composition and better spatial consistency within the cluster. Experimental results show that the intra-cluster entropy of the method presented in this invention is 0.316, significantly better than existing methods such as diffcyt (0.408), MELD (0.458), and Squidpy (0.429). This indicates that the microenvironment clusters generated by this invention have better structural uniformity and spatial consistency. Here, diffcyt is an R language toolkit, MELD is an algorithm framework based on graph theory and manifold learning, and the intra-cluster entropy was calculated using existing techniques.

[0089] 2. Validation of enhanced discriminative ability of biomarkers: When screening differential biomarkers, the Mann-Whitney U test was used to statistically test the abundance differences of microenvironment clusters between the good prognosis group and the poor prognosis group, that is, to compare the scale-dependent neighborhood N(q, h) determined by the same query center and the optimal radius. * (q)) Good prognostic sub-neighborhood N0(q, h) * (q)) and the difference in prognostic sub-neighborhood N1(q, h) * (q)) Differences in the number of microenvironment clusters, calculating p-values ​​and effect sizes (abs(LogFC(q, h)) * (q)); The preset effect size threshold is 0.6, and the preset significance level threshold is 0.05. Specific selection criteria include p-values ​​less than the preset significance level threshold (i.e., 0.05) and effect sizes (abs(LogFC(q, h)). * Spatial characteristics where (q))) are greater than the preset effect size threshold (i.e., 0.6). Statistical significance is evaluated using -log10(p) corresponding to the median significance p-value; a higher value indicates a stronger ability to detect significantly different biomarkers.

[0090] In biomarker discovery tasks, the biomarkers discovered by the method of this invention have a high phenotypic consistency with the biomarkers discovered by the existing methods mentioned above (mean cosine similarity > 0.87, cosine similarity is used to measure the directional consistency of two phenotypic feature vectors, and the closer the value is to 1, the more similar the phenotypes are), which proves that the method of this invention can reliably extract the original spatial signal into stable, repeatable, and clinically relevant biomarkers.

[0091] The method of this invention achieved the highest statistical significance (median significance p-value corresponding to -log10(p) = 2.107), which is significantly better than diffcyt (1.354), MELD (0.844) and Squidpy (1.114), indicating that the method of this invention can discover biomarkers with stronger prognostic power.

[0092] Validation experiments across centers and cancer types demonstrate that the biomarkers (including spatial and tissue-level biomarkers) discovered by the method of this invention can reliably capture prognostic heterogeneity and exhibit good generalization ability in different independent cohorts.

[0093] 3. Validation of faithful capture of multi-scale heterogeneity: The adaptive region growth and competitive allocation mechanism (i.e., cluster collision arbitration) of the method of this invention can effectively divide tissues into spatially continuous clusters (i.e., microenvironment clusters) corresponding to biological structures. Tumor nests, necrotic regions, and stromal boundaries are precisely delineated with high local purity, demonstrating that the method of this invention can capture spatial heterogeneity and cellular synergy without relying on predefined scales.

[0094] Ablation experiments show that, at a resolution of 16 (resolution represents the scaling factor of the initial seed number when constructing microenvironment clusters; the higher the resolution, the more initial seeds and the finer the granularity of the microenvironment clusters), the method of this invention achieves the optimal balance between cross-slice consistency (median cosine similarity = 0.602) and stability (median NMI of Bootstrap refit = 0.915, median NMI of random initialization = 0.883).

[0095] 4. Verification of clinical applicability and interpretability: Kaplan-Meier survival analysis was used to assess the risk stratification ability of biomarkers. Patients were divided into high-risk and low-risk groups based on the expression abundance of biomarkers (with the median as the cutoff value). The Log-rank test results showed that the p-values ​​of both spatial and tissue-level biomarkers were less than 0.05, indicating that they had good risk stratification ability.

[0096] The method of this invention is based entirely on conventional H&E staining images, without the need for additional multiplexed staining or molecular detection, which significantly reduces the cost and technical threshold of space biomarker research and has good prospects for clinical application.

Claims

1. A pathological image biomarker extraction method based on adaptive microenvironment construction, characterized in that, Includes the following steps: Obtain the type probability distribution vectors of multiple cells in a pathological image; A cell graph structure is constructed based on the physical coordinates of all cells, and the neighborhood composition vector of each cell is determined based on the type probability distribution vector of each cell. Calculate the local purity score of each cell based on the neighborhood composition vector of each cell, and select multiple seed cells from all cells according to the local purity score of each cell; Starting with various daughter cells, each region independently grows within the cell graph structure, generating multiple microenvironment clusters. The growth process for any given microenvironment cluster is as follows: using the neighborhood composition vector of the corresponding seed cell as the initial centroid vector of the current microenvironment cluster; determining whether the similarity between the neighborhood composition vectors of the external neighboring cells of the current microenvironment cluster and the centroid vector is greater than a dynamic similarity threshold; in this case, all external neighboring cells meeting the condition are included in the current microenvironment cluster, and the centroid vector is updated. The dynamic similarity threshold increases with the size of the current microenvironment cluster. This process of determination, inclusion, and updating is repeated until the growth cessation condition is met, at which point region growth stops. Generate microenvironment composition vectors based on the cellular composition of each microenvironment cluster; Spatial features were constructed based on the component vectors of each microenvironment, and the spatial features of multiple pathological images were aggregated for differential analysis to obtain biomarkers.

2. The method for extracting biomarkers from pathological images based on adaptive microenvironment construction according to claim 1, characterized in that, The step of obtaining the type probability distribution vectors of multiple cells in a pathological image includes: The pathological image was segmented into multiple cells using a segmentation model based on a convolutional neural network. The morphological features of the cells were extracted using a pre-trained encoder; The morphological features are input into a pre-trained classifier to obtain the probability distribution vector of each cell type.

3. The method for extracting biomarkers from pathological images based on adaptive microenvironment construction according to claim 1, characterized in that, The step of determining the neighborhood composition vector of each cell based on the type probability distribution vector of each cell includes: For any cell, the cells in the cell graph structure other than the center cell within a circular neighborhood of the center cell with radius r nei are adjacent cells of the center cell. The type of each cell in the circular neighborhood is determined based on the probability distribution vector of the cell types within the circular neighborhood. Count the number of cells of each type within the circular neighborhood and calculate the percentage of each cell type. The neighborhood composition vector of the central cell is determined based on the proportion of various cell types.

4. The method of claim 3, wherein the method is based on adaptive microenvironment construction. The step of selecting multiple seed cells includes: Calculate the local purity fraction for each cell, where the local purity fraction is the reciprocal of the Shannon entropy: S j =1 / H(Ne j ), where S j H(Ne) represents the local purity fraction of the j-th cell. j ) represents Ne j Shannon entropy, Ne j Ne represents the neighborhood composition vector of the j-th cell. j =[N j,1 N j,2 ,……,N j,K ], N j,k The percentage of cells of the kth type is represented by Num, where 1 ≤ j ≤ Num, Num represents the total number of cells in the pathological image, and K represents the number of cell types. All cells are arranged in descending order of their local purity fraction. The unmasked cell with the highest local purity fraction is selected as the seed cell using non-maximum suppression iterative selection. The non-maximum suppression uses a spatial radius R. nms Used to mask the cells surrounding the selected seed cell.

5. The method of claim 4, wherein the method is based on adaptive microenvironment construction for pathology image biomarker extraction. The steps of the region growth include: For the centroid vector Z of the current micro-environment cluster with a size of n... C,n Obtain the external neighboring cells of the current microenvironment cluster, wherein the external neighboring cells are defined as those centered on any cell within the current microenvironment cluster and having a radius of r. nei For cells within a circular neighborhood that do not belong to the current microenvironment cluster, determine the neighborhood composition vector of the external neighboring cells and its relation to Z. C,n Is the similarity between them greater than the dynamic similarity threshold? This formula serves as the inclusion condition, where n represents the size of the current microenvironment cluster, and cos(θ) represents the neighborhood composition vector of the external neighboring cells and Z. C,n The similarity between them, Ne neighbor T represents the neighborhood composition vector of the external neighboring cells. C,n T represents the dynamic similarity threshold when the size of the current microenvironment cluster is n. C,n T increases with the size n of the current microenvironment cluster. C,n = T base +δ×log(n), T base δ represents the base threshold, and δ represents the scaling factor. All external neighboring cells that meet the inclusion criteria are included in the current microenvironment cluster, and then processed according to the formula. Incrementally update the centroid vector, where m represents the number of newly added external neighboring cells to the current microenvironment cluster, and Ne... neighbor,i Z represents the neighborhood composition vector of the i-th newly included external neighboring cell. C,n+m This represents the centroid vector when the size of the current micro-environment cluster is n+m, i.e., the updated centroid vector; The growth stop condition is: no external neighboring cells meet the condition, or the size of the current microenvironment cluster reaches the maximum expansion radius R hard_limit .

6. The method of claim 5, wherein the method is based on adaptive microenvironment construction for pathology image biomarker extraction. The region growth step also includes cluster collision arbitration, specifically: When multiple microenvironment clusters compete for the same boundary cell during growth, calculate the overall score of the boundary cell relative to each participating microenvironment cluster: Where b represents a boundary cell, which is a cell simultaneously identified as meeting the inclusion criteria by at least two microenvironment clusters; C represents the competing microenvironment clusters; Score(b,C) represents the comprehensive score of boundary cell b relative to the competing microenvironment cluster C; ω represents the weighting coefficient; and D... M (b,C) represents the Mahalanobis distance between the boundary cell b and the competing microenvironment cluster C in phenotypic space, Sp b Sp represents the physical coordinates of the boundary cell b. top,C R represents the physical coordinates of the seed cell corresponding to the microenvironment cluster C participating in the competition. current,C This represents the maximum coverage area of ​​the competing microenvironment cluster C, which is the maximum physical distance from all cells in the competing microenvironment cluster C to the corresponding seed cell. Boundary cells are assigned to the competing microenvironment clusters with the lowest overall scores.

7. The method for extracting biomarkers from pathological images based on adaptive microenvironment construction according to claim 1, characterized in that, The steps for generating the microenvironment composition vector are as follows: The number of cells of various types within the microenvironment cluster was counted, and the proportion of each type of cell was calculated. The microenvironment composition vector of the microenvironment cluster is determined based on the proportion of various cell types.

8. The method of claim 1, wherein the method is based on adaptive microenvironment construction for pathology image biomarker extraction. The steps for constructing spatial features based on the composition vectors of each microenvironment include: For any microenvironment cluster, the microenvironment composition vector V C Iterate through a non-empty subset s of a set J consisting of K cell types, where each element in the non-empty subset s corresponds to a cell type; and use the subspace projection operator. From V C Extract the dimension corresponding to the cell type in the non-empty subset s to obtain V. C The projection result V onto the subspace corresponding to the non-empty subset s C,s V C,s =Pi s (V C ), where |s| represents the number of elements in the non-empty subset s; After traversing all non-empty subsets, we obtain V. C The corresponding set of low-dimensional subspace representations {V C,s |s∈P nonempty (J)}, using this subspace representation as the spatial characteristic of the microenvironment cluster, where P nonempty (J) represents the set of all non-empty subsets of set J, and the spatial features are represented in vector form in the spatial feature space.

9. The method for extracting biomarkers from pathological images based on adaptive microenvironment construction according to claim 8, characterized in that, The steps of the difference analysis include: Take any microenvironment cluster as the query microenvironment cluster. In the spatial feature space, with the spatial features of the query microenvironment cluster as the query center, search for the spatial features of microenvironment clusters that satisfy ||yq||≤h. This forms a scale-dependent neighborhood N(q,h) with radius h for the query microenvironment cluster, where N(q,h)={y|||yq||≤h}. The spatial feature space refers to the set of spatial features of all microenvironment clusters generated by multiple pathological images. The multiple pathological images correspond to different patients, and each pathological image is associated with a prognostic label of the corresponding patient. y represents any spatial feature in the spatial feature space, and q represents the spatial feature of the query microenvironment cluster, i.e., the query center. The scale-dependent neighborhood N(q,h) is divided into a good prognosis sub-neighborhood N0(q,h) and a poor prognosis sub-neighborhood N1(q,h) according to the prognosis label Y, where Y∈{0,1}, Y=0 represents a good prognosis and Y=1 represents a poor prognosis; Determine the difference trajectory function between N0(q,h) and N1(q,h): LogFC(q,h)=log2((|N0(q,h)|+ɛ) / (|N1(q,h)|+ɛ)), where LogFC(q,h) represents the difference trajectory function between N0(q,h) and N1(q,h), |N0(q,h)| represents the number of elements in N0(q,h), |N1(q,h)| represents the number of elements in N1(q,h), and ɛ is a constant; analyzing a curvature of the difference trajectory: where Curv(q, h) represents the curvature of the difference trajectory; Determine the optimal radius: , where h * (q) represents the optimal radius; Statistical significance tests are performed within the scale-dependent neighborhood determined by the query center and the optimal radius. Spatial features that meet the preset effect size threshold and preset significance level threshold are selected as biomarkers. The biomarkers include spatial biomarkers and tissue-level biomarkers.