Large language model layered single cell annotation method and system combined with knowledge graph
By combining knowledge graphs and large language models, a biological knowledge graph is constructed and global queries and subgraph retrieval are performed, solving the problems of accuracy and interpretability of cell type annotation and achieving efficient and reliable cell type annotation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-31
- Publication Date
- 2026-04-07
AI Technical Summary
Existing cell type annotation methods suffer from high subjectivity, low efficiency, limited generalization ability, and poor interpretability, resulting in low annotation accuracy.
By combining knowledge graphs and large language models, a biological knowledge graph is constructed to generate candidate major cell types. Global queries and subgraph searches are then performed within the knowledge graph to determine the final major cell types and their subtypes, and an annotation report is output.
It improves the accuracy, robustness, and interpretability of single-cell annotations, while reducing reliance on heavyweight models and lowering application costs.
Smart Images

Figure CN121811983A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of bioinformatics, and in particular to a hierarchical single-cell annotation method and system that combines a knowledge graph with a large language model. Background Technology
[0002] With the rapid development of single-cell RNA sequencing technology, researchers are able to analyze the heterogeneity of biological tissues at the resolution of a single cell. In the workflow of single-cell data analysis, cell type annotation is a crucial link connecting raw data with biological interpretation, playing a vital and indispensable role. The core objective of cell type annotation is to accurately classify cells into specific biological types (such as T cells, fibroblasts, epithelial cells, etc.) based on their gene expression profiles. Accurate cell type annotation is not only fundamental to understanding tissue and cell composition, analyzing cell developmental trajectories, and intercellular communication mechanisms, but also an important prerequisite for revealing disease pathological mechanisms and developing targeted therapeutic strategies.
[0003] Currently, there are various techniques for effectively annotating cell types, such as manual annotation methods, automated methods based on deep learning, and annotation methods based on large language models. Manual annotation methods primarily utilize clustering algorithms (such as Louvain or Leiden algorithms) to group cells with similar gene expression patterns into clusters, calculate the differentially expressed genes in each cluster, and then have biological experts manually compare and consult known marker genes with markers in existing literature or databases to infer the type of each cell cluster. Automated methods based on deep learning mainly employ supervised or semi-supervised learning, collecting large-scale, labeled single-cell atlases as reference datasets, training deep neural networks to learn the nonlinear mapping relationship between cell types and gene expression patterns, and finally, the model automatically predicts cell labels based on the learned feature distribution. Annotation methods based on large language models mainly convert the list of marker genes in single-cell data into natural language text prompts, directly querying the LLM (Large Language Modeling) for the cell type corresponding to these marker genes. The model uses prior knowledge stored in its internal parameters to provide annotation results through text generation.
[0004] However, traditional cell type annotation methods rely heavily on the personal experience and knowledge of experts, making them highly subjective, and the manual comparison process is extremely time-consuming and labor-intensive. Automated methods based on deep learning have limited generalization ability and struggle to identify highly specific cells. Annotation methods based on large language models suffer from severe illusion problems. Therefore, traditional cell type annotation methods often suffer from low accuracy due to their high subjectivity, low efficiency, limited generalization ability, and poor interpretability. Summary of the Invention
[0005] Based on this, in order to solve the above-mentioned technical problems, a hierarchical single-cell annotation method and system combining knowledge graphs with large language models is provided, which can improve the accuracy, robustness and interpretability of annotations while reducing illusions.
[0006] A hierarchical single-cell annotation method combining a knowledge graph with a large language model, the method comprising:
[0007] Collect single-cell transcriptome data containing manually annotated cell types and corresponding marker genes, and determine cell type nodes, gene nodes, pathway nodes and various directed relationships between nodes based on the single-cell transcriptome data. Construct a biological knowledge graph based on each node and directed relationship.
[0008] The list of marker genes for the single-cell cluster to be annotated is obtained and input into the large language model, and at least one candidate major cell type is generated through the large language model;
[0009] Based on the candidate major cell types, a global query is performed in the biological knowledge graph to obtain qualitative evidence corresponding to the candidate major cell types. The qualitative evidence and the candidate major cell types are then input into the large language model to determine the final major cell type.
[0010] Based on the final major cell type, a subgraph search is performed in the biological knowledge graph to obtain the cell subtype corresponding to the final major cell type, and the cell subtype, qualitative evidence, and search process are output as a single-cell annotation report.
[0011] In one embodiment, cell type nodes, gene nodes, pathway nodes, and directed relationships between nodes are determined based on the single-cell transcriptome data. A biological knowledge graph is constructed based on the nodes and directed relationships, including:
[0012] Cell type nodes, gene nodes, and pathway nodes were identified from the single-cell transcriptome data.
[0013] Based on the identified nodes, cell type hierarchy, gene-pathway involvement, gene co-expression, and pathway-cell type activity relationships are extracted from the single-cell transcriptome data as directed relationships.
[0014] A biological knowledge graph is obtained by storing the cell type nodes, gene nodes, pathway nodes, and directed relationships between the nodes using a graph database.
[0015] The biological knowledge graph supports dynamic retrieval based on cell type, gene, and pathway.
[0016] In one embodiment, the gene co-expression relationship is quantified by calculating the Pearson product-moment correlation coefficient between any two genes;
[0017] The pathway-cell type activity relationship is quantified by an AUCell score, which represents the integral of the gene set recovery curve on the gene expression ranking list.
[0018] In one embodiment, a list of marker genes for the single-cell clusters to be annotated is obtained and input into a large language model, which then generates at least one candidate major cell type, including:
[0019] Obtain the single-cell clusters to be annotated, screen out the target marker genes, and construct a list of marker genes.
[0020] Select a pre-trained large language model, position the large language model as a primary cell annotator based on preset prompt words, and input the preset prompt words and the list of marker genes into the large language model;
[0021] The large language model calls upon the biological knowledge stored in the pre-trained parameters to generate candidate major cell types that conform to the structured data format based on the preset prompt words and marker gene list.
[0022] The candidate major cell types are validated, and the list of all valid candidate major cell types is stored as structured data.
[0023] In one embodiment, based on the candidate major cell types, a global query is performed in the biological knowledge graph to obtain qualitative evidence corresponding to the candidate major cell types, including:
[0024] A search list is constructed based on each of the aforementioned candidate major cell types;
[0025] In the biological knowledge graph, a predefined global query scope is determined, and within the global query scope, ontological structural evidence, functional pathway association evidence, and co-expression network support evidence corresponding to each of the candidate major cell types are retrieved, and the retrieved evidence is used as qualitative evidence.
[0026] Each candidate major cell type and its corresponding qualitative evidence are structured and integrated to form an evidence set.
[0027] In one embodiment, the qualitative evidence and the candidate major cell types are input into a large language model to determine the final major cell type, including:
[0028] Based on preset decision prompts, the qualitative evidence and candidate major cell types are input into the large language model; the preset decision prompts require that each candidate major cell type be evaluated according to the target instruction based on the qualitative evidence.
[0029] The qualitative evidence is analyzed using the large language model to output the final main cell type;
[0030] The validity of the final major cell types is verified, and the verified final major cell types are stored as structured data.
[0031] In one embodiment, a subgraph retrieval is performed in the biological knowledge graph based on the final major cell type to obtain the cell subtype corresponding to the final major cell type, including:
[0032] The retrieval identifier is determined based on the final primary cell type, and the closed set consisting of the final primary cell type and all its direct or indirect descendant cell type nodes in the biological knowledge graph is taken as the subgraph range.
[0033] Within the subgraph, all descendant cell type nodes under the final main cell type are obtained as a candidate cell subtype set by traversing the cell type hierarchy relationship.
[0034] For each candidate subtype node, highly active pathways are retrieved sequentially through pathway-cell type activity relationships, and marker genes are reverse-matched through gene-pathway participation relationships; cell subtypes that have highly active pathways and participate in the pathways are retained.
[0035] In one embodiment, the method further includes:
[0036] The accuracy of the single-cell annotation process is evaluated using the Agreement Score metric of the cell ontology hierarchy, which categorizes the single-cell annotation results into complete match, partial match, and no match.
[0037] A hierarchical single-cell annotation system for a large language model combining knowledge graphs, the system comprising:
[0038] The biological knowledge graph construction module is used to collect single-cell transcriptome data containing manually annotated cell types and corresponding marker genes, and to determine cell type nodes, gene nodes, pathway nodes and various directed relationships between nodes based on the single-cell transcriptome data, and to construct a biological knowledge graph based on each node and directed relationship.
[0039] The candidate principal cell type determination module is used to obtain a list of marker genes for the single cell cluster to be annotated and input it into the large language model, and generate at least one candidate principal cell type through the large language model;
[0040] The final primary cell type determination module is used to perform a global query in the biological knowledge graph based on the candidate primary cell types to obtain qualitative evidence corresponding to the candidate primary cell types, and input the qualitative evidence and the candidate primary cell types into the large language model to determine the final primary cell type;
[0041] The cell subtype identification and report output module is used to perform a subgraph search in the biological knowledge graph based on the final major cell type, obtain the cell subtype corresponding to the final major cell type, and output the cell subtype, qualitative evidence, and search process as a single-cell annotation report.
[0042] The aforementioned hierarchical single-cell annotation method and system combining a knowledge graph and a large language model constructs a biological knowledge graph integrating cell types, genes, pathways, and multiple directed relationships. It first generates candidate major cell types using a large language model, then verifies the final major type through a global query of the knowledge graph, and finally locks the cell subtype through subgraph retrieval. The system outputs an annotation report containing complete evidence and the retrieval process, achieving a simultaneous improvement in the accuracy, interpretability, and robustness of single-cell annotation. At the same time, it reduces the dependence on heavyweight models and significantly reduces application costs. Attached Figure Description
[0043] Figure 1 This is a diagram illustrating the application environment of a hierarchical single-cell annotation method for a large language model that incorporates a knowledge graph in one embodiment.
[0044] Figure 2 This is a flowchart illustrating a hierarchical single-cell annotation method for a large language model that incorporates knowledge graphs in one embodiment.
[0045] Figure 3 This is a schematic diagram of the application framework structure of a hierarchical single-cell annotation method for a large language model that combines knowledge graphs in one embodiment.
[0046] Figures 4A-4F This is a schematic diagram illustrating the experimental results in one embodiment;
[0047] Figure 5 This is a structural block diagram of a hierarchical single-cell annotation system for a large language model that incorporates a knowledge graph in one embodiment.
[0048] Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0050] The hierarchical single-cell annotation method for large language models combined with knowledge graphs provided in this application can be applied to, for example... Figure 1 The application environment shown. For example... Figure 1 As shown, the application environment includes computer device 110. Computer device 110 can collect single-cell transcriptome data containing manually annotated cell types and corresponding marker genes, and determine cell type nodes, gene nodes, pathway nodes, and directed relationships between nodes based on the single-cell transcriptome data. It then constructs a biological knowledge graph based on these nodes and directed relationships. Computer device 110 can input a list of marker genes for the single-cell clusters to be annotated into a large language model, generating at least one candidate major cell type. Based on the candidate major cell type, computer device 110 can perform a global query in the biological knowledge graph to obtain qualitative evidence corresponding to the candidate major cell type, and input the qualitative evidence and the candidate major cell type into the large language model to determine the final major cell type. Computer device 110 can perform a subgraph search in the biological knowledge graph based on the final major cell type to obtain the cell subtype corresponding to the final major cell type, and output the cell subtype, qualitative evidence, and search process as a single-cell annotation report. Computer device 110 can be, but is not limited to, various personal computers, laptops, smartphones, robots, drones, tablets, and other devices.
[0051] In one embodiment, such as Figure 2 As shown, a hierarchical single-cell annotation method combining knowledge graphs with a large language model is provided, including the following steps:
[0052] Step 202: Collect single-cell transcriptome data containing manually annotated cell types and corresponding marker genes, and determine cell type nodes, gene nodes, pathway nodes and various directed relationships between nodes based on the single-cell transcriptome data. Construct a biological knowledge graph based on each node and directed relationship.
[0053] Computer equipment can collect high-quality single-cell transcriptome data containing expert-annotated cell types and their corresponding marker genes. In this embodiment, the main sources of the dataset may include original research data from published literature and official data portals of large-scale research projects. The original research data from published literature can be a list of expert-annotated cell type labels and marker genes extracted from a series of reviewed original research articles. Specifically, this may include data from the Human Cell Atlas (HCL), Mouse Cell Atlas (MCA), lung adenocarcinoma data, colorectal cancer data, B-cell lymphoma data, and cross-tissue reference maps. Official data portals of large-scale research projects may include: the HubMAP Azimuth project: obtaining authoritative cell annotation information and marker gene sets from the Human Biomolecular Atlas Project's Azimuth project; and the Human Cell Atlas (HCA): relevant data obtained from the HCA official data portal.
[0054] After collecting single-cell transcriptome data, computer equipment can extract the corresponding marker genes for each cell cluster.
[0055] In one embodiment, a hierarchical single-cell annotation method combining a large language model with a knowledge graph may further include a process of constructing a biological knowledge graph. The specific process includes: identifying cell type nodes, gene nodes, and pathway nodes from single-cell transcriptome data; based on the identified nodes, extracting cell type hierarchical relationships, gene-pathway involvement relationships, gene co-expression relationships, and pathway-cell type activity relationships from the single-cell transcriptome data as directed relationships; and storing cell type nodes, gene nodes, pathway nodes, and the directed relationships between these nodes using a graph database to obtain the biological knowledge graph. The biological knowledge graph supports dynamic retrieval based on cell type, gene, and pathway.
[0056] A well-constructed biological knowledge graph can include three core nodes: cell type, gene, and pathway, as well as four directed relationships: cell type hierarchy (IS_A), gene-pathway participation (PARTICIPATES_IN), gene co-expression (COEXPRESSED_IN), and pathway-cell type activity (HAS_ACTIVITY_IN).
[0057] Among them, the cell type hierarchy relationship IS_A, which is cell type to cell type, is derived from Cell Ontology and defines the hierarchical classification structure between cell types, enabling the model to reason from the major type (such as lymphocytes) to specific subtypes (such as cytotoxic T lymphocytes); the gene-pathway involvement relationship PARTICIPATES_IN, which is gene to pathway, is based on data integrated from the Gene Ontology and Reactome pathway databases. The gene-pathway involvement relationship connects genes with the biological pathways in which they participate, providing the model with the functional context of the gene set.
[0058] In one embodiment, gene co-expression relationships are quantified by calculating the Pearson product-moment correlation coefficient between any two genes; pathway-cell type activity relationships are quantified by AUCell scores; the AUCell score represents the integral of the gene set recovery curve over the gene expression ranking list.
[0059] Specifically, the gene co-expression relationship COEXPRESSED_IN, i.e., gene-to-gene, captures significant co-expression patterns of gene pairs within a specific cell type. It is quantified by calculating the Pearson product-moment correlation coefficient r between any two genes X and Y. Where n is the total number of cells of a specific cell type; and , respectively, are the log-normalized expression values of genes X and Y in cell i; x and y are the average expression values; the edge is established when the absolute value of r is greater than 0.8 and FDR is less than 0.05.
[0060] The pathway-cell type activity relationship (HAS_ACTIVITY_IN) indicates the activity of a gene pathway in a specific cell type. This relationship is quantified using the AUCell algorithm to measure the activity of a specific gene set (pathway) in a single cell. The AUCell score is the integral of the gene set recovery curve over the gene expression ranking list. Among them, the recovery function Defined as: S represents the pathway gene set. Let k be the list of genes in cell c ordered by expression level, where k is the rank and T is the preset rank threshold. A relationship is established if the AUCell score distribution of a certain pathway is significantly higher in the target cell type than in other cell types (verified by Wilcoxon rank-sum test, p < 0.05).
[0061] Step 204: Obtain the list of marker genes for the single-cell clusters to be annotated and input it into the large language model to generate at least one candidate major cell type.
[0062] Large Language Models (LLMs) can, based on an input list of marker genes for a single-cell cluster to be annotated, utilize their internal biological knowledge to propose at least one candidate major cell type for each cluster. In this embodiment, three most likely candidate major cell types can be proposed for each cluster.
[0063] In one embodiment, a hierarchical single-cell annotation method using a large language model combined with a knowledge graph may further include a process for generating candidate major cell types. The specific process includes: acquiring single-cell clusters to be annotated and selecting target marker genes to construct a marker gene list; selecting a pre-trained large language model, positioning the large language model as a primary cell annotator based on preset prompts, and inputting the preset prompts and the marker gene list into the large language model; calling the biological knowledge stored in the pre-trained parameters through the large language model, and generating candidate major cell types conforming to a structured data format based on the preset prompts and the marker gene list; validating the candidate major cell types, and storing the list of each valid candidate major cell type as structured data.
[0064] The computer device can leverage the internal biological knowledge of a large language model, taking a list of marker genes for cell clusters as input, prompting the model to act as a primary annotator, and proposing three most likely candidates for a broad range of cell lineages (i.e., major types) based on the marker genes. The results are sorted from highest to lowest probability and include name, ontology ID, and preliminary inference.
[0065] Specifically, the computer equipment can screen highly specific marker genes from the acquired single-cell clusters to be annotated through differential expression analysis, select the top 10 core marker genes, and organize them into a standardized marker gene list. The computer equipment can choose a pre-trained large language model, which provides a model calling environment that supports text-based input prompts and structured output results. Next, prompts can be designed that include role positioning, input information descriptions, output requirements, and format specifications. These prompts can position the large language model as a junior cell annotator, requiring it to generate at least one candidate major cell type based on the input standardized marker gene list. Each candidate major cell type needs to include the cell type name, the corresponding cell ontology ID, and a brief description based on the marker gene associations. The reasoning is based on prioritizing the genes according to their probability from highest to lowest. Then, the prompts and a standardized list of marker genes are input into a pre-configured large language model. The large language model can access biological knowledge stored in its pre-training parameters to perform correlation analysis on the input set of marker genes, calculating the matching degree between different major cell types and the gene set. Based on the matching degree, it generates candidate major cell types that meet the required format. Finally, the computer can validate the format of the candidate results output by the large language model, confirming whether they contain the three elements: cell type name, ontology ID, and reasoning basis. Unreasonable candidates with no known association with any marker genes are excluded. The validated list of candidate major cell types is stored as structured data and passed to the subsequent cell principal type determination stage.
[0066] Step 206: Based on the candidate major cell types, perform a global query in the biological knowledge graph to obtain qualitative evidence corresponding to the candidate major cell types, and input the qualitative evidence and candidate major cell types into the large language model to determine the final major cell type.
[0067] The computer device can perform a global query on the knowledge graph for the three proposed candidate major cell types, and determine the cell principal type by combining qualitative evidence. Specifically, for each of the three candidate major cell types, the computer device can perform a global query on the knowledge graph, collecting qualitative evidence related to the candidate major cell type, including ontological structural location, associated functional pathways, and co-expression network support. Subsequently, the computer device can integrate the three candidates and their corresponding knowledge graph retrieval evidence into a prompt word, prompting the large language model to act as an advanced computational biologist to make the final decision. The large language model critically evaluates all evidence, eliminates speculative interference, and confirms the unique and most probable major cell type.
[0068] In one embodiment, a hierarchical single-cell annotation method combining a knowledge graph and a large language model may further include a process of performing a global query and generating qualitative evidence. The specific process includes: constructing a search list based on each candidate major cell type; determining a predefined global query scope within the biological knowledge graph; retrieving ontological structural evidence, functional pathway association evidence, and co-expression network support evidence corresponding to each candidate major cell type within the global query scope; using the retrieved evidence as qualitative evidence; and structurally integrating each candidate major cell type and its corresponding qualitative evidence to form an evidence set.
[0069] The computer device can receive a list of candidate major cell types, which includes the name, cell ontology ID, and preliminary reasoning for each candidate major cell type. It extracts the cell ontology ID as the primary search key and the cell type name as the secondary search key to construct a standardized search list. Then, based on a comprehensive biological knowledge graph containing three core nodes (CellType, Gene, and Pathway) and four directed relationships (IS_A, PARTICIPATES_IN, COEXPRESSED_IN, and HAS_ACTIVITY_IN), the computer device can set a global query scope covering all nodes and relationships, clearly defining the search criteria. Three types of qualitative evidence are retrieved, which may include: ontology structure evidence obtained through the IS_A relationship, functional pathway association evidence obtained through the HAS_ACTIVITY_IN and PARTICIPATES_IN relationship, and co-expression network support evidence obtained through the COEXPRESSED_IN relationship. Then, based on the standardized search list, the knowledge graph query interface is called to retrieve the three types of qualitative evidence corresponding to each candidate major cell type in batches. Duplicate and invalid evidence is removed, and a structured evidence package containing ontology structure localization, marker gene participation pathway status, and marker gene co-expression matching degree is generated for each candidate major cell type.
[0070] In one embodiment, a hierarchical single-cell annotation method combining a knowledge graph and a large language model may further include a process for determining the final principal cell type. This process includes: inputting qualitative evidence and candidate principal cell types into the large language model based on preset decision prompts; requiring the preset decision prompts to evaluate each candidate principal cell type according to the target instruction based on the qualitative evidence; parsing the qualitative evidence through the large language model to output the final principal cell type; validating the final principal cell type; and storing the validated final principal cell type as structured data.
[0071] In this embodiment, a large language model can be designed to act as a prompt word for an advanced computational biologist. The prompt word explicitly requires that, based on candidate information and a structured evidence package, a unique final primary cell type be determined from the candidate primary cell types according to the evaluation criteria of evidence support strength, elimination of contradictory misjudgments, and supplementary reasoning based on biological common sense, and the decision basis must be output. The list of candidate primary cell types, the corresponding structured evidence package, and the prompt word are input into the pre-configured large language model. Then, the large language model can parse the evidence chain of each candidate, evaluate the relevance and sufficiency of the evidence, compare the evidence advantages between candidates, supplement the reasoning based on its own pre-trained biological knowledge, and output a result containing the name of the final primary cell type, ontology ID, and key decision basis. The decision basis is verified to ensure that it closely follows the knowledge graph evidence and the marker gene association, and subjective judgments without basis are excluded. The verified information of the final primary cell type is stored as structured data and passed to the subsequent cell subtype annotation stage.
[0072] Step 208: Perform a subgraph search in the biological knowledge graph based on the final major cell type to obtain the cell subtype corresponding to the final major cell type, and output the cell subtype, qualitative evidence, and search process as a single-cell annotation report.
[0073] Once the cell main type is determined, the computer device can focus on the subgraph of the determined main type in the knowledge graph, retrieve all cell subtypes that have functional pathway associations with the input marker gene, and infer the final cell subtype by combining the search information.
[0074] Specifically, once the final dominant cell type is identified, the computer device can perform a focused local search within the knowledge graph, strictly limiting the query scope to a subgraph consisting of the identified dominant cell type and its descendant nodes. The computer device can retrieve all cell subtype nodes that have functional pathway associations (PARTICIPATES_IN and HAS_ACTIVITY_IN relationships) with the input marker gene, but avoids querying COEXPRESSED_IN relationships to prevent non-specific interference. Finally, the large language model, acting as a cell annotation expert, combines the focused evidence provided by the subgraph to infer the most specific cell subtype, ultimately outputting an interpretable annotation report containing the cell type name, ID, reasoning process, and related evidence chains.
[0075] In one embodiment, a hierarchical single-cell annotation method combining a knowledge graph and a large language model may further include a process for obtaining cell subtypes. This process includes: determining a retrieval identifier based on the final primary cell type; defining a subgraph range as the closed set of nodes representing the final primary cell type and all its direct or indirect descendant cell types in the biological knowledge graph; within the subgraph range, traversing the cell type hierarchy to obtain all descendant cell type nodes under the final primary cell type as a candidate cell subtype set; for each candidate subtype node, sequentially retrieving highly active pathways through pathway-cell type activity relationships and reverse-matching marker genes through gene-pathway participation relationships; and retaining cell subtypes that possess highly active pathways and participate in those pathways.
[0076] The computer device can receive structured data of the final major cell type, including cell type name, cell ontology ID, decision basis, and associated evidence package. It extracts the cell ontology ID as the unique retrieval benchmark and the cell type name as an auxiliary verification identifier. Then, based on a comprehensive biological knowledge graph containing three core nodes (CellType, Gene, and Pathway) and four directed relationships (IS_A, PARTICIPATES_IN, HAS_ACTIVITY_IN, and COEXPRESSED_IN), it uses IS_A hierarchical relationship traversal to narrow down the subgraph to a closed set consisting of the final major cell type and all its direct or indirect descendant CellType nodes. The ontology hierarchical traversal algorithm verifies the integrity of the subgraph nodes, excluding irrelevant nodes not belonging to that major type. The computer device can set the retrieval target to CellType nodes (cell subtypes) within the subgraph and filter two types of functional relationships for subtype validity verification: one is to retrieve the highly active pathways corresponding to the subtype through the HAS_ACTIVITY_IN relationship, which must satisfy AUCe. The ll score was significantly higher than other cell types (p < 0.05). Secondly, the PARTICIPATES_IN relation was used to reverse-verify whether the marker genes of the cell cluster to be annotated participated in the aforementioned highly active pathways. Next, a knowledge graph retrieval interface was called, inputting the ontology ID of the final main cell type. First, all descendant CellType nodes under this main type were obtained as a set of candidate cell subtypes through the IS_A relation. Then, for each candidate subtype node, highly active pathways were retrieved through the HAS_ACTIVITY_IN relation, and marker genes were reverse-matched through the PARTICIPATES_IN relation. Only candidate subtypes with highly active pathways and whose marker genes to be annotated participated in the pathway were retained, while subtype nodes without functional association were removed. Then, the core information of the effective cell subtypes was extracted, including the subtype name, subtype ontology ID, associated highly active pathway name and ID, and a list of marker genes participating in the pathway. A structured subtype list was generated according to the association strength between the subtype and the marker genes. Finally, the completeness and validity of the structured subtype list were verified, and the verified structured subtype list was stored as formatted data.
[0077] In one embodiment, the hierarchical single-cell annotation method for a large language model that incorporates a knowledge graph may further include a performance evaluation process, specifically including: evaluating the accuracy of the single-cell annotation process using the Agreement Score metric of the cell ontology hierarchy, whereby the Agreement Score metric categorizes single-cell annotation results into complete match, partial match, and no match.
[0078] This application proposes a hierarchical single-cell annotation method combining a knowledge graph and a large language model. By constructing a biological knowledge graph integrating cell types, genes, pathways, and multiple directed relationships, and combining it with a large language model to first generate candidate major cell types, then verifying the final major type through global query of the knowledge graph, and finally locking the cell subtype through subgraph retrieval, the method outputs an annotation report containing complete evidence and the retrieval process. This achieves a simultaneous improvement in the accuracy, interpretability, and robustness of single-cell annotation, while reducing the dependence on heavyweight models and significantly reducing application costs.
[0079] In one embodiment, such as Figure 3 As shown, a hierarchical single-cell annotation method combining a knowledge graph and a large language model is presented, which can be divided into two core modules: knowledge graph construction and hierarchical LLM annotation. The knowledge graph construction part builds a biological knowledge graph using three types of nodes and four directed relationships. The three types of nodes include cell type, gene, and pathway. The four directed relationships include: IS_A: connecting cell type nodes and defining cell hierarchical classification; PARTICIPATES_IN: connecting genes and pathways, representing the biological pathways involved by genes; COEXPRESSED_IN: connecting genes and genes, reflecting the intracellular gene co-expression pattern; and HAS_ACTIVITY_IN: connecting pathways and cell types, associating pathway activity in specific cells.
[0080] The hierarchical LLM annotation section mainly includes inputting marker genes, generating candidate major cell types, global querying of the knowledge graph, determining the final major cell type, and subgraph retrieval + subtype annotation. Specifically, it includes: inputting the marker genes of the cell cluster to be annotated; the Large Language Model (LLM) outputs three possible candidate major cell types; retrieving qualitative evidence (ontology, pathway, co-expression information) corresponding to the candidate major cell types; LLM combining the evidence to select a unique final major cell type; retrieving the corresponding cell subtype in the knowledge graph based on the major type; and finally, LLM outputting the annotation results containing the evidence chain.
[0081] In one embodiment, the hierarchical single-cell annotation method for large language models that combines knowledge graphs provided in this application can be applied to a new framework called scHilda. Through a hierarchical annotation strategy, external knowledge graphs are deeply integrated into the reasoning process of large language models, improving the accuracy, robustness, and interpretability of annotations while reducing illusions.
[0082] like Figure 4A As shown, compared with other single-cell annotation methods, scHilda outperforms existing methods such as CellTypeAgent and GPTCellType on multiple benchmark datasets, reaching the state-of-the-art level.
[0083] In this embodiment, ablation experiments were conducted on several relationships in the knowledge graph, such as... Figure 4B As shown, the necessity of each relation is demonstrated. In addition, the IS_MARKER_FOR relation was added based on the widely accepted CellMark and PanglaoDB datasets, but the experimental results were poor. The interpretability output shows that because this relation directly connects cell type and gene marker, the model becomes overly dependent on this relation, and the defects in these two datasets are amplified, leading to a performance degradation.
[0084] like Figure 4C As shown, the scHilda framework can effectively improve the capabilities of lightweight models. Using low-cost models such as DeepSeek-V3.2 or Gemini-2.5-flash, it can achieve annotation performance close to top-tier models (such as OpenAI o3), significantly reducing application costs. Furthermore, the output of large language models includes the reasoning process and evidence from the knowledge graph, providing a complete explanation path. Since outputting interpretable text increases model consumption, and thought chains can enhance the model's reasoning ability, but scHilda's interpretability is not a standard thought chain, this embodiment also tested the case where interpretable text is not output, such as... Figure 4D As shown, it is demonstrated that the performance of scHilda is not affected when there is no interpretable text output.
[0085] like Figure 4E As shown, when dealing with complex mixed cell samples, scHilda, through a hierarchical strategy and a multi-candidate mechanism, can effectively identify mixed components and perform precise subtype annotations, demonstrating strong noise resistance. By modifying the cue words to position external knowledge as an aid to reasoning rather than a mandatory verification standard, scHilda requires LLMs to critically judge the information provided by the knowledge base, rather than over-relying on the knowledge base or being overconfident. This avoids situations where the correct reasoning of LLMs is negated due to the absence or errors of external databases. At the same time, it utilizes KG's structured evidence to suppress LLMs' illusions, such as... Figure 4F As shown.
[0086] It should be understood that although the steps in the flowchart above are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart above may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0087] In one embodiment, such as Figure 5 As shown, a hierarchical single-cell annotation system combining a knowledge graph and a large language model is provided, including: a biological knowledge graph construction module 510, a candidate principal cell type determination module 520, a final principal cell type determination module 530, and a cell subtype determination and report output module 540, wherein:
[0088] The biological knowledge graph construction module 510 is used to collect single-cell transcriptome data containing manually annotated cell types and corresponding marker genes, and to determine cell type nodes, gene nodes, pathway nodes and various directed relationships between nodes based on the single-cell transcriptome data, and to construct a biological knowledge graph based on each node and directed relationship.
[0089] The candidate principal cell type determination module 520 is used to obtain a list of marker genes for the single cell cluster to be annotated and input it into the large language model, and generate at least one candidate principal cell type through the large language model;
[0090] The final major cell type determination module 530 is used to perform a global query in the biological knowledge graph based on the candidate major cell types, obtain qualitative evidence corresponding to the candidate major cell types, and input the qualitative evidence and the candidate major cell types into the large language model to determine the final major cell type.
[0091] The cell subtype identification and report output module 540 is used to perform subgraph retrieval in the biological knowledge graph based on the final major cell type, obtain the cell subtype corresponding to the final major cell type, and output the cell subtype, qualitative evidence, and retrieval process as a single-cell annotation report.
[0092] In one embodiment, the biological knowledge graph construction module 510 is further configured to determine cell type nodes, gene nodes, and pathway nodes from single-cell transcriptome data; based on the determined nodes, extract cell type hierarchical relationships, gene-pathway participation relationships, gene co-expression relationships, and pathway-cell type activity relationships from the single-cell transcriptome data as directed relationships; and use a graph database to store cell type nodes, gene nodes, pathway nodes, and the directed relationships between each node to obtain a biological knowledge graph; wherein, the biological knowledge graph supports dynamic retrieval based on cell type, gene, and pathway.
[0093] In one embodiment, the candidate principal cell type determination module 520 is further configured to acquire single cell clusters to be annotated, screen out target marker genes to construct a marker gene list; select a pre-trained large language model, position the large language model as a primary cell annotator based on preset prompts, and input the preset prompts and the marker gene list into the large language model; call the biological knowledge stored in the pre-training parameters through the large language model, and generate candidate principal cell types that conform to the structured data format based on the preset prompts and the marker gene list; verify the candidate principal cell types, and store the list of each qualified candidate principal cell type as structured data.
[0094] In one embodiment, the final major cell type determination module 530 is further configured to construct a search list based on each candidate major cell type; determine a predefined global query scope in the biological knowledge graph; search for ontological structural evidence, functional pathway association evidence, and co-expression network support evidence corresponding to each candidate major cell type within the global query scope; use the retrieved evidence as qualitative evidence; and structurally integrate each candidate major cell type and its corresponding qualitative evidence to form an evidence set.
[0095] In one embodiment, the final primary cell type determination module 530 is further configured to input qualitative evidence and candidate primary cell types into a large language model based on preset decision prompts; the preset decision prompts require that each candidate primary cell type be evaluated according to the target instruction based on the qualitative evidence; the qualitative evidence is parsed through the large language model to output the final primary cell type; the validity of the final primary cell type is verified, and the verified final primary cell type is stored as structured data.
[0096] In one embodiment, the cell subtype determination and reporting output module 540 is further configured to determine a search identifier based on the final major cell type, and to use the closed set consisting of the final major cell type and all its direct or indirect descendant cell type nodes in the biological knowledge graph as a subgraph range; within the subgraph range, to obtain all descendant cell type nodes under the final major cell type as a candidate cell subtype set by traversing the cell type hierarchical relationship; for each candidate subtype node, to sequentially search for highly active pathways through the pathway-cell type activity relationship and to reverse match marker genes through the gene-pathway participation relationship; and to retain cell subtypes that have highly active pathways and participate in the pathway.
[0097] In one embodiment, a performance evaluation module is also included to evaluate the accuracy of the single-cell annotation process using the AgreementScore metric of the cell ontology hierarchy, which categorizes single-cell annotation results into complete match, partial match, and no match.
[0098] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 6 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When executed by the processor, the computer program implements a hierarchical single-cell annotation method for a large language model incorporating knowledge graphs. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.
[0099] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0100] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement steps of a hierarchical single-cell annotation method for a large language model incorporating a knowledge graph.
[0101] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program being executed by a processor to implement the steps of a hierarchical single-cell annotation method for a large language model incorporating a knowledge graph.
[0102] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0103] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0104] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A hierarchical single-cell annotation method for a large language model combining knowledge graphs, characterized in that, The method includes: Collect single-cell transcriptome data containing manually annotated cell types and corresponding marker genes, and determine cell type nodes, gene nodes, pathway nodes and various directed relationships between nodes based on the single-cell transcriptome data. Construct a biological knowledge graph based on each node and directed relationship. The list of marker genes for the single-cell cluster to be annotated is obtained and input into the large language model, and at least one candidate major cell type is generated through the large language model; Based on the candidate major cell types, a global query is performed in the biological knowledge graph to obtain qualitative evidence corresponding to the candidate major cell types. The qualitative evidence and the candidate major cell types are then input into the large language model to determine the final major cell type. Based on the final major cell type, a subgraph search is performed in the biological knowledge graph to obtain the cell subtype corresponding to the final major cell type, and the cell subtype, qualitative evidence, and search process are output as a single-cell annotation report.
2. The hierarchical single-cell annotation method for a large language model combining knowledge graphs as described in claim 1, characterized in that, Based on the single-cell transcriptome data, cell type nodes, gene nodes, pathway nodes, and the directed relationships between nodes are determined. A biological knowledge graph is constructed based on these nodes and their directed relationships, including: Cell type nodes, gene nodes, and pathway nodes were identified from the single-cell transcriptome data. Based on the identified nodes, cell type hierarchy, gene-pathway involvement, gene co-expression, and pathway-cell type activity relationships are extracted from the single-cell transcriptome data as directed relationships. A biological knowledge graph is obtained by storing the cell type nodes, gene nodes, pathway nodes, and directed relationships between the nodes using a graph database. The biological knowledge graph supports dynamic retrieval based on cell type, gene, and pathway.
3. The hierarchical single-cell annotation method for a large language model combining knowledge graphs as described in claim 2, characterized in that, The gene co-expression relationship is quantified by calculating the Pearson product-moment correlation coefficient between any two genes; The pathway-cell type activity relationship is quantified by an AUCell score, which represents the integral of the gene set recovery curve on the gene expression ranking list.
4. The hierarchical single-cell annotation method for a large language model combining knowledge graphs as described in claim 1, characterized in that, The list of marker genes for the single-cell clusters to be annotated is obtained and input into a large language model. The large language model then generates at least one candidate major cell type, including: Obtain the single-cell clusters to be annotated, screen out the target marker genes, and construct a list of marker genes. Select a pre-trained large language model, position the large language model as a primary cell annotator based on preset prompt words, and input the preset prompt words and the list of marker genes into the large language model; The large language model calls upon the biological knowledge stored in the pre-trained parameters to generate candidate major cell types that conform to the structured data format based on the preset prompt words and marker gene list. The candidate major cell types are validated, and the list of all valid candidate major cell types is stored as structured data.
5. The hierarchical single-cell annotation method for a large language model combining knowledge graphs according to claim 1, characterized in that, Based on the candidate major cell types, a global query is performed in the biological knowledge graph to obtain qualitative evidence corresponding to the candidate major cell types, including: A search list is constructed based on each of the aforementioned candidate major cell types; In the biological knowledge graph, a predefined global query scope is determined, and within the global query scope, ontological structural evidence, functional pathway association evidence, and co-expression network support evidence corresponding to each of the candidate major cell types are retrieved, and the retrieved evidence is used as qualitative evidence. Each candidate major cell type and its corresponding qualitative evidence are structured and integrated to form an evidence set.
6. The hierarchical single-cell annotation method for a large language model combining knowledge graphs according to claim 1, characterized in that, The qualitative evidence and the candidate major cell types are input into a large language model to determine the final major cell type, including: Based on preset decision prompts, the qualitative evidence and candidate major cell types are input into the large language model; the preset decision prompts require that each candidate major cell type be evaluated according to the target instruction based on the qualitative evidence. The qualitative evidence is analyzed using the large language model to output the final main cell type; The validity of the final major cell types is verified, and the verified final major cell types are stored as structured data.
7. The hierarchical single-cell annotation method for a large language model combining knowledge graphs according to claim 1, characterized in that, Based on the final major cell type, a subgraph search is performed in the biological knowledge graph to obtain the cell subtypes corresponding to the final major cell type, including: The retrieval identifier is determined based on the final primary cell type, and the closed set consisting of the final primary cell type and all its direct or indirect descendant cell type nodes in the biological knowledge graph is taken as the subgraph range. Within the subgraph, all descendant cell type nodes under the final main cell type are obtained as a candidate cell subtype set by traversing the cell type hierarchy relationship. For each candidate subtype node, highly active pathways are retrieved sequentially through pathway-cell type activity relationships, and marker genes are reverse-matched through gene-pathway participation relationships; cell subtypes that have highly active pathways and participate in the pathways are retained.
8. The hierarchical single-cell annotation method for a large language model combining knowledge graphs according to claim 1, characterized in that, The method further includes: The accuracy of the single-cell annotation process is evaluated using the Agreement Score metric of the cell ontology hierarchy, which categorizes the single-cell annotation results into complete match, partial match, and no match.
9. A hierarchical single-cell annotation system for a large language model combining knowledge graphs, characterized in that, The system includes: The biological knowledge graph construction module is used to collect single-cell transcriptome data containing manually annotated cell types and corresponding marker genes, and to determine cell type nodes, gene nodes, pathway nodes and various directed relationships between nodes based on the single-cell transcriptome data, and to construct a biological knowledge graph based on each node and directed relationship. The candidate principal cell type determination module is used to obtain a list of marker genes for the single cell cluster to be annotated and input it into the large language model, and generate at least one candidate principal cell type through the large language model; The final primary cell type determination module is used to perform a global query in the biological knowledge graph based on the candidate primary cell types to obtain qualitative evidence corresponding to the candidate primary cell types, and input the qualitative evidence and the candidate primary cell types into the large language model to determine the final primary cell type; The cell subtype identification and report output module is used to perform a subgraph search in the biological knowledge graph based on the final major cell type, obtain the cell subtype corresponding to the final major cell type, and output the cell subtype, qualitative evidence, and search process as a single-cell annotation report.