Nanopore sequencing method, training method, electronic device and storage medium
Through the joint training of multiple loss functions and the sequencing model of downsampling and upsampling structure, the problem of high algorithm complexity in nanopore sequencing is solved, and high-precision and fast base recognition is achieved.
Patent Information
- Application Number
- CN202311824058.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-27
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2043-12-27
AI Technical Summary
Existing machine learning algorithms in nanopore sequencing have high algorithmic complexity, which severely limits the inference speed and the inference accuracy needs to be improved.
A sequencing model trained with multiple loss functions is used, combined with downsampling and upsampling structures, including a shared encoder and CTC decoder, to encode and decode nanopore sequencing signals.
It improves the inference accuracy and speed of the sequencing model, achieves high-precision and fast base recognition, and breaks through the bottleneck of existing algorithms.
Smart Images

Figure CN120220809B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of machine learning technology, and in particular to a nanopore sequencing method, training method, electronic device, and storage medium. Background Art
[0002] Nanopore sequencing has become an important high-throughput sequencing technology in modern genomics; accurate identification of base sequences on polymer chains is crucial for determining further analysis. However, the raw pore current signal is often affected by various factors such as noise, electrode drift, and base-base interactions. Therefore, high-precision inference based on the pore current signal in nanopore sequencing is a challenging problem and crucial for its widespread application.
[0003] In the existing technology, machine learning algorithms are used for nanopore sequencing to infer the base sequence on the polymer chain. However, the existing machine learning algorithms have the problem of high algorithm complexity, which seriously limits the inference speed, and the inference accuracy still needs to be improved. Summary of the Invention
[0004] In view of this, the present disclosure proposes a nanopore sequencing method, a sequencing model training method, a nanopore sequencing device, a sequencing model training device, an electronic device, a storage medium, and a computer program product.
[0005] According to one aspect of the present disclosure, a nanopore sequencing method is provided, comprising:
[0006] Acquire nanopore sequencing signals;
[0007] The nanopore sequencing signal is input into a sequencing model for base recognition to obtain a base sequence corresponding to the nanopore sequencing signal; wherein the sequencing model is a model obtained by joint training of multiple loss functions, and the sequencing model includes a structure for downsampling the nanopore sequencing signal before encoding and upsampling it after encoding.
[0008] In one possible implementation, the sequencing model includes: a shared encoder and a connectionist temporal classification (CTC) decoder, wherein the shared encoder is used to encode the nanopore sequencing signal; and the CTC decoder is used to decode the encoding result of the shared encoder based on CTC beam search to obtain the base sequence corresponding to the nanopore sequencing signal.
[0009] In one possible implementation, the shared encoder includes one or more of a downsampling layer, an encoding layer, an upsampling layer, or a weighted residual connection layer; wherein the downsampling layer is used to reduce the sampling rate of the nanopore sequencing signal, the encoding layer is used to encode the signal after the sampling rate is reduced, the upsampling layer is used to increase the sampling rate of the output result of the encoding layer, and the weighted residual connection layer is used to perform weighted summation on the nanopore sequencing signal and the output result after the sampling rate is increased to obtain the encoding result of the shared encoder.
[0010] In a possible implementation, the method further includes: segmenting the nanopore sequencing signal to obtain multiple signal segments;
[0011] Inputting the nanopore sequencing signal into a sequencing model for base recognition to obtain a base sequence corresponding to the nanopore sequencing signal includes:
[0012] Inputting each signal segment of the multiple signal segments into the sequencing model for base recognition to obtain the base sequence corresponding to each signal segment;
[0013] The base sequences corresponding to the various signal segments are spliced together to obtain the base sequence corresponding to the nanopore sequencing signal.
[0014] According to another aspect of the present disclosure, a method for training a sequencing model is provided, the method comprising:
[0015] Acquire training data; wherein the training data includes: multiple sets of nanopore sequencing training signals and standard base sequences corresponding to each set of nanopore sequencing training signals;
[0016] Inputting each set of nanopore sequencing training signals into a preset model to obtain sequencing results corresponding to each set of nanopore sequencing training signals; wherein the preset model includes a structure for downsampling each set of nanopore sequencing training signals before encoding and upsampling each set of nanopore sequencing training signals after encoding;
[0017] Based on the sequencing results and the corresponding standard base sequences corresponding to each group of nanopore sequencing training signals, multiple loss functions are used to jointly train the preset model until a preset termination condition is reached, and a sequencing model is determined based on the preset model corresponding to the preset termination condition. The sequencing model is used to perform base recognition on the nanopore sequencing signal to obtain the base sequence corresponding to the nanopore sequencing signal.
[0018] In one possible implementation, the preset model includes: a shared encoder, a connectionist temporal classification (CTC) decoder, and an attention decoder; wherein the shared encoder is used to encode each set of nanopore sequencing training signals; the CTC decoder is used to decode the encoding results of the shared encoder based on CTC beam search to obtain a first base sequence corresponding to each set of nanopore sequencing training signals; and the attention decoder is used to decode the encoding results of the shared encoder based on an attention mechanism to obtain a second base sequence corresponding to each set of nanopore sequencing training signals.
[0019] The multiple loss functions include: a loss function of the CTC decoder determined based on the first base sequence corresponding to each group of nanopore sequencing training signals and the standard base sequence, and a loss function of the attention decoder determined based on the second base sequence corresponding to each group of nanopore sequencing training signals and the standard base sequence.
[0020] In one possible implementation, the shared encoder includes one or more of a downsampling layer, an encoding layer, an upsampling layer, or a weighted residual connection layer; wherein the downsampling layer is used to reduce the sampling rate of each group of nanopore sequencing training signals, the encoding layer is used to encode the signal after the sampling rate is reduced, the upsampling layer is used to increase the sampling rate of the output result of the encoding layer, and the weighted residual connection layer is used to perform weighted summation on each group of nanopore sequencing training signals and the output result after the sampling rate is increased to obtain the encoding result of the shared encoder.
[0021] In a possible implementation, determining a sequencing model according to the preset model corresponding to when the preset termination condition is reached includes:
[0022] The shared encoder and CTC decoder corresponding to when the preset termination condition is reached are used as the shared encoder and CTC decoder of the sequencing model, respectively.
[0023] According to another aspect of the present disclosure, a nanopore sequencing device is provided, comprising:
[0024] A first acquisition module is used to acquire nanopore sequencing signals;
[0025] A first sequencing module is configured to input the nanopore sequencing signal into a sequencing model for base recognition to obtain a base sequence corresponding to the nanopore sequencing signal; wherein the sequencing model is a model jointly trained with multiple loss functions, and the sequencing model includes a structure for downsampling the nanopore sequencing signal before encoding and upsampling it after encoding.
[0026] According to another aspect of the present disclosure, a training apparatus for a sequencing model is provided, the apparatus comprising:
[0027] A second acquisition module is configured to acquire training data, wherein the training data includes: multiple sets of nanopore sequencing training signals and a standard base sequence corresponding to each set of nanopore sequencing training signals;
[0028] a second sequencing module, configured to input each set of nanopore sequencing training signals into a preset model to obtain sequencing results corresponding to each set of nanopore sequencing training signals; wherein the preset model includes a structure for downsampling each set of nanopore sequencing training signals before encoding and upsampling each set of nanopore sequencing training signals after encoding;
[0029] A training module is configured to jointly train the preset model using multiple loss functions based on the sequencing results and the corresponding standard base sequences corresponding to each set of nanopore sequencing training signals until a preset termination condition is reached, and determine a sequencing model based on the preset model corresponding to the preset termination condition. The sequencing model is configured to perform base recognition on the nanopore sequencing signal to obtain the base sequence corresponding to the nanopore sequencing signal.
[0030] According to another aspect of the present disclosure, an electronic device is provided, 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.
[0031] According to another aspect of the present disclosure, a 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.
[0032] 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.
[0033] In the disclosed embodiments, the sequencing model is obtained by jointly training multiple loss functions, thereby improving the inference accuracy of the sequencing model. The sequencing model also includes a structure for downsampling the nanopore sequencing signal before encoding and upsampling it after encoding, thereby effectively improving the inference speed of the sequencing model. In this way, the acquired nanopore sequencing signal is input into the sequencing model, which can quickly and accurately perform base recognition and obtain the base sequence corresponding to the nanopore sequencing signal, thereby achieving high-precision and fast nanopore sequencing.
[0034] 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
[0035] 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.
[0036] Figure 1 A schematic flow chart of a nanopore sequencing method according to an embodiment of the present disclosure is shown.
[0037] Figure 2 A schematic structural diagram of a shared encoder according to an embodiment of the present disclosure is shown.
[0038] Figure 3 A schematic diagram of the process of performing nanopore sequencing using a sequencing model according to an embodiment of the present disclosure is shown.
[0039] Figure 4 A flowchart of a nanopore sequencing method according to an embodiment of the present disclosure is shown.
[0040] Figure 5 A flowchart of a training method according to an embodiment of the present disclosure is shown.
[0041] Figure 6 A schematic diagram of a process for training a preset model according to an embodiment of the present disclosure is shown.
[0042] Figure 7 A structural diagram of a nanopore sequencing device according to an embodiment of the present disclosure is shown.
[0043] Figure 8 A structural diagram of a training device for a sequencing model according to an embodiment of the present disclosure is shown.
[0044] Figure 9 A schematic structural diagram of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0045] 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.
[0046] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present disclosure. Thus, phrases such as "exemplary," "in one embodiment," "in some other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0047] In the present disclosure, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: including the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0048] 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.
[0049] Nanopore sequencing is a biological nanopore sequencing method that embeds a nanopore (protein pore or solid-state pore) into an insulating artificial membrane to form an ion channel. The membrane is flanked by two electrodes filled with an electrolyte solution. The potential difference between the two electrodes generates a transpore current within the nanopore. When a polymer chain (such as single-stranded deoxyribonucleic acid (DNA), ribonucleic acid (RNA), or protein) passes through the nanopore, the transpore current is modulated due to the different impedances of different monomers in the polymer chain (such as the bases A, T, G, and C in DNA). This transpore current signal can be detected. This transpore current corresponds to the monomer sequence in the polymer chain, and the monomer sequence in the polymer chain can be deduced by detecting changes in the transpore current. For example, the base sequence of the polymer chain can be detected.
[0050] Nanopore sequencing has become an important high-throughput sequencing technology in modern genomics. Accurate identification of base sequences on polymer chains is crucial for determining further analysis. However, the raw pore current signal is often affected by various factors, such as noise, electrode drift, and interactions between bases. Therefore, high-precision inference based on pore current signals in nanopore sequencing is a challenging problem and is crucial for its widespread application. In related technologies, machine learning algorithms are used for nanopore sequencing to infer the base sequence on the polymer chain. However, existing machine learning algorithms suffer from high algorithmic complexity, which severely limits the inference speed. For example, the Transformer algorithm has achieved a milestone in inference accuracy, but its high complexity severely limits the computational speed. In addition, the algorithms in related technologies all use a single loss function training method, which restricts further improvement in inference accuracy.
[0051] To this end, the embodiments of the present disclosure provide a solution for nanopore sequencing (described in detail below). Based on joint loss training and up-sampling, it can overcome the shortcomings of existing nanopore sequencing algorithms, break through the bottlenecks of existing algorithms, and improve the accuracy and speed of nanopore sequencing.
[0052] The following first describes in detail the nanopore sequencing method provided by the embodiments of the present disclosure.
[0053] Figure 1 A schematic flow chart of a nanopore sequencing method according to an embodiment of the present disclosure is shown. The method can be executed by an electronic device or processor with data processing capabilities, such as Figure 1 As shown, the method may include the following steps:
[0054] Step 101: Acquire nanopore sequencing signals.
[0055] The nanopore sequencing signal can be a through-pore current signal detected when a polymer chain to be sequenced passes through a nanopore. For example, a nanopore sequencer can be used to perform nanopore sequencing on a DNA chain, and the through-pore current signal of the DNA chain can be detected. This through-pore current signal is the nanopore sequencing signal.
[0056] For example, the through-pore current signal detected when the polymer chain passes through the nanopore can be preprocessed, and the preprocessed signal can be used as the nanopore sequencing signal. Considering that the detected through-pore current signal may be a current signal with poor filtering quality and high noise, the detected raw through-pore current signal can be preprocessed; for example, the raw current signal can be preprocessed by cleaning, normalizing, etc. to filter out the current information with poor quality and high noise, and the high-quality preprocessed through-pore current signal can be used as the nanopore sequencing signal.
[0057] Illustratively, after obtaining the nanopore sequencing signal, the nanopore sequencing signal can be segmented to obtain multiple signal segments. Illustratively, adjacent signal segments in the multiple signal segments may have a certain overlap region, wherein the size of the overlap region can be set as needed and is not limited thereto.
[0058] Step 102: Input the nanopore sequencing signal into a sequencing model for base recognition to obtain a base sequence corresponding to the nanopore sequencing signal.
[0059] The sequencing model is trained using multiple loss functions and includes a structure that downsamples the nanopore sequencing signal before encoding and upsamples it after encoding. This effectively improves the base calling accuracy of the sequencing model while significantly reducing its computational complexity.
[0060] In one possible implementation, the sequencing model may include: a shared encoder and a Connectionist Temporal Classification (CTC) decoder, wherein the shared encoder is used to encode the nanopore sequencing signal; and the CTC decoder is used to decode the encoding result of the shared encoder based on the beam search of CTC to obtain the base sequence corresponding to the nanopore sequencing signal. It is understandable that the shared encoder and the CTC decoder are obtained by joint training of multiple loss functions, wherein the training process is described below. Exemplarily, the number of shared encoders can be multiple, that is, the sequencing model can include multiple shared encoders, and different shared encoders can be connected in sequence, so that the nanopore sequencing signal can pass through the multiple shared encoders in sequence to obtain the final encoding result.
[0061] In one possible implementation, the structure for downsampling the nanopore sequencing signal before encoding in the sequencing model is used to reduce the sampling rate of the nanopore sequencing signal to be encoded before the sequencing model encodes the nanopore sequencing signal. For example, the nanopore sequencing signal can be regarded as consisting of multiple frame sub-signals. The downsampling structure can perform weighted summation of the sub-signals of a predetermined number of adjacent frames in the nanopore sequencing signal into one frame sub-signal, thereby reducing the sampling rate and reducing the data volume of the nanopore sequencing signal to be encoded. In this way, considering that the inference speed of the sequencing model is limited by the encoding complexity in the sequencing model, and the encoding complexity is affected by the length of the nanopore sequencing signal, the sampling rate of the nanopore sequencing signal to be encoded is reduced before encoding the nanopore sequencing signal, thereby greatly reducing the encoding complexity and improving the inference speed of the sequencing model. The structure for upsampling the nanopore sequencing signal after encoding in the sequencing model is used to increase the sampling rate of the encoding result after the sequencing model encodes the nanopore sequencing signal. For example, the sequencing model encodes the nanopore sequencing signal to generate a feature vector of each frame sub-signal. The upsampling structure can copy the generated feature vector of each frame sub-signal, thereby increasing the sampling rate and increasing the data volume of the encoding result.
[0062] Exemplarily, the sampling rate reduced by the structure that downsamples the nanopore sequencing signal before encoding can be the same as the sampling rate increased by the structure that upsamples the nanopore sequencing signal after encoding. For example, the structure that downsamples can perform weighted summation on the sub-signals of N adjacent frames in the nanopore sequencing signal to form one frame of sub-signal. Exemplarily, the downsampling layer can be configured with N weight scalars, and the specific values of the N weight variables can be obtained through learning during the training process. The N weight scalars represent the summation weights corresponding to each sub-signal in the N adjacent frames of sub-signals; accordingly, the structure that upsamples can replicate the generated feature vector of each frame of sub-signals N times, where N is an integer greater than 1, thereby achieving a proportional reduction and increase in the amount of data before and after encoding.
[0063] As an example, the shared encoder includes one or more of a downsampling layer, an encoding layer, an upsampling layer, or a weighted residual connection layer. For example, the shared encoder includes a downsampling layer, an encoding layer, an upsampling layer, and a weighted residual connection layer. The downsampling layer is a structure for downsampling the nanopore sequencing signal before encoding it, so as to reduce the sampling rate of the nanopore sequencing signal. The encoding layer is used to encode the signal after the sampling rate is reduced. For example, feature extraction can be performed on the nanopore sequencing signal after the sampling rate is reduced to generate a corresponding feature vector. Exemplarily, the encoding layer can be a recurrent neural network (RNN), a convolutional neural network (CNN), a transformer, a conformer, etc. For example, the encoding layer can be a transformer layer. The upsampling layer is a structure that upsamples the nanopore sequencing signal after encoding, and is used to increase the sampling rate of the output result of the encoding layer; the weighted residual connection layer is used to perform weighted summation on the nanopore sequencing signal and the output result after the sampling rate is increased to obtain the encoding result of the shared encoder; wherein, the weight value of the nanopore sequencing signal and the weight value of the output result after the sampling rate is increased can be determined in the model training stage. In this way, by reducing the sampling rate of the nanopore sequencing signal through the downsampling layer, the amount of data input to the encoding layer can be reduced, thereby reducing the amount of data that the encoding layer needs to process, and effectively improving the computing speed of the encoding layer; after the encoding layer encodes the signal after the sampling rate is reduced, the sampling rate of the output result of the encoding layer is increased through the upsampling layer, so that the final encoding result of the shared encoder can represent more detailed information, effectively improving the decoding accuracy and effect of the subsequent CTC decoder. It should be noted that one or more shared encoders can be configured in the sequencing model as needed, and this is not limited. For example, Figure 2 FIG. 1 shows a schematic diagram of the structure of a shared encoder according to an embodiment of the present disclosure. Figure 2 As shown, the number of shared encoders in the sequencing model can be 6, wherein each shared encoder includes a downsampling layer, an encoding layer, an upsampling layer and a weighted residual connection layer, wherein the input data is the nanopore sequencing signal obtained above, and the output data is the final encoding result.
[0064] As an example, the CTC decoder may include a linear layer, for example, may be composed of a linear layer; the encoding result of the shared encoder may be input into the linear layer, and the linear layer performs decoding based on the beam search of the CTC to generate a base sequence, which is the inferred base sequence corresponding to the above-obtained nanopore sequencing signal.
[0065] For example, Figure 3A schematic diagram of a process for performing nanopore sequencing using a sequencing model according to an embodiment of the present disclosure is shown. Figure 3 As shown, the sequencing model includes 6 shared encoders and a CTC decoder; each shared encoder includes a downsampling layer, a transformer encoding layer, an upsampling layer, and a weighted residual connection layer. When performing nanopore sequencing, the nanopore sequencing signal is input into the downsampling layer and the weighted residual connection layer of the first shared encoder, and then the signal with reduced sampling rate output by the downsampling layer is input into the transformer encoding layer of the first shared encoder for encoding, and then the output result of the transformer encoding layer is input into the upsampling layer of the first shared encoder, and then the result with increased sampling rate output by the upsampling layer is input into the weighted residual connection layer of the first shared encoder, and the weighted residual connection layer performs weighted summation on the nanopore sequencing signal and the result with increased sampling rate output by the upsampling layer to obtain the encoding result of the first shared encoder, and the encoding result is input into the second shared encoder; in the second shared encoder, the downsampling layer reduces the sampling rate of the encoding result, and then the signal with reduced sampling rate output by the downsampling layer is input into the The transformer encoding layer encodes the data, and then the output result of the transformer encoding layer is input into the upsampling layer of the second shared encoder. The upsampling layer outputs the upsampling rate result which is then input into the weighted residual connection layer of the second shared encoder. The weighted residual connection layer performs weighted summation on the encoding result of the first shared encoder and the upsampling rate result of the upsampling layer to obtain the encoding result of the second shared encoder, and inputs the encoding result into the third shared encoder. Similarly, the third, fourth, fifth, and sixth shared encoders also perform the above processing in sequence. Finally, the encoding result of the sixth shared encoder is input into the CTC decoder as the final encoding result. The CTC decoder consists of a linear layer, and decodes the final encoding result of the shared encoder based on the CTC beam search, and outputs the base sequence corresponding to the nanopore sequencing signal.
[0066] In one possible implementation, when a nanopore sequencing signal includes multiple signal segments, each of the multiple signal segments can be input into the sequencing model for base recognition to obtain the base sequence corresponding to each signal segment. The base sequences corresponding to each signal segment are then spliced together to obtain the base sequence corresponding to the nanopore sequencing signal. For example, during splicing, the base sequences corresponding to adjacent signal segments may overlap. For any signal segment, half of the overlap between the base sequence corresponding to that signal segment and the base sequence corresponding to the adjacent signal segment can be retained as part of the base sequence corresponding to that signal segment. In this way, by traversing all signal segments, the spliced base sequence, i.e., the base sequence corresponding to the nanopore sequencing signal, can be obtained.
[0067] In the disclosed embodiments, the sequencing model is obtained by jointly training multiple loss functions, thereby improving the inference accuracy of the sequencing model. The sequencing model also includes a structure that downsamples the nanopore sequencing signal before encoding and upsamples it after encoding, thereby effectively improving the inference speed of the sequencing model. In this way, based on joint loss training and upsampling, the shortcomings of existing nanopore sequencing algorithms can be overcome, breaking through the bottlenecks of existing algorithms. By inputting the acquired nanopore sequencing signal into the sequencing model, base recognition can be performed quickly and accurately to obtain the base sequence corresponding to the nanopore sequencing signal, thereby achieving high-precision and rapid nanopore sequencing.
[0068] Figure 4 A flow chart of a nanopore sequencing method according to an embodiment of the present disclosure is shown as follows: Figure 4 As shown, sequencing data is first acquired, then preprocessed. The preprocessed sequencing data is then encoded, decoded, downsampled, and upsampled using a sequencing model. Finally, the processed results are spliced to obtain a final, complete sequencing result. For example, the sequencing data may be the aforementioned nanopore sequencing signal, which includes multiple signal segments. These multiple signal segments can then be acquired, then preprocessed, such as by cleaning and normalization. The sequencing model can then be used to encode, decode, downsample, and upsample each of the multiple signal segments to obtain the base sequence corresponding to each signal segment. Finally, the base sequences corresponding to each signal segment are spliced to obtain the final, complete sequencing result, i.e., the base sequence corresponding to the entire nanopore sequencing signal.
[0069] The following is a detailed description of the training method for the sequencing model provided in the embodiment of the present disclosure. The training method can generate the above Figure 1 Sequencing model.
[0070] Figure 5A flow chart of a training method according to an embodiment of the present disclosure is shown. The method can be executed by an electronic device or processor with processing capabilities, such as Figure 5 As shown, the method may include the following steps:
[0071] Step 501: Obtain training data.
[0072] The training data includes: multiple groups of nanopore sequencing training signals and standard base sequences corresponding to each group of nanopore sequencing training signals; illustratively, the nanopore sequencing training signals can be the through-pore current signals when the polymer chain passes through the nanopore, and the standard base sequences of the through-pore current signals are known.
[0073] For example, nanopore sequencing training signals with known base sequences can be obtained from an existing database as training data; or a nanopore sequencer can be used to collect a through-pore current signal when a polymer chain passes through the nanopore, and the base sequence corresponding to the through-pore current signal can be determined using existing standard methods to obtain training data; or training data can be obtained by other methods, which are not limited to this.
[0074] Illustratively, each set of nanopore sequencing training signals may be preprocessed and / or segmented. Possible implementations of the preprocessing and segmentation processes may refer to the relevant description in step 101 above.
[0075] Step 502: Input each set of nanopore sequencing training signals into a preset model to obtain sequencing results corresponding to each set of nanopore sequencing training signals.
[0076] In this step, each set of nanopore sequencing training signals in the training data can be sequentially input into a preset model. The preset model performs base recognition on each set of nanopore sequencing training signals to generate a base sequence corresponding to each set of nanopore sequencing training signals, i.e., a sequencing result corresponding to each set of nanopore sequencing training signals. For example, if a set of nanopore sequencing training signals includes multiple signal segments, each of the multiple signal segments can be separately input into the preset model for base recognition to obtain the base sequence corresponding to each signal segment. The base sequences corresponding to the various signal segments are then concatenated to obtain the base sequence corresponding to the set of nanopore sequencing training signals.
[0077] In one possible implementation, the preset model may include: a shared encoder, a CTC decoder and an attention based encoder-decoder (AED); wherein the shared encoder is used to encode each group of nanopore sequencing training signals; the CTC decoder is used to decode the encoding results of the shared encoder based on CTC beam search to obtain the first base sequence corresponding to each group of nanopore sequencing training signals; the attention decoder is used to decode the encoding results of the shared encoder based on the attention mechanism to obtain the second base sequence corresponding to each group of nanopore sequencing training signals.
[0078] The preset model includes a structure for downsampling each set of nanopore sequencing training signals before encoding and upsampling them after encoding. For example, the structure for downsampling each set of nanopore sequencing training signals in the preset model can be used to reduce the sampling rate of the nanopore sequencing training signals to be encoded before the preset model encodes the nanopore sequencing training signals, and the structure for upsampling the nanopore sequencing training signals after encoding the nanopore sequencing training signals in the preset model is used to increase the sampling rate of the encoded results after the preset model encodes the nanopore sequencing training signals. The specific description of the structures for downsampling before encoding and upsampling after encoding can be referred to the relevant description of the structures for downsampling before encoding and upsampling after encoding in the sequencing model in step 102 above, and will not be repeated here.
[0079] Exemplarily, the number of shared encoders can be multiple, that is, the preset model can include multiple shared encoders, and different shared encoders can be connected in sequence. In this way, the nanopore sequencing training signal can pass through the multiple shared encoders in sequence to obtain the final encoding result. As an example, the shared encoder includes one or more of a downsampling layer, an encoding layer, an upsampling layer, or a weighted residual connection layer. For example, each shared encoder can include a downsampling layer, an encoding layer, an upsampling layer, and a weighted residual connection layer. The downsampling layer is used to reduce the sampling rate of each set of nanopore sequencing training signals, the encoding layer is used to encode the downsampled signal, the upsampling layer is used to increase the sampling rate of the encoding layer output, and the weighted residual connection layer is used to perform a weighted summation of each set of nanopore sequencing training signals and the upsampled output to obtain the encoding result of the shared encoder. The specific description of each layer in the shared encoder can refer to the relevant description of the shared encoder in the sequencing model in step 102 above, and will not be repeated here.
[0080] Exemplarily, the CTC decoder may include a linear layer, for example, may be composed of one linear layer; the encoding result of the shared encoder may be input into the linear layer, and the linear layer performs decoding based on the CTC beam search to generate a base sequence, which is the inferred base sequence corresponding to each set of nanopore sequencing training signals.
[0081] For example, the attention decoder can be a bidirectional decoder, for example, including three layers of forward decoders and three layers of reverse decoders, or the attention decoder can be a unidirectional decoder, for example, including three layers of forward decoders. The bidirectional decoder can model the encoding results of the shared encoder in both the forward and reverse directions to enhance robustness, while the unidirectional decoder can read the encoding results of the shared encoder from left to right, which speeds up decoding.
[0082] As an example, in a preset model, the CTC decoder and the attention decoder can be set in parallel; the CTC decoder is used to perform CTC decoding, and the goal is to directly correspond each set of nanopore sequencing training signals to the corresponding standard base sequence; the attention decoder performs autoregressive decoding, focusing on the data that is more critical to base recognition among a large number of input data, reducing attention to other data, and even filtering out irrelevant data; in this way, through the CTC decoder and the attention decoder, the efficiency and accuracy of base recognition of the preset model can be improved.
[0083] Step 503: Based on the sequencing results and the corresponding standard base sequences corresponding to each group of nanopore sequencing training signals, multiple loss functions are used to jointly train the preset model until a preset termination condition is reached, and a sequencing model is determined according to the preset model corresponding to the preset termination condition. The sequencing model is used to perform base recognition on the nanopore sequencing signal to obtain the base sequence corresponding to the nanopore sequencing signal.
[0084] In this step, the sequencing model determined by training can be used to perform base recognition on the nanopore sequencing signal to obtain the base sequence corresponding to the nanopore sequencing signal, for example, as described above. Figure 1 The sequencing model described in step 102. The preset termination condition may include: a preset number of iterations, a preset training time, or convergence of a loss function, etc., which are not limited thereto.
[0085] Exemplarily, in this step, based on the sequencing results corresponding to each group of nanopore sequencing training signals and the corresponding standard base sequences, multiple loss functions can be used for joint training, and the parameters of the preset model can be iteratively updated until the preset termination condition is reached. The sequencing model is determined based on the parameters of the preset model corresponding to when the preset termination condition is reached.
[0086] As an example, the shared encoder and CTC decoder corresponding to the preset termination condition can be used as the shared encoder and CTC decoder of the sequencing model, respectively. That is, the sequencing model used for actual nanopore sequencing includes the encoder and CTC decoder, but not the self-attention decoder. In this way, the jointly trained model includes the encoder and CTC decoder, and uses CTC-based beam search for decoding to accurately obtain the base sequence. This avoids the need for attention decoder inference, maximally simplifying sequencing model inference and accelerating inference speed.
[0087] As another example, the values of the N weight scalars configured in the downsampling layer corresponding to when the preset termination condition is reached can be used as the values of the N weight scalars in the downsampling layer in the sequencing model. For example, when the sampling coefficient is 5, the downsampling layer of the preset model is configured with 5 learnable weight scalars. During the training process of the preset model, the values of these 5 weight scalars can be continuously optimized through the multiple loss functions. The values of the 5 weight scalars corresponding to when the preset termination condition is reached can be used as the values of the 5 weight scalars in the downsampling layer in the sequencing model. In this way, during the actual nanopore sequencing process, the sub-signals of 5 adjacent frames in the nanopore sequencing signal can be weighted and summed to form a single frame of sub-signal. Correspondingly, the upsampling layer can directly copy the feature vector of each frame of sub-signal 5 times, thereby achieving a proportional reduction and increase in the amount of data before and after encoding.
[0088] As an example, the weight value of the nanopore sequencing training signal in the weight residual connection layer in the preset model when the preset termination condition is reached can be used as the weight value of the nanopore sequencing signal in the weight residual connection layer in the sequencing model, and the weight value of the output result after the sampling rate is increased in the weight residual connection layer in the preset model when the preset termination condition is reached can be used as the weight value of the output result after the sampling rate is increased in the weight residual connection layer in the sequencing model.
[0089] For example, the calculation principle of the weighted residual connection layer in the preset model is as follows:
[0090] y′=(1-c)·x+c·y
[0091] Here, x represents the nanopore sequencing training signal, y represents the output result after increasing the sampling rate, y′ represents the output result of the entire shared encoder, c is a learnable scalar between 0 and 1, representing the weight value of the output result after increasing the sampling rate, and 1-c represents the weight value of the nanopore sequencing training signal.
[0092] Exemplarily, the multiple loss functions include: a loss function for the CTC decoder determined based on the first base sequence corresponding to each set of nanopore sequencing training signals and the standard base sequence, and a loss function for the attention decoder determined based on the second base sequence corresponding to each set of nanopore sequencing training signals and the standard base sequence. In this way, the multiple loss functions can be combined as the target loss function to train the preset model, that is, the loss function of the CTC decoder and the loss function of the attention decoder are combined as the target loss function, thereby effectively improving the base recognition accuracy and efficiency of the trained preset model, wherein the sum of the weight values of the loss function of the CTC decoder and the loss function of the attention decoder is 1.
[0093] For example, the loss function of the CTC decoder and the loss function of the attention decoder can be combined as the target loss function through the following formula:
[0094] L joint (x,y)=λL CTC (x,y)+(1-λ)L AED (x,y)
[0095] Among them, L joint () represents the target loss function value, L CTC () represents the loss function value of the CTC decoder, L AED () represents the loss function value of the attention decoder, L CTC and L AED It can be calculated using the existing formula; x represents the base sequence output by the decoder, y is the label of the training data (i.e., the standard base sequence), and λ is a hyperparameter between 0 and 1, which is used to adjust the weights of the loss function of the CTC decoder and the loss function of the AED decoder. For example, it can be taken as 0.5.
[0096] In an embodiment of the present disclosure, multiple loss functions are used to jointly train a preset model, and a sequencing model is determined based on the preset model corresponding to the preset model when a preset termination condition is reached. As an example, the preset model can be jointly trained using a target loss function composed of the loss function of the CTC decoder and the loss function of the AED decoder. In this way, through joint loss training, the preset model can be helped to converge better, thereby improving the inference accuracy and efficiency of the trained preset model. At the same time, the preset model includes a structure for downsampling each set of nanopore sequencing training signals before encoding and upsampling them after encoding, thereby effectively improving the inference speed of the trained preset model. In this way, based on the joint loss training and configuring the upsampling and downsampling structure in the preset model, the training speed and training effect of the preset model are effectively improved. The sequencing model determined by the preset model corresponding to the preset model when the preset termination condition is reached has good inference speed and inference accuracy, which can overcome the shortcomings of existing nanopore sequencing algorithms and break through the bottleneck of existing algorithms. Then, the sequencing model is used to process the nanopore sequencing signals to quickly and accurately perform base recognition and obtain the base sequence corresponding to the nanopore sequencing signals, thereby achieving high-precision and fast nanopore sequencing.
[0097] Figure 6 A flow chart of a preset model training process according to an embodiment of the present disclosure is shown as follows: Figure 6As shown, the preset model may include a shared encoder, a CTC decoder, and an attention decoder. During the training process, the training data is input into the shared encoder, and the training data can be any of the above-mentioned groups of nanopore sequencing training signals; the number of the shared encoders can be 6, wherein each shared encoder includes a downsampling layer, a transformer encoding layer, an upsampling layer, and a weighted residual connection layer; the group of nanopore sequencing training signals is input into the downsampling layer and the weighted residual connection layer of the first shared encoder, and then the signal with reduced sampling rate output by the downsampling layer is input into the transformer encoding layer of the first shared encoder for encoding, and then the output of the transformer encoding layer is encoded. The result is input into the upsampling layer of the first shared encoder, and then the upsampling layer outputs the upsampling result to the weighted residual connection layer of the first shared encoder, and the weighted residual connection layer performs weighted summation on the nanopore sequencing training signal and the upsampling layer output result to obtain the encoding result of the first shared encoder, and inputs the encoding result into the second shared encoder; in the second shared encoder, the downsampling layer reduces the sampling rate of the encoding result, and then the signal with the downsampling layer output is input into the transformer encoding layer of the second shared encoder for encoding, thereby converting the tr The output result of the ansformer encoding layer is input into the upsampling layer of the second shared encoder, and then the upsampling rate output result of the upsampling layer is input into the weighted residual connection layer of the second shared encoder. The weighted residual connection layer performs weighted summation on the encoding result of the first shared encoder and the upsampling rate output result of the upsampling layer to obtain the encoding result of the second shared encoder, and inputs the encoding result into the third shared encoder; similarly, the third, fourth, fifth, and sixth shared encoders also perform the above processing in sequence. Finally, the encoding result of the sixth shared encoder is input into the CTC decomposition as the final encoding result. In the encoder and attention decoder, the CTC decoder decodes the final encoding result of the shared encoder and calculates the CTC loss value based on the decoded base sequence and training data labels. The attention decoder decodes the final encoding result of the shared encoder and calculates the AED loss value based on the decoded base sequence and training data labels. Then, joint loss training is performed based on the loss value jointly determined by the CTC loss value and the AED loss value, and the parameter values in the preset model are adjusted based on the loss value. In this way, the above operations are repeated for different groups of nanopore sequencing training signals until the preset termination condition is reached, and the sequencing model is determined according to the preset model corresponding to when the preset termination condition is reached.
[0098] The performance of the sequencing model obtained by using the training method in the embodiments of the present disclosure is described below.
[0099] (1) Comparing the performance of different joint training models under different decoding methods, for example, comparing the performance of using a unidirectional decoder and a bidirectional decoder in the nanopore sequencing signal decoding task for the preset model and the Rescore model trained in the embodiments of the present disclosure.
[0100] Since the preset model in the embodiment of the present disclosure is trained using a combination of weighted CTC and AED losses, the CTC decoder can also work independently, that is, in actual applications, the sequencing model only needs to be configured with a CTC decoder, and there is no need to configure an AED decoder. The embodiment of the present disclosure conducted an ablation experiment to compare the performance differences between the pure encoder and the encoder-decoder architecture. Table 1 shows the results of the performance comparison of different joint training models under different decoding methods. It can be seen from Table 1 that when using the pure encoder method, both the unidirectional decoder and the bidirectional decoder achieved performance comparable to their respective complete models. At the 35th round of training, the accuracy of the unidirectional decoder model was 94.16%, and the accuracy of the bidirectional decoder model was 94.24%.
[0101] Table 1. Performance comparison of different joint training models under different decoding methods
[0102]
[0103] (2) The sequencing model trained in the disclosed embodiments was evaluated on the same test dataset as the CRF model. Table 2 compares the decoding performance of the sequencing model and the CRF model in the disclosed embodiments. As can be seen from Table 2, the sequencing model proposed in the disclosed embodiments achieves decoding accuracy that is no less than that of the CRF model, while significantly outperforming the CRF model in inference speed.
[0104] Table 2. Comparison of decoding performance between the sequencing model and the CRF model in the disclosed embodiments
[0105]
[0106] Based on the same inventive concept of the above method embodiments, the embodiments of the present disclosure further provide a nanopore sequencing device and a training device for a sequencing model, which can be used to execute the technical solutions described in the above method embodiments.
[0107] Figure 7 A structural diagram of a nanopore sequencing device according to an embodiment of the present disclosure is shown. Figure 7 As shown, the device includes:
[0108] A first acquisition module 701 is used to acquire nanopore sequencing signals;
[0109] The first sequencing module 702 is configured to input the nanopore sequencing signal into a sequencing model for base recognition to obtain a base sequence corresponding to the nanopore sequencing signal. The sequencing model is a model trained using multiple loss functions, and includes a structure for downsampling the nanopore sequencing signal before encoding and upsampling it after encoding.
[0110] In the disclosed embodiments, the sequencing model is obtained by jointly training multiple loss functions, thereby improving the inference accuracy of the sequencing model. The sequencing model also includes a structure for downsampling the nanopore sequencing signal before encoding and upsampling it after encoding, thereby effectively improving the inference speed of the sequencing model. In this way, the acquired nanopore sequencing signal is input into the sequencing model, which can quickly and accurately perform base recognition and obtain the base sequence corresponding to the nanopore sequencing signal, thereby achieving high-precision and fast nanopore sequencing.
[0111] In one possible implementation, the sequencing model includes: a shared encoder and a connectionist temporal classification (CTC) decoder, wherein the shared encoder is used to encode the nanopore sequencing signal; and the CTC decoder is used to decode the encoding result of the shared encoder based on CTC beam search to obtain the base sequence corresponding to the nanopore sequencing signal.
[0112] In one possible implementation, the shared encoder includes one or more of a downsampling layer, an encoding layer, an upsampling layer, or a weighted residual connection layer; wherein the downsampling layer is used to reduce the sampling rate of the nanopore sequencing signal, the encoding layer is used to encode the signal after the sampling rate is reduced, the upsampling layer is used to increase the sampling rate of the output result of the encoding layer, and the weighted residual connection layer is used to perform weighted summation on the nanopore sequencing signal and the output result after the sampling rate is increased to obtain the encoding result of the shared encoder.
[0113] In one possible implementation, the first acquisition module 701 is further configured to segment the nanopore sequencing signal to obtain multiple signal segments; the first sequencing module 702 is further configured to input each signal segment of the multiple signal segments into the sequencing model for base recognition to obtain a base sequence corresponding to each signal segment; and to splice the base sequences corresponding to each signal segment to obtain a base sequence corresponding to the nanopore sequencing signal.
[0114] Figure 8 A structural diagram of a training device for a sequencing model according to an embodiment of the present disclosure is shown as follows: Figure 8 As shown, the device includes:
[0115] The second acquisition module 801 is configured to acquire training data, wherein the training data includes: multiple sets of nanopore sequencing training signals and a standard base sequence corresponding to each set of nanopore sequencing training signals;
[0116] A second sequencing module 802 is configured to input each set of nanopore sequencing training signals into a preset model to obtain sequencing results corresponding to each set of nanopore sequencing training signals; wherein the preset model includes a structure for downsampling each set of nanopore sequencing training signals before encoding and upsampling each set of nanopore sequencing training signals after encoding;
[0117] Training module 803 is used to jointly train the preset model using multiple loss functions based on the sequencing results and corresponding standard base sequences corresponding to each set of nanopore sequencing training signals until a preset termination condition is reached, and determine a sequencing model based on the preset model corresponding to the preset termination condition when the preset termination condition is reached. The sequencing model is used to perform base recognition on the nanopore sequencing signal to obtain the base sequence corresponding to the nanopore sequencing signal.
[0118] In an embodiment of the present disclosure, multiple loss functions are used to jointly train a preset model, and a sequencing model is determined based on the preset model corresponding to the preset model when a preset termination condition is reached. As an example, the preset model can be jointly trained using a target loss function composed of the loss function of the CTC decoder and the loss function of the AED decoder. In this way, through joint loss training, the preset model can be helped to converge better, thereby improving the inference accuracy and efficiency of the trained preset model. At the same time, the preset model includes a structure for downsampling each set of nanopore sequencing training signals before encoding and upsampling them after encoding, thereby effectively improving the inference speed of the trained preset model. In this way, based on the joint loss training and configuring the upsampling and downsampling structure in the preset model, the training speed and training effect of the preset model are effectively improved. The sequencing model determined by the preset model corresponding to the preset model when the preset termination condition is reached has good inference speed and inference accuracy, which can overcome the shortcomings of existing nanopore sequencing algorithms and break through the bottleneck of existing algorithms. Then, the sequencing model is used to process the nanopore sequencing signals to quickly and accurately perform base recognition and obtain the base sequence corresponding to the nanopore sequencing signals, thereby achieving high-precision and fast nanopore sequencing.
[0119] In one possible implementation, the preset model includes: a shared encoder, a connectionist temporal classification CTC decoder and an attention decoder; wherein the shared encoder is used to encode each group of nanopore sequencing training signals; the CTC decoder is used to decode the encoding results of the shared encoder based on CTC beam search to obtain the first base sequence corresponding to each group of nanopore sequencing training signals; the attention decoder is used to decode the encoding results of the shared encoder based on the attention mechanism to obtain the second base sequence corresponding to each group of nanopore sequencing training signals; the multiple loss functions include: a loss function of the CTC decoder determined based on the first base sequence corresponding to each group of nanopore sequencing training signals and the standard base sequence, and a loss function of the attention decoder determined based on the second base sequence corresponding to each group of nanopore sequencing training signals and the standard base sequence.
[0120] In one possible implementation, the shared encoder includes one or more of a downsampling layer, an encoding layer, an upsampling layer, or a weighted residual connection layer; wherein the downsampling layer is used to reduce the sampling rate of each group of nanopore sequencing training signals, the encoding layer is used to encode the signal after the sampling rate is reduced, the upsampling layer is used to increase the sampling rate of the output result of the encoding layer, and the weighted residual connection layer is used to perform weighted summation on each group of nanopore sequencing training signals and the output result after the sampling rate is increased to obtain the encoding result of the shared encoder.
[0121] In a possible implementation, the training module 803 is further configured to use the shared encoder and CTC decoder corresponding to when the preset termination condition is reached as the shared encoder and CTC decoder of the sequencing model, respectively.
[0122] above Figure 7 The nanopore sequencing device shown, Figure 8 The technical effects and specific descriptions of the training device for the sequencing model shown and its various possible implementation methods can be found in the methods in the above embodiments and will not be repeated here.
[0123] It should be understood that the division of the modules in the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into a physical entity, or they can be physically separated. In addition, the modules in the device can be implemented in the form of a processor calling software; for example, the device includes a processor, the processor is connected to a memory, and the memory stores instructions. The processor calls the instructions stored in the memory to implement any of the above methods or realize the functions of the modules of the device, wherein the processor is, for example, a general-purpose processor, such as a central processing unit (CPU) or a microprocessor, and the memory is a memory within the device or a memory outside the device. Alternatively, the modules in the device can be implemented in the form of hardware circuits, and the functions of some or all modules can be realized by designing the hardware circuits. The hardware circuit can be understood as one or more processors. For example, in one implementation, the hardware circuit is an application-specific integrated circuit (ASIC), which realizes the functions of some or all of the above modules by designing the logical relationship of the components in the circuit. For another example, in another implementation, the hardware circuit can be implemented by a programmable logic device (PLD). Taking a field programmable gate array (FPGA) as an example, it can include a large number of logic gate circuits, and the connection relationship between the logic gate circuits is configured by configuring the configuration file, thereby realizing the functions of some or all of the above modules. All modules of the above devices can be implemented in the form of software called by the processor, or in the form of hardware circuits, or in part by the form of software called by the processor, and the rest by hardware circuits.
[0124] In the embodiments of the present disclosure, a processor is a circuit capable of processing signals. In one implementation, the processor may be a circuit capable of reading and executing instructions, such as a CPU, a microprocessor, a graphics processing unit (GPU), a digital signal processor (DSP), a neural-network processing unit (NPU), a tensor processing unit (TPU), etc. In another implementation, the processor may implement certain functions through the logical relationship of a hardware circuit, and the logical relationship of the hardware circuit may be fixed or reconfigurable, such as a hardware circuit implemented by an ASIC or PLD, such as an FPGA. In a reconfigurable hardware circuit, the process of the processor loading a configuration document to implement the hardware circuit configuration can be understood as the process of the processor loading instructions to implement the functions of some or all of the above modules.
[0125] It can be seen that each module in the above apparatus can be one or more processors (or processing circuits) configured to implement the above embodiment methods, such as: CPU, GPU, NPU, TPU, microprocessor, DSP, ASIC, FPGA, or a combination of at least two of these processor forms. In addition, each module in the above apparatus can be fully or partially integrated together, or can be implemented independently, without limitation.
[0126] The present disclosure also provides an electronic device, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to implement the method of the above embodiment when executing the instructions. Figure 1 、 Figure 4 or Figure 5 The steps of the method shown.
[0127] Figure 9 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. Figure 9 As shown, the electronic device may include: at least one processor 901 , a communication line 902 , a memory 903 and at least one communication interface 904 .
[0128] The processor 901 can be a general-purpose central processing unit, a microprocessor, a specific application integrated circuit, or one or more integrated circuits for controlling the execution of the program of the disclosed solution; the processor 901 can also include a heterogeneous computing architecture of multiple general-purpose processors, for example, it can be a combination of at least two of a CPU, a GPU, a microprocessor, a DSP, an ASIC, and an FPGA; as an example, the processor 901 can be a CPU+GPU or a CPU+ASIC or a CPU+FPGA.
[0129] Communication link 902 may include a pathway for transmitting information between the aforementioned components.
[0130] The communication interface 904 uses any transceiver or other device for communicating with other devices or communication networks, such as Ethernet, RAN, wireless local area networks (WLAN), etc.
[0131] The memory 903 can be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory can be independent and connected to the processor via a communication line 902. The memory can also be integrated with the processor. The memory provided in the embodiment of the present disclosure can generally have non-volatility. Among them, the memory 903 is used to store computer-executable instructions for executing the disclosed solution, and is controlled by the processor 901 for execution. The processor 901 is used to execute the computer-executable instructions stored in the memory 903, thereby implementing the method provided in the above embodiment of the present disclosure; illustratively, the above Figure 1 、 Figure 4 or Figure 5 The steps of the method shown.
[0132] Optionally, the computer-executable instructions in the embodiments of the present disclosure may also be referred to as application code, which is not specifically limited in the embodiments of the present disclosure.
[0133] Exemplarily, the processor 901 may include one or more CPUs, for example, Figure 9 The processor 901 may also include a CPU, and any one of a GPU, an ASIC, and an FPGA, for example, Figure 9 CPU0+GPU0 or CPU 0+ASIC0 or CPU0+FPGA0 in.
[0134] For example, an electronic device may include multiple processors, such as Figure 9 901 and processor 907 in FIG. Each of these processors can be a single-core (single-CPU) processor, a multi-core (multi-CPU) processor, or a heterogeneous computing architecture including multiple general-purpose processors. A processor here can refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0135] In a specific implementation, as an embodiment, the electronic device may further include an output device 905 and an input device 906. The output device 905 communicates with the processor 901 and can display information in a variety of ways. For example, the output device 905 can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector, etc. For example, it can be a display device such as a vehicle-mounted HUD, an AR-HUD, a display, etc. The input device 906 communicates with the processor 901 and can receive user input in a variety of ways. For example, the input device 906 can be a mouse, a keyboard, a touch screen device, or a sensing device, etc.
[0136] The embodiments of the present disclosure provide a computer-readable storage medium having computer program instructions stored thereon, which implement the method in the above embodiments when the computer program instructions are executed by a processor. Figure 1 、 Figure 4 or Figure 5 The steps of the method shown.
[0137] The embodiments of the present disclosure provide a computer program product, which may include computer-readable code or a non-volatile computer-readable storage medium carrying computer-readable code; when the computer program product is run on a computer, the computer is caused to execute the method in the above embodiment. Figure 1 、 Figure 4 or Figure 5 The steps of the method shown.
[0138] The present disclosure may be a system, method and / or computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0139] A computer-readable storage medium can be a tangible device that can hold and store instructions for use by an instruction execution device. A computer-readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination thereof. As used herein, a computer-readable storage medium is not to be construed as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electric current signal transmitted through an electrical wire.
[0140] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in the computer-readable storage medium in each computing / processing device.
[0141] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, and conventional procedural programming languages such as "C" language or similar programming languages. Computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., utilizing an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions. The electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0142] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.
[0143] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0144] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0145] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction contains one or more executable instructions for realizing the prescribed logical function. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the prescribed function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0146] 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 nanopore sequencing method, characterized in that: The method comprises: Acquire nanopore sequencing signals; The nanopore sequencing signal is input into a sequencing model for base recognition to obtain a base sequence corresponding to the nanopore sequencing signal; wherein the sequencing model is a model obtained by jointly training a preset model through multiple loss functions, and the sequencing model includes a structure for downsampling the nanopore sequencing signal before encoding and upsampling it after encoding: the preset model includes: a shared encoder, a connectionist temporal classification (CTC) decoder, and an attention decoder; wherein the shared encoder is used to encode each group of nanopore sequencing training signals; the CTC decoder is used to decode the encoding results of the shared encoder based on CTC beam search to obtain a first base sequence corresponding to each group of nanopore sequencing training signals; the attention decoder is used to decode the encoding results of the shared encoder based on an attention mechanism to obtain a second base sequence corresponding to each group of nanopore sequencing training signals; the multiple loss functions include: a loss function of the CTC decoder determined based on the first base sequence corresponding to each group of nanopore sequencing training signals and a standard base sequence, and a loss function of the attention decoder determined based on the second base sequence corresponding to each group of nanopore sequencing training signals and the standard base sequence.
2. The method according to claim 1, characterized in that The sequencing model includes: the shared encoder and the CTC decoder, wherein the shared encoder is used to encode the nanopore sequencing signal; and the CTC decoder is used to decode the encoding result of the shared encoder based on CTC beam search to obtain the base sequence corresponding to the nanopore sequencing signal.
3. The method according to claim 2, characterized in that The shared encoder includes a downsampling layer, an encoding layer, and an upsampling layer; or, the shared encoder includes a downsampling layer, an encoding layer, an upsampling layer, and a weighted residual connection layer; wherein the downsampling layer is used to reduce the sampling rate of the nanopore sequencing signal, the encoding layer is used to encode the signal after the sampling rate is reduced, the upsampling layer is used to increase the sampling rate of the output result of the encoding layer, and the weighted residual connection layer is used to perform weighted summation on the nanopore sequencing signal and the output result after the sampling rate is increased to obtain the encoding result of the shared encoder.
4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: segmenting the nanopore sequencing signal to obtain multiple signal segments; Inputting the nanopore sequencing signal into a sequencing model for base recognition to obtain a base sequence corresponding to the nanopore sequencing signal includes: Inputting each signal segment of the multiple signal segments into the sequencing model for base recognition to obtain the base sequence corresponding to each signal segment; The base sequences corresponding to the various signal segments are spliced together to obtain the base sequence corresponding to the nanopore sequencing signal.
5. A method for training a sequencing model, characterized in that: The method comprises: Acquire training data; wherein the training data includes: multiple sets of nanopore sequencing training signals and standard base sequences corresponding to each set of nanopore sequencing training signals; Inputting each set of nanopore sequencing training signals into a preset model to obtain sequencing results corresponding to each set of nanopore sequencing training signals; wherein the preset model includes a structure for downsampling each set of nanopore sequencing training signals before encoding and upsampling each set of nanopore sequencing training signals after encoding; Based on the sequencing results and the corresponding standard base sequences corresponding to each set of nanopore sequencing training signals, the preset model is jointly trained using multiple loss functions until a preset termination condition is reached, and a sequencing model is determined based on the preset model corresponding to the preset termination condition, wherein the sequencing model is used to perform base recognition on the nanopore sequencing signal to obtain a base sequence corresponding to the nanopore sequencing signal; In which, the preset model includes: a shared encoder, a connectionist temporal classification CTC decoder and an attention decoder; wherein, the shared encoder is used to encode each group of nanopore sequencing training signals; the CTC decoder is used to decode the encoding results of the shared encoder based on CTC beam search to obtain the first base sequence corresponding to each group of nanopore sequencing training signals; the attention decoder is used to decode the encoding results of the shared encoder based on the attention mechanism to obtain the second base sequence corresponding to each group of nanopore sequencing training signals; the multiple loss functions include: a loss function of the CTC decoder determined based on the first base sequence corresponding to each group of nanopore sequencing training signals and the standard base sequence, and a loss function of the attention decoder determined based on the second base sequence corresponding to each group of nanopore sequencing training signals and the standard base sequence.
6. The method according to claim 5, characterized in that The shared encoder includes a downsampling layer, an encoding layer, and an upsampling layer; or, the shared encoder includes a downsampling layer, an encoding layer, an upsampling layer, and a weighted residual connection layer; wherein the downsampling layer is used to reduce the sampling rate of each group of nanopore sequencing training signals, the encoding layer is used to encode the signal after the sampling rate is reduced, the upsampling layer is used to increase the sampling rate of the output result of the encoding layer, and the weighted residual connection layer is used to perform weighted summation on each group of nanopore sequencing training signals and the output result after the sampling rate is increased to obtain the encoding result of the shared encoder.
7. The method according to claim 5 or 6, characterized in that Determining the sequencing model according to the preset model corresponding to when the preset termination condition is reached includes: The shared encoder and CTC decoder corresponding to when the preset termination condition is reached are used as the shared encoder and CTC decoder of the sequencing model, respectively.
8. An electronic device, 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 4 or any one of claims 5 to 7 when executing the instructions stored in the memory.
9. A 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 4 or any one of claims 5 to 7 is implemented.