Spatial omics spatial domain identification method and system based on graph structure self-learning
Patent Information
- Application Number
- CN202610975455.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-02
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2046-07-02
AI Technical Summary
[0004]为解决上述现有技术的不足,本发明提供了一种基于图结构自学习的空间组学空间域识别方法及系统,通过利用大语言模型迭代优化空间图结构构建代码,获取最匹配当前空间域识别GNN模型架构的图构建逻辑,并进行模型代码绑定与知识沉淀,解决现有空间域识别因空间组学图构建僵化、多模态融合不充分而导致识别精度低、计算成本高、效率低的问题,提升空间组学目标组织空间域识别的准确性、效率与可解释性
本发明提供了一种基于图结构自学习的空间组学空间域识别方法及系统,针对现有空间域识别因空间组学图构建僵化、多模态融合不充分而导致识别精度低、计算成本高、效率低的问题,对空间域识别任务执行过程中的空间组学图结构构建进行优化,通过大语言模型驱动的代码级进化,将传统的超参数微调转化为受语义引导的Python程序合成,在面临异质性极强的组织微环境时,能够自动探索出超越传统空间K近邻的高效拓扑构建逻辑,动态且自适应地平衡空间物理距离、组织形态图像与基因表达谱等多模态特征在边权重计算中的比例,显著提高下游空间域划分的图神经网络模型的精度上限与鲁棒性;同时,将成功进化的图构建脚本与对应的下游模型架构绑定存储,可在面对全新的空间组学下游算法时,能够基于模型伪代码的相似度进行精准推荐与“热启动”,在保证针对不同特定下游任务达到高预测性能的前提下,将图结构搜索的收敛时间显著缩短,大幅降低了算力开销。通过上述优化,可有效提升空间组学目标组织空间域识别的准确性、效率与可解释性。
Smart Images

Figure CN122474152B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of bioinformatics technology, and in particular relates to a spatial domain identification method and system for spatial omics based on graph structure self-learning. Background Technology
[0002] Unlike traditional single-cell sequencing, spatial omics technology can simultaneously preserve the expression abundance and in-situ spatial coordinates of molecules (such as cells, sequencing spots, etc.). Cells rely on their physical spatial location and intricate molecular communications to form a highly interconnected microenvironment network. This endogenous network topology makes Graph Neural Networks (GNNs) the core paradigm for spatial omics processing tasks (such as spatial domain identification tasks) due to their powerful information aggregation capabilities.
[0003] However, existing spatial domain recognition tasks have certain shortcomings: spatial domain recognition relies on graph structures and graph neural networks to complete clustering and region partitioning. Currently, the construction of graph structures depends on fixed heuristic rules (such as K-nearest neighbors), which have poor adaptability to organizational heterogeneity, easily resulting in overly smoothed dense areas and isolated nodes in sparse areas, directly leading to a decrease in spatial domain recognition accuracy. Furthermore, these heuristic rules cannot guarantee that they can adapt to multimodal features that integrate spatial location, gene expression, and tissue morphology, limiting feature expression capabilities and making it difficult to fit the real biological microenvironment, which also affects the subsequent spatial domain recognition results. In addition, when facing new models or other new tasks for spatial domain recognition, a huge amount of computing power is required to randomly search for graph structure construction methods from scratch, which has a slow convergence speed and lacks a mechanism for reusing historical experience. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a spatial domain recognition method and system based on graph structure self-learning in spatial omics. By iteratively optimizing the spatial graph structure construction code using a large language model, the method obtains the graph construction logic that best matches the current spatial domain recognition GNN model architecture, and performs model code binding and knowledge accumulation. This solves the problems of low recognition accuracy, high computational cost, and low efficiency in existing spatial domain recognition due to rigid spatial omics graph construction and insufficient multimodal fusion, thereby improving the accuracy, efficiency, and interpretability of spatial domain recognition for spatial omics target organization.
[0005] In a first aspect, the present invention provides a spatial domain identification method for spatial omics based on graph structure self-learning.
[0006] A spatial domain identification method for spatial omics based on graph structure self-learning includes: Acquire spatial omics data of the target tissue to be identified; Using the graph neural network model that performs spatial domain recognition downstream as the target model, the pseudocode of the target model is extracted and matched with the model pseudocode in the historical knowledge base to obtain the reference graph construction code. After fine-tuning by the large language model, an initial graph construction code population is generated. Based on spatial omics data, the initial graph construction code is run to generate graph structures. Each graph structure is input into the target model and a dual-index fitness evaluation is performed. Based on the evaluation results, the semantic mutation mechanism of the large language model is used to iteratively optimize the graph construction logic to obtain the optimal graph construction code. The code generates a graph structure based on the optimal graph, and the graph structure is input into the target model to perform spatial domain clustering and region partitioning to obtain spatial domain recognition results.
[0007] In a further technical solution, the spatial omics data includes gene expression matrices, spatial coordinate matrices, and tissue morphology images of sequencing spots.
[0008] Further technical solutions, referring to the acquisition of graph construction code, include: Using existing graph neural networks for spatial domain recognition as the target model, the source code of the target model is extracted; The source code of the target model is input as text data into the large language model. The large language model extracts the core algorithm skeleton and network layer structure of the target model according to the preset abstraction strategy, and generates standardized multi-view pseudocode of the target model. The pseudocode of the target model is matched with the pseudocode of the model in the historical knowledge base by structural similarity. The graph construction code corresponding to the most similar reference model is retrieved and used as the reference graph construction code.
[0009] A further technical solution is that the source code includes: a data loading stream, a network layer definition, and forward propagation logic; The abstraction strategy is to strip away specific variable names and hyperparameter values, retaining only the core algorithm control flow, data dimension transformation, and mathematical aggregation operations.
[0010] A further technical solution involves building code based on the reference graph, fine-tuning it using a large language model, and generating initial graph construction code, including: Using a large language model, the extracted reference graph construction code is injected and integrated into the initial processing script as high-quality topology prior logic. During the integration process, the large language model generates an initial graph construction code population containing multiple high-quality individuals by adopting different code implementation styles or fine-tuning logic details.
[0011] A further technical solution involves the following process of code-level evolution of the graph structure: In the current iteration of the population, based on spatial omics data, the graph construction code of each graph in the population is run to generate graph structures. Each graph structure is input into the target model. A dual-index fitness function is constructed with spatial domain recognition accuracy and computation time to evaluate the target model's processing effect on the current graph structure. The reference graph construction code, the current iteration population, and its corresponding fitness evaluation value are used as context inputs and fed into the large language model. The large language model uses a semantic mutation mechanism to reason and analyze the logic of the graph construction code and modify the code fragments to generate a population with better performance for the next iteration. The semantic mutation mechanism is used to dynamically adjust the fusion weights and edge rules of spatial distance, gene expression similarity, and tissue morphology similarity. The optimization process is continuously iterated until the code optimization converges, and the optimal graph construction code that fits the current target model is extracted.
[0012] Further technical solutions also include: The converged optimal graph construction code and the corresponding downstream target model pseudocode are bound and stored in the historical knowledge base for hot start and knowledge reuse in subsequent new tasks.
[0013] Secondly, the present invention provides a spatial domain identification system for spatial omics based on graph structure self-learning.
[0014] A spatial domain identification system based on graph structure self-learning in spatial omics includes: The data acquisition module is used to acquire spatial omics data of the target tissue to be identified; The initial graph construction code generation module is used to extract pseudocode from the target model of the graph neural network model that performs spatial domain recognition downstream, and match and retrieve the pseudocode of the target model with the model pseudocode in the historical knowledge base to obtain reference graph construction code. After fine-tuning by the large language model, the initial graph construction code population is generated. The optimal graph construction code generation module is used to generate graph structures by running each initial graph construction code based on spatial omics data. Each graph structure is input into the target model and a dual-index fitness evaluation is performed. Based on the evaluation results, the semantic mutation mechanism of the large language model is used to iteratively optimize the graph construction logic to obtain the optimal graph construction code. The spatial domain identification module is used to generate a graph structure based on the optimal graph construction code, input the graph structure into the target model to perform spatial domain clustering and region partitioning, and obtain the spatial domain identification result.
[0015] Thirdly, the present invention also provides an electronic device, comprising: a memory for storing executable instructions; and a processor for implementing the above-described spatial domain identification method based on graph structure self-learning when executing the executable instructions stored in the memory.
[0016] Fourthly, the present invention also provides a computer-readable storage medium storing executable instructions for causing a processor to execute the executable instructions to implement the above-described spatial domain identification method based on graph structure self-learning.
[0017] The above one or more technical solutions have the following beneficial effects: This invention provides a spatial domain recognition method and system based on graph structure self-learning in spatial omics. Addressing the problems of low accuracy, high computational cost, and low efficiency in existing spatial domain recognition methods due to rigid spatial omics graph construction and insufficient multimodal fusion, this invention optimizes the spatial omics graph structure construction during the spatial domain recognition task execution process. Through code-level evolution driven by a large language model, traditional hyperparameter fine-tuning is transformed into semantically guided Python program synthesis. When faced with highly heterogeneous tissue microenvironments, it can automatically explore efficient topology construction logic that surpasses traditional spatial K-nearest neighbors. It dynamically and adaptively balances the proportion of multimodal features such as spatial physical distance, tissue morphology images, and gene expression profiles in edge weight calculation, significantly improving the accuracy upper limit and robustness of the graph neural network model for downstream spatial domain partitioning. Simultaneously, the successfully evolved graph construction script is bound and stored with the corresponding downstream model architecture. When facing new spatial omics downstream algorithms, it can perform accurate recommendations and "hot starts" based on the similarity of model pseudocode. While ensuring high predictive performance for different specific downstream tasks, it significantly shortens the convergence time of graph structure search and greatly reduces computational overhead. The above optimizations can effectively improve the accuracy, efficiency, and interpretability of spatial domain identification for spatial omics objectives.
[0018] 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
[0019] 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.
[0020] Figure 1 This is an overall flowchart of the spatial domain identification method for spatial omics based on graph structure self-learning in an embodiment of the present invention. Detailed Implementation
[0021] It should be noted that the following detailed descriptions are exemplary and are intended only to describe specific embodiments and to provide further explanation of the invention, and are not intended to limit the scope of exemplary embodiments 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. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0022] As noted in the background section, spatial domain recognition tasks rely on graph structures and graph neural networks to perform clustering and region partitioning. However, current mainstream graph construction methods heavily depend on fixed heuristic static rules (such as K-nearest neighbors) to process input spatial coordinates and gene data. These rules impose overly rigid inductive biases on specific spatial omics data processing tasks: on the one hand, tissue slices are often highly heterogeneous with uneven cell density distribution. Fixed thresholds can lead to overcrowding in dense regions, causing "oversmoothing," while sparse regions form isolated nodes, directly resulting in a decrease in the accuracy of spatial domain recognition tasks. On the other hand, these heuristic rules cannot adaptively capture the complex and variable nonlinear mapping relationships between multimodal features such as spatial physical distance, tissue morphology features, and gene expression similarity, greatly limiting the feature expression capabilities of downstream GNN models when processing specific spatial domain recognition tasks. In addition, conventional graph learning methods based on parameter fine-tuning are limited by non-convex optimization landscapes, are prone to getting trapped in local optima, and often output uninterpretable black-box adjacency matrices.
[0023] Therefore, to address the above problems, this invention constructs a code-level graph structure learning strategy focused on spatial omics data. It breaks through the rigid inductive bias of traditional fixed heuristic rules and automatically mines and generates efficient, white-box graph topology construction code logic that is most suitable for the characteristics of the current organizational microenvironment by conducting adaptive global exploration in a unified code-level search space, thereby improving the accuracy of spatial domain identification tasks in spatial omics data.
[0024] Meanwhile, when dealing with the ever-emerging new spatial omics tasks or models, it is often necessary to switch between different downstream graph neural network architectures (e.g., from GCN for spatial domain recognition to GAT). Traditional automated machine learning (AutoML) or graph structure optimization algorithms often face severe "cold start" and "knowledge forgetting" problems, typically treating each graph structure exploration for a new downstream model as a completely independent computational island, lacking a mechanism for retaining successful optimization experiences. This forces the system to expend enormous computing power to perform extremely time-consuming random searches from scratch when faced with new downstream algorithm architectures, resulting in extremely high computational costs.
[0025] Therefore, to address the above problems, this invention also introduces a code-level graph structure learning strategy with lifelong learning and knowledge accumulation capabilities. This strategy can establish a binding mapping relationship between the downstream model architecture and the above-mentioned optimal graph construction code. Thus, when facing new spatial omics analysis tasks or new models, it can achieve efficient code-level "hot start" through model similarity retrieval, breaking the bottleneck of inefficient computing power in traditional methods that require starting from scratch for each optimization.
[0026] Example 1 This embodiment provides a spatial domain recognition method based on graph structure self-learning in spatial omics, addressing the problems of low recognition accuracy, high computational cost, and low efficiency in existing spatial domain recognition methods due to rigid spatial omics graph construction and insufficient multimodal fusion. Specifically, it includes: To address the challenge of traditional graph construction methods failing to capture complex interaction patterns in tissue slices that are highly dependent on biological context (such as tumor invasion boundaries and specific brain region levels), this paper integrates code evolution operators based on the Large Language Model (LLM) to transform the spatial graph construction task into an evolutionary population of executable Python scripts. Guided by feedback from both model accuracy and runtime efficiency, semantic mutations can be performed in a gradient-free code space to automatically optimize the graph construction logic that best matches the current downstream model architecture.
[0027] To address the issues of traditional automatic optimization algorithms consuming excessive computing power and being unable to be transferred across tasks, a model code binding and knowledge accumulation module is constructed. This module can bind the generated optimal graph construction code with specific downstream model pseudocode through key-value pair binding and store it in a library. When a new target downstream model is introduced, the architectural similarity between models can be calculated through intelligent recommendation, and graph construction code fragments of the reference downstream model can be directly retrieved and injected, enabling a leap from zero to a high starting point and significantly shortening the search convergence cycle.
[0028] like Figure 1 As shown, the method proposed in this embodiment specifically includes the following steps: Step S1: Obtain spatial omics data of the target tissue to be identified; the spatial omics data includes gene expression matrix, spatial coordinate matrix and tissue morphology image of sequencing spots.
[0029] In this embodiment, to more clearly illustrate the implementation process of the entire scheme, the spatial domain identification task of human dorsolateral prefrontal cortex (DLPFC) tissue sections is used as an example to elaborate on the execution process of this task. Specifically, the acquired spatial omics data are: SpatialLIBD 151507 spatial transcriptome section data sequenced based on the 10x Visium platform. The acquired data includes: gene expression matrix of 4226 spatial spots, expression characteristics of 33538 genes, corresponding in situ physical coordinate matrix, and H&E stained histological RGB image.
[0030] Based on this, the corresponding spatial domain recognition task is performed on these data, namely: identifying and segmenting different cortical structures (such as cortical layers 1-6 and white matter regions) in the DLPFC slices. The target downstream model used in this embodiment is the Spatial Graph Convolutional Network (SpaGCN) for spatial domain clustering recognition.
[0031] Step S2: Using the graph neural network model for downstream spatial domain recognition as the target model, extract the pseudocode of the target model and match it with the model pseudocode in the historical knowledge base to obtain the reference graph construction code. After fine-tuning with the large language model, an initial graph construction code population is generated.
[0032] Specifically, the process involves acquiring information about the target downstream spatial omics model. This downstream model refers to the model that ultimately performs the specific spatial omics data processing task (i.e., spatial domain identification), specifically the SpaGCN model used for DLPFC cortical spatial domain clustering. By calculating the architectural similarity between models, the most matching reference model and its graph construction core code are retrieved from the historical codebase, thereby achieving an efficient hot start of the target model code evolution population. The specific implementation method of this step is as follows: Step S2.1: Target downstream model parsing and pseudocode extraction.
[0033] When a new target downstream model (i.e., the SpaGCN architecture used for DLPFC spatial clustering) is introduced, the source code of the target model (including data loading flow, network layer definition, and forward propagation logic, etc.) is input as text data into the Large Language Model (LLM). The LLM extracts the core algorithm skeleton and network layer structure of the target model according to a preset abstraction strategy, and generates a standardized multi-view pseudocode representation of the target model. The preset abstraction strategy is to strip away specific variable names and hyperparameter values, retaining only the core algorithm control flow, data dimension transformation, and mathematical aggregation operations.
[0034] Step S2.2: Matching retrieval based on downstream model similarity.
[0035] First, calculate the pseudocode of the target model. With historical knowledge base Structural similarity scores among the stored pseudocode of historical downstream models The specific calculation method is as follows: use a pre-trained large language model (such as GPT) to compare the pseudocode of the target model with the pseudocode in the historical database and output a similarity score to obtain the similarity score.
[0036] As another implementation, code structure matching algorithms based on abstract syntax trees (ASTs) can be used to directly compare the tree edit distance between the target downstream model code and the historical downstream model code at the syntax level; or, pre-trained large code domain models (such as CodeBERT, GraphCodeBERT, etc.) can be used to transform the network architecture code of the target downstream model into dense vectors, and cosine similarity can be used for efficient approximate nearest neighbor retrieval to find the best reference model.
[0037] Then, by maximizing this score, the best reference downstream model with the most similar architecture is precisely located in the historical database. , can be represented as: ; In the above formula, Indicates the similarity score. The independent variable that reaches its maximum value; This indicates traversing the historical knowledge base. Each historical downstream model stored in ; For any historical model in the historical knowledge base The corresponding standardized pseudocode.
[0038] Step S2.3: Reference code retrieval and initial population construction.
[0039] Specifically, retrieve the best reference downstream model from the historical database. Preferred graph construction code template for bound storage Build a code template using this preferred diagram. As a prompt (i.e., the text or instructions provided to the model to guide it in generating specific outputs), the initial processing script is optimized through the Large Language Model (LLM), which is the default graph construction code provided by the user for the current new task (such as the K-nearest neighbor script code for processing the gene expression CSV file and coordinate file of 4226 spots of DLPFC slices).
[0040] In this embodiment, the Large Language Model (LLM) agent constructs a code template from the extracted preferred graph. As a prompt, combined with the user-provided initial processing script for the current task, this forms the LLM code optimization prompt context. It guides the LLM to rewrite and optimize the default graph construction code while maintaining the initial script's data reading method, input / output interfaces, and downstream model call flow unchanged. During this process, historically optimized code templates are not directly copied into the current script, but rather serve as high-quality topology construction references. This allows the LLM to draw upon design principles such as distance metrics, neighbor selection, edge weight calculation, or threshold processing, and generate an initial executable population containing multiple high-starting-point variants through different code implementation styles or fine-tuning of logic details (e.g., using different distance metric functions or truncation thresholds). It contains multiple high-quality initial graph construction codes.
[0041] Step S3: Based on spatial omics data, run each initial graph construction code to generate graph structures, input each graph structure into the target model and perform dual-index fitness evaluation. Based on the evaluation results, use the semantic mutation mechanism of the large language model to iteratively optimize the graph construction logic and obtain the optimal graph construction code.
[0042] Specifically, within the code search space of the graph construction program, an optimized graph construction script specific to the target downstream model is iteratively generated through the semantic mutation mechanism of a large language model, and performance is guided using a dual-index fitness function. The specific implementation of this step is as follows: Step S3.1: Graph structure construction and fitness assessment.
[0043] In the current iteration number, i.e. Generation population In the process, each graph building procedure is executed. The input spatial omics raw data (i.e., the gene expression matrix, in situ spatial physical coordinate matrix, and H&E staining image of the 4226 spots of the above DLPFC slice) are mapped into a microenvironment map structure. The graph structure is then input into the target downstream model to perform spatial domain recognition. At this point, a dual-index fitness function is defined. To balance the prediction accuracy of the target downstream model on the validation set (such as the ARI index of DLPFC cortical clustering) with the computational time cost, this function can be expressed as: ; In the above formula, Hyperparameters that balance accuracy and efficiency; The adjusted Rand Index is calculated using the following formula: ; in, The RAND index is the ratio of predicted pairs to true pairs. A predicted pair refers to whether any two sample points in the output of a spatial domain recognition algorithm are classified into the same class (or the same cluster), while a true pair refers to whether two sample points in the true labels belong to the same class or (the same cluster). () represents the mathematical expectation under random assignment; It is usually set to 1, which is used to evaluate the consistency between the model's clustering results and the true labels; This is a function to find the maximum value. This is the tolerance threshold; The normalized time score, i.e., the runtime of the normalized single-line graph construction code, is calculated using the following formula: ; in, Candidate code The original actual time taken to complete the entire process (i.e., time score) is calculated. The constant 300 in the denominator is a normalized bias term, which means 300s = 5min. It is the upper limit benchmark of the engineering experience time for this task.
[0044] Step S3.2: Code semantic mutation driven by large language model.
[0045] Specifically, inspired by code evolution paradigms such as Alpha Evolve, but in order to overcome the limitations of not involving graph topology construction code optimization and lacking prior rule guidance, this step proposes a semantic mutation mechanism, which is also the core means to achieve adaptive representation and mapping of multimodal features (space, genes, images).
[0046] In this embodiment, the large language model agent receives the current population. Reference graph construction code and their corresponding fitness assessment values As contextual input, guided by this, LLM analyzes potential optimization directions in the current candidate graph construction code through a semantic mutation mechanism, and performs semi-random semantic rewriting on the code snippets.
[0047] The semantic mutation mechanism is used to dynamically adjust spatial distance, gene expression similarity, and edge rules. Specifically, edge rules refer to the rules for determining whether an edge is established between two spatial spots or cell nodes and how to assign edge weights, including K-nearest neighbor edges and radius threshold edges, and are part of the graph construction code. If the graph structure generated by a candidate code results in low consistency between the clustering results of the target model and the real spatial region labels, LLM analyzes and infers the cause of the problem based on the reference code. For example, if the graph construction logic has a poor integration effect on spatial information, morphological information, and omics information, or if the spatial coordinates and omics data of DLPFC slices are not effectively integrated, LLM modifies the edge weight calculation formula or edge conditions based on fitness feedback and the reference code to adjust the edge connection method and edge weights. Similarly, this solution is not limited to simply changing the connection method and weights. It can also optimize distance metrics, normalization methods, and similarity calculation methods while keeping the interface unchanged, thereby achieving local optimization. For example, the calculation methods for spatial distance and gene expression similarity are derived from the original script. Inspired by the reference graph construction code template, the LLM can locally rewrite these calculation methods to make the generated graph structure better than the final target model output.
[0048] It should be noted that the above modification process does not presuppose a single rule, but rather the LLM generates several semantic mutation schemes semi-randomly, guided by reference code and fitness feedback. These semantic mutation schemes may include adjusting the fusion ratio between spatial physical distance, H&E image pixel morphological similarity and gene expression similarity, or changing the distance metric function, altering the number of neighbors, modifying the distance truncation threshold, etc.
[0049] After the above-mentioned code-level adjustments, rewriting, and combinations, different code variants are obtained. After graph construction, model running, and dual-metric fitness evaluation, the code with better performance is retained for the next iteration, thus generating a next-generation code population with higher expected performance. We will continue with subsequent iterations and optimizations.
[0050] Finally, the above optimization process is iterated continuously until the code optimization converges, and the optimal graph construction code adapted to the current target model is extracted. In this embodiment, a threshold for the number of optimization iterations is set (which can be set based on historical experience, such as 20 times). When the number of iterations reaches the preset threshold, convergence is considered complete.
[0051] As one implementation method, in the above code evolution process, in addition to directly running the target downstream model on the full amount of spatial omics data to obtain accuracy and time cost, a surrogate model or biologically inspired indicators can be introduced for rapid pre-evaluation. That is, graph modularity and spatial autocorrelation index can be used as unsupervised graph quality surrogate indicators; or, a lightweight regression neural network can be trained as a performance predictor to filter out inefficient variants in advance before putting the code into the expensive downstream GNN for execution, thereby reducing the computational cost of the large model evolution process.
[0052] As one implementation method, after code optimization converges, the optimal graph construction script adapted to the current target downstream model is extracted and bound to the pseudocode of the target model, thus accumulating it into a reusable historical experience asset for hot-starting and knowledge reuse in subsequent new tasks. This step specifically includes: After evolution, the globally optimal graph construction program with the highest fitness score and best suited to the computational needs of the current target downstream model is selected from the final population. .
[0053] Standardize the target downstream model extracted above into pseudocode. With the generation of this step Perform a binding mapping and store it as a pair of core knowledge assets in the global historical knowledge code repository. In future tasks, this imported data will serve as the foundation for similarity comparison and reference recommendations in step S101.
[0054] Step S4: Based on the optimal graph, construct code to generate graph structure, input the graph structure into the target model to perform spatial domain clustering and region partitioning, and obtain spatial domain recognition results.
[0055] This embodiment elevates the paradigm of spatial graph structure learning from low-level matrix parameter fine-tuning to high-dimensional Python executable program synthesis. Based on the semantic guidance of a large model, it selectively evolves the graph topology generation logic, overcoming the limitations of traditional methods while ensuring absolute transparency and human readability of the biological computing logic. A closed-loop mechanism specifically designed for pseudocode matching, extraction, and binding into a library is employed. This mechanism summarizes the most preferred graph topology features for a specific graph neural network architecture and forms key-value pairs between downstream graph neural network models and graph construction code. When facing new omics analysis tasks, it can provide a precise code-level "hot start" engine by calculating the similarity of model architectures. In the field of spatial omics, this achieves lifelong accumulation and reuse of graph construction logic across algorithms and tasks, improving the accuracy, efficiency, and interpretability of spatial domain identification for spatial omics target organization.
[0056] Example 2 This embodiment provides a spatial domain identification system for spatial omics based on graph structure self-learning, including: The data acquisition module is used to acquire spatial omics data of the target tissue to be identified; The initial graph construction code generation module is used to extract pseudocode from the target model of the graph neural network model that performs spatial domain recognition downstream, and match and retrieve the pseudocode of the target model with the model pseudocode in the historical knowledge base to obtain reference graph construction code. After fine-tuning by the large language model, the initial graph construction code population is generated. The optimal graph construction code generation module is used to generate graph structures by running each initial graph construction code based on spatial omics data. Each graph structure is input into the target model and a dual-index fitness evaluation is performed. Based on the evaluation results, the semantic mutation mechanism of the large language model is used to iteratively optimize the graph construction logic to obtain the optimal graph construction code. The spatial domain identification module is used to generate a graph structure based on the optimal graph construction code, input the graph structure into the target model to perform spatial domain clustering and region partitioning, and obtain the spatial domain identification result.
[0057] Example 3 This embodiment provides an electronic device, including: a memory for storing executable instructions; and a processor for executing the executable instructions stored in the memory to implement the method provided in this embodiment.
[0058] Example 4 This embodiment also provides a computer-readable storage medium storing executable instructions, which, when executed by a processor, will cause the processor to execute the method described above in this embodiment.
[0059] The steps and methods involved in Embodiments 2 to 4 above correspond to those in Embodiment 1. For specific implementation details, please refer to the relevant description section of Embodiment 1. The term "computer-readable storage medium" should be understood as a single medium or multiple media including one or more instruction sets; it should also be understood as including any medium capable of storing, encoding, or carrying an instruction set for execution by a processor and enabling the processor to perform any of the methods in this invention.
[0060] 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.
[0061] The above description is only a preferred embodiment of the present invention. Although the specific implementation of the present invention has been described in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that, based on the technical solution of the present invention, various modifications or variations that can be made by those skilled in the art without creative effort are still within the scope of protection of the present invention.
Claims
1. A spatial domain identification method for spatial omics based on graph structure self-learning, characterized in that, include: Acquire spatial omics data of the target tissue to be identified; Using the graph neural network model that performs spatial domain recognition downstream as the target model, the pseudocode of the target model is extracted and matched with the pseudocode of the model in the historical knowledge base to obtain the reference graph construction code. After fine-tuning by the large language model, the initial graph construction code population is generated. Based on spatial omics data, initial graph construction code was run to generate graph structures. These graph structures were then input into the target model and subjected to a dual-index fitness evaluation. Based on the evaluation results, the graph construction logic was iteratively optimized using a semantic mutation mechanism of a large language model to obtain the optimal graph construction code. The optimization process for the graph construction code is as follows: In the current iteration of the population, based on spatial omics data, the graph construction code of each graph in the population is run to generate graph structures. Each graph structure is input into the target model. A dual-index fitness function is constructed with spatial domain recognition accuracy and computation time to evaluate the target model's processing effect on the current graph structure. The reference graph construction code, the current iteration population, and its corresponding fitness evaluation value are used as context inputs and fed into the large language model. The large language model uses a semantic mutation mechanism to reason and analyze the logic of the graph construction code and modify the code fragments to generate a population with better performance for the next iteration. The semantic mutation mechanism is used to dynamically adjust the fusion weights and edge rules of spatial distance, gene expression similarity, and tissue morphology similarity. The optimization process is continuously iterated until the code optimization converges, and the optimal graph adapted to the current target model is extracted to construct the code. The code generates a graph structure based on the optimal graph, and the graph structure is input into the target model to perform spatial domain clustering and region partitioning to obtain spatial domain recognition results.
2. The spatial domain identification method based on graph structure self-learning for spatial omics as described in claim 1, characterized in that, The spatial omics data includes gene expression matrices, spatial coordinate matrices, and tissue morphology images of sequencing spots.
3. The spatial domain identification method based on graph structure self-learning for spatial omics as described in claim 1, characterized in that, The acquisition of the reference graph construction code includes: Using existing graph neural networks for spatial domain recognition as the target model, the source code of the target model is extracted; The source code of the target model is input as text data into the large language model. The large language model extracts the core algorithm skeleton and network layer structure of the target model according to the preset abstraction strategy, and generates standardized multi-view pseudocode of the target model. The pseudocode of the target model is matched with the pseudocode of the model in the historical knowledge base by structural similarity. The graph construction code corresponding to the most similar reference model is retrieved and used as the reference graph construction code.
4. The spatial domain identification method based on graph structure self-learning for spatial omics as described in claim 3, characterized in that, The source code includes: data loading stream, network layer definition, and forward propagation logic; The abstraction strategy is to strip away specific variable names and hyperparameter values, retaining only the core algorithm control flow, data dimension transformation, and mathematical aggregation operations.
5. The spatial domain identification method based on graph structure self-learning as described in claim 3, characterized in that, Based on the reference graph, the code is fine-tuned using a large language model to generate the initial graph construction code, which includes: Using a large language model, the extracted reference graph construction code is injected and integrated into the initial processing script as high-quality topology prior logic. During the integration process, the large language model generates an initial graph construction code population containing multiple high-quality individuals by adopting different code implementation styles or fine-tuning logic details.
6. The spatial domain identification method for spatial omics based on graph structure self-learning as described in claim 1, characterized in that, Also includes: The converged optimal graph construction code and the corresponding downstream target model pseudocode are bound and stored in the historical knowledge base for hot start and knowledge reuse in subsequent new tasks.
7. A spatial domain identification system for spatial omics based on graph structure self-learning, characterized in that, include: The data acquisition module is used to acquire spatial omics data of the target tissue to be identified; The initial graph construction code generation module is used to extract pseudocode from the target model of the graph neural network model that performs spatial domain recognition downstream, and match and retrieve the pseudocode of the target model with the model pseudocode in the historical knowledge base to obtain reference graph construction code. After fine-tuning by the large language model, the initial graph construction code population is generated. The optimal graph construction code generation module is used to generate graph structures based on spatial omics data by running initial graph construction codes. Each graph structure is then input into the target model and subjected to a dual-index fitness evaluation. Based on the evaluation results, the graph construction logic is iteratively optimized using a semantic mutation mechanism of a large language model to obtain the optimal graph construction code. The optimization process of the graph construction code is as follows: In the current iteration of the population, based on spatial omics data, the graph construction code of each graph in the population is run to generate graph structures. Each graph structure is input into the target model. A dual-index fitness function is constructed with spatial domain recognition accuracy and computation time to evaluate the target model's processing effect on the current graph structure. The reference graph construction code, the current iteration population, and its corresponding fitness evaluation value are used as context inputs and fed into the large language model. The large language model uses a semantic mutation mechanism to reason and analyze the logic of the graph construction code and modify the code fragments to generate a population with better performance for the next iteration. The semantic mutation mechanism is used to dynamically adjust the fusion weights and edge rules of spatial distance, gene expression similarity, and tissue morphology similarity. The optimization process is continuously iterated until the code optimization converges, and the optimal graph adapted to the current target model is extracted to construct the code. The spatial domain identification module is used to generate a graph structure based on the optimal graph construction code, input the graph structure into the target model to perform spatial domain clustering and region partitioning, and obtain the spatial domain identification result.
8. An electronic device, characterized in that, include: Memory, used to store executable instructions; The processor, when executing executable instructions stored in the memory, implements the spatial domain identification method based on graph structure self-learning as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The device stores executable instructions for causing a processor to execute the executable instructions to implement the spatial omics spatial domain identification method based on graph structure self-learning as described in any one of claims 1-6.
Citation Information
Patent Citations
Spatial transcriptome region identification method driven by multi-modal graph fusion
CN121354671A
Intelligent logic defect detection method and system based on business semantic enhancement
CN122152670A