Method, device and medium for generating nanopore sequencing signal decoding model training set
By generating training sets in nanopore sequencing technology, the decoding path and sequence comparison of the basic model are used to filter and construct the training set, solving the problem of limited decoding accuracy, and achieving a higher accuracy decoding model.
Patent Information
- Application Number
- CN202411540900.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2044-10-31
AI Technical Summary
In the existing nanopore sequencing technology, the decoding accuracy of the decoding model is limited, and it is difficult to effectively decode the current signal to obtain accurate nucleic acid sequence information.
By obtaining the current signal, using the pre-trained basic model for base recognition, generating decoding sequences and decoding paths, performing sequence alignment, filtering subsequences with the accuracy of recognition, extracting subsequences in the reference sequence, and building a training set based on these subsequences and current signals to further train the decoding model.
Improve the accuracy of the decoding model and can more effectively decode the current signal to obtain accurate nucleic acid sequence information.
Smart Images

Figure CN119446271B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of biological gene sequencing technology, 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 changes in current generated by the passage of a single nucleic acid molecule, enabling direct reading of DNA or RNA sequences. Compared to second-generation sequencing technologies, nanopore sequencing offers advantages such as longer read lengths, greater portability, and the ability to perform real-time analysis.
[0003] According to the principle of nanopore sequencing, the current signals corresponding to the nucleic acid sequence are collected by the nanopore sequencer. These current signals then need to be decoded to obtain the sequence information. Generally, when a nucleic acid sequence passes through the nanopore, the current is only tens to hundreds of picoamperes (pA). Compared with the optical signal-to-noise ratio of second-generation sequencing, traditional decoding methods have difficulty decoding the current signals. 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, a neural network model is trained using a deep learning method to obtain a decoding model; based on the decoding model, the current signal is decoded to obtain a decoded sequence.
[0004] However, the training set requires annotating (i.e., decoding) the current signal, which in turn requires a decoding model. For example, the invention patent application number 202211268928.9, entitled "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 capable of performing 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 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 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;
[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] determining, based on the decoding path, a current signal corresponding to the second subsequence in the current signal;
[0014] A training set of a decoding model is determined based on different second subsequences and corresponding current signals.
[0015] In a possible implementation, extracting second subsequences between different sequence positions in the reference sequence based on the sequence positions of 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 from 1, j is an integer decreasing from n, and n is the number of sequence positions;
[0017] If 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, thereby obtaining the second subsequence.
[0018] In a possible implementation, determining whether a subsequence between an i-th sequence position and a j-th sequence position in the reference sequence satisfies a second preset condition includes:
[0019] determining whether a 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] Determining a via speed corresponding to the subsequence based on a current signal corresponding to the subsequence; determining 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 an 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 a time interval between adjacent bases in the subsequence; determining whether the time interval between the bases is greater than a preset time interval; wherein, if the time interval between the bases is less than or equal to the preset time interval, the subsequence does not meet the second preset condition.
[0026] In a possible implementation, 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 a 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.
[0029] In a possible implementation, determining whether the decoded sequence meets 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 decoded sequence and the reference sequence to the total length of the alignment; the coverage is used to indicate the proportion of the portion of the decoded sequence participating in the alignment to the total length of the decoded 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 strands, it is determined that the decoded sequence meets the preset parsing condition.
[0032] In a possible implementation, 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] Determining 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] Using the sequence segment corresponding to the second minimizer in the decoded sequence as an anchor, using the position corresponding to the second minimizer in the reference sequence and the 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 the position in the decoded sequence and the reference sequence and their matching information;
[0037] Determine the possible alignment chains between different anchors;
[0038] Determining the optimal alignment chain with the highest score from all possible alignment chains 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 alignment chain, a dynamic programming algorithm is used to extend the alignment along both ends of the decoded sequence from each anchor point until the preset termination condition is reached, and finally the sequence alignment result of the decoded sequence and the reference sequence is obtained.
[0040] In a possible implementation, determining, based on the sequence comparison result, at least two first subsequences in the decoded sequence whose recognition accuracy satisfies a first preset condition includes:
[0041] In the decoded sequence, a subsequence having a continuous matching length of bases greater than a preset length is determined based on the sequence alignment 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 array 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 of training during 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 for 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 an apparatus for generating a nanopore sequencing signal decoding model training set, comprising: a processor; and 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] By acquiring the current signal obtained by detecting the 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 the 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 decoding sequence whose recognition accuracy meets a first preset condition; based on the sequence positions corresponding to different first subsequences in the reference sequence, extracting second subsequences between different sequence positions in the reference sequence; based on the decoding path, determining the current signal corresponding to the second subsequence in the current signal; based on the different second subsequences and the corresponding current signals, determining a training set for the decoding model; this can solve the problem of limited decoding accuracy of the decoding model obtained by training the decoding model with the training set obtained by annotating the current signal with the basic model; the signals that cannot be decoded by the basic model can be annotated and included in the training set, so that a more accurate decoding model 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 illustrating a method for generating a nanopore sequencing signal decoding model training set according to an embodiment of the present disclosure is shown;
[0054] Figure 2 A schematic diagram illustrating a model structure of a basic model according to an embodiment of the present disclosure;
[0055] Figure 3 shows the occurrence positions of bases marked by the decoding path in the current signal according to an embodiment of the present disclosure;
[0056] Figure 4 A schematic diagram illustrating sequence alignment between a decoded sequence and a reference sequence according to an embodiment of the present disclosure is shown;
[0057] Figure 5 A flowchart illustrating a method for generating a nanopore sequencing signal decoding model training set according to another embodiment of the present disclosure is shown;
[0058] Figure 6 is a block diagram illustrating an apparatus for generating a nanopore sequencing signal decoding model training set according to an exemplary embodiment;
[0059] Figure 7It is a block diagram of an apparatus 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 indicated.
[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, numerous specific details are provided in the following detailed description to better illustrate the present disclosure. Those skilled in the art will appreciate that the present disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art are not described in detail in order to highlight the main points of the present disclosure.
[0063] Figure 1 A flow chart showing a method for generating a nanopore sequencing signal decoding model training set according to an embodiment of the present disclosure is shown. This embodiment takes the method as an example of an electronic device with computing capabilities, which can 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: Acquire a current signal obtained by detecting a nucleic acid sequence using a nanopore sequencer.
[0065] When a single nucleic acid molecule passes through a nanopore, it causes a change in current, 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 base model is a neural network model capable of performing preliminary decoding of current signals. The decoding accuracy of the base model is lower than that of the decoding model trained in this application. To further improve the accuracy of the base model, it is necessary to annotate the signals that the base model cannot decode and include them in the training set for further training to obtain a decoding model. The method provided in this application can annotate signals that the base model cannot decode.
[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 of 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 fragments, and pairing the current signal of each DNA fragment with the base sequence 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 the basic model. This embodiment does not limit the method for obtaining the basic model. 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). 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; the last layer of CNN is connected to the first layer of LSTM through SiLU. LSTM consists of 5 layers. The last layer of LSTM is connected to the CRF model. During the training process, the model includes the CRF loss function (i.e. Figure 2 The prediction bias is calculated using the CRF Encoder in
[15] to train the base 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, with reference to Figure 3 The decoding pathway is shown, marking the positions of bases in the current signal.
[0075] Step 103 : aligning the decoded sequence with a reference sequence corresponding to the current signal to obtain a sequence alignment result.
[0076] In genomics, a reference sequence refers to a known genomic sequence corresponding to a current signal. The reference sequence is used to align with and analyze the decoded sequence.
[0077] In one example, aligning the decoded sequence with a reference sequence corresponding to the current signal to obtain a sequence alignment result includes: aligning the decoded sequence with the reference sequence using an alignment tool to obtain a sequence alignment result.
[0078] Optionally, the alignment tool includes a Basic Local Alignment Search Tool (BLAST), Bowtie2, Minimap2, etc. This embodiment does not limit the implementation 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 the first minimizer and the 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 the position of the second minimizer corresponding to the reference sequence; using the sequence segment corresponding to the second minimizer in the decoded sequence as an anchor, and obtaining the position of the second minimizer corresponding to the reference sequence, the position of the second minimizer corresponding to the decoded sequence, and the 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, where each anchor includes the position and matching information in the decoded sequence and the reference sequence; 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. 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 to extend the alignment from each anchor point 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 and take the k-mer with the minimum hash value within the w window to get the minimizer. The value of w is greater than the value of k.
[0081] The hash table stores the position of the first minimizer in the reference sequence according to its position. Later, when matching the second minimizer with the first, hash table lookup improves search efficiency. If the second minimizer matches the first, the reference sequence position stored by the first minimizer is read to obtain the corresponding position of the second minimizer in the reference sequence. At this point, the anchor table stores the position of the second minimizer in the reference sequence.
[0082] In this example, the purpose of determining the optimal alignment chain is to screen for anchors that are continuously distributed across the reference sequence, thereby improving alignment accuracy and efficiency. An anchor refers to a specific sequence segment or group of segments in the decoded sequence that have a clear matching position in the reference sequence. In this example, the anchor is the sequence segment corresponding to the second minimizer in the decoded sequence.
[0083] The Anchor Table is used to store the anchor information of each anchor, so as to quickly find and manage all anchors in the decoded sequence. Optionally, the Anchor Table is sorted by 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] Determining the possible alignment chains between different anchors includes: evaluating the distance between different anchors; if the distance is less than a preset distance threshold, determining that the different anchors are continuous, and connecting 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 corresponding to different anchors in the reference sequence; or, it can be the physical distance between the positions corresponding to different anchors in the reference sequence, which 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, the alignment is extended from each anchor point along both ends of the decoded sequence. This includes extending the alignment from each anchor point in the optimal alignment chain along both ends of the decoded sequence until further extension is impossible or a preset termination condition is reached. The alignment path with the highest score is selected as the optimal alignment path, and the alignment result of this optimal alignment path is determined as the sequence alignment result. The alignment path score can be determined based on alignment quality, such as the number of matches, mismatches, insertions, and deletions.
[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 alignment results, determining at least two first subsequences in the decoded sequence whose recognition accuracy meets a first preset condition includes: in the decoded sequence, determining, based on the sequence alignment results, a subsequence whose continuous matching length of bases is greater than a preset length, to obtain the first subsequence.
[0090] Specifically, the CS tag of the sequence alignment results is obtained and analyzed to determine the length of consecutive base matches. The CS tag is a tag used to record alignment details and is generated by the sequence alignment tool. The CS tag can describe in detail the base changes that occurred during the alignment, including exact matches, insertions, deletions, and substitutions.
[0091] Schematically, the format of the cs tag includes: ":[0-9]" where the numbers in the brackets represent 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 sequence alignment of the decoded sequence shown and the reference sequence is: ":2-ta:21+at:1*ag*tg:1". From the CS tag, it can be seen 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 decoded sequence), replaced base TG (i.e., T in the reference sequence is replaced by G in the decoded 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 : Based on the sequence positions corresponding to the different first subsequences in the reference sequence, extract the second subsequences between the different sequence positions in the reference sequence.
[0094] In one example, since the longer the extracted second subsequence is, the more sequence information it contains, which is more conducive to subsequent training, this embodiment uses the extraction of the second subsequence starting from the two furthest first subsequences as an example for explanation.
[0095] Accordingly, based on the sequence positions corresponding to different first subsequences in the reference sequence, extracting a 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 in the reference sequence satisfies a second preset condition. If the second preset condition is satisfied, updating the value of i to i+1 and the value of j to j-1, and re-performing the step of determining whether the subsequence between the i-th sequence position and the j-th sequence position in the reference sequence satisfies the second preset condition, 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, thereby obtaining the second subsequence.
[0096] Where 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 range of positions occupied by the i(j)th first subsequence in the reference sequence.
[0097] The second preset condition is used to indicate that abnormal data exists in the subsequence. In this embodiment, the subsequence containing abnormal data is eliminated 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 a 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 length is padded with 0. However, current signals 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.
[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 pore speeds for each subsequence. For example, the preset speed range includes speeds less than the mean of each subsequence minus n times the standard deviation, and speeds greater than the mean plus n times the standard deviation. n is a positive integer. This ensures the stability of the pore speeds in the training set. For example, the preset speed range includes speeds less than 275.424 base pairs per second (bp / s) for subsequences, and speeds greater than 600 bp / s for subsequences.
[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 with values 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 first calculated, and then the median function is used again to find the median of the absolute deviations. 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 fixed positive integer, and the value of a can be 2, 3, 5, etc. This embodiment does not limit the value of a.
[0109] 4. Obtaining the time interval between adjacent bases in the subsequence; determining whether the time interval between the two bases is greater than a preset time interval; wherein, if the time interval between the two bases is less than or equal to the preset time interval, the subsequence does not meet the second preset condition.
[0110] If the time interval between adjacent bases passing through the nanopore is too long, it indicates pore blockage, meaning the nucleic acid sequence being tested remains in the nanopore for too long, preventing smooth passage. In this case, the collected subsequence is also abnormal data. The preset time interval can be 0.2 seconds, or a value greater or less than 0.2 seconds, depending on the time interval between passes during pore blockage. This embodiment does not impose a limit on the value of the preset time interval.
[0111] In other embodiments, the second preset condition may further include other conditions, which are not listed here in this embodiment. If the subsequence meets all the second preset conditions, it is determined that the subsequence meets 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 furthest first subsequences but from two first subsequences separated by a preset number of bases. This embodiment does not limit the method for extracting the second subsequence.
[0113] Optionally, if the decoding accuracy of the base model is too low, there is a high probability that the first subsequence does not exist. In this case, determining the first subsequence based on the sequence alignment results for subsequent analysis would waste computing resources of the electronic device. Based on this, determining at least two first subsequences in the decoded sequence whose recognition accuracy meets a first preset condition based on the sequence alignment results further includes: determining whether the decoded sequence meets a preset parsing condition based on the sequence alignment results; if the decoded sequence meets the parsing condition, triggering 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 alignment results.
[0114] Accordingly, when the decoding sequence does not meet 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 meets 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 meets 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 ratio of the number of matches between the decoded sequence and the reference sequence to the total length of the comparison; the coverage is used to indicate the ratio 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, a contig is a continuous DNA sequence formed by splicing together short sequence fragments (reads) in the decoded sequence based on their overlapping regions. Each contig has a unique identifier, the contigID, which is used to identify this specific sequence fragment.
[0119] The positive and negative strands refer to the two possible ways that DNA can be read in the double-stranded structure: forward (sense strand) and reverse (antisense strand), due to the direction of replication and transcription. The difference between the positive and negative strands lies in the direction in which they are read in the genome.
[0120] During sequence alignment, the alignment tool outputs contig IDs and strand orientations. Therefore, the contig IDs can be used to determine whether each sequence segment aligned with the reference sequence originates from the same contig. Strand orientations can be used to determine whether a segment belongs to the sense or antisense strand.
[0121] Step 106 : Determine a current signal corresponding to the second subsequence in the current signal based on the decoding path.
[0122] Because the decoding path is marked with the positions at which each base in the decoding sequence appears in the current signal, based on this, the current signal corresponding to the second subsequence is determined in the current signal based on the decoding path, including: for the first subsequence corresponding to the sequence position used to determine the second subsequence, based on the decoding path, determining the positions at which the first subsequence appears in the current signal, extracting the current signals between the positions, and obtaining the current signal corresponding to the second subsequence.
[0123] For example: Reference Figure 4 , assuming that the sequence positions used to determine the second subsequence include 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 positions of each base in the first subsequence 43 and the positions of each base in the first subsequence 44 in the current signal can be determined. By extracting the current signal between these two position areas, the current signal corresponding to the second subsequence can be obtained. For example, Figure 3 In the decoding path shown, the current signal between the bases corresponding to the first subsequence 43 and 44 is extracted.
[0124] Step 107: Determine a training set for 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 the base characters in the second subsequence into digital codes that can be recognized by the decoding model; batch-dividing the array consisting of the different converted second subsequences and the 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 used for one iteration of 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 is not limited in this embodiment.
[0128] In one example, an 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 zeros according to the largest sequence length among the converted second subsequences; and aligning the current signals in the batch array to a preset alignment length by padding with zeros. This allows different samples in the same batch to be aligned in the data dimension, which can improve the training efficiency and stability of the model.
[0129] The alignment length can be set according to the processing performance of the electronic device. For example, the alignment length is 10,000 signal points, which is the number of signal points collected in 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 the decoding model using the training set of the decoding model based on the basic model; or, the decoding model is obtained by training the 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 this 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 decoding path corresponding to the current signal; compare the decoding sequence with the 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 second subsequences 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 the different second subsequences and the corresponding current signals, determine the training set of the decoding model; this can solve the problem of limited decoding accuracy of the decoding model obtained by training the decoding model with the training set obtained by annotating the current signal with the basic model; the signals that cannot be decoded by the basic model can be annotated and included in the training set, so that a more accurate decoding model can be trained, thereby improving the decoding accuracy of the decoding model.
[0133] In addition, by extracting the second subsequence starting from the two furthest first subsequences, it is possible to ensure 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 trained decoding model.
[0135] In addition, by identifying the first subsequence and further extracting the second subsequence only when the decoded sequence meets the parsing condition, 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 exemplified 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 using a nanopore sequencer to obtain a current signal;
[0138] Step 52: Decode the current signal using 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 alignment result. If the sequence alignment result indicates that the decoded sequence meets the parsing condition, step 54 is executed. If the sequence alignment result indicates that the decoded sequence does not meet the parsing condition, the next decoded sequence is updated and step 53 is executed.
[0140] Step 54: Determine whether each subsequence in the decoding sequence satisfies a first preset condition. If so, filter to obtain a first subsequence and execute step 55. If none of the subsequences satisfies the first preset condition, update to the next decoding sequence and execute step 53.
[0141] Step 55, based on the sequence positions of the different first subsequences corresponding to the reference sequence, extracting second subsequences between the 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 for 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 FIG1 is a block diagram of an apparatus 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, for nucleic acid acquisition, and current signals obtained by detecting nucleic acid sequences through a nanopore sequencer;
[0147] A base recognition module 620 is configured to perform 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 indicates the position of the current signal corresponding to each base in the decoding sequence;
[0148] a sequence alignment module 630, configured to align the decoded sequence with a reference sequence corresponding to the current signal to obtain a sequence alignment result;
[0149] a sequence screening module 640, configured to determine, based on the sequence comparison result, at least two first subsequences in the decoded sequence whose recognition accuracy satisfies a first preset condition;
[0150] A sequence extraction module 650 is configured to extract second subsequences between different sequence positions in the reference sequence based on the sequence positions of different first subsequences corresponding to 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 configured to determine a training set for 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. For the sake of brevity, it will not be repeated here.
[0155] The present disclosure also provides a computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium may 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] An embodiment of the present disclosure also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying 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 can 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 the 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 2003. 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 that can be executed by the processing component 1922 of the apparatus 1900 to perform the above-described method.
[0161] While various embodiments of the present disclosure have been described above, the foregoing description is intended to be illustrative, non-exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, their practical applications, or technological improvements in the marketplace, or to enable others skilled 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 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; 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; determining, based on the decoding path, a current signal corresponding to the second subsequence in the current signal; A training set of a decoding model is determined based on different second subsequences and corresponding current signals.
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 includes: 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 from 1, j is an integer decreasing from n, and n is the number of sequence positions; If 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, thereby obtaining the second subsequence.
3. The method according to claim 2, characterized in that Determining whether a subsequence between an i-th sequence position and a j-th sequence position in the reference sequence satisfies a second preset condition includes: determining whether a 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, Determining a via speed corresponding to the subsequence based on a current signal corresponding to the subsequence; determining 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 an 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 a time interval between adjacent bases in the subsequence; determining whether the time interval between the bases is greater than a preset time interval; wherein, if the time interval between the bases 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, wherein 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: Determining whether the decoded sequence meets a preset parsing condition based on the sequence comparison result; In a 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.
5. The method according to claim 4, characterized in that 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 decoded sequence and the reference sequence to the total length of the alignment; the coverage is used to indicate the proportion of the portion of the decoded sequence participating in the alignment to the total length of the decoded 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 strands, it is determined that the decoded sequence meets the preset parsing condition.
6. The method according to claim 1, characterized in that 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; Determining 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; Using the sequence segment corresponding to the second minimizer in the decoded sequence as an anchor, using the position corresponding to the second minimizer in the reference sequence and the 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 the position in the decoded sequence and the reference sequence and their matching information; Determine the possible alignment chains between different anchors; Determining the optimal alignment chain with the highest score from all possible alignment chains 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 alignment chain, a dynamic programming algorithm is used to extend the alignment from each anchor point 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.
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 includes: In the decoded sequence, a subsequence having a continuous matching length of bases greater than a preset length is determined based on the sequence alignment result to obtain the first subsequence.
8. The method according to any one of claims 1 to 7, characterized in that: The determining of 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 array 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 of training during 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 for 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 according to 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