Method and device for generating nanopore sequencing signal decoding model training set and medium
By using the basic model to perform base recognition and sequence alignment in the training set of nanopore sequencing signal decoding model, the accurate subsequence is determined, and the problem of limited accuracy of the existing decoding model is solved and higher decoding accuracy is achieved.
Patent Information
- Application Number
- CN202411540900.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-10-31
AI Technical Summary
The existing training set of nanopore sequencing signal decoding models is annotated by using basic models, resulting in limited decoding accuracy of the decoding model.
By obtaining the current signal detected by the nanopore sequencer, using a pre-trained basic model for base recognition, obtaining the decoding sequence and decoding path, and comparing it with the reference sequence to determine that the recognition accuracy meets the preset conditions. subsequences, thus building a more accurate training set of decoded models.
Improve the decoding accuracy of the decoding model, and train a decoding model with higher accuracy by labeling signals that cannot be decoded by the basic model and incorporating them into the training set.
Smart Images

Figure CN119446271A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of biological gene sequencing, and in particular to a method, device and medium for generating a nanopore sequencing signal decoding model training set. Background Art
[0002] Nanopore sequencing is a third-generation sequencing technology that uses nanoscale pores to detect the current changes generated when a single nucleic acid molecule passes through, thereby directly reading the DNA or RNA sequence. Compared with the second-generation sequencing technology, nanopore sequencing technology has the advantages of long read length, portable instruments, and real-time analysis.
[0003] According to the principle of nanopore sequencing, the current signal corresponding to the nucleic acid sequence is collected by the nanopore sequencer, and then these current signals need to be decoded to obtain sequence information. Generally, when the nucleic acid sequence passes through the nanopore, the current is only tens to hundreds of picoamperes (pA). Compared with the optical signal of the second-generation sequencing, the signal-to-noise ratio is low, and it is difficult for traditional decoding methods to decode the current signal. Therefore, a method for decoding the current signal based on deep learning training decoding model is proposed. That is, a training set consisting of the current signal and the nucleic acid sequence corresponding to the current signal is obtained; based on the training set, the neural network model is trained by deep learning method to obtain a decoding model; based on the decoding model, the current signal is decoded to obtain a decoding sequence.
[0004] However, the training set needs to be obtained by annotating (i.e. decoding) the current signal. At this time, the annotation process requires a decoding model. For example, the invention patent with application number 202211268928.9 and invention name "Deep Learning Training Set Establishment Method and Application for Nanopore Sequencing Base Recognition" provides a training set establishment method that can annotate the sequencing current signal from scratch and train a basic model that can perform preliminary decoding of the sequencing current signal.
[0005] However, the decoding accuracy of the decoding model obtained by training the decoding model using the training set obtained by annotating the current signal using the basic model is limited. Summary of the invention
[0006] In view of this, the present disclosure proposes a method, device and medium for generating a nanopore sequencing signal decoding model training set, which can annotate the signals that cannot be decoded by the basic model and include them in the training set, thereby training a decoding model with higher accuracy.
[0007] According to one aspect of the present disclosure, a method for generating a nanopore sequencing signal decoding model training set is provided, the method comprising:
[0008] Acquiring a current signal obtained by detecting a nucleic acid sequence through a nanopore sequencer;
[0009] Performing base recognition on the current signal through a pre-trained basic model to obtain a decoding sequence and a decoding path corresponding to the current signal, wherein the decoding path is used to indicate the position of the current signal corresponding to each base in the decoding sequence;
[0010] Comparing the decoded sequence with a reference sequence corresponding to the current signal to obtain a sequence comparison result;
[0011] Based on the sequence comparison result, determining at least two first subsequences in the decoded sequence whose recognition accuracy meets a first preset condition;
[0012] Extracting second subsequences between different sequence positions in the reference sequence based on the sequence positions of different first subsequences corresponding to the reference sequence;
[0013] Based on the decoding path, determining a current signal corresponding to the second subsequence in the current signal;
[0014] Based on the different second subsequences and the corresponding current signals, a training set of the decoding model is determined.
[0015] In a possible implementation manner, extracting second subsequences between different sequence positions in the reference sequence based on sequence positions corresponding to different first subsequences in the reference sequence includes:
[0016] In the reference sequence, determining whether a subsequence between an i-th sequence position and a j-th sequence position satisfies a second preset condition; wherein the second preset condition is used to indicate that abnormal data exists in the subsequence; i is an integer increasing sequentially from 1, j is an integer decreasing sequentially from n, and n is the number of the sequence positions;
[0017] When the second preset condition is met, the value of i is updated to i+1 and the value of j is updated to j-1, and the step of determining whether the subsequence between the i-th sequence position and the j-th sequence position in the reference sequence meets the second preset condition and subsequent steps are performed again; until the subsequence between the i-th sequence position and the j-th sequence position does not meet the second preset condition, the second subsequence is obtained.
[0018] In a possible implementation manner, determining, in the reference sequence, whether a subsequence between an i-th sequence position and a j-th sequence position satisfies a second preset condition includes:
[0019] Determine whether the duration of the current signal corresponding to the subsequence is greater than a preset duration; wherein, if the duration is less than or equal to the preset duration, the subsequence does not meet the second preset condition;
[0020] and / or,
[0021] Determine the via speed corresponding to the subsequence based on the current signal corresponding to the subsequence; determine whether the via speed is within a preset speed range; wherein, if the via speed is not within the preset speed range, the subsequence does not meet the second preset condition;
[0022] and / or,
[0023] Obtaining the outlier value of each signal point in the current signal corresponding to the subsequence; determining whether the outlier value is greater than a preset threshold; wherein, if the outlier value is less than or equal to the preset threshold, the subsequence does not meet the second preset condition;
[0024] and / or,
[0025] Obtaining the time interval between adjacent bases in the subsequence; determining whether the time interval between the through-holes is greater than a preset time interval; wherein, if the time interval between the through-holes is less than or equal to the preset time interval, the subsequence does not meet the second preset condition.
[0026] In a possible implementation manner, the determining, based on the sequence comparison result, at least two first subsequences in the decoded sequence whose recognition accuracy satisfies a first preset condition further includes:
[0027] Determining whether the decoded sequence meets a preset parsing condition based on the sequence comparison result;
[0028] In the case where the decoded sequence satisfies the parsing condition, the step of determining, based on the sequence comparison result, at least two first subsequences in the decoded sequence whose recognition accuracy satisfies a first preset condition is triggered to be executed.
[0029] In a possible implementation manner, determining whether the decoded sequence satisfies a preset parsing condition based on the sequence comparison result includes:
[0030] Obtaining the accuracy and coverage of the alignment indicated by the sequence alignment result; the accuracy is used to indicate the proportion of the number of matches between the decoding sequence and the reference sequence to the total alignment length; the coverage is used to indicate the proportion of the portion of the decoding sequence participating in the alignment to the total length of the decoding sequence;
[0031] When the accuracy and the coverage meet the third preset condition, and multiple sequence alignment results of the decoded sequence on the reference sequence all indicate the same continuous sequence fragment and the same forward and reverse chains, it is determined that the decoded sequence meets the preset analysis condition.
[0032] In a possible implementation manner, comparing the decoded sequence with a reference sequence corresponding to the current signal to obtain a sequence comparison result includes:
[0033] Determine a seed minimizer of a first minimum hash value corresponding to the reference sequence, and store the first minimizer and the position of the first minimizer in the reference sequence in a hash table;
[0034] Determine a second minimizer corresponding to the decoding sequence;
[0035] Determine in the hash table a first minimizer that is identical to the second minimizer, and obtain a position of the second minimizer corresponding to the reference sequence;
[0036] Taking a sequence segment corresponding to the second minimizer in the decoded sequence as an anchor point Anchor, taking a position corresponding to the second minimizer in the reference sequence and a position corresponding to the second minimizer in the decoded sequence as Anchor information of the Anchor, and generating an Anchor table, wherein the Anchor includes positions in the decoded sequence and the reference sequence and matching information thereof;
[0037] Determine the possible alignment chains between different Anchors;
[0038] Determine, from all possible alignment chains, an optimal alignment chain with the highest score based on a preset scoring algorithm, wherein the optimal alignment chain indicates a potential alignment region between the decoding sequence and the reference sequence;
[0039] Starting from the second minimizer corresponding to the Anchor in the optimal comparison chain, a dynamic programming algorithm is used to extend the comparison along both ends of the decoded sequence from each Anchor point until the preset termination condition is reached, and finally the sequence comparison result between the decoded sequence and the reference sequence is obtained.
[0040] In a possible implementation manner, determining, based on the sequence comparison result, at least two first subsequences in the decoded sequence whose recognition accuracy meets a first preset condition includes:
[0041] In the decoded sequence, a subsequence whose continuous matching length of bases is greater than a preset length is determined based on the sequence comparison result to obtain the first subsequence.
[0042] In a possible implementation, determining a training set of a decoding model based on different second subsequences and corresponding current signals includes:
[0043] Converting the base characters in the second subsequence into digital codes recognizable by the decoding model to obtain a converted second subsequence;
[0044] Dividing the arrays consisting of the second subsequences after different conversions and the current signals corresponding to each of the second subsequences after conversion into batches to obtain a plurality of batch arrays; wherein each batch array is an array used for one iteration training in the decoding model training process;
[0045] Performing data alignment on the converted second subsequence and the current signal in each batch array to obtain an aligned second subsequence and an aligned current signal;
[0046] A training set of the decoding model is generated based on the aligned second subsequence corresponding to each batch array and the aligned current signal.
[0047] According to another aspect of the present disclosure, there is provided a device for generating a nanopore sequencing signal decoding model training set, comprising: a processor; a memory for storing processor executable instructions; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.
[0048] According to another aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, wherein the computer program instructions implement the above method when executed by a processor.
[0049] According to another aspect of the present disclosure, a computer program product is provided, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.
[0050] The method comprises the following steps: obtaining a current signal obtained by detecting a nucleic acid sequence through a nanopore sequencer; performing base recognition on the current signal through a pre-trained basic model to obtain a decoding sequence and a decoding path corresponding to the current signal; comparing the decoding sequence with a reference sequence corresponding to the current signal to obtain a sequence comparison result; determining at least two first subsequences in the decoding sequence whose recognition accuracy meets a first preset condition based on the sequence comparison result; extracting a second subsequence between different sequence positions in the reference sequence based on sequence positions corresponding to different first subsequences; determining a current signal corresponding to the second subsequence in the current signal based on the decoding path; and determining a training set of a decoding model based on different second subsequences and corresponding current signals. The method can solve the problem of limited decoding accuracy of a decoding model obtained by training a decoding model using a training set obtained by annotating current signals with a basic model. Signals that cannot be decoded by the basic model can be annotated and included in the training set, so that a decoding model with higher accuracy can be trained, thereby improving the decoding accuracy of the decoding model.
[0051] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.
[0053] Figure 1 A flowchart showing a method for generating a nanopore sequencing signal decoding model training set according to an embodiment of the present disclosure;
[0054] Figure 2 A schematic diagram showing a model structure of a basic model according to an embodiment of the present disclosure;
[0055] Figure 3 The figure shows the occurrence position of the bases marked by the decoding path in the current signal according to an embodiment of the present disclosure;
[0056] Figure 4 A schematic diagram showing a sequence alignment between a decoded sequence and a reference sequence according to an embodiment of the present disclosure;
[0057] Figure 5 A flowchart showing a method for generating a nanopore sequencing signal decoding model training set according to another embodiment of the present disclosure;
[0058] Figure 6 is a block diagram of a device for generating a nanopore sequencing signal decoding model training set according to an exemplary embodiment;
[0059] Figure 7It is a block diagram of a device for generating a nanopore sequencing signal decoding model training set according to another exemplary embodiment. DETAILED DESCRIPTION
[0060] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0061] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0062] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the main purpose of the present disclosure.
[0063] Figure 1 A flow chart of a method for generating a nanopore sequencing signal decoding model training set according to an embodiment of the present disclosure is shown. This embodiment is described by taking the method used in an electronic device with computing capabilities as an example. The electronic device may be a user terminal or a server. The user terminal includes but is not limited to: a nanopore sequencer, a computer, a mobile phone, etc. This embodiment does not limit the type of electronic device. Figure 1 As shown, the method includes:
[0064] Step 101, obtaining a current signal obtained by detecting a nucleic acid sequence through a nanopore sequencer.
[0065] When a single nucleic acid molecule passes through a nanopore, it causes a current change, which is detected by the nanopore sequencer and outputs a corresponding current signal.
[0066] Optionally, the nucleic acid sequence may be a deoxyribonucleic acid (DNA) sequence, or a ribonucleic acid (RNA) sequence, etc. This embodiment does not limit the type of the nucleic acid sequence.
[0067] Optionally, the number of nucleic acid sequences is one or more, and this embodiment does not limit the number of nucleic acid sequences.
[0068] Optionally, the sampling rate of the current signal is 5 kHz, or 4 kHz, etc. This embodiment does not limit the sampling rate of the current signal.
[0069] Step 102 , performing base recognition on the current signal using a pre-trained basic model to obtain a decoding sequence and a decoding path corresponding to the current signal, wherein the decoding path is used to indicate the position of the current signal corresponding to each base in the decoding sequence.
[0070] In this embodiment, the basic model is a neural network model that can perform preliminary decoding of current signals, and the decoding accuracy of the basic model is lower than the decoding accuracy of the decoding model required to be trained in this application. At this time, if the accuracy of the basic model needs to be further improved, the signals that cannot be decoded by the basic model need to be annotated and included in the training set for further training to obtain a decoding model. The method provided in this application can annotate signals that cannot be decoded by the basic model.
[0071] The basic model is obtained by: selecting a template DNA with a known sequence, measuring the nanopore sequencing current signal of the template DNA, and selecting one from the measurement results as the template current signal; measuring the nanopore sequencing current signals of several DNA fragments whose sequences are included in the template DNA sequence, and sequentially comparing the current signals of each DNA fragment and the template DNA; obtaining the base sequence of the DNA fragment, and pairing the current signal and the base sequence of each DNA fragment one by one to obtain an initial training data set; importing the initial training set into a neural network for training to obtain an initial neural network model, which is the basic model; or, training the neural network model with a public training data set to obtain a basic model, and this embodiment does not limit the method for obtaining the basic model. Among them, the public training data set includes but is not limited to: a data set provided by Oxford Nanopore Technologies (ONT) or a data set provided by the National Center for Biotechnology Information Sequence Read Archive (NCBI Sequence Read Archive, SRA), and this embodiment does not limit the method for obtaining the public training data set.
[0072] Schematically, the model structure of the basic model includes: a multi-layer convolutional neural network (CNN) and a long short-term memory network (LSTM). The training process of the basic model uses a loss function based on a conditional random field (CRF) to calculate the prediction deviation to update the model parameters.
[0073] refer to Figure 2 The basic model shown is based on Figure 2 It can be seen that the basic model includes: 3 layers of CNN, and the adjacent two layers of CNN are connected by activation functions. Figure 2The activation function is SiLU (Sigmoid Linear Unit) function as an example for explanation; the last layer of CNN is connected to the first layer of LSTM through SiLU. LSTM includes 5 layers in total. The last layer of LSTM is connected to the CRF model. During the training process, the model includes the loss function of CRF (i.e. Figure 2 The prediction deviation is calculated by using the CRF Encoder in to train the basic model.
[0074] After obtaining the basic model, the current signal is input into the basic model to obtain the decoding sequence and decoding path corresponding to the current signal. Among them, the decoding path is the path with the highest score (highest probability) among all possible tag sequences from the starting position to the end position of the nucleic acid sequence, that is, the path corresponding to the predicted decoding sequence. In other words, the decoding path is the position of the current signal corresponding to each base in the predicted decoding sequence, refer to Figure 3 The decoding pathways shown indicate where the bases appear in the current signal.
[0075] Step 103: compare the decoded sequence with a reference sequence corresponding to the current signal to obtain a sequence comparison result.
[0076] In genomics, a reference sequence refers to a known genomic sequence corresponding to a current signal, and the reference sequence is used to align with and analyze the decoded sequence.
[0077] In one example, comparing the decoded sequence with a reference sequence corresponding to the current signal to obtain a sequence comparison result includes: comparing the decoded sequence with the reference sequence using a comparison tool to obtain a sequence comparison result.
[0078] Optionally, the alignment tool includes a basic local alignment search tool (Basic Local Alignment Search Tool, BLAST), Bowtie2, Minimap2, etc. This embodiment does not limit the implementation method of the alignment tool.
[0079] In one example, the sequence alignment process of the alignment tool includes: determining a seed (minimizer) of a first minimum hash value corresponding to a reference sequence, and storing a first minimizer and a position of the first minimizer in the reference sequence in a hash table; determining a second minimizer corresponding to a decoded sequence; determining a first minimizer identical to the second minimizer in the hash table, and obtaining a position of the second minimizer corresponding to the reference sequence; using a sequence fragment corresponding to the second minimizer in the decoded sequence as an anchor, and obtaining a position of the second minimizer corresponding to the reference sequence, and a position of the second minimizer corresponding to the decoded sequence. The position in the decoded sequence is used as the anchor information of the Anchor to generate an Anchor table, wherein each Anchor includes the position in the decoded sequence and the reference sequence and its matching information; the possible alignment chains between different Anchors are determined; from all possible alignment chains, the optimal alignment chain with the highest score is determined based on a preset scoring algorithm, and the optimal alignment chain indicates the potential alignment area between the decoded sequence and the reference sequence; starting from the second minimizer corresponding to the anchor table in the optimal alignment chain, a dynamic programming algorithm is used, starting from each Anchor point, and the alignment is extended along both ends of the decoded sequence until the preset termination condition is reached, and finally the sequence alignment result of the decoded sequence and the reference sequence is obtained.
[0080] The minimizer (including the first minimizer and the second minimizer) refers to the seed with the minimum hash value in a sequence, that is, the k-mer with the minimum hash value. A k-mer is a sequence sub-segment with a length of k. For example, a DNA sequence is composed of four bases: A, C, G, and T. According to computer coding, these four bases can be regarded as a quaternary number. A k-mer can be regarded as a k-bit quaternary number. For example, the hash value of GCT is: 2×4 2 +1×4 1 +3×4 0 =39, that is, the hash value of GCT is 39. From this, we can calculate the hash value of each k-mer, take the k-mer with the minimum hash value in the w window, and get the minimizer. The value of w is greater than the value of k.
[0081] In the hash table, the position of the first minimizer in the reference sequence is stored according to the position indicated by the first minimizer. Later, when matching the second minimizer with the first minimizer, the search efficiency can be improved by searching the hash table. In the case where the second minimizer is the same as the first minimizer, the position of the reference sequence stored by the first minimizer is read to obtain the position of the second minimizer in the reference sequence. At this time, the position of the second minimizer in the reference sequence is stored in the anchor table.
[0082] In this embodiment, the purpose of determining the optimal alignment chain is to screen out anchors that are continuously distributed on the reference sequence, thereby improving the accuracy and efficiency of the alignment. Anchor refers to a specific sequence fragment or a group of specific sequence fragments in the decoded sequence, which have clear matching positions in the reference sequence. In this embodiment, Anchor is the sequence fragment corresponding to the second minimizer in the decoded sequence.
[0083] The Anchor table is used to store the Anchor information of each Anchor to quickly find and manage all Anchors in the decoded sequence. Optionally, the Anchor table is sorted according to the position of the Anchor in the reference sequence, so that subsequent alignment operations such as chaining and dynamic programming expansion can be easily performed.
[0084] Determine the possible alignment chains between different Anchors, including: evaluating the distance between different Anchors; if the distance is less than a preset distance threshold, determine that the different Anchors are continuous, connect the continuous Anchors to form one or more possible alignment chains. Each alignment chain represents a potential alignment region of the query sequence on the reference sequence. The distance between different Anchors can be the number of bases between the positions of different Anchors in the reference sequence; or, it can be the physical distance between the positions of different Anchors in the reference sequence, and the physical distance refers to the time interval between the current signals corresponding to the positions in the reference sequence.
[0085] And / or, all anchors are sorted according to their positions in the reference sequence to determine continuous anchors, and the continuous anchors are connected to form one or more possible alignment chains. This embodiment does not limit the method for determining the possible alignment chains.
[0086] Optionally, the preset scoring algorithm includes but is not limited to a scoring algorithm based on matching quality, a scoring algorithm based on mismatch penalty, and a scoring algorithm based on gap penalty. This embodiment does not limit the scoring method of the alignment chain.
[0087] Using a dynamic programming algorithm, starting from each anchor point, the alignment is extended along both ends of the decoded sequence, including: starting from each anchor point in the optimal alignment chain, extending along both ends of the decoded sequence until it is no longer possible to extend or a preset termination condition is reached; selecting the alignment path with the highest score as the optimal alignment path, and determining the alignment result of the optimal alignment path as the sequence alignment result. The score of the alignment path can be determined based on alignment quality, such as: matching, mismatching, insertion and deletion.
[0088] Step 104: Based on the sequence comparison result, determine at least two first subsequences in the decoded sequence whose recognition accuracy meets a first preset condition.
[0089] In one example, based on the sequence comparison result, determining at least two first subsequences in the decoded sequence whose recognition accuracy meets the first preset condition includes: in the decoded sequence, determining a subsequence whose continuous matching length of bases is greater than a preset length based on the sequence comparison result to obtain a first subsequence.
[0090] Specifically, the cs tag of the sequence alignment result is obtained for analysis to determine the continuous matching length of the bases. The cs tag is a tag used to record the alignment details, and the cs tag is generated by the sequence alignment tool. The cs tag can describe in detail the base changes that occurred during the alignment process, including complete matches, insertions, deletions, and substitutions.
[0091] Schematically, the format of the cs tag includes: ":[0-9]" The number in the brackets indicates the number of bases that are fully matched, "-" followed by the missing bases, "+" followed by the inserted bases, and "*" followed by the replaced bases. For example: Figure 4 The cs tag obtained after the decoding sequence shown is aligned with the reference sequence, and the cs tag is: ":2-ta:21+at:1*ag*tg:1". It can be seen from the cs tag that the sequence alignment results are: 2 completely matched bases, missing bases T and A, 21 completely matched bases, inserted bases A and T, 1 completely matched base, replaced base AG (i.e., A in the reference sequence is replaced by G in the decoding sequence), replaced base TG (i.e., T in the reference sequence is replaced by G in the decoding sequence), and 1 completely matched base.
[0092] Optionally, the preset length may be 20, or a positive integer less than 20 or greater than 20, etc. This embodiment does not limit the value of the preset length.
[0093] Step 105: extract second subsequences between different sequence positions in the reference sequence based on the sequence positions corresponding to different first subsequences in the reference sequence.
[0094] In one example, since the longer the extracted second subsequence is, the more sequence information it contains, the more conducive to subsequent training. Therefore, in this embodiment, extracting the second subsequence from the two furthest first subsequences is used as an example for description.
[0095] Accordingly, based on the sequence positions corresponding to different first subsequences in the reference sequence, extracting the second subsequence between different sequence positions in the reference sequence includes: determining whether the subsequence between the i-th sequence position and the j-th sequence position satisfies the second preset condition in the reference sequence. If the second preset condition is satisfied, updating the value of i to i+1 and the value of j to j-1, and performing again the step of determining whether the subsequence between the i-th sequence position and the j-th sequence position satisfies the second preset condition in the reference sequence and subsequent steps; until the subsequence between the i-th sequence position and the j-th sequence position does not satisfy the second preset condition, obtaining the second subsequence.
[0096] Wherein, i is an integer increasing from 1, j is an integer decreasing from n, and n is the number of sequence positions. The i(j)th sequence position can be represented by the position range occupied by the i(j)th first subsequence in the reference sequence.
[0097] The second preset condition is used to indicate that a subsequence contains abnormal data. In this embodiment, the subsequence containing the abnormal data is removed to ensure the validity of the data in the training set and improve the training effect of the decoding model.
[0098] In one example, in the reference sequence, determining whether a subsequence between the i-th sequence position and the j-th sequence position satisfies a second preset condition includes but is not limited to at least one of the following:
[0099] 1. Determine whether the duration of the current signal corresponding to the subsequence is greater than a preset duration; if the duration is less than or equal to the preset duration, the subsequence does not meet the second preset condition.
[0100] The preset duration is determined based on the sampling rate of the current signal and the alignment length of the current signal when training the decoding model. For example: the sampling rate of the current signal is 5kHz, that is, the signal contains 5000 signal points per second, and the 2-second signal contains 10000 points. According to the characteristics of GPU computing, multiple signals need to be sent to the video memory for training at one time. These multiple signals need to be aligned in length. If the alignment length is set to 10000, the original current signal length needs to be less than or equal to 10000 points, and the insufficient ones are padded with 0. However, those greater than 10000 cannot be truncated, because the truncated current signal contains information, which will cause signal loss. Based on this, at this time, the duration of the current signal cannot exceed 2 seconds (that is, the preset duration). If it exceeds 2 seconds, it will be treated as abnormal data processing.
[0101] 2. Determine the via speed corresponding to the subsequence based on the current signal corresponding to the subsequence; determine whether the via speed is within a preset speed range; wherein, if the via speed is not within the preset speed range, the subsequence does not meet the second preset condition.
[0102] The preset speed range is determined based on the mean and standard deviation of the through-hole speed of each subsequence, for example: the preset speed range includes the through-hole speed less than the mean of each subsequence minus n times the standard deviation, and also includes the through-hole speed greater than the mean plus n times the standard deviation. n is a positive integer. In this way, the stability of the through-hole speed of the data in the training set can be guaranteed. For example: the preset speed range includes the through-hole speed of the subsequence less than 275.424 base pairs per second (bp / s), and also includes the through-hole speed of the subsequence greater than 600bp / s.
[0103] 3. Obtaining the outlier value of each signal point in the current signal corresponding to the subsequence; determining whether the outlier value is greater than a preset threshold; wherein, if the outlier value is less than or equal to the preset threshold, the subsequence does not meet the second preset condition.
[0104] If there are outliers greater than a preset threshold in the current signal, it means that the quality of the current signal is poor. Therefore, by removing outliers greater than the preset threshold, the quality of the data in the training set can be guaranteed.
[0105] In one example, outliers are filtered using the median absolute deviation (MAD). The specific calculation process can be referred to the following formula:
[0106] MAD=median(|x i -M|);
[0107] outlier value = {x i ∣∣x i -M|>a*MAD};
[0108] Among them, x i is the i-th signal point in the current signal, M is the median of all signal points, and median represents the function for calculating the median of a set of data. That is, when calculating by MAD, the absolute deviation of each signal point from the median is calculated first, and then the median function is used again to find the median of the absolute deviation. outlier value represents the outlier value of the signal point, x i ∣∣x i -M|>a*MAD means if x i -The absolute value of M is greater than a times the absolute median deviation, then x i is an outlier. Wherein, a is a positive integer with a fixed value, and the value of a can be 2, 3, 5, etc. This embodiment does not limit the value of a.
[0109] 4. Obtain the time interval between adjacent bases in the subsequence; determine whether the time interval between the through-holes is greater than a preset time interval; wherein, if the time interval between the through-holes is less than or equal to the preset time interval, the subsequence does not meet the second preset condition.
[0110] When the time interval between adjacent bases passing through the nanopore is too long, it indicates that there is a pore blocking phenomenon, that is, the nucleic acid sequence to be tested stays at the nanopore for too long and does not pass through the nanopore smoothly. At this time, the collected subsequence is also abnormal data. The preset time interval can be 0.2 seconds, or a value greater than or less than 0.2 seconds, which can be determined specifically according to the time interval between passing through the nanopore when the nanopore is blocked. This embodiment does not limit the value of the preset time interval.
[0111] In other embodiments, the second preset condition may also include other conditions, which are not listed one by one in this embodiment. When the subsequence satisfies all the second preset conditions, it is determined that the subsequence satisfies the second preset condition, and the subsequence is used as the second subsequence for subsequent analysis.
[0112] In addition, in other embodiments, the second subsequence may be extracted not from the two farthest first subsequences but from two first subsequences separated by a preset number of bases. This embodiment does not limit the method of extracting the second subsequence.
[0113] Optionally, because the decoding accuracy of the basic model is too low, there is a high probability that the first subsequence does not exist. At this time, determining the first subsequence for subsequent analysis based on the sequence comparison result will waste the computing resources of the electronic device. Based on this, based on the sequence comparison result, determining at least two first subsequences in the decoded sequence whose recognition accuracy meets the first preset condition also includes: determining whether the decoded sequence meets the preset parsing condition based on the sequence comparison result; if the decoded sequence meets the parsing condition, triggering the execution of the step of determining at least two first subsequences in the decoded sequence whose recognition accuracy meets the first preset condition based on the sequence comparison result.
[0114] Accordingly, when the decoding sequence does not satisfy the parsing condition, the current decoding sequence is not parsed, and if there is a next decoding sequence, step 103 is performed on the next decoding sequence.
[0115] In one example, determining whether a decoded sequence satisfies a preset parsing condition based on a sequence alignment result includes: obtaining the accuracy and coverage of the alignment indicated by the sequence alignment result; and determining that the decoded sequence satisfies the preset parsing condition when the accuracy and coverage meet a third preset condition and multiple sequence alignment results of the decoded sequence on the reference sequence all indicate the same continuous sequence fragment contig and the same forward and reverse chains.
[0116] Among them, the accuracy is used to indicate the proportion of the number of matches between the decoded sequence and the reference sequence to the total comparison length; the coverage is used to indicate the proportion of the part of the decoded sequence involved in the comparison to the total length of the decoded sequence.
[0117] The third preset condition includes: the accuracy is greater than a preset accuracy threshold, and the coverage is greater than a preset coverage threshold.
[0118] In genomics, contig refers to a continuous DNA sequence fragment formed by splicing short sequence fragments (reads) in the decoded sequence according to the overlapping regions between them. Each contig has a unique identifier, namely contigID, which is used to identify this specific sequence fragment.
[0119] The positive and negative strands refer to the two possible reading modes in the double-stranded structure of DNA, namely the positive strand (sense strand) and the reverse strand (antisense strand) due to the direction of replication and transcription. The difference between the positive strand and the antisense strand lies in the direction in which they are read in the genome.
[0120] During the sequence alignment process, the sequence alignment results output by the alignment tool include contig ID and chain direction. Therefore, the contig ID can be used to determine whether each sequence fragment aligned with the reference sequence is from the same contig. The chain direction can be used to determine whether the sequence fragment belongs to the sense chain or the antisense chain.
[0121] Step 106: Determine the current signal corresponding to the second subsequence in the current signal based on the decoding path.
[0122] Since the decoding path is marked with the positions at which each base in the decoding sequence appears in the current signal, based on this, based on the decoding path, the current signal corresponding to the second subsequence is determined in the current signal, including: for the first subsequence corresponding to the sequence position used to determine the second subsequence, based on the decoding path, the positions at which the first subsequence appears in the current signal are determined, and the current signals between the positions are extracted to obtain the current signal corresponding to the second subsequence.
[0123] For example: Reference Figure 4 , assuming that the sequence position used to determine the second subsequence includes sequence position 41 and sequence position 42. Among them, sequence position 41 corresponds to the first subsequence 43, and sequence position 42 corresponds to the first subsequence 44. Based on the decoding path, the position where each base in the first subsequence 43 appears in the current signal and the position where each base in the first subsequence 44 appears in the current signal can be determined. The current signal between these two position areas can be extracted to obtain the current signal corresponding to the second subsequence. For example, Figure 3 The current signal between the bases corresponding to the first subsequences 43 and 44 is extracted in the decoding path shown.
[0124] Step 107: Determine a training set of a decoding model based on different second subsequences and corresponding current signals.
[0125] In one example, a training set of a decoding model is determined based on different second subsequences and corresponding current signals, including: converting base characters in the second subsequence into digital codes recognizable by the decoding model; batching an array consisting of different converted second subsequences and current signals corresponding to each converted second subsequence to obtain multiple batch arrays; performing data alignment on the converted second subsequences and current signals in each batch array to obtain aligned second subsequences and aligned current signals; and generating a training set of the decoding model based on the aligned second subsequences and aligned current signals corresponding to each batch array.
[0126] Optionally, the digital code may be a binary code, or may be other types of codes, which may be determined according to the implementation of the decoding model. This embodiment does not limit the implementation of the digital code.
[0127] Each batch array is an array used for one iteration of training in the decoding model training process. The number of arrays in each batch array is a preset number, such as 20,000 or 10,000. The value of the preset number can be determined based on the training requirements of the decoding model, and this embodiment does not limit the value of the preset number.
[0128] In one example, the array consisting of different converted second subsequences and the current signals corresponding to each converted second subsequence is divided into batches, including: aligning the sequence lengths of the converted second subsequences in each batch array by padding with 0 according to the maximum sequence length of the converted second subsequences; aligning the current signals in the batch array to a preset alignment length by padding with 0. In this way, different samples in the same batch can be aligned in the data dimension, which can improve the training efficiency and stability of the model.
[0129] The alignment length may be set according to the processing performance of the electronic device, for example, the alignment length is 10,000 signal points, that is, the number of signal points collected for 2 seconds at a sampling rate of 5 kHz.
[0130] In other embodiments, an array consisting of different second subsequences and corresponding current signals may be directly used to form a training set, and then the processing of the data in the training set may be performed by other devices. This embodiment does not limit the implementation method of the data in the training set.
[0131] Optionally, the decoding model is obtained by training a training set of the decoding model based on the basic model; or, the decoding model is obtained by training a reconstructed neural network model using the training set corresponding to the basic model and the training set of the decoding model. This embodiment does not limit the training method of the decoding model.
[0132] In summary, the method for generating a nanopore sequencing signal decoding model training set provided in the present embodiment is to obtain a current signal obtained by detecting a nucleic acid sequence through a nanopore sequencer; perform base recognition on the current signal through a pre-trained basic model to obtain a decoding sequence and a decoding path corresponding to the current signal; compare the decoding sequence with a reference sequence corresponding to the current signal to obtain a sequence comparison result; based on the sequence comparison result, determine at least two first subsequences in the decoding sequence whose recognition accuracy meets a first preset condition; based on the sequence positions corresponding to different first subsequences in the reference sequence, extract a second subsequence between different sequence positions in the reference sequence; based on the decoding path, determine the current signal corresponding to the second subsequence in the current signal; based on different second subsequences and corresponding current signals, determine a training set of a decoding model; the problem of limited decoding accuracy of a decoding model obtained by training a decoding model with a training set obtained by annotating current signals with a basic model can be solved; signals that cannot be decoded by the basic model can be annotated and included in the training set, so that a decoding model with higher accuracy can be trained, thereby improving the decoding accuracy of the decoding model.
[0133] In addition, by extracting the second subsequence from the two furthest first subsequences, it can be ensured that a sufficiently long second subsequence is extracted, and that the second subsequence contains more sequence information, thereby improving the accuracy of the decoding model.
[0134] In addition, by filtering abnormal subsequences according to the second preset condition when extracting the second subsequence, it can be ensured that the training set contains valid data, thereby improving the model performance of the decoding model obtained through training.
[0135] In addition, by identifying the first subsequence and further extracting the second subsequence only when the decoded sequence meets the parsing condition, the computing resources of the electronic device can be saved.
[0136] Optionally, in order to more clearly understand the method for generating a nanopore sequencing signal decoding model training set provided by the present application, the method is exemplarily described below, with reference to Figure 5 , the method includes the following steps:
[0137] Step 51, performing nucleic acid sequence detection on the sample to be tested by a nanopore sequencer to obtain a current signal;
[0138] Step 52, decoding the current signal through the basic model to obtain a decoding sequence and a decoding path;
[0139] Step 53, compare the decoded sequence with the reference sequence to obtain a sequence comparison result; if the sequence comparison result indicates that the decoded sequence meets the parsing condition, execute step 54; if the sequence comparison result indicates that the decoded sequence does not meet the parsing condition, update to the next decoded sequence and execute step 53;
[0140] Step 54, determining whether each subsequence in the decoding sequence satisfies a first preset condition; if so, filtering to obtain a first subsequence, and executing step 55; if each subsequence does not satisfy the first preset condition, updating to the next decoding sequence, and executing step 53;
[0141] Step 55, based on the sequence positions of different first subsequences corresponding to the reference sequence, extracting second subsequences between different sequence positions in the reference sequence;
[0142] Step 56, determining a current signal corresponding to the second subsequence in the current signal based on the decoding path;
[0143] Step 57: Determine a training set of a decoding model based on different second subsequences and corresponding current signals.
[0144] In this embodiment, by marking the current signals that cannot be decoded by the basic model, a training set is established to train the decoding model, which can improve the decoding accuracy of the decoding model.
[0145] Figure 6 is a block diagram of a device for generating a nanopore sequencing signal decoding model training set according to an exemplary embodiment. Figure 6 It can be seen that the device includes at least the following modules: a nanopore sequencing module 610 , a base recognition module 620 , a sequence alignment module 630 , a sequence screening module 640 , a sequence extraction module 650 , a signal extraction module 660 and a training set generation module 670 .
[0146] Nanopore sequencing module 610, used for nucleic acid acquisition, and current signals obtained by detecting nucleic acid sequences through a nanopore sequencer;
[0147] A base recognition module 620 is used to perform base recognition on the current signal through a pre-trained basic model to obtain a decoding sequence and a decoding path corresponding to the current signal, wherein the decoding path is used to indicate the position of the current signal corresponding to each base in the decoding sequence;
[0148] A sequence comparison module 630 is used to compare the decoded sequence with a reference sequence corresponding to the current signal to obtain a sequence comparison result;
[0149] A sequence screening module 640 is used to determine at least two first subsequences in the decoded sequence whose recognition accuracy meets a first preset condition based on the sequence comparison result;
[0150] A sequence extraction module 650, configured to extract second subsequences between different sequence positions in the reference sequence based on sequence positions corresponding to different first subsequences in the reference sequence;
[0151] A signal extraction module 660, configured to determine, based on the decoding path, a current signal corresponding to the second subsequence in the current signal;
[0152] The training set generation module 670 is used to determine a training set of a decoding model based on different second subsequences and corresponding current signals.
[0153] For detailed description, please refer to the above method embodiment.
[0154] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0155] The embodiment of the present disclosure also provides a computer-readable storage medium on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.
[0156] An embodiment of the present disclosure further proposes an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.
[0157] The embodiments of the present disclosure also provide a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.
[0158] Figure 7 1 is a block diagram of an apparatus 1900 for generating a nanopore sequencing signal decoding model training set according to an exemplary embodiment. For example, the apparatus 1900 may be provided as a server or a terminal device. Figure 7The apparatus 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method
[0159] The device 1900 may also include a power supply component 1926 configured to perform power management of the device 1900, a wired or wireless network interface 1950 configured to connect the device 1900 to a network, and an input / output interface 1958 (I / O interface). The device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server 2000. TM , MacOS X TM , Unix TM ,Linux TM , FreeBSD TM or similar.
[0160] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the device 1900 to perform the above method.
[0161] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for generating a nanopore sequencing signal decoding model training set, characterized in that: The method comprises: Acquiring a current signal obtained by detecting a nucleic acid sequence through a nanopore sequencer; Performing base recognition on the current signal through a pre-trained basic model to obtain a decoding sequence and a decoding path corresponding to the current signal, wherein the decoding path is used to indicate the position of the current signal corresponding to each base in the decoding sequence; Comparing the decoded sequence with a reference sequence corresponding to the current signal to obtain a sequence comparison result; Based on the sequence comparison result, determining at least two first subsequences in the decoded sequence whose recognition accuracy meets a first preset condition; Extracting second subsequences between different sequence positions in the reference sequence based on the sequence positions of different first subsequences corresponding to the reference sequence; Based on the decoding path, determining a current signal corresponding to the second subsequence in the current signal; Based on the different second subsequences and the corresponding current signals, a training set of the decoding model is determined.
2. The method according to claim 1, characterized in that The extracting, based on the sequence positions of different first subsequences corresponding to the reference sequence, second subsequences between different sequence positions in the reference sequence comprises: In the reference sequence, determining whether a subsequence between an i-th sequence position and a j-th sequence position satisfies a second preset condition; wherein the second preset condition is used to indicate that abnormal data exists in the subsequence; i is an integer increasing sequentially from 1, j is an integer decreasing sequentially from n, and n is the number of the sequence positions; When the second preset condition is met, the value of i is updated to i+1 and the value of j is updated to j-1, and the step of determining whether the subsequence between the i-th sequence position and the j-th sequence position in the reference sequence meets the second preset condition and subsequent steps are performed again; until the subsequence between the i-th sequence position and the j-th sequence position does not meet the second preset condition, the second subsequence is obtained.
3. The method according to claim 2, characterized in that The step of determining, in the reference sequence, whether a subsequence between an i-th sequence position and a j-th sequence position satisfies a second preset condition comprises: Determine whether the duration of the current signal corresponding to the subsequence is greater than a preset duration; wherein, if the duration is less than or equal to the preset duration, the subsequence does not meet the second preset condition; and / or, Determine the via speed corresponding to the subsequence based on the current signal corresponding to the subsequence; determine whether the via speed is within a preset speed range; wherein, if the via speed is not within the preset speed range, the subsequence does not meet the second preset condition; and / or, Obtaining the outlier value of each signal point in the current signal corresponding to the subsequence; determining whether the outlier value is greater than a preset threshold; wherein, if the outlier value is less than or equal to the preset threshold, the subsequence does not meet the second preset condition; and / or, Obtaining the time interval between adjacent bases in the subsequence; determining whether the time interval between the through-holes is greater than a preset time interval; wherein, if the time interval between the through-holes is less than or equal to the preset time interval, the subsequence does not meet the second preset condition.
4. The method according to claim 1, characterized in that: The step of determining, based on the sequence comparison result, at least two first subsequences in the decoded sequence whose recognition accuracy satisfies a first preset condition further includes: Determining whether the decoded sequence meets a preset parsing condition based on the sequence comparison result; In the case where the decoded sequence satisfies the parsing condition, the step of determining, based on the sequence comparison result, at least two first subsequences in the decoded sequence whose recognition accuracy satisfies a first preset condition is triggered to be executed.
5. The method according to claim 4, characterized in that The determining whether the decoded sequence meets a preset parsing condition based on the sequence comparison result includes: Obtaining the accuracy and coverage of the alignment indicated by the sequence alignment result; the accuracy is used to indicate the proportion of the number of matches between the decoding sequence and the reference sequence to the total alignment length; the coverage is used to indicate the proportion of the portion of the decoding sequence participating in the alignment to the total length of the decoding sequence; When the accuracy and the coverage meet the third preset condition, and multiple sequence alignment results of the decoded sequence on the reference sequence all indicate the same continuous sequence fragment and the same forward and reverse chains, it is determined that the decoded sequence meets the preset analysis condition.
6. The method according to claim 1, characterized in that The step of comparing the decoded sequence with a reference sequence corresponding to the current signal to obtain a sequence comparison result includes: Determine a seed minimizer of a first minimum hash value corresponding to the reference sequence, and store the first minimizer and the position of the first minimizer in the reference sequence in a hash table; Determine a second minimizer corresponding to the decoding sequence; Determine in the hash table a first minimizer that is identical to the second minimizer, and obtain a position of the second minimizer corresponding to the reference sequence; Taking a sequence segment corresponding to the second minimizer in the decoded sequence as an anchor point Anchor, taking a position corresponding to the second minimizer in the reference sequence and a position corresponding to the second minimizer in the decoded sequence as Anchor information of the Anchor, and generating an Anchor table, wherein the Anchor includes positions in the decoded sequence and the reference sequence and matching information thereof; Determine the possible alignment chains between different Anchors; Determine, from all possible alignment chains, an optimal alignment chain with the highest score based on a preset scoring algorithm, wherein the optimal alignment chain indicates a potential alignment region between the decoding sequence and the reference sequence; Starting from the second minimizer corresponding to the Anchor in the optimal comparison chain, a dynamic programming algorithm is used to extend the comparison along both ends of the decoded sequence from each Anchor point until the preset termination condition is reached, and finally the sequence comparison result between the decoded sequence and the reference sequence is obtained.
7. The method according to claim 1, characterized in that The determining, based on the sequence comparison result, at least two first subsequences in the decoded sequence whose recognition accuracy satisfies a first preset condition comprises: In the decoded sequence, a subsequence whose continuous matching length of bases is greater than a preset length is determined based on the sequence comparison result to obtain the first subsequence.
8. The method according to any one of claims 1 to 7, characterized in that: The step of determining a training set of a decoding model based on different second subsequences and corresponding current signals includes: Converting the base characters in the second subsequence into digital codes recognizable by the decoding model to obtain a converted second subsequence; Dividing the arrays consisting of the second subsequences after different conversions and the current signals corresponding to each of the second subsequences after conversion into batches to obtain a plurality of batch arrays; wherein each batch array is an array used for one iteration training in the decoding model training process; Performing data alignment on the converted second subsequence and the current signal in each batch array to obtain an aligned second subsequence and an aligned current signal; A training set of the decoding model is generated based on the aligned second subsequence corresponding to each batch array and the aligned current signal.
9. A device for generating a nanopore sequencing signal decoding model training set, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to implement the method described in any one of claims 1 to 8 when executing the instructions stored in the memory.
10. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Deep learning training set construction method for nanopore sequencing base recognition and its application
CN116486910B
Method, system and device for assembling genomic sequence
CN105989249A
Method for quickly identifying single-molecule nanopore sequencing bases based on deep network
CN112183486A
Base interpretation method based on nanopore electric signal, interpretation equipment and storage medium
CN112309503A
Deep learning training set establishment method for nanopore sequencing base recognition and application of deep learning training set establishment method
CN116486910A