Single cell sequencing data autonomous analysis method and system based on large language model

Through the independent analysis method of single-cell sequencing data based on large language models, the single-cell sequencing data analysis task is automatically performed, solving the complex and cost-effective problems of existing methods and achieving efficient and automated data analysis.

CN119400247APending Publication Date: 2025-02-07TIANJIN UNIV

Patent Information

Application Number
CN202411561061.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

The existing single-cell sequencing data analysis methods are complex and require a lot of manual operations, which increases the technical difficulty and cost of researchers, and the existing large-language models cannot be directly used to automate the single-cell analysis tasks.

Method used

Using the independent analysis method of single-cell sequencing data based on large language models, the single-cell sequencing data analysis tasks are automatically performed by initializing large language models, building planners, executors and evaluators, including task decomposition, tool retrieval, code generation and evaluation. .

Benefits of technology

The automation of single-cell sequencing data analysis is achieved, reducing the technical difficulty and labor cost of the analysis process, and improving the analysis efficiency and quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119400247A_ABST
    Figure CN119400247A_ABST
Patent Text Reader

Abstract

The invention provides a single cell sequencing data autonomous analysis method and system based on a large language model. The method comprises the steps that S1, the large language model, task description and single cell sequencing data are initialized; s2, constructing a planner based on a large language model, and analyzing and decomposing tasks according to the task description; s3, constructing an actuator based on the large language model, and retrieving and acquiring a tool document; step S4, based on the tool document, generating a code solution for the subtask; s5, executing the code solution in the code sandbox; s6, constructing an evaluator based on the large language model, and evaluating the code solution and the execution result thereof; and S7, returning and repeatedly executing the steps S3 to S6 until the execution is finished. Effective cooperative work among the planner, the actuator and the evaluator can be realized, full-process automation and high-quality single cell sequencing data analysis aiming at natural language input are realized, and the labor cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of single-cell sequencing data analysis, and in particular to a method for autonomous analysis of single-cell sequencing data based on a large language model, and further to a system using the method for autonomous analysis of single-cell sequencing data based on a large language model. Background Art

[0002] Single-cell sequencing (scRNA-seq) technology can measure transcriptome profiles at an unprecedented scale and resolution, thus revolutionizing molecular biology. Single-cell sequencing data is also called RNA sequencing data or scRNA-seq data. With the advancement of experimental technology, large-scale innovations in computational methods have been promoted. Currently, there are more than 1,400 tools available for analyzing scRNA-seq data. Computational frameworks and software libraries such as Bioconductor, Seurat3, and Scanpy, combined with corresponding method benchmarks and best practice workflows, enable data analysts to master this field and build analysis pipelines. This interaction of experimental and computational innovations has led to milestone discoveries in biology, revealing the heterogeneity of tissue cells.

[0003] However, the analysis process of single-cell sequencing data is long and the steps are complex. Most of the existing single-cell sequencing data analysis studies focus on specific tasks, such as cell type annotation, which requires researchers to manually combine and use various different tools to obtain the final analysis results. This existing analysis method not only requires researchers to have proficient computer engineering skills to reasonably call a large number of existing code tools to perform each single-step task, but also requires researchers to have sufficient biological and medical background to be able to make reasonable choices for models and hyperparameters based on the characteristics of biological data. These factors undoubtedly increase the complexity and cost of researchers performing single-cell analysis tasks and raise the requirements for researchers. Therefore, there is an urgent need for user-friendly automated tools that can automatically combine and execute existing methods to produce results for single-cell analysis tasks.

[0004] In recent years, research on large language models has developed rapidly. They are trained by a large amount of corpus data and have basic knowledge of the general world, so they are widely used to solve real-world tasks, such as chatting and programming. However, this existing large language model cannot be directly used for agents that automatically perform a series of single-cell analysis tasks. Existing agents mainly focus on improving general abilities, such as writing and programming abilities, and are not well suited to the biological field. Therefore, how to provide an autonomous analysis method and system for single-cell sequencing data based on a large language model is undoubtedly of great significance. It can not only greatly reduce the technical difficulty of single-cell analysis for researchers in the biological field, eliminate the technical barriers for bioinformatics researchers in the data analysis process, but also greatly reduce the labor cost of single-cell sequencing data analysis. Summary of the invention

[0005] The technical problem to be solved by the present invention is a method for autonomous analysis of single-cell sequencing data based on a large language model, which aims to effectively reduce the technical difficulty of the analysis process of single-cell sequencing, eliminate the technical difficulties in the single-cell sequencing data analysis process, and can also effectively reduce the labor cost of single-cell sequencing data analysis. On this basis, a system using the method for autonomous analysis of single-cell sequencing data based on a large language model is further provided.

[0006] In this regard, the present invention provides a method for autonomously analyzing single-cell sequencing data based on a large language model, comprising the following steps:

[0007] Step S1, initializing the large language model, task description, and single-cell sequencing data;

[0008] Step S2, building a planner based on the large language model, first inputting the task description and data set information into the planner, then analyzing the task description through the planner, and performing task decomposition to obtain subtasks;

[0009] Step S3, constructing an executor based on the large language model, performing tool retrieval and obtaining tool documents, wherein the information of the tool documents includes tool call and tool parameter information;

[0010] Step S4, based on the tool document, generating a code solution for the current subtask through the executor;

[0011] Step S5, executing the code solution in the code sandbox. If the execution fails, return to re-execute step S4; if successful, obtain the execution result of the code solution, and the execution result includes result data and charts of the preset step analysis of the single-cell sequencing data;

[0012] Step S6, constructing an evaluator based on the large language model, evaluating the code solution and its execution result through the evaluator, and generating an evaluation result. If the evaluation result does not reach the preset evaluation threshold, returning to step S4 and repeating the execution until the evaluation result reaches the preset evaluation threshold;

[0013] Step S7, return and repeat steps S3 to S6 until all subtasks are completed.

[0014] A further improvement of the present invention is that step S1 includes the following sub-steps:

[0015] Step S101, initializing large language model parameters, wherein the large language model parameters include an application programming interface key and a temperature;

[0016] Step S102: Initialize the task description u in natural language form task ;

[0017] Step S103, initializing single-cell sequencing data

[0018] A further improvement of the present invention is that step S2 includes the following sub-steps:

[0019] Step S201, initialize a large language model and define the large language model as a planner

[0020] Step S202, setting the planner The system prompt word is Among them, the system prompt word Includes natural language descriptions associated with historical data of the entire process of single-cell sequencing data analysis, and the associated natural language descriptions are used to define the planner All decomposition steps included in task decomposition, wherein the decomposition steps include any one or more of a quality control step, a normalization step, a highly variable gene identification step, a dimensionality reduction step, a batch effect correction step, a clustering step, a cell type annotation step, and a trajectory inference step;

[0021] Step S203: Use Python tools to read single-cell sequencing data Get dataset information Build for planner Input hint word

[0022] Step S204: describe the task task and dataset information Input to planner Then in the planner In the natural language interaction through the large language model, the task description u task Analyze and use the formula It is decomposed into several subtasks, and the subtasks are passed through t1, t2, …, t n To represent, n is a natural number representing the sequence number.

[0023] A further improvement of the present invention is that step S203 includes the following sub-steps:

[0024] Step S2031, read the single-cell sequencing data through the Scanpy process analysis toolkit of the Python tool And store the read data in a preset storage area;

[0025] And, step S2032, extracting data set information from the data Dataset Information Including cell number and gene number;

[0026] In step S204, according to the data set information Build for planner Input hint word The instruction to construct is: Input prompt word = f"Please analyze according to the following dataset information: {dataset_info}", where dataset_info represents the dataset information The number of cells and genes included.

[0027] A further improvement of the present invention is that step S3 includes the following sub-steps:

[0028] Step S301, initialize a large language model, defined as an executor

[0029] Step S302, setting the actuator The system prompt word is The actuator System prompt words Including historical data and tool pool for the entire process of single-cell sequencing data analysis Tool Pool Documentation and the associated natural language description of the code generation requirements;

[0030] Step S303: The task description information of the current subtask is i and dataset information Input to actuator i represents the subtask number of the current step;

[0031] Step S304, executor From the tool pool Retrieve the tool for solving the current subtask by command Get a list of recommended tools

[0032] Step S305, executor According to the tool list Get the corresponding tool documentation

[0033] A further improvement of the present invention is that step S4 includes the following sub-steps:

[0034] Step S401: Integrate the actuators of step S3 in sequence System prompt words Task description information i , Tool Documentation Dataset Information And historical code Form a complete execution prompt word, which is To indicate that the actuator System prompt words For actuator Generate code;

[0035] Step S402, actuator Generate a code solution c for the current subtask based on the execution prompt word i , the instructions to generate the code solution are

[0036] A further improvement of the present invention is that step S5 includes the following sub-steps:

[0037] Step S501, executing the code solution c described in step S4 in the code sandbox ε i ;

[0038] Step S502: during the execution process, determine whether the execution is successful. If the code sandbox ε throws an exception, it is determined that the execution failed, and return to step S4 to regenerate the code solution c. i , and then execute it through the code sandbox ε; otherwise, it is judged that the execution is successful and jumps to step S503;

[0039] Step S503, by executing the code solution c described in step S4 i , get and output the code execution result ε( c i).

[0040] A further improvement of the present invention is that step S6 includes the following sub-steps:

[0041] Step S601, initialize a large language model, defined as an evaluator

[0042] Step S602: Setting the evaluator The system prompt word is The system prompt word is Including single-cell sequencing data The evaluation indicators and relevant natural language descriptions of the evaluation tools;

[0043] Step S603: Integrate the evaluators in sequence The system prompt word is Evaluation task description information task , the code execution result of step S5 ε(c i ), dataset information And the code solution c for step S4 i , forming a complete evaluation prompt word, which is passed To express;

[0044] Step S604, evaluator Generate an evaluation result about the execution result of the current subtask based on the evaluation prompt word

[0045] Step S605, through the evaluator If the current evaluation result does not reach the preset evaluation threshold, the process returns to step S4 and executes again until the current evaluation result reaches the preset evaluation threshold, then the process jumps to step S606;

[0046] Step S606: The code solution c corresponding to the current step i Add to history code middle.

[0047] A further improvement of the present invention is that when step S5 triggers returning to step S4 to regenerate the code solution c i When the number of execution failures reaches the first threshold, the historical code Corresponding code solution c i When the step S6 triggers the return to re-execute step S4, the evaluation failure information is recorded, and after the number of evaluation failures reaches the second threshold, the historical code Corresponding code solution c i Move to the error code database; the first threshold is less than the second threshold.

[0048] The present invention also provides a single-cell sequencing data autonomous analysis system based on a large language model, which adopts the single-cell sequencing data autonomous analysis method based on a large language model as described above, and includes:

[0049] Initialization module, which initializes the large language model, task description, and single-cell sequencing data;

[0050] A planner construction module builds a planner based on a large language model. The task description and data set information are first input into the planner. The planner then analyzes the task description and decomposes the task to obtain subtasks.

[0051] An executor construction module constructs an executor based on a large language model, performs tool retrieval and obtains tool documents, wherein the information of the tool documents includes tool call and tool parameter information;

[0052] The code solution generation module generates a code solution for the current subtask through the executor based on the tool documentation;

[0053] An execution module executes the code solution in the code sandbox. If the execution fails, the execution module returns to re-execute the code solution generation module. If successful, the execution result of the code solution is obtained, and the execution result includes result data and charts of the preset step analysis of the single-cell sequencing data;

[0054] An evaluation module, which constructs an evaluator based on a large language model, evaluates the code solution and its execution result through the evaluator, and generates an evaluation result. If the evaluation result does not reach a preset evaluation threshold, the code solution generation module is returned to be repeatedly executed until the evaluation result reaches the preset evaluation threshold;

[0055] The loop module returns and repeatedly executes the executor construction module to the evaluation module until all subtasks are completed.

[0056] Compared with the prior art, the beneficial effects of the present invention are: after initialization, a planner is first constructed based on a large language model to realize the analysis of the task and obtain subtasks; then an executor is constructed based on the large language model, tool documents are retrieved through tools, and a code solution is generated for the current subtask through the executor; finally, the generated code solution is executed in the code sandbox, evaluated by an evaluator constructed based on the large language model, and an evaluation result is generated and judged and processed until the evaluation result reaches a preset evaluation threshold; therefore, the present invention can realize effective collaboration among the planner, executor and evaluator, realize full-process automation for natural language input and high-quality single-cell sequencing data analysis, can greatly reduce the technical difficulty of the analysis process of single-cell sequencing, eliminate technical difficulties in the single-cell sequencing data analysis process, and can also effectively reduce the labor cost of single-cell sequencing data analysis. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 It is a schematic diagram of the working process of an embodiment of the present invention;

[0058] Figure 2 It is a schematic diagram of autonomous analysis of single-cell sequencing data according to an embodiment of the present invention. DETAILED DESCRIPTION

[0059] In the description of the present invention, if it involves a description of orientation, for example, the orientation or position relationship indicated by "upper", "lower", "front", "back", "left", "right", etc. is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. If a certain technical feature is referred to as "set", "fixed", "connected", or "installed" on another technical feature, it can be directly set, fixed, or connected to the other technical feature, or it can be indirectly set, fixed, connected, or installed on the other technical feature.

[0060] In the description of the present invention, if "several" is involved, it means more than one; if "multiple" is involved, it means more than two; if "greater than", "less than", or "exceed" is involved, it should be understood as not including the number itself; if "above", "below", or "within" is involved, it should be understood as including the number itself. If "first", "second", etc. are involved, they should be understood as being used only to distinguish the names of the same or similar technical features, and should not be understood as implying / indicating the relative importance of the technical features, the number of the technical features, or the order of the technical features.

[0061] The preferred embodiments of the present invention will be further described in detail below in conjunction with the accompanying drawings.

[0062] like Figure 1 and Figure 2 As shown, this embodiment provides a method for autonomous analysis of single-cell sequencing data based on a large language model, comprising the following steps:

[0063] Step S1, initializing the large language model, task description, and single-cell sequencing data;

[0064] Step S2, building a planner based on the large language model, first inputting the task description and data set information into the planner, then analyzing the task description through the planner, and performing task decomposition to obtain subtasks;

[0065] Step S3, constructing an executor based on the large language model, performing tool retrieval and obtaining tool documents, wherein the information of the tool documents includes tool call and tool parameter information;

[0066] Step S4, based on the tool document, generating a code solution for the current subtask through the executor;

[0067] Step S5, executing the code solution in the code sandbox. If the execution fails, return to re-execute step S4; if successful, obtain the execution result of the code solution, and the execution result includes result data and charts of the preset step analysis of the single-cell sequencing data;

[0068] Step S6, constructing an evaluator based on the large language model, evaluating the code solution and its execution result through the evaluator, and generating an evaluation result. If the evaluation result does not reach the preset evaluation threshold, returning to step S4 and repeating the execution until the evaluation result reaches the preset evaluation threshold;

[0069] Step S7, return and repeat steps S3 to S6 until all subtasks are completed.

[0070] The large language model described in this embodiment refers to an intelligent model obtained after training with a large amount of text data, through deep learning and neural network technology, based on the transformer (Transformer) architecture, so as to be able to learn a language model. The large language model includes but is not limited to the GPT-3.5 model, the GPT-4 model, the Claude 3 model, the Qwen-1.5 model and the LLaMA 3 model, and the GPT-4 model is used by default. It should be noted that those skilled in the art can select different large language models and set different hyperparameters for different task scenarios. The examples and parameters provided in this embodiment are only used as test cases and should not be construed as limitations on this application.

[0071] The step S1 in this embodiment is used to initialize the large language model parameters and task description, etc. The step S1 includes the following sub-steps:

[0072] Step S101, initializing large language model parameters, wherein the large language model parameters include an application programming interface key and a temperature;

[0073] Step S102: Initialize the task description u in natural language form task ;

[0074] Step S103, initializing single-cell sequencing data

[0075] In step S101, the application programming interface key refers to the API key, and API refers to the Application Programming Interface. Temperature refers to a hyperparameter used to control the randomness of the output in a large language model. The higher the temperature value, the more random and creative the output of the model; the lower the temperature value, the more deterministic and consistent the output of the model. In this embodiment, the default value of temperature after initialization is 0.05. The single-cell sequencing data By default, it includes raw data matrix, gene information, cell information, metadata and other related information. The raw data matrix is ​​stored in the form of a sparse matrix by default. Each row in the raw data matrix represents a gene, each column represents a single cell, and each element in the matrix represents the expression of the gene in the single cell. Gene information contains information about each gene, such as gene name, gene number, etc. Cell information contains barcode information for each single cell, such as barcode sequence, cell type, etc. Metadata, as a description of each cell, includes QC indicators of the cell, such as the number of unique genes detected in each cell, the total number of molecules detected in the cell, the percentage of reads mapped to the mitochondrial genome, etc. Other related information includes sequencing depth, saturation, and median gene expression.

[0076] The step S2 in this embodiment preferably includes the following sub-steps:

[0077] Step S201, initialize a large language model and define the large language model as a planner For example, define an initialized GPT-4 model as a planner

[0078] Step S202, setting the planner The system prompt word is Among them, the system prompt word Includes natural language descriptions associated with historical data of the entire process of single-cell sequencing data analysis, and the associated natural language descriptions are used to define the planner All decomposition steps included in task decomposition, wherein the decomposition steps include any one or more of a quality control step, a normalization step, a highly variable gene identification step, a dimensionality reduction step, a batch effect correction step, a clustering step, a cell type annotation step, and a trajectory inference step;

[0079] Step S203: Use Python tools to read single-cell sequencing data Get dataset information Build for planner Input hint word Python tools refer to single-cell sequencing data analysis tools, including but not limited to the Scanpy process analysis toolkit and the Palantir single-cell data trajectory inference toolkit; the Scanpy process analysis toolkit is also called the single-cell RNA sequencing data analysis tool;

[0080] Step S204: describe the task task and dataset information Input to planner Then in the planner In the natural language interaction through the large language model, the task description u task Analyze and use the formula It is decomposed into several subtasks, and the subtasks are passed through t1, t2, …, t n To represent, n is a natural number representing the sequence number.

[0081] In step S202 of this embodiment, the natural language description of the whole process of analyzing the single-cell sequencing data in the historical data is used as the system prompt word. The content of the whole process is then used to define the planner through a natural language description of the whole process. All the decomposition steps included in task decomposition.

[0082] Among them, the quality control step is used to check the quality and integrity of the data, including the expression levels of cells and genes; to identify and remove low-quality cells, such as dead cells, broken cells, etc.; this quality control step can use single-cell RNA sequencing data analysis tools such as Cell Ranger, Seurat or Scrublet to remove low-quality cells and detect double cells. The normalization step is used to normalize the data. The normalization methods include LogNormalize and SCTransform to eliminate the deviation caused by different sequencing depths. The highly variable gene identification step is used to identify genes with large expression changes in different cells. The methods used include using the FindVariableFeatures function of the Seurat language software package or the model in the Scanpy toolkit. The dimensionality reduction step can use data dimensionality reduction methods such as principal component analysis (PCA), t-SNE (t-distributed random neighbor embedding) and UMAP (Uniform Manifold Approximation and Projection) to reduce dimensionality, effectively reducing the complexity of the data and facilitating visualization. Batch effect correction step, which is a key step, can use the integration function of tools such as Harmony, Combat or Seurat. Clustering step, which is implemented through K-means, Louvain or Leiden algorithm, groups similar cells to identify different cell populations, and after clustering, dimensionality reduction and visualization are performed through t-SNE dimensionality reduction method or UMAP dimensionality reduction method to observe the distribution of different cell populations. Cell type annotation step, use single cell reference database (such as CellMarker) or bioinformatics tools such as scGPT to assign types to cell populations. Trajectory inference step, used to analyze cell development trajectory and infer the transition process of cell state, specifically including Monocle, Slingshot and PAGA and other cell sequencing data analysis tools for trajectory inference analysis.

[0083] More specifically, step S203 in this embodiment includes the following sub-steps:

[0084] Step S2031, read the single-cell sequencing data through the Scanpy process analysis toolkit of the Python tool And store the read data in a preset storage area;

[0085] And, step S2032, extracting data set information from the data Dataset Information Including the number of cells and genes. For example, according to a preset threshold, cells and genes below the preset threshold are filtered out. The preset threshold refers to the preset quality threshold of cells and genes, which can be set and adjusted according to actual conditions.

[0086] In step S204 of this embodiment, according to the data set information Build for planner Input hint word The instruction to construct is: Input prompt word = f"Please analyze according to the following dataset information: {dataset_info}", where dataset_info represents the dataset information Preferably, the input prompt word can also convert the above-constructed prompt word into a specific analysis process, namely: perform PCA principal component analysis for dimensionality reduction; use t-SNE dimensionality reduction method or UMAP dimensionality reduction method for data visualization; perform clustering steps to identify different cell populations; identify cell trajectories through trajectory inference steps, infer cell differentiation processes, etc.

[0087] Step S3 in this embodiment includes the following sub-steps:

[0088] Step S301, initialize a large language model, defined as an executor For example, define an initialized GPT-4 model as an executor

[0089] Step S302, setting the actuator The system prompt word is The actuator System prompt words Including historical data and tool pool for the entire process of single-cell sequencing data analysis Tool Pool Documentation and the associated natural language description of the code generation requirements;

[0090] Step S303: The task description information of the current subtask is i and dataset information Input to actuator i represents the subtask number of the current step;

[0091] Step S304, executor From the tool pool Retrieve the tool for solving the current subtask by command Get a list of recommended tools

[0092] Step S305, executor According to the tool list Get the corresponding tool documentation For example, preset tool pool Tool Pool Documentation in and its tools to save the corresponding index associations and obtain the index association table. According to the tool list You can quickly obtain the corresponding tool document by querying the index association table Tool Documentation Includes detailed information about the tool call and tool parameters.

[0093] Step S4 in this embodiment includes the following sub-steps:

[0094] Step S401: Integrate the actuators of step S3 in sequence System prompt words Task description information i , Tool Documentation Dataset Information And historical code Form a complete execution prompt word, which is To indicate that the actuator System prompt words For actuator Generate code;

[0095] Step S402, actuator Generate a code solution c for the current subtask based on the execution prompt word i , the instructions to generate the code solution are

[0096] Step S5 in this embodiment includes the following sub-steps:

[0097] Step S501, executing the code solution c described in step S4 in the code sandbox ε i ;

[0098] Step S502: during the execution process, determine whether the execution is successful. If the code sandbox ε throws an exception, it is determined that the execution failed, and return to step S4 to regenerate the code solution c. i , and then execute it through the code sandbox ε; otherwise, it is judged that the execution is successful and jumps to step S503;

[0099] Step S503, by executing the code solution c described in step S4 i , get and output the code execution result ε(c i ). The code execution result ε(c i ) including single-cell sequencing data The result data and charts of the preset steps; the preset steps refer to the specific analysis steps that are preset and can be set and adjusted according to the actual situation. The default is the code solution c i The corresponding code execution steps.

[0100] Step S6 in this embodiment includes the following sub-steps:

[0101] Step S601, initialize a large language model, defined as an evaluator For example, define an initialized GPT-4 model as an evaluator

[0102] Step S602: Setting the evaluator The system prompt word is The system prompt word is Including single-cell sequencing data The evaluation indicators and relevant natural language descriptions of the evaluation tools;

[0103] Step S603: Integrate the evaluators in sequence The system prompt word is Evaluation task description information task , the code execution result of step S5 ε(c i ), dataset information And the code solution c for step S4 i , forming a complete evaluation prompt word, which is passed To express;

[0104] Step S604, evaluator Generate an evaluation result about the execution result of the current subtask based on the evaluation prompt word

[0105] Step S605, through the evaluator If the current evaluation result does not reach the preset evaluation threshold, the process returns to step S4 and executes again until the current evaluation result reaches the preset evaluation threshold, then the process jumps to step S606; the preset evaluation threshold refers to a preset threshold for judging the evaluation result, which can be set and adjusted according to the actual situation and needs;

[0106] Step S606: The code solution c corresponding to the current step i Add to history code middle.

[0107] It should be noted that, preferably, when step S5 triggers the return to step S4 to regenerate the code solution c iWhen the number of execution failures reaches the first threshold, the historical code Corresponding code solution c i The first threshold refers to the preset threshold of the number of execution failures, which can be set and adjusted according to actual conditions and needs; when the number of execution failures reaches the first threshold, the historical code Corresponding code solution c i Move to the error code database, which can effectively clear historical codes Solutions to code that is prone to execution failure in c i On the other hand, it can also provide a data basis for error guidance through the error code database, providing a data basis for avoiding execution errors of large language models, which is more suitable for large language models for single-cell sequencing data analysis.

[0108] Similarly, when step S6 triggers the return to re-execute step S4, the evaluation failure information is recorded, and when the number of evaluation failures reaches the second threshold, the historical code Corresponding code solution c i The second threshold refers to the pre-set threshold of the number of evaluation failures, which can be set and adjusted according to actual conditions and needs; when the number of evaluation failures reaches the second threshold, the historical code Corresponding code solution c i Move to the error code database, which can also effectively clear historical codes Code solutions that are prone to evaluation failure in c i , which can provide a data basis for error guidance through the error code database, and provide a data basis for optimizing the evaluation mechanism of the large language model, so that as the data increases, a large language model that is more suitable for single-cell sequencing data analysis can be proposed.

[0109] It is worth noting that in this embodiment, the first threshold is smaller than the second threshold. The reason for this design is that for the large language model of single-cell sequencing data analysis, the code solution c for execution failure i The probability needs to be controlled more strictly and accurately to ensure the historical code Corresponding code solution c i Try to execute successfully as much as possible to reduce unnecessary subsequent jumps and reduce the amount of redundant data during the execution process. The evaluation failure is related to the set evaluation failure number threshold, which is greater than the first threshold by default.

[0110] Specifically, in the steps S1 to S7, this embodiment specifically verifies single-cell sequencing analysis tasks such as clustering, batch effect correction, cell type annotation, and trajectory inference. The experimental results of this embodiment (CellAgent) are presented in Tables 1 to 3 below. Among them, GPT-4 in Table 1 represents the success rate of directly applying the GPT-4 model to analyze single-cell sequencing data; GPT-4 (expert) represents its expert knowledge shared and consistent with this application; CellAgent is the autonomous analysis method for single-cell sequencing data based on a large language model described in this application. Tables 2 to 3 compare CellAgent with traditional methods for data analysis, where Table 2 is verified on the batch removal task. The results show that CellAgent can always perform better in terms of all five indicators, while the baseline algorithm is always excellent in some indicators and poor in other performance. Table 3 is verified on the trajectory inference task, and the results show that CellAgent's performance level exceeds all existing methods based on all indicators.

[0111] Table 1 Experimental table of success rate of the autonomous analysis method of single-cell sequencing data based on the large language model

[0112]

[0113] Table 2. Table of batch removal experiments for the autonomous analysis method of single-cell sequencing data based on a large language model

[0114]

[0115] Table 3 Trajectory inference experiment table of the autonomous analysis method of single-cell sequencing data based on large language model

[0116]

[0117] This embodiment also provides a single-cell sequencing data autonomous analysis system based on a large language model, which adopts the single-cell sequencing data autonomous analysis method based on a large language model as described above, and includes:

[0118] Initialization module, which initializes the large language model, task description, and single-cell sequencing data;

[0119] A planner construction module builds a planner based on a large language model. The task description and data set information are first input into the planner. The planner then analyzes the task description and decomposes the task to obtain subtasks.

[0120] An executor construction module constructs an executor based on a large language model, performs tool retrieval and obtains tool documents, wherein the information of the tool documents includes tool call and tool parameter information;

[0121] The code solution generation module generates a code solution for the current subtask through the executor based on the tool documentation;

[0122] An execution module executes the code solution in the code sandbox. If the execution fails, the execution module returns to re-execute the code solution generation module. If successful, the execution result of the code solution is obtained, and the execution result includes result data and charts of the preset step analysis of the single-cell sequencing data;

[0123] An evaluation module, which constructs an evaluator based on a large language model, evaluates the code solution and its execution result through the evaluator, and generates an evaluation result. If the evaluation result does not reach a preset evaluation threshold, the code solution generation module is returned to be repeatedly executed until the evaluation result reaches the preset evaluation threshold;

[0124] The loop module returns and repeatedly executes the executor construction module to the evaluation module until all subtasks are completed.

[0125] In summary, after initialization, this embodiment first builds a planner based on the large language model to analyze and obtain subtasks of the task; then builds an executor based on the large language model, obtains tool documents through tool retrieval, and generates a code solution for the current subtask through the executor; finally, executes the generated code solution in the code sandbox, evaluates it through the evaluator built based on the large language model, generates an evaluation result, and judges and processes it until the evaluation result reaches a preset evaluation threshold; therefore, this embodiment can achieve effective collaboration among the planner, executor, and evaluator, and the single-cell sequencing data autonomous analysis method realizes automatic planning of tasks described by users in natural language, high-quality execution of subtasks, automatic repair of code operation abnormalities, autonomous evaluation and iterative optimization of code solutions, and finally obtains high-quality data analysis results.

[0126] This embodiment can achieve full-process automation and high-quality single-cell sequencing data analysis for natural language input, can significantly reduce the technical difficulty of the analysis process for single-cell sequencing, eliminate technical difficulties in the single-cell sequencing data analysis process, and can also effectively reduce the labor cost of single-cell sequencing data analysis.

[0127] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the scope of protection of the present invention.

Claims

1. A method for autonomous analysis of single-cell sequencing data based on a large language model, characterized in that: The following steps are involved: Step S1, initializing the large language model, task description, and single-cell sequencing data; Step S2, building a planner based on the large language model, first inputting the task description and data set information into the planner, then analyzing the task description through the planner, and performing task decomposition to obtain subtasks; Step S3, constructing an executor based on the large language model, performing tool retrieval and obtaining tool documents, wherein the information of the tool documents includes tool call and tool parameter information; Step S4, based on the tool document, generating a code solution for the current subtask through the executor; Step S5, executing the code solution in the code sandbox. If the execution fails, return to re-execute step S4; if successful, obtain the execution result of the code solution, and the execution result includes result data and charts of the preset step analysis of the single-cell sequencing data; Step S6, constructing an evaluator based on the large language model, evaluating the code solution and its execution result through the evaluator, and generating an evaluation result. If the evaluation result does not reach the preset evaluation threshold, returning to step S4 and repeating the execution until the evaluation result reaches the preset evaluation threshold; Step S7, return and repeat steps S3 to S6 until all subtasks are completed.

2. The method for autonomous analysis of single-cell sequencing data based on a large language model according to claim 1, characterized in that: The step S1 comprises the following sub-steps: Step S101, initializing large language model parameters, wherein the large language model parameters include an application programming interface key and a temperature; Step S102: Initialize the task description u in natural language form task ; Step S103, initializing single-cell sequencing data 3. The method for autonomous analysis of single-cell sequencing data based on a large language model according to claim 1, characterized in that: The step S2 comprises the following sub-steps: Step S201, initialize a large language model and define the large language model as a planner Step S202, set up the planner The system prompt word is Among them, the system prompt word Includes natural language descriptions associated with historical data of the entire process of single-cell sequencing data analysis, and the associated natural language descriptions are used to define the planner All decomposition steps included in task decomposition, wherein the decomposition steps include any one or more of a quality control step, a normalization step, a highly variable gene identification step, a dimensionality reduction step, a batch effect correction step, a clustering step, a cell type annotation step, and a trajectory inference step; Step S203: Use Python tools to read single-cell sequencing data Get dataset information Build for planner Input hint word Step S204: describe the task task and dataset information Input to planner Then in the planner In the natural language interaction through the large language model, the task description u task Analyze and use the formula It is decomposed into several subtasks, and the subtasks are passed through t1, t2, …, t n To represent, n is a natural number representing the sequence number.

4. The method for autonomous analysis of single-cell sequencing data based on a large language model according to claim 2, characterized in that: The step S203 includes the following sub-steps: Step S2031, read the single-cell sequencing data through the Scanpy process analysis toolkit of the Python tool And store the read data in a preset storage area; And, step S2032, extracting data set information from the data Dataset Information Including cell number and gene number; In step S204, according to the data set information Build for planner Input hint word The instruction to construct is: Input prompt word = f"Please analyze according to the following dataset information: {dataset_info}", where dataset_info represents the dataset information The number of cells and genes included.

5. The method for autonomous analysis of single-cell sequencing data based on a large language model according to any one of claims 1 to 4, characterized in that: The step S3 comprises the following sub-steps: Step S301, initialize a large language model, defined as an executor Step S302, setting the actuator The system prompt word is The actuator System prompt words Including historical data and tool pool for the entire process of single-cell sequencing data analysis Tool Pool Documentation and the associated natural language description of the code generation requirements; Step S303: The task description information of the current subtask is i and dataset information Input to actuator i represents the subtask number of the current step; Step S304, executor From the tool pool Retrieve the tool for solving the current subtask by command Get a list of recommended tools Step S305, executor According to the tool list Get the corresponding tool documentation 6. The method for autonomous analysis of single-cell sequencing data based on a large language model according to claim 5, characterized in that: The step S4 comprises the following sub-steps: Step S401, sequentially integrate the actuators of step S3 System prompt words Task description information i , Tool Documentation Dataset Information And historical code Form a complete execution prompt word, which is To indicate that the actuator System prompt words For actuator Generate code; Step S402, actuator Generate a code solution c for the current subtask based on the execution prompt word i , the instructions to generate the code solution are 7. The method for autonomous analysis of single-cell sequencing data based on a large language model according to claim 6, characterized in that: The step S5 comprises the following sub-steps: Step S501, executing the code solution c described in step S4 in the code sandbox ε i ; Step S502: during the execution process, determine whether the execution is successful. If the code sandbox ε throws an exception, it is determined that the execution failed, and return to step S4 to regenerate the code solution c. i , and then execute it through the code sandbox ε; otherwise, it is judged that the execution is successful and jumps to step S503; Step S503, by executing the code solution c described in step S4 i , get and output the code execution result ε(c i ).

8. The method for autonomous analysis of single-cell sequencing data based on a large language model according to claim 7, characterized in that: The step S6 comprises the following sub-steps: Step S601, initialize a large language model, defined as an evaluator Step S602: Setting the evaluator The system prompt word is The system prompt word is Including single-cell sequencing data The evaluation indicators and relevant natural language descriptions of the evaluation tools; Step S603: Integrate the evaluators in sequence The system prompt word is Evaluation task description information task , the code execution result of step S5 ε(c i ), dataset information And the code solution c for step S4 i , forming a complete evaluation prompt word, which is passed To express; Step S604, evaluator Generate an evaluation result about the execution result of the current subtask based on the evaluation prompt word Step S605, through the evaluator If the current evaluation result does not reach the preset evaluation threshold, the process returns to step S4 and executes again until the current evaluation result reaches the preset evaluation threshold, then the process jumps to step S606; Step S606: The code solution c corresponding to the current step i Add to history code middle.

9. The method for autonomous analysis of single-cell sequencing data based on a large language model according to claim 8, characterized in that: When step S5 triggers the return to step S4 to regenerate the code solution c i When the number of execution failures reaches the first threshold, the historical code Corresponding code solution c i Moved to error code database; When step S6 triggers the return to re-execute step S4, the evaluation failure information is recorded, and when the number of evaluation failures reaches the second threshold, the historical code Corresponding code solution c i Move to the error code database; the first threshold is less than the second threshold.

10. A single-cell sequencing data autonomous analysis system based on a large language model, characterized in that: The method for autonomous analysis of single-cell sequencing data based on a large language model as claimed in any one of claims 1 to 9 is adopted, and comprises: Initialization module, which initializes the large language model, task description, and single-cell sequencing data; A planner construction module builds a planner based on a large language model. The task description and data set information are first input into the planner. The planner then analyzes the task description and decomposes the task to obtain subtasks. An executor construction module constructs an executor based on a large language model, performs tool retrieval and obtains tool documents, wherein the information of the tool documents includes tool call and tool parameter information; The code solution generation module generates a code solution for the current subtask through the executor based on the tool documentation; An execution module executes the code solution in the code sandbox. If the execution fails, the execution module returns to re-execute the code solution generation module. If successful, the execution result of the code solution is obtained, and the execution result includes result data and charts of the preset step analysis of the single-cell sequencing data; An evaluation module, which constructs an evaluator based on a large language model, evaluates the code solution and its execution result through the evaluator, and generates an evaluation result. If the evaluation result does not reach a preset evaluation threshold, the code solution generation module is returned to be repeatedly executed until the evaluation result reaches the preset evaluation threshold; The loop module returns and repeatedly executes the executor construction module to the evaluation module until all subtasks are completed.

Citation Information

Patent Citations

  • Single cell data analysis method based on natural language processing

    CN117894376A

  • Single cell transcriptome computation and analysis method and system incorporating deep learning model

    WO2022188785A1

Cited By

  • Automatic construction system for biological information analysis process

    CN121148496A

  • A bio-information analysis flow automation construction system

    CN121148496B