WO2026000404A1 - 碱基识别方法、碱基识别模型训练方法及电子设备 - Google Patents
碱基识别方法、碱基识别模型训练方法及电子设备Info
- Publication number
- WO2026000404A1 WO2026000404A1 PCT/CN2024/102675 CN2024102675W WO2026000404A1 WO 2026000404 A1 WO2026000404 A1 WO 2026000404A1 CN 2024102675 W CN2024102675 W CN 2024102675W WO 2026000404 A1 WO2026000404 A1 WO 2026000404A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- preset
- signal data
- dimension
- historical
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/27—Regression, e.g. linear or logistic regression
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
- G06N3/0455—Auto-encoder networks; Encoder-decoder networks
-
- G—PHYSICS
- G16—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
- G16B—BIOINFORMATICS, i.e. INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR GENETIC OR PROTEIN-RELATED DATA PROCESSING IN COMPUTATIONAL MOLECULAR BIOLOGY
- G16B20/00—ICT specially adapted for functional genomics or proteomics, e.g. genotype-phenotype associations
- G16B20/30—Detection of binding sites or motifs
Definitions
- This application relates to the field of biomedical technology, specifically to a base recognition method, a base recognition model training method, and an electronic device.
- Nanopore sequencing is a high-throughput sequencing method based on single-molecule current measurement. It utilizes nanopores made of proteins or solid materials to guide deoxyribonucleic acid (DNA) and/or ribonucleic acid (RNA) molecules one by one through the pores.
- the electrical signal data corresponding to the DNA and/or RNA is obtained as signal data. By analyzing the signal data, the base sequence of the DNA and/or RNA can be deduced.
- An embodiment of this application provides a base identification method, the method comprising: performing a first preprocessing on signal data to obtain first preprocessed data; inputting the first preprocessed data into a pre-trained base identification model, using the base identification model to extract features from the first preprocessed data to obtain data features of the first preprocessed data; inputting the data features into a preset decoder, using the decoder to decode the data features to obtain the base sequence corresponding to the signal data.
- the method further includes acquiring the signal data, including: acquiring electrical signal data obtained by nanopore sequencing of deoxyribonucleic acid (DNA) or ribonucleic acid (RNA), the electrical signal data including multiple electrical signal amplitude data that vary over time; and using the electrical signal data as the signal data.
- acquiring the signal data including: acquiring electrical signal data obtained by nanopore sequencing of deoxyribonucleic acid (DNA) or ribonucleic acid (RNA), the electrical signal data including multiple electrical signal amplitude data that vary over time; and using the electrical signal data as the signal data.
- the first preprocessing includes: normalizing multiple electrical signal amplitude data in the signal data, using the normalized signal data as updated signal data; determining the offset value of a first numerical sequence within a preset window length range in the updated signal data based on a sliding window algorithm, and updating the first numerical sequence accordingly based on the offset value to obtain the first preprocessed data.
- the base recognition model includes a convolutional module, the convolutional module comprising a plurality of sequentially connected convolutional layers.
- the convolutional layer wherein the stride of the last convolutional layer of the convolutional module is related to the length of the first preprocessed data and the number of bases contained in the longest base sequence label in the dataset.
- the (input length, input dimension, output dimension, stride) of the first convolutional layer is represented as (L,
- the base recognition model includes a Conformer encoding module, which includes a feedforward neural network.
- the feedforward neural network includes an upsampling fully connected layer and a downsampling fully connected layer, wherein: the upsampling fully connected layer is used to upsample the feature data output by the convolutional module based on a preset upsampling ratio to obtain feature data of a preset dimension; the downsampling fully connected layer is used to downsample the feature data of the preset dimension to restore the feature data of the preset dimension to the dimension of the feature data output by the convolutional module.
- the preset decoder includes a Connection Timing Classification (CTC) decoder.
- CTC Connection Timing Classification
- An embodiment of this application provides a method for training a base recognition model.
- the method includes: collecting sample data; performing a second preprocessing on the sample data to obtain preprocessed sample data; and training a preset model based on the preprocessed sample data to obtain a base recognition model that meets preset requirements.
- the sample data includes multiple historical signal data
- the second preprocessing includes: identifying abnormal data in the sample data, removing abnormal data from the multiple historical signal data to obtain multiple filtered historical signal data; normalizing each of the multiple filtered historical signal data, and using each normalized filtered historical signal data as updated historical signal data; determining the offset value of a second numerical sequence within a preset window length range in the updated historical signal data based on a sliding window algorithm, and updating the second numerical sequence accordingly based on the offset value to obtain the second preprocessed historical signal data.
- the method further includes acquiring the historical signal data, including: acquiring historical electrical signal data obtained by nanopore sequencing of historical deoxyribonucleic acid (DNA) or historical ribonucleic acid (RNA), wherein the historical electrical signal data includes electrical signal amplitude data that varies over time; and using the historical electrical signal data as the historical signal data.
- acquiring historical electrical signal data obtained by nanopore sequencing of historical deoxyribonucleic acid (DNA) or historical ribonucleic acid (RNA), wherein the historical electrical signal data includes electrical signal amplitude data that varies over time; and using the historical electrical signal data as the historical signal data.
- determining the abnormal data in the sample data includes: normalizing the multiple electrical signal amplitudes of each historical signal data in the plurality of historical signal data based on a preset kurtosis algorithm; determining the kurtosis value of each historical signal data after normalization; and taking the historical signal data corresponding to the kurtosis value that is less than a preset kurtosis threshold as abnormal data.
- the preset model includes an improved Conformer encoding module, which includes a feedforward neural network.
- the feedforward neural network includes an upsampling fully connected layer and a downsampling fully connected layer, wherein: the upsampling fully connected layer is used to upsample the feature data output by the convolutional module based on a preset upsampling ratio to obtain feature data of a preset dimension; the downsampling fully connected layer is used to downsample the feature data of the preset dimension to restore the feature data of the preset dimension to the dimension of the feature data output by the convolutional module.
- the preset requirement includes a combination of one or more of the following requirements: the average accuracy of the model prediction results obtained by the preset model is greater than a preset accuracy threshold; the median accuracy of the model prediction results obtained by the preset model is greater than a preset median threshold; and the total time consumed by the preset model to predict a preset number of historical data sequences is less than a preset duration threshold.
- An embodiment of this application provides a base recognition device, the device comprising: a preprocessing module for performing a first preprocessing on signal data to obtain first preprocessed data; a feature extraction module for inputting the first preprocessed data into a pre-trained base recognition model, and using the base recognition model to extract features from the first preprocessed data to obtain data features of the first preprocessed data; and a decoding module for inputting the data features into a preset decoder, and using the decoder to decode the data features to obtain the base sequence corresponding to the signal data.
- An embodiment of this application provides an electronic device, which includes a processor and a memory.
- the processor is used to execute a computer program stored in the memory to implement the base recognition method or the base recognition model training method.
- Embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the base recognition method or the base recognition model training method.
- the base recognition method described in this application improves the efficiency and accuracy of base recognition by performing a first preprocessing on the signal data to normalize the data and remove low-frequency offset amplitudes, using a pre-trained base recognition model to extract features from the first preprocessed data, and then using a preset decoder to decode the extracted features.
- the base recognition model is trained using the base recognition model training method provided in this application embodiment.
- a second preprocessing on the sample data to filter noise, normalize the data, and remove low-frequency offset amplitudes, followed by training the preset model using the second preprocessed sample data improves the model's training efficiency and prediction accuracy, thereby increasing the accuracy of base recognition.
- Figure 1 is a structural diagram of an electronic device provided in an embodiment of this application.
- Figure 2 is a flowchart of a base recognition method provided in an embodiment of this application.
- Figure 3 is a schematic diagram illustrating the principle of a sliding window algorithm provided in an embodiment of this application.
- Figure 4 is a structural example diagram of a base recognition model provided in an embodiment of this application.
- Figure 5 is a flowchart of a base recognition model training method provided in an embodiment of this application.
- Figure 6 is an example diagram of the signal peak distribution provided in an embodiment of this application.
- Figure 7 is an example diagram of the verification results of the base recognition model provided in an embodiment of this application.
- Figure 8 is an example diagram of a data loading process provided in an embodiment of this application.
- Figure 9 is a structural diagram of a base recognition device provided in an embodiment of this application.
- nanopore sequencing is a high-throughput sequencing method based on single-molecule current measurement. It utilizes nanopores made of proteins or solid materials to guide deoxyribonucleic acid (DNA) and/or ribonucleic acid (RNA) molecules one by one through the pores, and measures the current as different bases in the DNA and/or RNA pass through the pores to obtain the corresponding electrical signal data of DNA and/or RNA as signal data. By analyzing the signal data, the base sequence of DNA and/or RNA can be inferred.
- DNA deoxyribonucleic acid
- RNA ribonucleic acid
- nanopore sequencing technology uses biological nanopores such as protein nanopores
- a nucleic acid sequence e.g., DNA or RNA
- the nanopore acts as a signal sensor while simultaneously controlling the perforation of nucleic acids.
- the magnitude of the detected electrical signal is generally positively correlated with the space occupied by the analyte nucleotide within the nanopore. Due to the instability of biological nanopores, their function as signal sensors is limited to a relatively narrow range of voltage and temperature, and the signal-to-noise ratio of the detected electrical signal data is relatively low. Furthermore, because it is difficult to mass-produce solid-state nanopores, although solid-state nanopores are more stable than biological nanopores, biological nanopores are more widely used.
- An event detector is used to extract the effective electrical signal from the raw sequencing electrical signal for base recognition and segment the effective electrical signal data into time series with approximate numerical characteristics, i.e., events.
- Each event consists of features such as the mean, standard deviation, start time, and length of the electrical signal data. Ideally, each base entering the nanopore generates a new event.
- the event detector may encounter the following issues when segmenting and generating event data: Two error scenarios: (a) The event detector incorrectly splits the raw sequencing electrical signal data corresponding to a base into two events (i.e., only one base generates two events through the nanopore), in which case the corresponding base identification result will produce a base insertion error; (b) The event detector generates one event from the raw data points of two bases (i.e., two consecutive bases generate one event through the nanopore), in which case the identification result will produce a deletion error.
- HMMs Hidden Markov Models
- nanopore signal data contains long-term dependencies, making it difficult for HMMs to capture these long-term dependencies.
- HMMs are based on prior models of known nucleic acid sequences, which may lead to higher error rates when processing unknown base sequences.
- LSTM Long Short-Term Memory
- deep learning methods in related technologies generally use simple data normalization methods (such as min-max normalization, Z-score normalization, etc.) as preprocessing techniques.
- simple data normalization methods such as min-max normalization, Z-score normalization, etc.
- these normalization methods only use global amplitude offset and scaling, and cannot remove the low-frequency amplitude offset that exists in long electrical signal sequences.
- the relevant technologies suffer from low base recognition accuracy due to factors such as dispersed distribution of electrical signal features, noise in training data, and insufficient model fitting and memory capabilities.
- this application provides a base identification method.
- a pre-trained base identification model is used to extract features from the pre-processed data.
- a preset decoder is then used to decode the extracted features, thereby improving the efficiency and accuracy of base identification.
- the base identification model is trained using the method provided in this application.
- a second preprocessing step on the sample data is performed to filter noise, normalize the data, and remove low-frequency offset amplitudes.
- the preset model is then trained using the second pre-processed sample data, which improves the model's training efficiency and prediction accuracy, thus enhancing the accuracy of base identification.
- FIG. 1 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
- the electronic device 10 can be a computer, server, mobile phone, tablet computer, laptop computer, cloud server, cloud computer, or other electronic devices.
- This application embodiment does not impose any restrictions on the specific type of electronic device.
- the electronic device 10 may include a communication module 101, a memory 102, a processor 103, an input/output (I/O) interface 104, and a bus 105.
- the processor 103 is coupled to the communication module 101, the memory 102, and the I/O interface 104 via the bus 105.
- Communication module 101 may include a wired communication module and/or a wireless communication module.
- the wired communication module may provide one or more wired communication solutions such as Universal Serial Bus (USB) and Controller Area Network (CAN).
- the wireless communication module may provide wireless fidelity (Wi-Fi), Bluetooth (BT), mobile communication networks, frequency modulation (FM), and near-field communication technologies.
- Wi-Fi wireless fidelity
- BT Bluetooth
- FM frequency modulation
- NFC Near Field Communication
- IR infrared
- Memory 102 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
- RAM random access memories
- NVM non-volatile memories
- the RAM can be directly read and written by the processor 103 and can be used to store executable programs (e.g., machine instructions) of the operating system or other running programs, as well as user and application data.
- the RAM may include static random-access memory (SRAM), dynamic random-access memory (DRAM), synchronous dynamic random-access memory (SDRAM), double data rate synchronous dynamic random-access memory (DDR SDRAM), etc.
- Non-volatile memory can also store executable programs and user and application data, and can be pre-loaded into random access memory for direct reading and writing by the processor 103.
- Non-volatile memory can include disk storage devices and flash memory.
- the memory 102 is used to store one or more computer programs.
- the one or more computer programs are configured to be executed by the processor 103.
- the one or more computer programs include multiple instructions that, when executed by the processor 103, can implement a base recognition method that is executed on the electronic device 10.
- the electronic device 10 further includes an external memory interface for connecting to an external memory to expand the storage capacity of the electronic device 10.
- Processor 103 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and/or a neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.
- AP application processor
- GPU graphics processing unit
- ISP image signal processor
- DSP digital signal processor
- NPU neural network processing unit
- the processor 103 provides computing and control capabilities; for example, the processor 103 is used to execute computer programs stored in the memory 102 to implement the base recognition method described above.
- I/O interface 104 is used to provide a channel for user input or output.
- I/O interface 104 can be used to connect various input/output devices, such as a mouse, keyboard, touch device, display screen, etc., so that users can enter information or visualize information.
- I/O interface 104 can also be used to provide a data transmission channel with nanopore sequencing equipment, so that electronic devices can obtain signal data (e.g., electrical signals) from nanopore sequencing equipment.
- Bus 105 is used at least to provide a channel for communication between communication modules 101, memory 102, processor 103, and I/O interface 104 in electronic device 10.
- the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 10.
- the electronic device 10 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements.
- the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
- FIG 2 is a flowchart of a base recognition method provided in an embodiment of this application.
- the base recognition method is applied in an electronic device, such as the electronic device 10 in Figure 1, and specifically includes the following steps. Depending on different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
- signal data is first acquired based on an event detector to identify the base sequence.
- the acquisition of signal data includes at least: acquiring electrical signal data obtained from nanopore sequencing of deoxyribonucleic acid (DNA) or ribonucleic acid (RNA), and using this electrical signal data as the signal data.
- the electrical signal data includes multiple electrical signal amplitude data that vary over time.
- the electronic device can acquire electrical signal data obtained from sequencing DNA or RNA from the event detector as signal data according to the sampling frequency of the event detector. For example, if the sampling frequency of the event detector is 5000 samples/sec, that is, the event detector outputs an electrical signal data with a fixed data length of 5000 per second, the electronic device can acquire the electrical signal data per second as signal data.
- the electrical signal data can represent the electrical signal data obtained in the current sequencing process, or it can be historical electrical signal data, such as the electrical signal data of a previously completed sequencing process.
- signal data can be regarded as a one-dimensional data vector or sequence composed of multiple electrical signal amplitudes.
- the value of n can be set according to actual needs, and this application does not impose specific restrictions on it. For example, the value of n is 5000.
- the first preprocessing of the signal data may include, but is not limited to: normalizing multiple electrical signal amplitude data in the signal data, using the normalized signal data as updated signal data; determining the offset value of a first numerical sequence within a preset window length range in the updated signal data based on a sliding window algorithm, and updating the first numerical sequence accordingly based on the offset value to obtain the first preprocessed data.
- the signal data can be normalized based on the median, and the formula used for normalization may include:
- median(z) represents the median of z
- s represents the normalized signal data (i.e., the updated signal data)
- n represents the total length of the signal data.
- the value of n can be set according to actual needs, and this application does not impose specific restrictions on it. For example, the value of n can be 5000.
- the low-frequency offset value within each preset window of the updated signal data is calculated based on a sliding window algorithm, using the following formula:
- the offset value of the first numerical sequence within the window's length range at that position is calculated.
- the corresponding offset value is subtracted from each data point in the first numerical sequence within each range, thus updating the first numerical sequence within the window.
- the first preprocessed data is obtained.
- the sliding window algorithm is equivalent to performing a more refined normalization process on the updated signal data.
- the first preprocessing can also be normalization, standardization, offset removal, or noise reduction.
- the preprocessing of sample data during training includes normalization and offset removal, performing similar preprocessing in this application can improve the prediction accuracy of the model's inference application.
- the first preprocessed data is input into a pre-trained base recognition model, and the base recognition model is used to extract features from the first preprocessed data to obtain the data features of the first preprocessed data.
- the base recognition model includes at least a convolutional module (e.g., an adaptive stride convolutional module) and an improved Conformer encoding module (e.g., as shown in Figure 4).
- the adaptive stride convolutional module may include a preset first number of one-dimensional convolutional layers (1D Convolutional Neural Network, 1D-CNN/1D-conv) for feature extraction from the first preprocessed data.
- the preset first number can be set according to actual needs or determined through parameter optimization during model training.
- the preset first number can be determined to be 3 (e.g., as shown in Figure 4), indicating that the model obtained by stacking 3 1D-CNNs in the adaptive stride convolutional module has the best performance.
- 1D-CNN can use trained convolutional kernels to perform convolution operations on the first preprocessed data within the window, thereby achieving local perception and feature extraction of the input data within the window, and then mapping the extracted features to the next layer.
- the convolutional module includes multiple sequentially connected convolutional layers.
- the stride step of the last convolutional layer of the convolutional module data length L of each historical signal data in the sample data / number of bases l in the longest base sequence label in the dataset.
- dataset refers to the model training dataset.
- the dataset may include multiple historical signal datasets, each of which can be a 1*5000 dimension vector.
- A represents adenine
- T represents thymine
- G represents guanine
- C represents cytosine.
- the convolutional module includes a first convolutional layer, a second convolutional layer, and a third convolutional layer connected in sequence.
- the input data is a 5000*1 matrix, meaning each of the 5000 electrical signal values has a dimension of 1; the output dimension is 4, meaning the output matrix is a 5000*4 matrix, with each electrical signal value having a 4-dimensional dimension.
- Each convolutional kernel in the first convolutional layer is 1*1 in size, and the number of kernels is 1*4, where 1 represents the number of input channels, 4 represents the number of output channels, and the stride is 1.
- the input data is a 5000*4 matrix, meaning each of the 5000 electrical signal values has a dimension of 4; the output dimension is 16, meaning the output matrix is a 5000*16 matrix, with each electrical signal value having a 16-dimensional dimension.
- Each convolutional kernel in the second convolutional layer is 1*1 in size, and there are 4*16 kernels, where 4 represents the number of input channels, 16 represents the number of output channels, and the stride is 1.
- the input length, input dimension, output dimension, and stride of the third convolutional layer can be represented as (5000, 16, 16, step).
- the input data is a 5000*16 matrix, meaning each of the 5000 electrical signal values has a dimension of 16; the output dimension is 16, meaning the output matrix is a 5000*16 matrix, with each electrical signal value having a 16-dimensional dimension.
- Each convolutional kernel in the third convolutional layer is 1*step in size, and there are 16*16 kernels, where 16 represents the number of input channels and 16 represents the number of output channels.
- an activation layer can be connected after each 1D-CNN.
- This activation layer can use a predefined activation function (e.g., the Gelu (Gaussian Error Linear Unit) function) to perform element-wise nonlinear mapping on the feature representation output by the 1D-CNN, thereby learning more complex and nonlinear feature representations and improving the model's feature prediction and expressive capabilities.
- the Gelu function combines the characteristics of the Gaussian distribution with the nonlinear properties of the sigmoid function, achieving a smooth, continuous, and differentiable nonlinear transformation. It compresses the negative part while maintaining the positive part of the input and preserves high numerical stability, thus better handling the vanishing and exploding gradient problems and improving model performance.
- other activation functions or approximate Gelu function formulas such as the Fast Gelu function, can be used to reduce computational complexity and improve the efficiency of nonlinear mapping.
- the Conformer encoding module is a model structure that combines Convolutional Neural Network (CNN) and Transformer.
- a typical Conformer encoding module mainly consists of the following key components: (1) Feedforward module: usually includes linear normalization layer and activation layer, used to perform preliminary processing and transformation on the input data. For example, the feedforward module can adopt a macaron-like structure, that is, the two feedforward layers are connected by residual connections, which helps to alleviate the gradient vanishing problem in deep neural networks; (2) Native multi-head attention mechanism module: can perform self-attention on different positions in the input sequence. Adaptive weighting is used to obtain the importance of each position.
- the multi-head self-attention module can use relative position encoding technology to enable the model to capture the structural information in the input sequence more accurately.
- Relative position encoding is obtained by calculating the relative relationship between different positions in the input sequence, which helps the model to better generalize to inputs of different lengths;
- Native convolution operation module responsible for capturing local features of input data.
- the convolution module can include gating mechanisms (such as pointwise convolution and gated linear units), one-dimensional deep convolutional layers, and batch normalization operations;
- Linear normalization layer can be used in various parts of the Conformer encoding module. Operations such as residual connections and layer normalization are used to enhance the stability and training efficiency of the model. Residual connections help alleviate the gradient vanishing problem in deep neural networks, while layer normalization can make the training process of the model more stable.
- N a second preset number
- the feedforward neural network in the improved Conformer encoding module adds an upsampling fully connected layer and a downsampling fully connected layer.
- the upsampling fully connected layer upsamples the feature data output by the adaptive stride convolution module based on a preset upsampling ratio to obtain feature data of a preset dimension.
- the downsampling fully connected layer downsamples the feature data of the preset dimension, restoring the feature data of the preset dimension to the dimension of the feature data output by the adaptive stride convolution module.
- the upsampling fully connected layer enhances the model's feature perception capability, thereby obtaining more feature parameters; the downsampling fully connected layer scales the data to a preset dimension.
- the feature dimension before upsampling is the output dimension of the third convolutional layer (L/step, batch size, 16).
- the feature dimension after upsampling is (L/step, batch size, r*16), and after downsampling, it is restored to (L/step, batch size, 16).
- L represents the length of the input data (e.g., 50000)
- l represents the number of bases contained in the longest base sequence label in the dataset
- batch size represents the number of input data that the model network can process in one forward and backward propagation.
- the normalized feature vector output by the improved Conformer module is activated by a Softmax layer to obtain the data features of the first preprocessed data.
- the data features can be represented as a probability matrix with L/step rows and 4 ⁇ k columns, where k is the k-mer value, such as 3.
- each probability value in the model's output probability matrix corresponds to the probability of a k-mer at the current time step.
- the base sequence label is GTCACC
- the k-mer encoding is [GTC, TCA, CAC, ACC].
- J a label of length
- J-2 e.g., 4
- the Conformer model of the base recognition model can be further fine-tuned, for example, by adjusting the number of network layers and the parameters of the hidden layers.
- the data features are input into a preset decoder, and the data features are decoded by the decoder to obtain the base sequence corresponding to the signal data.
- the preset decoder includes a Connectionist Temporal Classification decoder (CTC decoder). Since the decoder of the base recognition model is tasked with outputting the classification result (e.g., base sequence) of the bases corresponding to the entire signal data based on the data features of the first preprocessed data, and the data features of the first preprocessed data may differ in dimension from the base recognition result, a CTC decoder capable of handling cases where the input (e.g., the data features of the first preprocessed data) and the label (e.g., the base sequence) are not perfectly aligned can be used as the decoder of the base recognition model, thereby improving the model's recognition accuracy and robustness.
- CTC decoder Connectionist Temporal Classification decoder
- the contextual feature vector of each time step of the signal data For example, if the signal data is obtained from DNA sequencing, the contextual feature vector of each time step of the signal data. With a dimension of 768, decoding and classifying multiple contextual feature vectors of signal data yields a base sequence composed of the following four bases: adenine (A), thymine (T), guanine (G), and cytosine (C).
- This base sequence can be considered as a label for the signal data or multiple contextual feature vectors of the signal data.
- the dimension of the label may differ from the total dimension of the multiple contextual feature vectors (e.g., the dimension of the label is much smaller than the total dimension of the multiple contextual feature vectors). In such cases, a decoder capable of handling decoding operations where the input and label are not perfectly aligned is required.
- the CTC decoder when it decodes and classifies the data features, it introduces a special blank marker (or placeholder) and uses algorithms such as beam search or Viterbi to explore multiple candidate classification results at each time step. Based on the probability distribution and the decoder's parameters, the multiple candidate classification results are aggregated, and the classification result with the highest probability is selected to obtain the base sequence corresponding to the signal data. For example, if the signal data is obtained from DNA sequencing, the multiple candidate classification results include: adenine (A), thymine (T), guanine (G), cytosine (C), and a placeholder.
- the placeholder is used to address the problem that the dimension of the input (e.g., multiple context feature vectors) is larger than the dimension of the label (e.g., the base sequence).
- the base identification method obtained in several embodiments of this application obtains model input data by normalizing signal data and removing low-frequency assignment offsets, extracts features from the input data using a base identification model, and then decodes the data features using a decoder, which can improve the accuracy of identifying the base sequence of signal data.
- FIG. 5 a flowchart of a base recognition model training method provided in an embodiment of this application is shown.
- the base recognition model training method is applied to an electronic device, such as the electronic device 10 in Figure 1, and specifically includes the following steps. Depending on different requirements, the order of the steps in this flowchart can be changed, and some steps can be omitted.
- S301 Collect sample data, perform a second preprocessing on the sample data, and obtain the second preprocessed sample data.
- the sample data includes multiple historical signal data
- the method further includes acquiring the historical signal data, including: acquiring historical electrical signal data obtained by nanopore sequencing of historical deoxyribonucleic acid (DNA) or historical ribonucleic acid (RNA), wherein the historical electrical signal data includes electrical signal amplitude data that varies over time; and using the historical electrical signal data as the historical signal data.
- the electronic device can collect multiple historical electrical signal data corresponding to multiple events detected by the event detector as the multiple historical signal data, wherein each historical electrical signal data corresponds to a historical DNA or historical RNA.
- the method may further include: obtaining the true base sequence of the historical DNA or the historical RNA corresponding to the historical electrical signal data; and using the true base sequence as a label for the corresponding historical electrical signal data to obtain labeled historical signal data.
- the second preprocessing method used in the model training process differs from the first preprocessing method used in the model inference process.
- the second preprocessing includes: identifying outlier data in the sample data; removing outlier data from the plurality of historical signal data to obtain a plurality of filtered historical signal data; normalizing each of the plurality of filtered historical signal data; using each normalized filtered historical signal data as updated historical signal data; and based on a sliding window algorithm, determining the offset value of a second numerical sequence within each preset window length range in the updated historical signal data, and updating the second numerical sequence accordingly based on the offset value to obtain the first... Second, the historical signal data after preprocessing.
- determining the abnormal data in the sample data includes: normalizing the multiple electrical signal amplitudes of each historical signal data in the plurality of historical signal data based on a preset kurtosis algorithm; determining the kurtosis value of each historical signal data after normalization; and taking the historical signal data corresponding to the kurtosis value that is less than a preset kurtosis threshold as abnormal data.
- the kurtosis algorithm may include a fourth-order standard moment algorithm, the formula of which includes:
- FFT Fast Fourier Transform
- the value of n can be set according to actual needs, and this application does not impose specific restrictions on it. For example, the value of n can be 5000.
- the preset kurtosis threshold can be set according to actual needs, and this application does not impose specific restrictions on it. For example, if the preset kurtosis threshold is 0.6, then the frequency domain data corresponding to historical signal data with K ⁇ 0.6 can be filtered as abnormal data.
- FIG. 6 there are example diagrams of the frequency domain data distribution corresponding to invalid signals of abnormal data (e.g., abnormal electrical signal data corresponding to abnormal hole states) and the frequency domain data distribution corresponding to valid signals of normal data provided in the embodiments of this application.
- the horizontal axis represents kurtosis, and the vertical axis represents the number of samples.
- the kurtosis distribution of the frequency domain data corresponding to invalid signals is concentrated in the part less than 0.6, and the kurtosis distribution of the frequency domain data corresponding to valid signals is concentrated in the part greater than or equal to 0.6. Therefore, the frequency domain data corresponding to historical signal data with K ⁇ 0.6 can be regarded as abnormal data.
- the peak threshold can also be adjusted automatically using an algorithm.
- the second preprocessing is equivalent to filtering out abnormal data in the sample data before the first preprocessing.
- the subsequent normalization processing and the offset removal method based on the sliding window algorithm are similar to the methods used in the first preprocessing, and will not be described again here.
- data that the event detector failed to filter out can be filtered out, such as electrical signal data corresponding to non-base sequences.
- electrical signal data corresponding to non-base sequences For example, it could be abnormal electrical signal data corresponding to abnormal pore states caused by blockage when nucleic acids pass through biological nanopores, thereby improving the quality of training samples and thus improving the accuracy of the model.
- the model can focus more on the inherent patterns and relationships within the signal data, rather than being influenced by the magnitude of the signal data values. This helps improve the model's generalization ability and prediction accuracy. This allows the model to better adapt to new data and unknown situations; in addition, it can adjust the signal data to a suitable numerical range, thereby accelerating the model's convergence process and improving model training efficiency.
- a supervised training method can be used to train a preset model based on the second preprocessed sample data.
- the preset model can be iteratively updated at least once using the second preprocessed sample data.
- the data of the batch corresponding to each update in the second preprocessed sample data can be used for the update. If the preset model obtained by the update does not meet the preset requirements, the data in the first set of the next batch is used for the next update until a preset model that meets the preset requirements is obtained as the base recognition model.
- the preset requirements may include, but are not limited to, a combination of one or more of the following requirements: the loss function corresponding to the preset model reaches a preset convergence condition; the number of iterations updated at least once reaches a preset iteration number threshold; the average accuracy of the model prediction results obtained by the preset model is greater than a preset accuracy threshold; the median accuracy of the model prediction results obtained by the preset model is greater than a preset median threshold; and the total time consumed by the preset model to predict a preset number of historical data sequences is less than a preset duration threshold.
- the results of validating the base recognition model using 1318 validation set data are shown in Figure 7.
- the base recognition model includes a convolutional module (e.g., an adaptive stride convolutional module) and an improved Conformer encoding module (e.g., as shown in Figure 4).
- the adaptive stride convolutional module includes a first convolutional layer, a second convolutional layer, and a third convolutional layer.
- the (input length, input dimension, output dimension, stride) of the first convolutional layer is represented as (L, 1, 4, 1), where L represents the data length of each historical signal data in the sample data.
- the (input length, input dimension, output dimension, stride) of the second convolutional layer is represented as (L, 4, 16, 1).
- the base recognition model training method provided in this application proposes a preprocessing method for the base call scenario, which solves the problem that current global amplitude shift and scaling processing methods cannot remove the low-frequency amplitude shift of long electrical signal sequences.
- the receptive field and stride of the one-dimensional convolution are determined according to k-mer and the ratio of electrical signal length to the actual number of bases.
- an optimized Conformer structure is proposed to solve the problems of insufficient feature representation ability and lack of parallel computing support when using LSTM in the base call process. This improves the data parallel computing capability and data feature acquisition capability, thereby improving the accuracy of base call.
- the hardware environment and software development environment used during model training in this application embodiment can Examples are shown in Table 1 below:
- GPU graphics processing unit
- CPU central processing unit
- Figure 8 is an example diagram of a data loading process provided in an embodiment of this application.
- This application uses a multi-machine, multi-GPU data loading method, where worker is a data loading process, different blocks represent non-repeating training data, and the number of GPUs is n.
- Figure 9 is a structural diagram of a base recognition device provided in an embodiment of this application.
- the base recognition device 70 may include a plurality of functional modules composed of computer program segments.
- the computer programs of each program segment in the base recognition device 70 may be stored in the memory of an electronic device and executed by at least one processor to perform the function of base recognition (see FIG2 for details).
- the base recognition device 70 can be divided into multiple functional modules according to its functions. These functional modules may include: a preprocessing module 701, a feature extraction module 702, and a decoding module 703.
- the term "module” in this application refers to a series of computer program segments that can be executed by at least one processor and perform a fixed function, and which are stored in memory.
- the functional implementation of each module in the base recognition device 70 can be found in the above description of the base recognition method, and will not be repeated here.
- the preprocessing module 701 is used to perform a first preprocessing on the signal data to obtain first preprocessed data.
- the feature extraction module 702 is used to input the first preprocessed data into a pre-trained base recognition model, and use the base recognition model to extract features from the first preprocessed data to obtain the data features of the first preprocessed data.
- the decoding module 703 is used to input the data features into a preset decoder, and use the decoder to decode the data features to obtain the base sequence corresponding to the signal data.
- this application also provides a base recognition model training device, which may include multiple functional modules composed of computer program segments.
- the computer programs of each program segment in the base recognition model training device may be stored in the memory of an electronic device and executed by at least one processor to perform the function of base recognition model training (see Figure 5 for details).
- the functional implementation of each module in the base recognition model training device can be found in the above description of the base recognition model training method, and will not be repeated here.
- This application also provides a computer-readable storage medium storing a computer program, the computer program including program instructions, and the method implemented when the program instructions are executed can refer to the methods in the above embodiments of this application.
- the computer-readable storage medium can be the internal memory of the electronic device described in the above embodiments, such as the hard disk or RAM of the electronic device.
- the computer-readable storage medium can be an external storage device of the electronic device, such as a plug-in hard disk, a Smart Media Card (SMC), or a Secure Digital Storage Device (SDD). Digital (SD) cards, flash cards, etc.
- SMC Smart Media Card
- SDD Secure Digital Storage Device
- SD Digital
- the computer-readable storage medium may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function, etc.; and the data storage area may store data created based on the use of the electronic device, etc.
- the disclosed devices/terminal equipment and methods can be implemented in other ways.
- the device/terminal equipment embodiments described above are merely illustrative.
- the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods.
- multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
- the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
- the units described as separate components may or may not be physically separate.
- the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Life Sciences & Earth Sciences (AREA)
- Health & Medical Sciences (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Data Mining & Analysis (AREA)
- Artificial Intelligence (AREA)
- Biophysics (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Bioinformatics & Computational Biology (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Evolutionary Biology (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Chemical & Material Sciences (AREA)
- Analytical Chemistry (AREA)
- Mathematical Physics (AREA)
- Genetics & Genomics (AREA)
- Proteomics, Peptides & Aminoacids (AREA)
- Computing Systems (AREA)
- Biotechnology (AREA)
- Biomedical Technology (AREA)
- Medical Informatics (AREA)
- Spectroscopy & Molecular Physics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Analysis (AREA)
Abstract
提供一种碱基识别方法、碱基识别模型训练方法及电子设备,所述碱基识别方法对信号数据进行第一预处理得到第一预处理数据;将第一预处理数据输入预先训练的碱基识别模型,得到第一预处理数据的数据特征;利用解码器对数据特征进行解码,得到信号数据对应的碱基序列。所述碱基识别模型训练方法对样本数据进行第二预处理得到第二预处理后的样本数据;基于第二预处理后的样本数据训练预设模型得到满足预设要求的碱基识别模型。利用上述方法能够提高碱基识别模型的预测精准度,从而提高碱基识别的准确率。
Description
本申请涉及生物医药技术领域,具体涉及一种碱基识别方法、碱基识别模型训练方法及电子设备。
纳米孔测序技术(Nanopore Sequencing)是一种基于单分子电流测量的高通量测序方法,可以利用由蛋白质或固态材料构成的纳米孔将脱氧核糖核酸(Deoxyribonucleic Acid,DNA)和\或核糖核酸(Ribonucleic Acid,RNA)分子逐个引导通过孔道,并测量DNA和\或RNA中的不同碱基通过孔道之间时的电流,得到DNA和\或RNA对应的电信号数据作为信号数据,通过对信号数据进行解析即可推测DNA和\或RNA的碱基序列。
但是,由于DNA和\或RNA分子通过纳米孔的速率不稳定、电流信号检测器的技术局限性等原因,电信号数据中可能会存在噪声或异常数据,导致相关碱基识别算法的准确率降低。此外,相关技术中使用的基于深度学习的碱基识别模型,通常无法解决识别长电信号序列与保证识别准确率之间的平衡性问题,导致模型的可用性较低。
发明内容
鉴于以上内容,有必要提出一种碱基识别方法、碱基识别模型训练方法及电子设备,能够解决由于电信号特征分布分散、训练数据噪声、模型拟合与记忆能力不足等原因导致的碱基识别准度较低的问题。
本申请的实施例提供一种碱基识别方法,所述方法包括:对信号数据进行第一预处理,得到第一预处理数据;将所述第一预处理数据输入预先训练的碱基识别模型,利用所述碱基识别模型对所述第一预处理数据进行特征提取,得到所述第一预处理数据的数据特征;将所述数据特征输入预设的解码器,利用所述解码器对所述数据特征进行解码,得到所述信号数据对应的碱基序列。
在一个实施例中,所述方法还包括采集所述信号数据,包括:采集对脱氧核糖核酸DNA或核糖核酸RNA进行纳米孔测序得到的电信号数据,所述电信号数据包括随时间变化的多个电信号幅值数据;将所述电信号数据作为所述信号数据。
在一个实施例中,所述第一预处理包括:对所述信号数据中的多个电信号幅值数据进行归一化处理,将归一化处理后的信号数据作为更新的信号数据;基于滑动窗口算法,确定所述更新的信号数据中每个预设窗口长度范围内的第一数值序列的偏移值,并基于所述偏移值对应更新所述第一数值序列,得到所述第一预处理数据。
在一个实施例中,所述碱基识别模型包括卷积模块,所述卷积模块包括多个依次连接的卷
积层,其中,所述卷积模块的最后一层卷积层的步长与所述第一预处理数据的数据长度以及数据集中最长的碱基序列标签含有的碱基数之间存在对应关系。
在一个实施例中,所述碱基识别模型包括卷积模块,所述卷积模块包括第一卷积层、第二卷积层、第三卷积层,其中:第一卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,n1,n2,b1),其中,L表示所述第一预处理数据的数据长度,n1、n2、b1表示预设数值;第二卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,n2,n3,b1),其中,n3表示预设数值;第三卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,n3,n3,step),其中,step=L/l,l表示数据集中最长的碱基序列标签含有的碱基数。
在一个实施例中,所述碱基识别模型包括Conformer编码模块,所述Conformer编码模块包括前馈神经网络,所述前馈神经网络包括上采样全连接层、下采样全连接层,其中:所述上采样全连接层用于基于预设的上采样比例对所述卷积模块输出的特征数据进行上采样,得到预设维度的特征数据;所述下采样全连接层用于对所述预设维度的特征数据进行下采样,将所述预设维度的特征数据恢复至所述卷积模块输出的特征数据的维度。
在一个实施例中,所述预设的解码器包括连接时序分类CTC解码器。
本申请的实施例提供一种碱基识别模型训练方法,所述方法包括:采集样本数据,对所述样本数据进行第二预处理,得到第二预处理后的样本数据;基于第二预处理后的样本数据训练预设模型,得到满足预设要求的碱基识别模型。
在一个实施例中,所述样本数据包括多个历史信号数据,所述第二预处理包括:确定所述样本数据中的异常数据,从所述多个历史信号数据中剔除异常数据得到多个过滤后的历史信号数据;对所述多个过滤后的历史信号数据中的每个过滤后的历史信号数据进行归一化处理,将归一化处理后的每个过滤后的历史信号数据作为更新的历史信号数据;基于滑动窗口算法,确定所述更新的历史信号数据中每个预设窗口长度范围内的第二数值序列的偏移值,并基于所述偏移值对应更新所述第二数值序列,得到第二预处理后的历史信号数据。
在一个实施例中,所述方法还包括采集所述历史信号数据,包括:采集对历史脱氧核糖核酸DNA或历史核糖核酸RNA进行纳米孔测序得到的历史电信号数据,所述历史电信号数据包括随时间变化的电信号幅值数据;将所述历史电信号数据作为所述历史信号数据。
在一个实施例中,所述确定所述样本数据中的异常数据包括:基于预设的峰度算法,对所述多个历史信号数据中每个历史信号数据的多个电信号幅值进行归一化处理;确定归一化处理后的每个历史信号数据的峰度值,将小于预设峰度阈值的峰度值对应的历史信号数据作为异常数据。
在一个实施例中,所述预设模型包括自适应步长卷积模块,所述自适应步长卷积模块包括第一卷积层、第二卷积层、第三卷积层,其中:第一卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,n1,n2,b1),其中,L表示所述样本数据中每个历史信号数据的数据长度,n1、n2、b1表示预设数值;第二卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,n2,n3,b1),其中,n3表示预设数值;第三卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,n3,n3,step),其中,step=L/l,l表示数据集中最长的碱基序列标签含有的碱基
数。
在一个实施例中,所述预设模型包括改进的Conformer编码模块,所述改进的Conformer编码模块包括前馈神经网络,所述前馈神经网络包括上采样全连接层、下采样全连接层,其中:所述上采样全连接层用于基于预设的上采样比例对所述卷积模块输出的特征数据进行上采样,得到预设维度的特征数据;所述下采样全连接层用于对所述预设维度的特征数据进行下采样,将所述预设维度的特征数据恢复至所述卷积模块输出的特征数据的维度。
在一个实施例中,所述预设要求包括如下一种或多种要求的组合:所述预设模型得到的模型预测结果的平均准确率大于预设准确率阈值;所述预设模型得到的模型预测结果的准确率中位数大于预设中位数阈值;所述预设模型对预设数量的历史数据序列进行预测所耗费的总时间小于预设时长阈值。
本申请的实施例提供一种碱基识别装置,所述装置包括:预处理模块,用于对信号数据进行第一预处理,得到第一预处理数据;特征提取模块,用于将所述第一预处理数据输入预先训练的碱基识别模型,利用所述碱基识别模型对所述第一预处理数据进行特征提取,得到所述第一预处理数据的数据特征;解码模块,用于将所述数据特征输入预设的解码器,利用所述解码器对所述数据特征进行解码,得到所述信号数据对应的碱基序列。
本申请的实施例提供一种电子设备,所述电子设备包括处理器和存储器,所述处理器用于执行所述存储器中存储的计算机程序时实现所述碱基识别方法或所述碱基识别模型训练方法。
本申请的实施例提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现所述碱基识别方法或所述碱基识别模型训练方法。
综上所述,本申请所述的碱基识别方法,通过对信号数据进行第一预处理以实现对信号数据的数据归一化与低频偏移幅值的移除,使用预先训练的碱基识别模型对第一预处理数据进行特征提取,并使用预设解码器对提取的特征进行解码,可以实现碱基识别的效率与精准度的提高。其中,碱基识别模型为本申请实施例提供的碱基识别模型训练方法训练得到,通过对样本数据进行第二预处理以实现对样本数据的噪声过滤、数据归一化与低频偏移幅值的移出,使用第二预处理后的样本数据训练预设模型,可以提高模型的训练效率与模型的预测精准度,从而提高碱基识别的准确率。
图1是本申请一实施例提供的电子设备的结构图。
图2是本申请一实施例提供的碱基识别方法的流程图。
图3是本申请一实施例提供的滑动窗口算法的原理示例图。
图4是本申请一实施例提供的碱基识别模型的结构示例图。
图5是本申请一实施例提供的碱基识别模型训练方法的流程图。
图6是本申请一实施例提供的信号峰值分布的示例图。
图7是本申请一实施例提供的碱基识别模型的验证结果的示例图。
图8是本申请一实施例提供的数据加载过程的示例图。
图9是本申请一实施例提供的碱基识别装置的结构图。
为了能够更清楚地理解本申请的上述目的、特征和优点,下面结合附图和具体实施例对本申请进行详细描述。需要说明的是,在不冲突的情况下,本申请的实施例及实施例中的特征可以相互组合。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中在本申请的说明书中所使用的术语只是为了描述在一个实施例中实施例的目的,不是旨在于限制本申请。
需要说明的是,本申请中“至少一个”是指一个或者多个,“多个”是指两个或多于两个。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。本申请的说明书和权利要求书及附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不是用于描述特定的顺序或先后次序。
在本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。在不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。
在一个实施例中,纳米孔测序技术(Nanopore Sequencing)是一种基于单分子电流测量的高通量测序方法,可以利用由蛋白质或固态材料构成的纳米孔将脱氧核糖核酸(Deoxyribonucleic Acid,DNA)和\或核糖核酸(Ribonucleic Acid,RNA)分子逐个引导通过孔道,并测量DNA和\或RNA中的不同碱基通过孔道之间时的电流,得到DNA和\或RNA对应的电信号数据作为信号数据,通过对信号数据进行解析即可推测DNA和\或RNA的碱基序列。
但是,由于DNA和\或RNA分子通过纳米孔的速率不稳定、电流信号检测器的技术局限性等原因,电信号数据中可能会存在噪声或异常数据,影响下游碱基识别算法的精度和稳定性,导致相关碱基识别算法的准确率降低。
举例而言,若纳米孔测序技术使用的是蛋白质纳米孔等生物纳米孔,在核酸(例如DNA或RNA)序列中不同的分子通过生物纳米孔时,生物纳米孔在控制核酸穿孔的同时也同时作为信号传感器,其检测到的电信号的大小基本与核酸中的待测核苷酸在纳米孔内部所占空间的大小成正相关关系;由于生物纳米孔的不稳定性,生物纳米孔作为信号传感器只能在较小范围的电压和温度范围内工作,且检测得到的电信号数据的信噪比相对较低。此外,由于很难大规模生成固态纳米孔,因此虽然固态纳米孔比生物纳米孔更稳定,但是生物纳米孔更为广泛被使用。
事件检测器用于从原始测序电信号中截取即将用于碱基识别的有效电信号,并将有效电信号数据分割成数值特征近似的时间序列,即所谓的事件,每个事件由电信号数据的平均值、标准差、开始时间和长度等特征组成。在理想情况下,每一个进入纳米孔的碱基会产生一个新事件,但由于碱基通过纳米孔的速率不稳定,因此事件检测器在分割生成事件数据时可能会出现如下
两种错误情况:(a)事件检测器错误地把一个碱基对应的原始测序电信号数据分割成两个事件(即仅一个碱基通过纳米孔产生两个事件),这时对应的碱基识别结果会产生碱基插入错误;(b)事件检测器从两个碱基的原始数据点生成一个事件(即两个连续碱基通过纳米孔产生一个事件),这时识别结果会产生删除错误。
此外,相关技术中使用的基于深度学习的碱基识别模型,通常无法解决识别长电信号序列与保证识别准确率之间的平衡性问题,导致模型的性能较低。例如,早期相关技术中使用的隐马尔可夫模型(Hidden Markov Model,HMM)只能建模短期依赖关系,而纳米孔信号数据中存在长期依赖关系,因此HMM难以捕捉到长期依赖性;此外,HMM是基于已知核酸序列的先验模型,在处理未知碱基序列时可能导致较高的错误率。近期相关技术中使用的长短期记忆模型(Long Short-Term Memory,LSTM)虽然可以在一定程度上提高碱基识别的准确率,但是由于LSTM的模型结构的复杂性,模型训练与预测需要耗费的时间成本较高、模型处理长序列数据所需算力也非常大,因此,对于纳米孔信号数据这种非常长的时间序列数据,LSTM特征表达能力仍然不足。因此,在当前情况下,使用LSTM的高精度模型可能受到数据特点的限制,在平衡准确性和模型参数数量方面做出妥协。这意味着使用参数较少的模型可能会导致较低的准确率。
其次,相关技术中深度学习方法一般采用简单的数据归一化(例如最小-最大规范化,Z-score归一化等)方法作为预处理技术,但这些归一化方法都是只使用全局的幅值偏移和放缩,无法移除长电信号序列的存在的低频幅值偏移。
综上所述,相关技术中存在由于电信号特征分布分散、训练数据噪声、模型拟合与记忆能力不足等原因导致的碱基识别准度较低的问题。
为解决上述问题,本申请实施例提供一种碱基识别方法,通过对信号数据进行第一预处理以实现对信号数据的数据归一化与低频偏移幅值的移除,使用预先训练的碱基识别模型对第一预处理数据进行特征提取,并使用预设解码器对提取的特征进行解码,可以实现碱基识别的效率与精准度的提高。其中,碱基识别模型为本申请实施例提供的碱基识别模型训练方法训练得到,通过对样本数据进行第二预处理以实现对样本数据的噪声过滤、数据归一化与低频偏移幅值的移出,使用第二预处理后的样本数据训练预设模型,可以提高模型的训练效率与模型的预测精准度,从而提高碱基识别的准确率。
图1为本申请实施例提供的一种电子设备的结构示意图。该电子设备10可以为计算机、服务器、手机、平板电脑、笔记本电脑、云服务器、云电脑等电子设备,本申请实施例对电子设备的具体类型不作任何限制。
如图1所示,该电子设备10可以包括通信模块101、存储器102、处理器103、输入/输出(Input/Output,I/O)接口104及总线105。处理器103通过总线105分别耦合于通信模块101、存储器102、I/O接口104。
通信模块101可以包括有线通信模块和/或无线通信模块。有线通信模块可以提供通用串行总线(universal serial bus,USB)、控制器局域网总线(CAN,Controller Area Network)等有线通信的解决方案中的一种或多种。无线通信模块可以提供无线保真(wireless fidelity,Wi-Fi),蓝牙(bluetooth,BT),移动通信网络,调频(frequency modulation,FM),近距离无线通信技术(near field
communication,NFC),红外技术(infrared,IR)等无线通信的解决方案中的一种或多种。
存储器102可以包括一个或多个随机存取存储器(random access memory,RAM)和一个或多个非易失性存储器(non-volatile memory,NVM)。随机存取存储器可以由处理器103直接进行读写,可以用于存储操作系统或其他正在运行中的程序的可执行程序(例如机器指令),还可以用于存储用户及应用的数据等。随机存取存储器可以包括静态随机存储器(static random-access memory,SRAM)、动态随机存储器(dynamic random access memory,DRAM)、同步动态随机存储器(synchronous dynamic random access memory,SDRAM)、双倍资料率同步动态随机存取存储器(double data rate synchronous dynamic random access memory,DDR SDRAM)等。
非易失性存储器也可以存储可执行程序和存储用户及应用的数据等,可以提前加载到随机存取存储器中,用于处理器103直接进行读写。非易失性存储器可以包括磁盘存储器件、快闪存储器(flash memory)。
存储器102用于存储一个或多个计算机程序。一个或多个计算机程序被配置为被处理器103执行。该一个或多个计算机程序包括多个指令,多个指令被处理器103执行时,可实现在电子设备10上执行的碱基识别方法。
在其他实施例中,所述电子设备10还包括外部存储器接口,用于连接外部的存储器,实现扩展电子设备10的存储能力。
处理器103可以包括一个或多个处理单元,例如:处理器103可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
处理器103提供计算和控制能力,例如,处理器103用于执行存储器102内存储的计算机程序,以实现上述的碱基识别方法。
I/O接口104用于提供用户输入或输出的通道,例如I/O接口104可用于连接各种输入输出设备,例如,鼠标、键盘、触控装置、显示屏等,使得用户可以录入信息,或者使信息可视化。或者,I/O接口104还可以用于提供与纳米孔测序设备的数据传输通道,使得电子设备可以从纳米孔测序设备处获取信号数据(例如电信号)。
总线105至少用于提供电子设备10中的通信模块101、存储器102、处理器103、I/O接口104之间相互通信的通道。
可以理解的是,本申请实施例示意的结构并不构成对电子设备10的具体限定。在本申请另一些实施例中,电子设备10可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
图2是本申请一实施例提供的碱基识别方法的流程图。所述碱基识别方法应用于电子设备中,例如图1中的电子设备10,具体包括以下步骤,根据不同的需求,该流程图中步骤的顺序可以改变,某些可以省略。
S201,对信号数据进行第一预处理,得到第一预处理数据。
在本申请的一些实施例中,为识别碱基序列,基于事件检测器先采集信号数据。对信号数据的采集至少包括:采集对脱氧核糖核酸(Deoxyribonucleic Acid,DNA)或核糖核酸(Ribonucleic Acid,RNA)进行纳米孔测序得到的电信号数据,并将所述电信号数据作为所述信号数据。其中,所述电信号数据包括随时间变化的多个电信号幅值数据。
在一些实施例中,电子设备可以根据事件检测器的采样频率从事件检测器处获取对DNA或RNA进行测序得到的电信号数据作为信号数据,例如,若事件检测器的采样频率为5000samples/sec,即事件检测器每秒输出一个固定数据长度为5000的电信号数据,电子设备可以将每秒获得的电信号数据作为一个信号数据,其中,电信号数据可以表示当前测序过程中获得的电信号数据,也可以是历史电信号数据,例如,之前已经完成的测序过程的电信号数据。
由于电信号数据可以包括随时间变化的电信号幅值数据,因此信号数据可以视为由多个电信号幅值构成的一维数据向量或序列。例如,信号数据可以是长度为n的数据序列z={z1,z2,…,zi,…,zn},其中每个数据可以示例性表示为zi,i={1,2,...,n},n表示信号数据的总长度,n的取值可以根据实际需要进行设置,本申请对此不作具体限制,例如,n取值为5000。
在一个实施例中,对信号数据的第一预处理可以包括但不限于:对所述信号数据中的多个电信号幅值数据进行归一化处理,将归一化处理后的信号数据作为更新的信号数据;基于滑动窗口算法,确定所述更新的信号数据中每个预设窗口长度范围内的第一数值序列的偏移值,并基于所述偏移值对应更新所述第一数值序列,得到所述第一预处理数据。
在一个实施例中,可以根据信号数据的中位数(median)对信号数据进行归一化处理,所述归一化处理使用的公式可以包括:
其中,数据序列z={z1,z2,…,zi,…,zn}表示信号数据,median(z)表示z的中位数,s表示归一化处理后的信号数据(即更新的信号数据),s={s1,s2,…,si,…,sn},i={1,2,...,n},n表示信号数据的总长度,n的取值可以根据实际需要进行设置,本申请对此不作具体限制,例如n取值为5000。
在其他实施例中,还可以使用其他归一化处理方法实现对信号数据的归一化,例如,最小-最大规范化,Z-score归一化等。
在一个实施例中,基于滑动窗口算法计算更新的信号数据中的每个预设窗口内的低频偏移值,使用的公式包括:
oj=sj-fj,
其中,fj表示滑动窗口滑动至更新的信号数据s={s1,s2,…,si,…,sn}的第j个位置时窗口内的第一数值序列对应的偏移值,j的取值范围为0至(n-width)/p中的整数,n表示更新的信号数据的数据长度(例如5000),width表示预设窗口的长度(例如500),p表示预设步长(例如50);sj表示与滑动窗口做矩阵点乘的长度为width的取值从s={s1,s,…,si,…,sn}中下标j*p到
j*p+width下标的矩阵(即第j个第一数值序列),即sj=[sj*p,sj*p+1,…,sj*p+wid];w=wwidth×1=[1/width,1/width,…,1/width];oj表示第j个第一数值序列sj中每个元素sk减去对应的偏移值fj得到的矩阵oj=[oj*p,oj*p+1,…,oj*p+width],从而可以得到第一预处理数据o=(o0...oj...on-wid/p)。
具体的,参考图3所示滑动窗口算法的原理示例图,长度为width的窗口在更新的信号数据s={s1,s2,…,si,…,sn}中以步长p进行滑动遍历,每滑动至一个位置,计算该位置处窗口长度范围内的第一数值序列的偏移值,再从每个范围内的第一数值序列中的每个数据点中减去对应的偏移值,即可实现对窗口内的第一数值序列的更新,对整个更新的信号数据s的数据序列遍历更新后即可得到第一预处理数据。滑动窗口算法相当于对更新的信号数据进行了更精细化的归一化处理。在一个实施例中,第一预处理还可以是归一化、标准化、去除偏移值或去噪等处理。参考后续碱基识别模型的训练方法中的对应描述,由于训练过程中对样本数据进行的预处理中包括归一化处理与偏移值消除处理,因此在此处应用过程中执行相似的预处理,可以提高模型推理应用过程的预测准确率。
S202,将所述第一预处理数据输入预先训练的碱基识别模型,利用碱基识别模型对第一预处理数据进行特征提取,得到第一预处理数据的数据特征。
在一个实施例中,碱基识别模型至少包括卷积模块(例如自适应步长卷积模块)、改进的Conformer编码模块(例如图4所示)。其中,自适应步长卷积模块可以包括预设第一数量的一维卷积层(1D Convolutional Neural Network,1D-CNN\1D-conv),用于对第一预处理数据进行特征提取,预设第一数量可以根据实际需求进行设置,还可以通过模型训练过程中的参数优化过程确定,例如,根据模型训练过程可以确定预设第一数量是3(例如图4所示),表示在自适应步长卷积模块使用3个1D-CNN叠加得到的模型的性能最佳。
具体的,通过滑动一个固定大小的窗口,1D-CNN可以使用训练后的卷积核对窗口内的第一预处理数据进行卷积运算,从而实现对窗口内的输入数据的局部感知和特征提取,然后将提取的特征映射到下一层。举例而言,卷积模块包括多个依次连接的卷积层。其中,所述卷积模块的最后一层卷积层的步长与第一预处理数据的数据长度(例如L=5000)以及数据集中最长的碱基序列标签含有的碱基数(例如l=5)之间存在对应关系。例如,卷积模块的最后一层卷积层的步长step=样本数据中每个历史信号数据的数据长度L/数据集中最长的碱基序列标签含有的碱基数l。
其中,数据集表示模型训练数据集,例如数据集可以包括多个历史信号数据,其中每个历史信号数据可以是维度为1*5000的向量;每个历史信号数据可以有一个对应的碱基序列标签,l表示数据集中最长的碱基序列标签含有的碱基数;例如,数据集中有三个历史信号数据,三个历史信号数据的碱基序列标签分别为AAAGC,AAGT,TCG,其中最长的碱基序列标签为AAAGC,因此l=5。其中,A表示腺嘌呤(Adenine),T表示胸腺嘧啶(Thymine),G表示鸟嘌呤(Guanine),C表示胞嘧啶(Cytosine)
在一个实施例中,卷积模块包括依次连接的第一卷积层、第二卷积层、第三卷积层。
第一卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,n1,n2,b1),其中,
L表示第一预处理数据的数据长度,n1、n2、b1表示预设数值。例如,若L=5000,n1=1,n2=4,b1=1,则第一卷积层的(输入长度,输入维度,输出维度,步长)表示为(5000,1,4,1),输入数据是5000*1的矩阵,即5000个电信号值中每个电信号值维度是1;输出维度是4,即输出矩阵是5000*4的矩阵,每个电信号值维度变成4维。第一卷积层中每个卷积核大小为1*1,卷积核个数为1*4,其中1代表输入通道数,4代表输出通道数,步长为1。
第二卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,n2,n3,b1),其中,n3表示预设数值。例如,若L=5000,n3=16,b1=1,第二卷积层的(输入长度,输入维度,输出维度,步长)表示为(5000,4,16,1),输入数据是5000*4的矩阵,即5000个电信号值中每个电信号值维度是4;输出维度是16,即输出矩阵是5000*16的矩阵,每个电信号值维度变成16维。第二卷积层中每个卷积核大小为1*1,卷积核个数为4*16,其中4代表输入通道数,16代表输出通道数,步长为1。
第三卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,n3,n3,step),其中,step=L/l,l表示数据集中最长的碱基序列标签含有的碱基数。例如,第三卷积层的(输入长度,输入维度,输出维度,步长)表示为(5000,16,16,step),输入数据是5000*16的矩阵,即5000个电信号值中每个电信号值维度是16;输出维度是16,即输出矩阵是5000*16的矩阵,每个电信号值维度变成16维。第三卷积层中每个卷积核大小为1*step,卷积核个数为16*16,其中16代表输入通道数,16代表输出通道数,步长为step。step直接决定第三个卷积层输出矩阵的时间维度的长度为L/step=l,即其长度满足数据集所有标签的概率学习。
在一个示例中,例如图4所示,每个1D-CNN之后可以连接一个激活层,激活层可以使用预设的激活函数(例如Gelu(Gaussian Error Linear Unit)函数)对1D-CNN输出的特征表示进行逐元素的非线性映射,从而学习到更复杂与非线性的特征表示,提高模型的特征预测与表达能力。其中,Gelu函数结合了高斯分布的特点和sigmoid函数的非线性特性,能够实现平滑、连续且可导的非线性变换,在保持输入的正部分不变的同时对负部分进行压缩并保持较高的数值稳定性,从而可以更好地处理梯度消失和梯度爆炸问题,提高模型性能。在另一示例中,还可以使用其他激活函数,或者近似的Gelu函数公式,例如快速Gelu(Fast Gelu)函数等,以减少计算复杂度并提高非线性映射的效率。
在一个实施例中,Conformer编码模块是一种结合了卷积神经网络CNN和Transformer的模型结构,普通的Conformer编码模块主要由以下几个关键组件构成:(1)前馈模块:通常包含线性归一化层和激活层,用于对输入数据进行初步的处理和转换,例如,前馈模块可以采用macaron-like结构,即两个前馈层之间通过残差连接相连,有助于缓解深度神经网络中的梯度消失问题;(2)原生多头注意力机制模块:可以通过对输入序列中的不同位置进行自适应地加权,从而得到每个位置的重要性,例如,多头自注意力模块可以采用相对位置编码技术,使得模型能够更准确地捕捉输入序列中的结构信息,相对位置编码是通过计算输入序列中不同位置之间的相对关系得到的,有助于模型对不同长度的输入进行更好的泛化;(3)原生卷积操作模块:负责捕捉输入数据的局部特征,卷积模块可以包含门控机制(例如逐点卷积和门控线性单元)、一维深度卷积层以及批归一化等操作;(4)线性归一化层:可以在Conformer编码模块的各个部分之
间使用残差连接和层归一化等操作来增强模型的稳定性和训练效率,残差连接有助于缓解深度神经网络中的梯度消失问题,而层归一化则可以使模型的训练过程更加稳定。
区别于相关技术,本申请的一些实施例中提出了一种改进的Conformer编码模块,碱基识别模型预设第二数量(例如图4所示的N个,例如N=4)的改进的Conformer编码模块。具体的,改进的Conformer编码模块中的前馈神经网络中添加了上采样全连接层、下采样全连接层,其中:所述上采样全连接层用于基于预设的上采样比例对所述自适应步长卷积模块输出的特征数据进行上采样,得到预设维度的特征数据;所述下采样全连接层用于对所述预设维度的特征数据进行下采样,将所述预设维度的特征数据恢复至所述自适应步长卷积模块输出的特征数据的维度。上采样全连接层可以提升模型特征感知能力,从而可以获得更多的特征参数;下采样全连接层可以将数据缩放成预设的维度大小。
例如,上采样前的特征维度为第三卷积层的输出维度(L/step,batch size,16),当上采样比例为r时,上采样后的特征维度为(L/step,batch size,r*16),下采样后恢复到(L/step,batch size,16),其中,L表示输入数据的数据长度(例如50000),l表示数据集中最长的碱基序列标签含有的碱基数,batch size表示在一次前向和后向传播中模型网络可以处理的输入数据的数量。在一个实施例中,将改进的Conformer模块输出的归一化特征向量经由Softmax层激活后,得到第一预处理数据的数据特征,例如,该数据特征可以表示为一个维度为L/step行、4^k列的概率矩阵,其中k为k-mer的k值,比如3。
具体而言,k-mer表示模型能够识别的最小编码单位,即模型输出的概率矩阵中每个概率值对应一个当前时刻k-mer的概率,例如碱基序列标签为:GTCACC,k-mer编码为[GTC,TCA,CAC,ACC],即长度为J(例如6)的标签可以切分为J-2(例如4)个k-mer(k=3)的顺序组合等价替换。若k=3,模型输出的概率矩阵为L/step=l行、4^3=64列,每一行表示后续使用的解码器实际解码的每一步,每一列代表当前解码步下每一个k-mer出现的概率;由于k取3代表同时取三个碱基作为一个编码,而每个编码可以由A、T、C、G这4种碱基中的每3个组成,故有对应4^3=64列的64种不同组合。
具体的,碱基识别模型的其他介绍还可以参考后续碱基识别模型的训练方法中的描述。在其他实施例中,碱基识别模型的Conformer模型可以进一步微调,例如网络层数以及隐藏层参数。
S203,将所述数据特征输入预设的解码器,利用所述解码器对所述数据特征进行解码,得到所述信号数据对应的碱基序列。
在一个实施例中,所述预设的解码器包括连接时序分类解码器(Connectionist Temporal Classification decoder,CTC decoder)。由于碱基识别模型的解码器的任务是根据第一预处理数据的数据特征输出得到整条信号数据对应的碱基的分类结果(例如碱基序列),而第一预处理数据的数据特征可能与碱基识别结果的维度可能有不同,因此,可以使用能够处理输入(例如第一预处理数据的数据特征)与标签(例如碱基序列)之间不完全对齐的情况的CTC解码器作为碱基识别模型的解码器,从而提高模型的识别准确性和鲁棒性。
例如,若信号数据是对DNA进行测序获得的,信号数据的每个时间步的上下文特征向量的
维度为768,对信号数据的多个上下文特征向量进行解码分类,可以得到由以下4种碱基构成的碱基序列:腺嘌呤(Adenine,A)、胸腺嘧啶(Thymine,T)、鸟嘌呤(Guanine,G)、胞嘧啶(Cytosine,C)。其中,碱基序列可以视为信号数据或者信号数据的多个上下文特征向量的标签,标签的维度可能与多个上下文特征向量的总维度不同(例如标签的维度远小于多个上下文特征向量的总维度),这种情况需要的解码器即为能够处理输入与标签之间不完全对齐的解码操作的解码器。
在一些实施例中,CTC解码器对所述数据特征进行解码分类时,通过引入一个特殊的空白标记(或称为占位符),可以使用束搜索(beam search)算法、viterbi等算法来探索每个时间步的多个候选分类结果,并根据概率分布和解码器的参数对多个候选分类结果进行聚合并选择可能性最高的分类结果,从而得到信号数据对应的碱基序列。例如,若信号数据是对DNA进行测序获得的,多个候选分类结果包括:腺嘌呤A、胸腺嘧啶T、鸟嘌呤G、胞嘧啶C、占位符,其中占位符用于解决输入(例如多个上下文特征向量)的维度比标签(例如碱基序列)的维度更大的问题。
本申请多个实施例提供的碱基识别方法,通过对信号数据进行数据归一化、低频赋值偏移移除得到模型输入数据,利用碱基识别模型对输入数据进行特征提取,再利用解码器对数据特征进行解码,能够提高对信号数据的碱基序列进行识别的准确性。
上述实施例对碱基识别模型的应用推理过程进行了介绍,接下来将对本申请实施例提供的碱基识别模型训练方法进行说明。参考图5所示,为本申请一实施例提供的碱基识别模型训练方法的流程图。所述碱基识别模型训练方法应用于电子设备中,例如图1中的电子设备10,具体包括以下步骤,根据不同的需求,该流程图中步骤的顺序可以改变,某些可以省略。
S301,采集样本数据,对所述样本数据进行第二预处理,得到第二预处理后的样本数据。
在一个实施例中,所述样本数据包括多个历史信号数据,所述方法还包括采集所述历史信号数据,包括:采集对历史脱氧核糖核酸DNA或历史核糖核酸RNA进行纳米孔测序得到的历史电信号数据,所述历史电信号数据包括随时间变化的电信号幅值数据;将所述历史电信号数据作为所述历史信号数据。参考S201中的描述,电子设备可以收集事件检测器检测的多个事件对应的多个历史电信号数据作为所述多个历史信号数据,其中,每个历史电信号数据对应一个历史DNA或历史RNA。
在一个实施例中,由于模型训练过程可以采用有监督的训练方法,所述方法还可以包括:获取所述历史电信号数据对应的所述历史DNA或所述历史RNA的真实碱基序列;将所述真实碱基序列作为对应的历史电信号数据的标签,得到有标签的历史信号数据。
在一个实施例中,模型训练过程使用的第二预处理方式与模型推理过程使用的第一预处理方式不同,具体的,所述第二预处理包括:确定所述样本数据中的异常数据,从所述多个历史信号数据中剔除异常数据得到多个过滤后的历史信号数据;对所述多个过滤后的历史信号数据中的每个过滤后的历史信号数据进行归一化处理,将归一化处理后的每个过滤后的历史信号数据作为更新的历史信号数据;基于滑动窗口算法,确定所述更新的历史信号数据中每个预设窗口长度范围内的第二数值序列的偏移值,并基于所述偏移值对应更新所述第二数值序列,得到第
二预处理后的历史信号数据。
在一个实施例中,所述确定所述样本数据中的异常数据包括:基于预设的峰度算法,对所述多个历史信号数据中每个历史信号数据的多个电信号幅值进行归一化处理;确定归一化处理后的每个历史信号数据的峰度值,将小于预设峰度阈值的峰度值对应的历史信号数据作为异常数据。
在一个实施例中,所述峰度算法(kurtosis)可以包括四阶标准矩算法,所使用的公式包括:
其中,数据序列x={x1,x2,…,xi,…,xn}表示历史信号数据对应的频域数据(例如通过对历史信号数据进行快速傅里叶变换(Fast Fourier Transformation,FFT)得到的频域数据),xi表示历史信号数据对应的频域数据中的第i个频域数据;μ表示历史信号数据对应的频域数据x对应的均值,σ表示历史信号数据对应的频域数据x对应的方差;数据序列y={y1,y2,…,yi,…,yn}表示对历史信号数据对应的频域数据x进行归一化处理得到的更新的频域数据,表示更新的频域数据y对应的均值;K表示历史信号数据对应的频域数据x对应的峰度值;i={1,2,...,n},n表示信号数据的总长度,n的取值可以根据实际需要进行设置,本申请对此不作具体限制,例如n取值为5000。
在一个实施例中,预设峰度阈值可以根据实际需要进行设置,本申请对此不作具体限制,例如预设峰度阈值取值为0.6,即可以将K<0.6的历史信号数据对应的频域数据作为异常数据进行过滤。在一示例中,如图6所示,为本申请实施例提供的异常数据(例如异常孔状态对应的异常电信号数据)对应的非有效信号对应的频域数据分布的示例图以及正常数据对应的有效信号对应的频域数据分布的示例图,其中,横轴代表峰度,纵轴代表样本数,可以看出非有效信号对应的频域数据的峰度分布集中在小于0.6的部分,有效信号对应的频域数据的峰度分布集中在大于或等于0.6的部分,因此可以将K<0.6的历史信号数据对应的频域数据作为异常数据。在其他实施例中,还可以使用算法自行调节峰值阈值。
参考S201中的描述,第二预处理相当于在第一预处理之前对样本数据中的异常数据进行了异常过滤,其后的归一化处理、基于滑动窗口算法的偏移值移除方法与第一预处理中使用的方法类似,在此不再进行重复描述。
通过基于历史信号数据对应的频域数据对无效样本数据进行剔除,可以过滤掉事件检测器过滤失败的数据,例如非碱基序列对应的电信号数据,举例而言,可以是由于核酸通过生物纳米孔时的blockage(堵塞、阻碍)导致的异常孔状态对应的异常电信号数据,从而提高训练样本的质量,进而提高模型的精度。
通过对异常过滤后的样本数据进行归一化处理,可以使得模型更加专注于信号数据的内在模式和关系,而不是受到信号数据数值大小的影响,这有助于提升模型的泛化能力和预测精度,
使模型能够更好地适应新数据和未知情况;此外,还可以将信号数据调整到合适的数值范围,从而加速模型的收敛过程,提高模型训练效率。
通过基于滑动窗口算法对归一化后的样本数据进行偏移值移除,可以剔除信号数据中的低频偏移值,解决目前全局的幅值偏移和放缩的预处理方式无法移除长电信号序列的存在的低频幅值偏移的问题。
S302,基于第二预处理后的样本数据训练预设模型,得到满足预设要求的碱基识别模型。
在一个实施例中,可以采用有监督的训练方法基于第二预处理后的样本数据训练预设模型,具体地,可以使用第二预处理后的样本数据对预设模型进行至少一次的迭代更新,在至少一次的迭代更新中的每一次更新中,可以使用第第二预处理后的样本数据中与每次更新对应的批次的数据进行更新,若更新得到的预设模型未达到预设要求,则使用下一批次的第一集合中的数据进行下一次更新,直至得到满足预设要求的预设模型作为碱基识别模型。
在一个实施例中,预设要求可以包括但不限于如下一种或多种要求的组合:所述预设模型对应的损失函数达到预设收敛条件;所述至少一次的迭代更新的次数达到预设的迭代次数阈值;所述预设模型得到的模型预测结果的平均准确率大于预设准确率阈值;所述预设模型得到的模型预测结果的准确率中位数大于预设中位数阈值;所述预设模型对预设数量的历史数据序列进行预测所耗费的总时间小于预设时长阈值。
在一示例中,使用1318条验证集数据对碱基识别模型进行验证的结果如图7所示,其中,准确率计算方法为:准确率=判读正确的碱基数/参考序列长度;“mean”表示平均准确率;“median”表示准确率中位数;“tooktime”表示判读完1318条序列所耗时间(单位:秒);“speed(samples/sec)”表示一秒处理的电流信号数量;“speed(bases/sec)”表示一秒判读的碱基数量;“val_chunks_num”表示该验证集的chunk(一个chunk为一秒的电流信号)数量。可以看出,此时碱基识别模型能够在保证预测效率的同时具有较高的预测准确率,模型的性能很好。
在一个实施例中,碱基识别模型包括卷积模块(例如自适应步长卷积模块)、改进的Conformer编码模块(例如图4所示),其中,所述自适应步长卷积模块包括第一卷积层、第二卷积层、第三卷积层,其中:第一卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,1,4,1),其中,L表示所述样本数据中每个历史信号数据的数据长度;第二卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,4,16,1);第三卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,16,16,step),其中,step=L/l,l表示数据集中最长的碱基序列标签含有的碱基数。碱基识别模型的其他描述可以参考S202中的记载。
本申请实施例提供的碱基识别模型训练方法,针对碱基判读(basecall)场景提出预处理方法,解决目前全局的幅值偏移和放缩的与处理方式无法移除长电信号序列的存在的低频幅值偏移的问题;根据k-mer以及电信号长度和实际碱基数量的比例确定一维卷积的感受野和步长,并且提出了一种优化的Conformer结构,用于解决在basecall流程中使用LSTM时特征表达能力不足、不支持并行计算的问题,提升了数据并行计算能力以及数据特征获取能力,提高了碱基判读的准确率。
在一个实施例中,本申请实施例中模型训练过程中使用的硬件环境以及软件开发环境可以
示例如下表1:
表1
通过图形处理器(Graphics Processing Unit,GPU)辅助中央处理器(Central Processing Unit,CPU)进行模型训练,能够有效提升模型的训练效率。
图8是本申请一实施例提供的数据加载过程的示例图,本申请使用多机多卡数据加载的方法,其中worker为数据加载进程,不同块代表不重复的训练数据,GPU个数为n个。
图9是本申请一实施例提供的碱基识别装置的结构图。
在一些实施例中,所述碱基识别装置70可以包括多个由计算机程序段所组成的功能模块。所述碱基识别装置70中的各个程序段的计算机程序可以存储于电子设备的存储器中,并由至少一个处理器所执行,以执行(详见图2描述)碱基识别的功能。
本实施例中,所述碱基识别装置70根据其所执行的功能,可以被划分为多个功能模块。所述功能模块可以包括:预处理模块701、特征提取模块702、解码模块703。本申请所称的模块是指一种能够被至少一个处理器所执行并且能够完成固定功能的一系列计算机程序段,其存储在存储器中。在本实施例中,关于所述碱基识别装置70的中各个模块的功能实现方式可以参见上文对碱基识别方法的限定,在此不再重复描述。
所述预处理模块701,用于对信号数据进行第一预处理,得到第一预处理数据。
所述特征提取模块702,用于将所述第一预处理数据输入预先训练的碱基识别模型,利用所述碱基识别模型对所述第一预处理数据进行特征提取,得到所述第一预处理数据的数据特征。
所述解码模块703,用于将所述数据特征输入预设的解码器,利用所述解码器对所述数据特征进行解码,得到所述信号数据对应的碱基序列。
在另一实施例中,本申请还提供一种碱基识别模型训练装置,所述碱基识别模型训练装置可以包括多个由计算机程序段所组成的功能模块。所述碱基识别模型训练装置中的各个程序段的计算机程序可以存储于电子设备的存储器中,并由至少一个处理器所执行,以执行(详见图5描述)碱基识别模型训练的功能。关于所述碱基识别模型训练装置的中各个模块的功能实现方式可以参见上文对碱基识别模型训练方法的限定,在此不再重复描述。
本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序中包括程序指令,所述程序指令被执行时所实现的方法可参照本申请上述各个实施例中的方法。
其中,所述计算机可读存储介质可以是上述实施例所述的电子设备的内部存储器,例如所述电子设备的硬盘或内存。所述计算机可读存储介质也可以是所述电子设备的外接存储设备,例如所述电子设备上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure
Digital,SD)卡,闪存卡(Flash Card)等。
在一些实施例中,所述计算机可读存储介质可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等;存储数据区可存储根据电子设备的使用所创建的数据等。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的实施例中,应该理解到,所揭露的装置/终端设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/终端设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。
Claims (15)
- 一种碱基识别方法,其特征在于,所述方法包括:对信号数据进行第一预处理,得到第一预处理数据;将所述第一预处理数据输入预先训练的碱基识别模型,利用所述碱基识别模型对所述第一预处理数据进行特征提取,得到所述第一预处理数据的数据特征;将所述数据特征输入预设的解码器,利用所述解码器对所述数据特征进行解码,得到所述信号数据对应的碱基序列。
- 根据权利要求1所述的碱基识别方法,其特征在于,所述方法还包括采集所述信号数据,包括:采集对脱氧核糖核酸DNA或核糖核酸RNA进行纳米孔测序得到的电信号数据,所述电信号数据包括随时间变化的多个电信号幅值数据;将所述电信号数据作为所述信号数据。
- 根据权利要求1或2所述的碱基识别方法,其特征在于,所述第一预处理包括:对所述信号数据中的多个电信号幅值数据进行归一化处理,将归一化处理后的信号数据作为更新的信号数据;基于滑动窗口算法,确定所述更新的信号数据中每个预设窗口长度范围内的第一数值序列的偏移值,并基于所述偏移值对应更新所述第一数值序列,得到所述第一预处理数据。
- 根据权利要求1所述的碱基识别方法,其特征在于,所述碱基识别模型包括卷积模块,所述卷积模块包括多个依次连接的卷积层,其中,所述卷积模块的最后一层卷积层的步长与所述第一预处理数据的数据长度以及数据集中最长的碱基序列标签含有的碱基数之间存在对应关系。
- 根据权利要求1所述的碱基识别方法,其特征在于,所述碱基识别模型包括卷积模块,所述卷积模块包括第一卷积层、第二卷积层、第三卷积层,其中:第一卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,n1,n2,b1),其中,L表示所述第一预处理数据的数据长度,n1、n2、b1表示预设数值;第二卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,n2,n3,b1),其中,n3表示预设数值;第三卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,n3,n3,step),其中,step=L/l,l表示数据集中最长的碱基序列标签含有的碱基数。
- 根据权利要求1所述的碱基识别方法,其特征在于,所述碱基识别模型包括Conformer编码模块,所述Conformer编码模块包括前馈神经网络,所述前馈神经网络包括上采样全连接层、下采样全连接层,其中:所述上采样全连接层用于基于预设的上采样比例对所述卷积模块输出的特征数据进行上采样,得到预设维度的特征数据;所述下采样全连接层用于对所述预设维度的特征数据进行下采样,将所述预设维度的特征 数据恢复至所述卷积模块输出的特征数据的维度。
- 根据权利要求1所述的碱基识别方法,其特征在于,所述预设的解码器包括连接时序分类CTC解码器。
- 一种碱基识别模型训练方法,其特征在于,所述方法包括:采集样本数据,对所述样本数据进行第二预处理,得到第二预处理后的样本数据;基于第二预处理后的样本数据训练预设模型,得到满足预设要求的碱基识别模型。
- 根据权利要求8所述的碱基识别模型训练方法,其特征在于,所述样本数据包括多个历史信号数据,所述第二预处理包括:确定所述样本数据中的异常数据,从所述多个历史信号数据中剔除异常数据得到多个过滤后的历史信号数据;对所述多个过滤后的历史信号数据中的每个过滤后的历史信号数据进行归一化处理,将归一化处理后的每个过滤后的历史信号数据作为更新的历史信号数据;基于滑动窗口算法,确定所述更新的历史信号数据中每个预设窗口长度范围内的第二数值序列的偏移值,并基于所述偏移值对应更新所述第二数值序列,得到第二预处理后的历史信号数据。
- 根据权利要求9所述的碱基识别模型训练方法,其特征在于,所述方法还包括采集所述历史信号数据,包括:采集对历史脱氧核糖核酸DNA或历史核糖核酸RNA进行纳米孔测序得到的历史电信号数据,所述历史电信号数据包括随时间变化的电信号幅值数据;将所述历史电信号数据作为所述历史信号数据。
- 根据权利要求9所述的碱基识别模型训练方法,其特征在于,所述确定所述样本数据中的异常数据包括:基于预设的峰度算法,对所述多个历史信号数据中每个历史信号数据的多个电信号幅值进行归一化处理;确定归一化处理后的每个历史信号数据的峰度值,将小于预设峰度阈值的峰度值对应的历史信号数据作为异常数据。
- 根据权利要求8所述的碱基识别模型训练方法,其特征在于,所述预设模型包括卷积模块,所述卷积模块包括第一卷积层、第二卷积层、第三卷积层,其中:第一卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,n1,n2,b1),其中,L表示所述样本数据中每个历史信号数据的数据长度,n1、n2、b1表示预设数值;第二卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,n2,n3,b1),其中,n3表示预设数值;第三卷积层的(输入长度,输入维度,输出维度,步长)表示为(L,n3,n3,step),其中,step=L/l,l表示数据集中最长的碱基序列标签含有的碱基数。
- 根据权利要求8所述的碱基识别模型训练方法,其特征在于,所述预设模型包括改进的Conformer编码模块,所述改进的Conformer编码模块包括前馈神经网络,所述前馈神经网络包 括上采样全连接层、下采样全连接层,其中:所述上采样全连接层用于基于预设的上采样比例对所述卷积模块输出的特征数据进行上采样,得到预设维度的特征数据;所述下采样全连接层用于对所述预设维度的特征数据进行下采样,将所述预设维度的特征数据恢复至所述卷积模块输出的特征数据的维度。
- 根据权利要求8所述的碱基识别模型训练方法,其特征在于,所述预设要求包括如下一种或多种要求的组合:所述预设模型得到的模型预测结果的平均准确率大于预设准确率阈值;所述预设模型得到的模型预测结果的准确率中位数大于预设中位数阈值;所述预设模型对预设数量的历史数据序列进行预测所耗费的总时间小于预设时长阈值。
- 一种电子设备,其特征在于,所述电子设备包括处理器和存储器,所述处理器用于执行所述存储器中存储的计算机程序时实现如权利要求1至7中任意一项所述的碱基识别方法,或实现如权利要求8至14中任意一项所述的碱基识别模型训练方法。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2024/102675 WO2026000404A1 (zh) | 2024-06-28 | 2024-06-28 | 碱基识别方法、碱基识别模型训练方法及电子设备 |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2024/102675 WO2026000404A1 (zh) | 2024-06-28 | 2024-06-28 | 碱基识别方法、碱基识别模型训练方法及电子设备 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2026000404A1 true WO2026000404A1 (zh) | 2026-01-02 |
Family
ID=98220592
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2024/102675 Pending WO2026000404A1 (zh) | 2024-06-28 | 2024-06-28 | 碱基识别方法、碱基识别模型训练方法及电子设备 |
Country Status (1)
| Country | Link |
|---|---|
| WO (1) | WO2026000404A1 (zh) |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20170370903A1 (en) * | 2016-06-23 | 2017-12-28 | Roche Sequencing Solutions, Inc. | Formation and calibration of nanopore sequencing cells |
| US20200176082A1 (en) * | 2018-11-28 | 2020-06-04 | Oxford Nanopore Technologies Ltd. | Analysis of nanopore signal using a machine-learning technique |
| CN112183486A (zh) * | 2020-11-02 | 2021-01-05 | 中山大学 | 基于深度网络快速识别单分子纳米孔测序碱基方法 |
| US20230296582A1 (en) * | 2022-03-21 | 2023-09-21 | Oxford Nanopore Technologies Plc | Calibration and profiling of a nanopore array device |
| CN118038972A (zh) * | 2023-12-28 | 2024-05-14 | 北京普译生物科技有限公司 | 一种基于Transformer架构用于纳米孔测序的碱基识别方法、装置及存储介质 |
| WO2024124521A1 (zh) * | 2022-12-16 | 2024-06-20 | 深圳华大生命科学研究院 | 用于对纳米孔测序时间序列电信号分类的方法和设备 |
-
2024
- 2024-06-28 WO PCT/CN2024/102675 patent/WO2026000404A1/zh active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20170370903A1 (en) * | 2016-06-23 | 2017-12-28 | Roche Sequencing Solutions, Inc. | Formation and calibration of nanopore sequencing cells |
| US20200176082A1 (en) * | 2018-11-28 | 2020-06-04 | Oxford Nanopore Technologies Ltd. | Analysis of nanopore signal using a machine-learning technique |
| CN112183486A (zh) * | 2020-11-02 | 2021-01-05 | 中山大学 | 基于深度网络快速识别单分子纳米孔测序碱基方法 |
| US20230296582A1 (en) * | 2022-03-21 | 2023-09-21 | Oxford Nanopore Technologies Plc | Calibration and profiling of a nanopore array device |
| WO2024124521A1 (zh) * | 2022-12-16 | 2024-06-20 | 深圳华大生命科学研究院 | 用于对纳米孔测序时间序列电信号分类的方法和设备 |
| CN118038972A (zh) * | 2023-12-28 | 2024-05-14 | 北京普译生物科技有限公司 | 一种基于Transformer架构用于纳米孔测序的碱基识别方法、装置及存储介质 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP3806089B1 (en) | Mixed speech recognition method and apparatus, and computer readable storage medium | |
| US10957309B2 (en) | Neural network method and apparatus | |
| CN111125658B (zh) | 识别欺诈用户的方法、装置、服务器和存储介质 | |
| EP3624114B1 (en) | Method and apparatus for speech recognition | |
| CN107221320A (zh) | 训练声学特征提取模型的方法、装置、设备和计算机存储介质 | |
| US12236192B2 (en) | Task-specific text generation based on multimodal inputs | |
| WO2020190480A1 (en) | Classifying an input data set within a data category using multiple data recognition tools | |
| CN116779044B (zh) | 基于多标签特征选择的基因分类方法、系统及设备 | |
| CN111653274A (zh) | 唤醒词识别的方法、装置及存储介质 | |
| CN109947971A (zh) | 图像检索方法、装置、电子设备及存储介质 | |
| CN112529029A (zh) | 信息处理方法、神经网络的训练方法、装置及存储介质 | |
| CN116206289A (zh) | 一种跨域司机疲劳驾驶检测方法、装置、终端及存储介质 | |
| CN116541776A (zh) | 一种基于时空互补学习的脑电波情感识别方法、系统 | |
| CN118212927B (zh) | 基于声音特征的身份识别方法、系统、存储介质及电子设备 | |
| US12548572B2 (en) | Systems and methods for adaptive preprocessor selection for efficient multi-modal classification | |
| CN119649894B (zh) | 基因调控网络的预测模型生成方法、装置、服务器和介质 | |
| CN115049546A (zh) | 样本数据处理方法、装置、电子设备及存储介质 | |
| CN115455142A (zh) | 文本检索方法、计算机设备和存储介质 | |
| WO2026000404A1 (zh) | 碱基识别方法、碱基识别模型训练方法及电子设备 | |
| CN118279786A (zh) | 一种基于扩散模型的时序动作定位方法 | |
| CN113208566B (zh) | 一种数据处理方法、装置、电子设备及存储介质 | |
| CN115471438A (zh) | 自编码器的训练方法、细胞数量检测方法及相关设备 | |
| CN114912502B (zh) | 一种基于表情与语音的双模态深度半监督情感分类方法 | |
| CN118015374B (zh) | 一种小样本图像识别方法及系统 | |
| CN113811895A (zh) | 用于人工智能模型个性化的方法和装置 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 24943985 Country of ref document: EP Kind code of ref document: A1 |