Devices and methods for generating code
By using a device and method to generate code, and leveraging a general code library and a large language model, the automated generation of instructions into code is achieved. This solves the problems of insufficient flexibility and throughput in automated library construction technology when dealing with highly complex samples, and realizes efficient, flexible, and widely applicable automated library construction.
Patent Information
- Application Number
- CN202510591292.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-08
- Publication Date
- 2026-11-17
AI Technical Summary
Existing automated library construction technologies lack flexibility and throughput when processing highly complex samples, and their operation processes are complex and costly, making it difficult to achieve widespread applicability of various types of library construction kits.
Employing a code generation device and method, and utilizing a general code library, analysis module, search module, large language model, and code tuning module, this system automates the generation of code from instructions to instructions, supports flexible library construction needs for complex samples, and covers various types of library construction kits.
It has achieved an efficient, flexible, and widely applicable automated solution for library construction, which simplifies the operation process, improves the efficiency and accuracy of library construction, and reduces costs.
Smart Images

Figure SMS_1 
Figure SMS_3 
Figure SMS_4
Abstract
Description
Technical Field
[0001] This application relates to the field of bioinformatics technology, specifically to an apparatus and method for generating code. Background Technology
[0002] With the rapid development of high-throughput sequencing technology, library construction technology has become an important tool in modern genomics research and clinical applications. Traditional manual library construction techniques are time-consuming and labor-intensive, and prone to human error, seriously affecting experimental efficiency and data accuracy. To solve these problems, automated library construction technology has emerged.
[0003] Despite significant progress in automated library construction technology, most current techniques still only support fixed templates and specific sample sizes, presenting challenges in terms of ease of use, template generalization, and applicability. For example, the flexibility and throughput of automated platforms need improvement when handling highly complex samples. Furthermore, simplifying procedures and reducing costs while maintaining library construction quality remains a key research focus.
[0004] However, current methods for building automated libraries still need improvement. Summary of the Invention
[0005] This application aims to address at least one of the technical problems existing in the prior art. To this end, this application provides an apparatus and method for generating code. The apparatus automates the process from instruction manual analysis to code generation, supports flexible library construction needs for complex samples, is easy to operate, covers various types of library construction kits, and provides an efficient, flexible, and widely applicable automated solution for library construction. Thus, it proposes a means to support widely applicable automated library construction for complex samples.
[0006] In a first aspect, this application proposes an apparatus for generating code used to control automated experimental equipment. According to an embodiment of this application, the apparatus includes: a general code library storing a plurality of preset code blocks and first description information of the preset code blocks; a first analysis module for analyzing a specification related to the automated experiment to obtain second description information of the specification; a search module for determining intermediate code from the plurality of preset code blocks in the general code library based on the second description information obtained by the first analysis module and the first description information; a second analysis module for analyzing and determining a parameter dictionary for adjusting the intermediate code; and a code adjustment module for adjusting the intermediate code based on the parameter dictionary to obtain code for controlling the automated experimental equipment.
[0007] Therefore, the device according to the embodiments of this application realizes automation from specification analysis to code generation, supports flexible library construction needs for complex samples, is easy to operate, covers a variety of different types of library construction kits, and realizes an efficient, flexible and widely applicable automated library construction solution.
[0008] According to an embodiment of this application, the first description information includes a preset step name and preset step content corresponding to the preset code block, and the second description information includes a step name and the step content corresponding to the step name.
[0009] According to embodiments of this application, the above-described apparatus may also have at least one of the following additional technical features:
[0010] According to an embodiment of this application, the general code library stores vector features of the first descriptive information.
[0011] According to an embodiment of this application, the search module further includes: a vectorization submodule, used to vectorize the step name and the step content corresponding to the step name in the second description information to obtain a vector to be matched; and a search submodule, used to determine candidate code blocks based on the similarity between the vector to be matched and the vector features of the first description information.
[0012] According to an embodiment of this application, the search module includes a large language model.
[0013] According to an embodiment of this application, the search module is used to match candidate code blocks among multiple preset code blocks in the general code library based on the second description information and the first description information obtained by the first analysis module, and to determine intermediate code based on the candidate code blocks according to the large language model.
[0014] According to an embodiment of this application, the first analysis module and the second analysis module are the same analysis module, which includes a large language model.
[0015] According to an embodiment of this application, the parameter dictionary includes the conditions and numerical information in the specification.
[0016] In a second aspect, this application proposes a method for generating code used to control automated experimental equipment. According to an embodiment of this application, the method includes: obtaining a specification related to the automated experiment; performing an initial analysis on the specification to obtain step names and corresponding step contents; determining candidate code blocks in a general code library based on the step names and step contents obtained from the initial analysis, the general code library storing multiple preset code blocks and description information of the preset code blocks, the description information including preset step names and preset step contents corresponding to the code blocks; determining intermediate code using a large language model based on the candidate code blocks; performing a secondary analysis on the specification to determine a parameter dictionary for adjusting the intermediate code; and adjusting the intermediate code based on the parameter dictionary to obtain code for controlling the automated experimental equipment.
[0017] Therefore, the code generation method according to the embodiments of this application automates the process from specification analysis to code generation, supports flexible library construction needs for complex samples, is easy to operate, covers a variety of different types of library construction kits, and achieves an efficient, flexible, and widely applicable automated library construction solution.
[0018] According to embodiments of this application, the above method may also have at least one of the following additional technical features:
[0019] According to an embodiment of this application, the general code library further stores vector features of the description information, and determining candidate code blocks in the general code library includes: vectorizing the step names of the specification and the step content corresponding to the step names to obtain a matching vector; and determining the candidate code block based on the similarity between the matching vector and the vector features of the description information.
[0020] According to embodiments of this application, the primary analysis and the secondary analysis are performed using a large language model, respectively.
[0021] According to an embodiment of this application, the parameter dictionary includes the conditions and numerical information in the specification.
[0022] In a third aspect, this application proposes an electronic device. According to an embodiment of this application, the electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements the method for generating code described above.
[0023] In a fourth aspect, this application provides a readable storage medium. According to an embodiment of this application, the readable storage medium stores computer-readable instructions for causing a computer to execute the above-described method of generating code.
[0024] In a fifth aspect, this application proposes an electronic device. According to an embodiment of this application, the electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. The electronic device stores a general code library including multiple preset code blocks. When the processor executes the program, it implements a method for generating code. The method includes: receiving user-inputted instructions related to an automated experiment; responding to the user's instructions and calling a specification related to the automated experiment; outputting intermediate code from the multiple preset code blocks that matches the specification; and outputting code for controlling the automated experimental device based on the intermediate code and the user's instructions.
[0025] According to embodiments of this application, the automated experiment-related instructions include at least one of the following: experimental procedures, experimental equipment manuals, reagent manuals, experimental parameters, and software information.
[0026] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0027] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:
[0028] Figure 1 This is a schematic diagram of the process in Embodiment 1 of the present invention;
[0029] Figure 2 This is a schematic diagram of the RAG code block matching process in Embodiment 1 of the present invention;
[0030] Figure 3 This is a diagram showing the applicable scope of the general code block in Embodiment 1 of the present invention;
[0031] Figure 4 This is a performance comparison chart of different large model code modifications in Embodiment 2 of the present invention. Detailed Implementation
[0032] The embodiments of the present invention are described in detail below. The embodiments described below are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0033] It should be noted that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0034] The endpoints and any values of the ranges disclosed herein are not limited to the precise ranges or values, and these ranges or values should be understood to include values close to these ranges or values. For numerical ranges, the endpoint values of the various ranges, the endpoint values of the various ranges and individual point values, and individual point values can be combined with each other to obtain one or more new numerical ranges, which should be considered as specifically disclosed herein.
[0035] In this document, the terms “comprising” or “including” are open-ended expressions, meaning that they include the contents specified in this invention, but do not exclude other aspects.
[0036] In this document, the terms “optionally,” “optionally,” or “optionally” generally refer to an event or condition that may, but may not, occur, and the description includes both cases in which the event or condition occurs and cases in which the event or condition does not occur.
[0037] Terms and Definitions
[0038] In this paper, the term "large language model" refers to a large-scale natural language processing model trained using deep learning techniques. These models typically have billions or even hundreds of billions of parameters and are capable of understanding and generating natural language text. Through unsupervised learning on large-scale text datasets, they learn the syntax, semantics, and context of a language, thus possessing powerful language understanding and generation capabilities. ChatGPT is an example.
[0039] In this paper, the term "vectorization" refers to converting text into numerical vectors so that computers can understand and process it. For example, word embedding techniques can map words, phrases, or entire documents into high-dimensional vector spaces that capture the semantic and syntactic information of the text.
[0040] In this paper, the term "library" refers to a collection of DNA or RNA samples that stores a large number of gene sequences. Libraries are created to study gene function and to find clones of specific genes.
[0041] In this article, the term "parameter dictionary" refers to a data structure that stores key-value pairs, providing a flexible and efficient way to organize and access data, making the code clearer, more maintainable, and more scalable.
[0042] Device for generating code
[0043] In a first aspect, this application proposes an apparatus for generating code used to control automated experimental equipment. According to an embodiment of this application, the apparatus includes: a general code library storing a plurality of preset code blocks and first description information of the preset code blocks; a first analysis module for analyzing a specification related to the automated experiment to obtain second description information of the specification; a search module for determining intermediate code from the plurality of preset code blocks in the general code library based on the second description information obtained by the first analysis module and the first description information; a second analysis module for analyzing and determining a parameter dictionary for adjusting the intermediate code; and a code adjustment module for adjusting the intermediate code based on the parameter dictionary to obtain code for controlling the automated experimental equipment.
[0044] Therefore, the device of this application automates the process from instruction manual analysis to code generation, supports flexible library construction needs for complex samples, is easy to operate, covers a variety of different types of library construction kits, and achieves an efficient, flexible, and widely applicable automated solution for library construction. The system comprises several modules: a general code library, a universal codebase, and a general codebase. The general codebase provides the foundational materials and reference framework for subsequent code generation, ensuring that the generated code accurately executes each step of the library construction process, thereby enabling effective control of the automated library construction equipment. The first analysis module analyzes the kit instructions, extracting the step names and corresponding content to provide crucial information for subsequent code generation, ensuring that the generated code accurately reflects the specific steps and operational requirements of library construction. The search module matches the steps in the kit instructions with the general code library, providing a crucial bridge for automating the automated library construction process and improving the efficiency and accuracy of code generation. The large language model leverages its powerful capabilities in natural language understanding and code generation, adapting general code blocks to code that matches specific experimental steps, providing a foundation for subsequent code adjustment and optimization. The second analysis module defines a parameter dictionary, ensuring that the subsequent code adjustment module can fine-tune the intermediate code based on the parameter dictionary. The code adjustment module, based on the parameter dictionary extracted from the kit instructions, precisely and finely adjusts the intermediate code generated by the large language model module, ensuring that the adjusted code accurately adapts to the experimental conditions of the specific kit. The intermediate code is an executable code generated by adapting key information and parameters extracted from the kit instructions, combined with general code library materials, and adapted by a large language model. It is used to realize automated library construction operations under specific experimental conditions.
[0045] According to an embodiment of this application, the first description information includes a preset step name and preset step content corresponding to the preset code block, and the second description information includes a step name and the step content corresponding to the step name.
[0046] According to some specific embodiments of this application, the large language model includes ChatGPT, Claude, and Gemini, among others. The large language model is based on the Transformer architecture and comprises three main parts: an encoder, a decoder, and an output layer. The encoder processes the input text, converting it into a semantic representation; the decoder, in the generation task, decodes the text based on the encoder's output and existing context to generate new content; and the output layer, based on the decoder, outputs the final prediction result.
[0047] According to an embodiment of this application, the general code library stores vector features of the first description information. Thus, it includes a library-building code block name vector library, which is composed of vectors converted from the names of each library-building code block using an embedding model; and a library-building code block content vector library, which is composed of vectors converted from the content information of each library-building code block using an embedding model.
[0048] According to some specific embodiments of this application, the general code library is based on the instructions for the 17 library preparation kits in Table 1.
[0049] Table 1
[0050]
[0051] According to an embodiment of this application, the search module further includes: a vectorization method for converting the step names and corresponding step contents in the second description information to obtain a matching vector; and a search submodule for determining candidate code blocks based on the similarity between the matching vector and the vector features of the first description information. Thus, RAG (Retrieval-Augmented Generation) retrieval enhancement generation technology is used. Retrieval enhancement generation refers to using a retrieval model to extract relevant information from an external knowledge base or document collection, and passing this information as auxiliary input to a generation model (such as a language model) for generation. The extracted library construction step names are converted into vectors using an embedding model, and the similarity between this vector and all vectors in the library construction code block name vector library is calculated using the following formula: Where a i and b iLet be the i-th component of vectors a and b, and n be the dimension of the vector. Next, select the top 10 library creation code block name vectors with the highest similarity and find their corresponding library creation code block content vectors. Then, convert the step content into a library creation content vector and calculate its similarity to the top 10 library creation code block content vectors, selecting the top 5 library creation code block content with the highest similarity. Input these top 5 library creation code block content and the step content information into ChatGPT, which returns the most similar library creation code block content, thus determining the library creation code block that matches the step content.
[0052] According to some specific embodiments of this application, the first analysis module prompt is shown in Table 2, which allows ChatGPT to extract the content of the Chinese library construction steps of the reagent kit according to the rules of the prompt.
[0053] Table 2
[0054]
[0055] According to embodiments of this application, the search module includes a large language model. This allows for different analysis tasks, thereby improving the overall efficiency and accuracy of the model.
[0056] According to an embodiment of this application, the search module is used to match candidate code blocks among multiple preset code blocks in the general code library based on the second description information and the first description information obtained by the first analysis module, and to determine intermediate code based on the candidate code blocks according to the large language model.
[0057] According to an embodiment of this application, the first analysis module and the second analysis module are the same analysis module, which includes a large language model.
[0058] According to an embodiment of this application, the parameter dictionary includes the conditions and numerical information in the specification. Therefore, integrating the conditions and numerical information in the specification into a parameter dictionary provides an adjustment basis for the code adjustment module, enabling the generated code to accurately reflect the specific requirements and conditions of library construction, thereby improving the applicability of the code and the accuracy of the experiment.
[0059] According to some specific embodiments of this application, the large language model module prompt is shown in Table 3. Based on candidate code blocks, it constructs an input parameter list, inputs the input parameter list and the reagent kit instruction manual document into ChatGPT, extracts the parameter values corresponding to the input parameters, and returns them in JSON format.
[0060] Table 3
[0061]
[0062] According to some specific embodiments of this application, the large language model module further includes the ability to modify the input parameter dictionary based on the sample size after ChatGPT returns the input parameter dictionary. This results in code that better meets experimental requirements.
[0063] According to some specific embodiments of this application, the sample size is 1 to 96, for example, it can be 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 40, 80, 90, 91, 92, 93, 94, 95, 96, etc.
[0064] According to some specific embodiments of this application, the code adjustment module prompt, as shown in Table 4, inputs the calculated input parameter dictionary and the corresponding general code block into ChatGPT, and combines it with a code modification prompt to allow ChatGPT to modify the code according to the rules and generate new executable code.
[0065] Table 4
[0066]
[0067] Methods for generating code
[0068] In a second aspect, this application proposes a method for generating code used to control automated experimental equipment. According to an embodiment of this application, the method includes: obtaining a manual related to the automated experiment; performing a first analysis on the manual to obtain step names and corresponding step contents; based on the step names and step contents obtained from the first analysis, determining candidate code blocks in a general code library, the general code library storing multiple preset code blocks and description information of the preset code blocks, the description information including preset step names and preset step contents corresponding to the code blocks; using a large language model to determine intermediate code based on the candidate code blocks; performing a second analysis on the manual to determine a parameter dictionary for adjusting the intermediate code; and adjusting the intermediate code based on the parameter dictionary to obtain code for controlling the automated experimental equipment. Thus, by obtaining and deeply analyzing the reagent kit manual, extracting the step information and parameter dictionary, and using a general code library and a large language model, code is generated and adjusted, ultimately forming code capable of accurately controlling automated library construction equipment, thereby achieving a high degree of automation and intelligence in the library construction process, greatly improving the efficiency, accuracy, and reliability of library construction. The intermediate code is an executable code generated by adapting key information and parameters extracted from the kit instructions, combined with general code library materials, and adapted by a large language model. It is used to realize automated library construction operations under specific experimental conditions.
[0069] According to an embodiment of this application, the general code library further stores vector features of the description information, and determining candidate code blocks in the general code library includes: vectorizing the step names of the specification and the step content corresponding to the step names to obtain a matching vector; and determining the candidate code block based on the similarity between the matching vector and the vector features of the description information.
[0070] According to embodiments of this application, the primary analysis and the secondary analysis are performed using a large language model, respectively.
[0071] According to an embodiment of this application, the parameter dictionary includes the conditions and numerical information in the specification.
[0072] Those skilled in the art will understand that the features and advantages described above for the device for generating code also apply to this method, and will not be repeated here.
[0073] In a third aspect, this application proposes an electronic device. According to an embodiment of this application, the electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements the method for generating code described above.
[0074] Those skilled in the art will understand that the features and advantages described above for the device for generating code also apply to this electronic device, and will not be repeated here.
[0075] In a fourth aspect, this application provides a readable storage medium. According to an embodiment of this application, the readable storage medium stores computer-readable instructions for causing a computer to execute the above-described method of generating code.
[0076] Those skilled in the art will understand that the features and advantages described above for the device for generating code also apply to this readable storage medium, and will not be repeated here.
[0077] In a fifth aspect, this application proposes an electronic device. According to an embodiment of this application, the electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. The electronic device stores a general code library including multiple preset code blocks. When the processor executes the program, it implements a method for generating code. The method includes: receiving user-inputted instructions related to an automated experiment; responding to the user's instructions and calling a specification related to the automated experiment; outputting intermediate code from the multiple preset code blocks that matches the specification; and outputting code for controlling the automated experimental device based on the intermediate code and the user's instructions.
[0078] According to embodiments of this application, the automated experiment-related instructions include at least one of the following: experimental procedures, experimental equipment manuals, reagent manuals, experimental parameters, and software information.
[0079] Those skilled in the art will understand that the features and advantages described above for the device for generating code also apply to this electronic device, and will not be repeated here.
[0080] The present invention will be explained below with reference to embodiments. Those skilled in the art will understand that the following embodiments are for illustrative purposes only and should not be considered as limiting the scope of the invention. Where specific techniques or conditions are not specified in the embodiments, they are performed according to the techniques or conditions described in the literature in the field or according to the product instructions. Reagents or instruments whose manufacturers are not specified are all conventional products that can be obtained commercially.
[0081] Example 1:
[0082] In this embodiment, taking the "HT-126ATOPlex_DNA Library Construction Kit Instruction Manual Chinese Controlled Version 24.4.9" as an example, the overall process is as follows: Figure 1 As shown.
[0083] (1) The user uploads a new library construction kit, then uses the Paddle PDF converter to convert the uploaded PDF file into a txt file, inputs the contents of the txt file into ChatGPT, and extracts a prompt based on the library construction information. The steps for constructing the Chinese library in the kit and the specific operation content of each step are extracted. The extracted content is as follows:
[0084] {
[0085] "first step":{
[0086] Name: "PCR Reaction"
[0087] Description: 1. Prepare the first round of PCR reaction solution on ice according to the required number of reactions. PCR Reaction Solution I preparation: PCR Enzyme Mix 12.5 μL, PCR Clean Enzyme 0.5 μL, Custom Panel PCR Primer Pool 2 μL, Total 15 / 16 μL. 2. Transfer 10 μL of the DNA sample to be tested or the positive control to a new 0.2 mL container. 1. Pipette 15 / 16 μL of the prepared first-round PCR reaction solution into the PCR tube. Vortex three times for 3 seconds each time, then briefly centrifuge to collect the reaction solution at the bottom of the tube. 2. Place the PCR tube / plate on a PCR instrument and perform the reaction according to the conditions in the table below. First-round PCR reaction conditions (system: 25 μL): 95℃ for 10 min, 95℃ for 20 s, 62℃ for 1 min, 58℃ for 1 min, 72℃ for 30 s, 4℃ Hold. 3. After the reaction, briefly centrifuge the PCR tube / plate. The product is then purified in the PCR tube / plate for the next step.
[0088] },
[0089] Step Two:{
[0090] Name: "PCR Product Purification"
[0091] Description: 1. Mix the DNAClean Beads thoroughly. Pipette the appropriate volume of DNAClean Beads into a sample tube (first-round PCR product). Gently pipette at least 10 times until all magnetic beads are suspended. On the last pipette, ensure all liquid and magnetic beads are transferred into the tube. 2. Incubate at room temperature for 5 minutes. 3. Briefly centrifuge the PCR tube / plate, then place it on a magnetic rack and let it stand for 2–5 minutes until the liquid is clear. Carefully aspirate and discard the supernatant. 4. Keep the PCR tube / plate fixed on the magnetic rack and add 160 μL of... 5. Rinse the magnetic beads and tube walls with 80% ethanol, gently pipette three times, let stand for 30 seconds, and carefully aspirate the supernatant. 6. Repeat step 4 once. Aspirate as much liquid as possible from the tube. If a small amount remains on the tube wall, briefly centrifuge the PCR tube / plate, separate it on a magnetic rack, and then aspirate the liquid from the bottom of the tube with a small-range pipette. 7. Keep the PCR tube / plate fixed on the magnetic rack, open the cap, and allow it to dry at room temperature until the surface of the magnetic beads is no longer reflective and cracked. 8. Remove the PCR tube / plate from the magnetic rack, add 6.5 μL of TE Buffer for DNA elution, and gently pipette at least 10 times until all magnetic beads are suspended. 9. Incubate at room temperature for 5 minutes. 10. Briefly centrifuge the PCR tube / plate and set aside.
[0092] },
[0093] Step 3:{
[0094] "Name":"Second Round of PCR",
[0095] "Description": "1. Add 4 μL of PCR Barcode Primer Mix to the sample tube (first-round purified product). 2. Prepare PCR Reaction Solution I on ice according to the required number of reactions, vortex to mix, briefly centrifuge, and then place on ice. Preparation of PCR Reaction Solution II: PCR Enzyme Mix 12.5 μL, PCR Clean Enzyme 0.5 μL, PCR Additive 0.5 μL, Custom Panel PCR Block 1 μL, Total 14.5 / 15.5 μL. 3. Add 14.5 / 15.5 μL..." 4. Pour PCR reaction solution II into each sample tube, vortex three times for 3 seconds each time, and briefly centrifuge to collect the liquid at the bottom of the tube. Place the PCR tubes / plates on a PCR instrument and perform the reaction according to the conditions in the table below. Second round PCR reaction conditions (system: 25 μL): 95℃ for 10 min, 95℃ for 20 s, 62℃ for 1 min, 58℃ for 1 min, 72℃ for 30 s, 4℃ Hold. 5. After the reaction, briefly centrifuge the PCR tubes / plates, and proceed with the next purification step using the PCR tubes / plates.
[0096] },
[0097] Step 4:{
[0098] Name: "PCR Product Purification"
[0099] Description: 1. Mix the DNAClean Beads thoroughly, and take the appropriate volume of DNAClean Beads. 1. Transfer the beads to the sample tube (second round PCR product). Gently pipette at least 10 times until all beads are suspended. On the last pipette cycle, ensure all liquid and beads are transferred into the tube. 2. Incubate at room temperature for 5 minutes. 3. Briefly centrifuge the PCR tube / plate, then place it on a magnetic rack and let it stand for 2-5 minutes until the liquid is clear. Carefully aspirate and discard the supernatant. 4. Keep the PCR tube / plate fixed on the magnetic rack, add 160 μL of 80% ethanol to rinse the beads and tube walls. Gently pipette 3 times and let it stand for 30 seconds. Carefully aspirate and discard the supernatant. 5. Repeat step 4 once. Aspirate as much liquid as possible from the tube. If a small amount remains on the tube wall, briefly centrifuge the PCR tube / plate, separate it on the magnetic rack, and then aspirate the liquid from the bottom of the tube with a small-capacity pipette. 6. Keep the PCR tube / plate fixed on the magnetic rack, open the cap, and allow it to dry at room temperature until the surface of the beads is no longer reflective and cracked. 7. Remove the PCR tube / plate from the magnetic rack and add 25 μL of... 8. Wash DNA with TE buffer, rapidly pipetting at least 10 times until completely mixed, avoiding the formation of air bubbles. 9. Incubate at room temperature for 5 minutes. 10. Place the PCR tube or 96-well plate on a magnetic rack and let it stand for 2–5 minutes until the liquid is clear. Transfer 23 μL of the supernatant to a new 0.2 mL PCR tube or 96-well PCR plate.
[0100] }
[0101] }
[0102] (2) Use RAG technology for code block matching. The matching process is as follows: Figure 2 As shown. First, the name and content of each step are converted into vectors, and the top 10 name vectors with the highest similarity are retrieved from the database name vector library. Then, using the similarity calculation formula, the similarity between the step content vector and the content vectors corresponding to these 10 name vectors is compared, and the top 5 content vectors are selected. These contents are input into ChatGPT along with the target step contents, and the most similar step contents are returned, which in turn match the corresponding database code block ['PCR amplification_2.py', 'First round of magnetic bead purification_3.py', 'PCR amplification_4.py', 'Second round of magnetic bead purification_5.py'].
[0103] (3) Confirm the code block information and provide the number of samples to be tested. Then extract the input parameter information in the code block, construct an input parameter list, input the parameter list, sample quantity, and txt content of the reagent kit to ChatGPT, and calculate the prompt in combination with the parameters. Let ChatGPT calculate the value of each parameter and return it in dictionary format.
[0104] (4) Verify the correctness of the parameter dictionary, and link the parameter dictionary with the corresponding general code block for database creation. The scope of application of the general code block is as follows: Figure 3 As shown, as input to ChatGPT, combined with the code modification prompt, ChatGPT modifies the general code block, assigns the values corresponding to each parameter in the parameter dictionary to the parameter variables in the code, and regenerates new code.
[0105] (5) Conduct experiments based on the newly generated code script.
[0106] Example 2:
[0107] We conducted comparative experiments with code modifications on models including GPT-4o, GPT-4, GPT-3.5, Qwen-plus, and GLM-4v. We also selected five library preparation kits ('Free DNAkit', 'Universal DNAkit', 'DigestionDNAkit', 'ATOPlex DNAkit', and 'ATOPlex RNAkit') for the experiments. The results are as follows: Figure 4 As shown, both models GPT-4o and GPT-4 can generate correct executable code under precise prompts.
[0108] Example 3:
[0109] The experiment was conducted using library preparation kits other than the five training sets. The results are shown in Table 4. This application is fully applicable to three of the kits and most steps are applicable to the other two kits, indicating that this application has a significant advantage in expanding the scope of new library preparation kit instructions.
[0110] Table 4
[0111]
[0112] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0113] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. An apparatus for generating code, the code being used to control automated experimental equipment, the apparatus comprising: A general code library, wherein the general code library stores multiple preset code blocks and first description information of the preset code blocks; The first analysis module is used to analyze the instruction manual related to the automated experiment in order to obtain the second descriptive information of the instruction manual. The search module is used to determine intermediate code from multiple preset code blocks in the general code library based on the second description information and the first description information obtained by the first analysis module. The second analysis module is used to analyze and determine the parameter dictionary for adjusting the intermediate code; and The code adjustment module is used to adjust the intermediate code based on the parameter dictionary in order to obtain the code used to control the automated experimental equipment.
2. The apparatus of claim 1, wherein, The general code library stores the vector features of the first descriptive information.
3. The apparatus of claim 2, wherein, The search module further includes: The vectorization submodule is used to vectorize the step names and corresponding step contents in the second description information to obtain the matching vector; and The search submodule is used to determine candidate code blocks based on the similarity between the vector to be matched and the vector features of the first description information.
4. The apparatus of claim 1, wherein, The search module includes a large language model; Optionally, the search module is used to match candidate code blocks among multiple preset code blocks in the general code library based on the second description information and the first description information obtained by the first analysis module, and determine intermediate code based on the candidate code blocks according to the large language model.
5. The apparatus of claim 1, wherein, The first analysis module and the second analysis module are the same analysis module, which includes a large language model; Optionally, the parameter dictionary includes the condition and numerical information in the specification.
6. A method for generating code, the code being used to control automated experimental equipment, the method comprising: Obtain the instruction manuals related to automated experiments; The instruction manual is analyzed to obtain the step names and the corresponding step content. Based on the step name and step content obtained from the first analysis, candidate code blocks are determined in a general code library. The general code library stores multiple preset code blocks and description information of the preset code blocks. The description information includes the preset step name and preset step content corresponding to the code block. The intermediate code is determined based on the candidate code blocks using a large language model; The instruction manual is analyzed a second time to determine the parameter dictionary used to adjust the intermediate code; and Based on the parameter dictionary, the intermediate code is adjusted to obtain code for controlling the automated experimental equipment.
7. The method of claim 6, wherein, The general code library further stores vector features of the description information, and the step of determining candidate code blocks in the general code library includes: The step names and corresponding step contents of the instruction manual are vectorized to obtain the matching vector; and The candidate code block is determined based on the similarity between the vector to be matched and the vector features of the description information.
8. The method of claim 6, wherein, The primary and secondary analyses were performed using large language models, respectively.
9. The method of claim 6, wherein, The parameter dictionary includes the conditions and numerical information in the specification.
10. An electronic device, comprising: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method for generating code according to any one of claims 6 to 9.
11. A readable storage medium, characterized by, The readable storage medium stores computer-readable instructions for causing a computer to execute the method of generating code according to any one of claims 6 to 9.
12. An electronic device comprising: The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The general-purpose code library stored in the electronic device includes multiple preset code blocks. When the processor executes the program, it implements a method for generating code, the method comprising: Receive user-input instructions related to automated experiments; Responding to user commands and recalling the instruction manual related to the automated experiment; Output the intermediate code from the plurality of preset code blocks that matches the specification; Based on the intermediate code and the user instructions, code is output to control the automated experimental equipment.
13. The electronic device of claim 10, wherein, The automated experiment-related instructions include at least one of the following: experimental procedures, experimental equipment manuals, reagent manuals, experimental parameters, and software information.
