DNA methylation detection method and device and electronic equipment
By applying the deep learning model of Transformer and Conformer architecture in DNA methylation detection, combined with nanopore sequencing technology, the problem of low accuracy of DNA methylation detection in the existing technology is solved, and high-precision methylation positions are achieved Accurate detection of point recognition and genome level.
Patent Information
- Application Number
- CN202411415129.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-10-11
AI Technical Summary
The existing nanopore sequencing technology is not accurate for DNA methylation detection methods, and the recognition accuracy of methylation sites needs to be improved.
Using deep learning models based on Transformer architecture and Conformer architecture, combined with nanopore sequencing technology, sequence characteristics and signal characteristics are extracted and feature fusion is performed to improve methylation positions by obtaining the original electrical signal data and base sequence of DNA sequences. point recognition accuracy.
High-precision recognition of DNA methylation sites is achieved, the detection accuracy at the genome level is improved, the problems of gradient disappearance and gradient explosion are alleviated, and the accuracy and stability of detection are improved.
Smart Images

Figure CN119274648A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of gene detection, and in particular to a DNA methylation detection method, device and electronic equipment. Background Art
[0002] Deoxyribonucleic acid (DNA) methylation is an important epigenetic modification that involves the addition of methyl groups (-CH3) at specific locations in DNA molecules. DNA methylation mainly occurs at the 5' position of cytosine at the CG site (i.e., a dinucleotide sequence in which cytosine is followed by guanine, C represents cytosine and G represents guanine), forming 5-methylcytosine (5-mC). DNA methylation is related to gene expression regulation, genome stability, cell differentiation and development, and the occurrence of various diseases. It is of great significance to accurately identify methylation sites through DNA methylation detection.
[0003] Nanopore sequencing DNA methylation detection is an emerging DNA methylation detection method. This method applies nanopore sequencing technology to DNA methylation detection, using nanoscale protein pores to directly detect current changes generated when DNA molecules pass through. Since methylation sites will cause unique current changes, methylation sites can be identified by analyzing current signals. Nanopore sequencing DNA methylation detection has the following advantages: 1. Direct sequencing: Nanopore sequencing technology can directly read the sequence and methylation status of a single DNA molecule, reducing sample processing steps and potential biases; 2. It can detect DNA sequence and methylation status simultaneously; 3. Nanopore sequencing technology has the advantages of high throughput and long read length, which can cover the entire genome and provide a comprehensive methylation map; 4. Nanopore sequencing technology can perform DNA sequencing in real time, so that the test results can be obtained quickly; 5. No polymerase chain reaction (PCR) amplification is required, which avoids amplification bias and errors introduced by PCR, and can more accurately reflect the methylation status of the original sample; 6. It is suitable for a variety of sample types; 7. Nanopore sequencing technology has high sensitivity and can detect low-frequency methylation changes and rare epigenetic modifications; 8. It can detect methylation levels from low to high with a wide dynamic range; 9. The data generated by nanopore sequencing technology can be analyzed by a variety of bioinformatics tools, and the data analysis is highly flexible. These advantages make nanopore sequencing technology a powerful tool for studying DNA methylation and epigenetic modifications. However, the current DNA methylation detection method using nanopore sequencing technology is not very accurate, and the accuracy of identifying methylation sites needs to be further improved. Summary of the invention
[0004] In view of this, the present application proposes a DNA methylation detection method, device and electronic device, which can improve the accuracy of identifying methylation sites by a DNA methylation detection method using nanopore sequencing technology.
[0005] According to one aspect of the present application, a DNA methylation detection method is provided, comprising: obtaining a DNA sequence to be tested; obtaining raw electrical signal data and a base sequence corresponding to the DNA sequence to be tested by nanopore sequencing technology; obtaining a methylation detection result corresponding to the DNA sequence to be tested according to the raw electrical signal data, the base sequence and a deep learning model; wherein the deep learning model comprises a sequence feature extraction module, a signal feature extraction module, a feature fusion module and a classification module; the sequence feature extraction module comprises a Transformer encoder, and the sequence feature extraction module is used to extract features of the base sequence; the signal feature extraction module comprises a Conformer encoder, and the signal feature extraction module is used to extract features of the raw electrical signal data; the feature fusion module comprises a Transformer decoder, and the feature fusion module is used to fuse features of the base sequence and features of the raw electrical signal data to obtain fused features; the classification module comprises a fully connected layer, and the classification module is used to obtain the methylation detection result corresponding to the DNA sequence to be tested according to the fused features.
[0006] In a possible implementation, the methylation detection result corresponding to the DNA sequence to be tested is obtained according to the original electrical signal data, the base sequence and the deep learning model, including: determining the CG site in the base sequence; the CG site represents a dinucleotide sequence in which cytosine is followed by guanine; for each CG site in the base sequence, extracting a CG sequence fragment of a preset length containing the CG site from the base sequence; obtaining the first electrical signal data corresponding to each CG sequence fragment from the original electrical signal data; for each CG sequence fragment, the CG sequence fragment, the first electrical signal data corresponding to the CG sequence fragment and the CG sequence fragment are combined. The corresponding second sequence feature is input into the deep learning model to obtain the methylation detection result corresponding to the CG sequence fragment; wherein the second sequence feature corresponding to the CG sequence fragment includes at least one of the signal mean, signal standard deviation and signal length of the first electrical signal data corresponding to the CG sequence fragment; the methylation detection result corresponding to the CG sequence fragment includes whether the CG site contained in the CG sequence fragment is methylated; according to the methylation detection result corresponding to each of the CG sequence fragments, the methylation detection result corresponding to the DNA sequence to be tested is obtained; the methylation detection result corresponding to the DNA sequence to be tested includes whether each CG site in the DNA sequence to be tested is methylated.
[0007] In a possible implementation, the CG sequence fragment, the first electrical signal data corresponding to the CG sequence fragment, and the second sequence feature corresponding to the CG sequence fragment are input into the deep learning model to obtain the methylation detection result corresponding to the CG sequence fragment, including: inputting the CG sequence fragment and the second sequence feature into the sequence feature extraction module to obtain the sequence fragment feature; inputting the first electrical signal data into the signal feature extraction module to obtain the electrical signal feature; inputting the sequence fragment feature and the electrical signal feature into the feature fusion module to obtain the fusion feature; and inputting the fusion feature into the classification module to obtain the methylation detection result corresponding to the CG sequence fragment.
[0008] In a possible implementation, the sequence feature extraction module also includes an embedding layer, a first position encoder and an attention fusion submodule; the inputting the CG sequence fragment and the second sequence feature into the sequence feature extraction module to obtain the sequence fragment feature includes: inputting the CG sequence fragment into the embedding layer to obtain the embedding vector corresponding to the CG sequence fragment; inputting the CG sequence fragment into the first position encoder to obtain the position encoding vector corresponding to the CG sequence fragment; according to the embedding vector corresponding to the CG sequence fragment and the position encoding vector corresponding to the CG sequence fragment, obtaining the first sequence feature corresponding to the CG sequence fragment; inputting the first sequence feature and the second sequence feature into the attention fusion submodule to obtain the third sequence feature corresponding to the CG sequence fragment; inputting the third sequence feature into the Transformer encoder to obtain the sequence fragment feature.
[0009] In a possible implementation, the attention fusion submodule includes a first feature splicing submodule, an attention weight calculation submodule, a feature weighting submodule, a second feature splicing submodule and an output submodule; the first feature splicing submodule is used to splice the first sequence feature and the second sequence feature to obtain a first splicing feature; the attention weight calculation submodule is used to calculate the attention weights corresponding to the first sequence feature and the second sequence feature; the feature weighting submodule is used to weight the first sequence feature and the second sequence feature according to the attention weights corresponding to the first sequence feature and the second sequence feature to obtain a first weighted feature and a second weighted feature; the second feature splicing submodule is used to splice the first weighted feature and the second weighted feature to obtain a second splicing feature; the output submodule is used to convert the second splicing feature into the third sequence feature.
[0010] In a possible implementation, the signal feature extraction module also includes a linear layer and a second position encoder; the inputting the first electrical signal data into the signal feature extraction module to obtain the electrical signal feature includes: inputting the first electrical signal data into the linear layer to obtain the second electrical signal data; inputting the second electrical signal data into the second position encoder to obtain the position encoding vector corresponding to the second electrical signal data; obtaining the first signal feature corresponding to the first electrical signal data according to the second electrical signal data and the position encoding vector corresponding to the second electrical signal data; and inputting the first signal feature into the Conformer encoder to obtain the electrical signal feature.
[0011] In a possible implementation, the step of inputting the sequence segment feature and the electrical signal feature into the feature fusion module to obtain the fused feature includes: inputting the sequence segment feature and the electrical signal feature into the Transformer decoder to obtain the fused feature.
[0012] In one possible implementation, the classification module includes a plurality of sequentially connected fully-connected layers; and inputting the fusion feature into the classification module to obtain the methylation detection result corresponding to the CG sequence fragment includes: inputting the fusion feature into the first fully-connected layer among the plurality of sequentially connected fully-connected layers, and obtaining the methylation detection result corresponding to the CG sequence fragment output by the last fully-connected layer among the plurality of sequentially connected fully-connected layers.
[0013] According to another aspect of the present application, a DNA methylation detection device is provided, comprising: a first acquisition module, used to acquire a DNA sequence to be tested; a second acquisition module, used to acquire original electrical signal data and a base sequence corresponding to the DNA sequence to be tested by nanopore sequencing technology; a methylation detection module, used to obtain a methylation detection result corresponding to the DNA sequence to be tested according to the original electrical signal data, the base sequence and a deep learning model; wherein the deep learning model comprises a sequence feature extraction module, a signal feature extraction module, a feature fusion module and a classification module; the sequence feature extraction module comprises a Transformer encoder, and the sequence feature extraction module is used to extract features of the base sequence; the signal feature extraction module comprises a Conformer encoder, and the signal feature extraction module is used to extract features of the original electrical signal data; the feature fusion module comprises a Transformer decoder, and the feature fusion module is used to fuse features of the base sequence and features of the original electrical signal data to obtain fused features; the classification module comprises a fully connected layer, and the classification module is used to obtain a methylation detection result corresponding to the DNA sequence to be tested according to the fused features.
[0014] In a possible implementation, the methylation detection module is further used to: determine the CG site in the base sequence; the CG site represents a dinucleotide sequence in which cytosine is followed by guanine; for each CG site in the base sequence, extract a CG sequence fragment of a preset length containing the CG site from the base sequence; obtain the first electrical signal data corresponding to each of the CG sequence fragments from the original electrical signal data; for each of the CG sequence fragments, input the CG sequence fragment, the first electrical signal data corresponding to the CG sequence fragment, and the second sequence feature corresponding to the CG sequence fragment into the deep learning model to obtain the methylation detection result corresponding to the CG sequence fragment; wherein the second sequence feature corresponding to the CG sequence fragment includes at least one of the signal mean, signal standard deviation and signal length of the first electrical signal data corresponding to the CG sequence fragment; the methylation detection result corresponding to the CG sequence fragment includes whether the CG site contained in the CG sequence fragment is methylated; according to the methylation detection result corresponding to each of the CG sequence fragments, the methylation detection result corresponding to the DNA sequence to be tested is obtained; the methylation detection result corresponding to the DNA sequence to be tested includes whether each CG site in the DNA sequence to be tested is methylated.
[0015] In a possible implementation, the methylation detection module is further used to: input the CG sequence fragment and the second sequence feature into the sequence feature extraction module to obtain a sequence fragment feature; input the first electrical signal data into the signal feature extraction module to obtain an electrical signal feature; input the sequence fragment feature and the electrical signal feature into the feature fusion module to obtain a fusion feature; input the fusion feature into the classification module to obtain a methylation detection result corresponding to the CG sequence fragment.
[0016] In a possible implementation, the sequence feature extraction module also includes an embedding layer, a first position encoder and an attention fusion submodule; the methylation detection module is further used to: input the CG sequence fragment into the embedding layer to obtain the embedding vector corresponding to the CG sequence fragment; input the CG sequence fragment into the first position encoder to obtain the position encoding vector corresponding to the CG sequence fragment; according to the embedding vector corresponding to the CG sequence fragment and the position encoding vector corresponding to the CG sequence fragment, obtain the first sequence feature corresponding to the CG sequence fragment; input the first sequence feature and the second sequence feature into the attention fusion submodule to obtain the third sequence feature corresponding to the CG sequence fragment; input the third sequence feature into the Transformer encoder to obtain the sequence fragment feature.
[0017] In a possible implementation, the attention fusion submodule includes a first feature splicing submodule, an attention weight calculation submodule, a feature weighting submodule, a second feature splicing submodule and an output submodule; the first feature splicing submodule is used to splice the first sequence feature and the second sequence feature to obtain a first splicing feature; the attention weight calculation submodule is used to calculate the attention weights corresponding to the first sequence feature and the second sequence feature; the feature weighting submodule is used to weight the first sequence feature and the second sequence feature according to the attention weights corresponding to the first sequence feature and the second sequence feature to obtain a first weighted feature and a second weighted feature; the second feature splicing submodule is used to splice the first weighted feature and the second weighted feature to obtain a second splicing feature; the output submodule is used to convert the second splicing feature into the third sequence feature.
[0018] In a possible implementation, the signal feature extraction module also includes a linear layer and a second position encoder; the methylation detection module is also used to: input the first electrical signal data into the linear layer to obtain second electrical signal data; input the second electrical signal data into the second position encoder to obtain a position encoding vector corresponding to the second electrical signal data; obtain a first signal feature corresponding to the first electrical signal data based on the second electrical signal data and the position encoding vector corresponding to the second electrical signal data; input the first signal feature into the Conformer encoder to obtain the electrical signal feature.
[0019] In a possible implementation, the methylation detection module is further used to: input the sequence fragment feature and the electrical signal feature into the Transformer decoder to obtain the fusion feature.
[0020] In one possible implementation, the classification module includes a plurality of sequentially connected fully-connected layers; the methylation detection module is further used to: input the fusion feature into the first fully-connected layer among the plurality of sequentially connected fully-connected layers, and obtain the methylation detection result corresponding to the CG sequence fragment output by the last fully-connected layer among the plurality of sequentially connected fully-connected layers.
[0021] According to another aspect of the present application, 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-mentioned DNA methylation detection method when executing the instructions stored in the memory.
[0022] According to another aspect of the present application, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, wherein the computer program instructions implement the above-mentioned DNA methylation detection method when executed by a processor.
[0023] According to another aspect of the present application, a computer program product is provided, comprising 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-mentioned DNA methylation detection method.
[0024] The DNA methylation detection method of the present application obtains the original electrical signal data and base sequence corresponding to the DNA sequence to be tested through nanopore sequencing technology, and obtains the methylation detection result by processing the base sequence and the original electrical signal data using a deep learning model based on the Transformer architecture and the Conformer architecture. This can improve the accuracy of identifying methylation sites, achieve high-precision methylation detection, and effectively alleviate the problems of gradient vanishing and gradient exploding.
[0025] Other features and aspects of the present application will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the present application and, together with the description, serve to explain the principles of the present application.
[0027] Figure 1 A flow chart of a DNA methylation detection method according to an embodiment of the present application is shown.
[0028] Figure 2 A flow chart of a DNA methylation detection method according to an embodiment of the present application is shown.
[0029] Figure 3 A schematic diagram of the structure of a deep learning model according to an embodiment of the present application is shown.
[0030] Figure 4 A flow chart of a DNA methylation detection method according to an embodiment of the present application is shown.
[0031] Figure 5 A schematic diagram showing DNA methylation detection using a deep learning model according to an embodiment of the present application.
[0032] Figure 6 A schematic diagram of the processing flow of DNA methylation detection using a deep learning model according to an embodiment of the present application is shown.
[0033] Figure 7 A schematic structural diagram of a DNA methylation detection device according to an embodiment of the present application is shown.
[0034] Figure 8 A block diagram of an electronic device 1900 according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0035] Various exemplary embodiments, features and aspects of the present application will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0036] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0037] In addition, in order to better illustrate the present application, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present application can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present application.
[0038] The performance of the nanopore sequencing DNA methylation detection method is mainly evaluated from the read-level accuracy and genome-level accuracy. The read-level accuracy indicates the accuracy of the detection and identification of methylation sites in a single sequencing read. A single sequencing read refers to a continuous base sequence fragment read and measured by a single sequencing reaction during DNA sequencing, also known as a read. The complete DNA sequence can be reconstructed by aligning and splicing a large number of read data. The read-level accuracy reflects the ability of the nanopore sequencing DNA methylation detection method to correctly identify the methylation state on a single DNA sequence fragment. High read-level accuracy means that the methylation site in each sequencing read can be accurately detected and recorded. The genome-level accuracy indicates the accuracy of the detection and identification of methylation sites across the entire genome. The genome-level accuracy reflects the ability of the nanopore sequencing DNA methylation detection method to correctly identify the methylation state across the entire genome. High genome-level accuracy means that methylation sites can be accurately detected and recorded across the entire genome.
[0039] Nanopore sequencing DNA methylation detection methods can be divided into statistical-based detection methods and model-based detection methods. Statistical-based detection methods infer methylation status by performing statistical tests on the current signal between the DNA sequence to be tested and the unmethylated DNA sequence. In order to identify methylated DNA bases, statistical-based detection methods require two sets of sequencing reads: one set of sequencing reads from natural DNA and the other set of sequencing reads from matched amplified DNA. By testing the difference between the two sets of sequencing reads, the methylation status of the target DNA base at the genome level can be predicted. Some researchers used the Mann-Whitney U test to detect controlled DNA methylation in Escherichia coli, identifying 5-mC and N6-methylation (6-mA) with an accuracy of more than 62% at the genome level. Some researchers used the Kolmogorov-Smirnov test in the NanoMod tool to identify methylated bases and tested Escherichia coli methylation data with an accuracy of more than 70% at the genome level. Statistical-based detection methods do not require a training dataset to detect methylated bases, but in order to identify methylated bases in natural DNA, statistical-based detection methods require matched amplified DNA as a control sample. In addition, statistical-based detection methods are less accurate than model-based detection methods.
[0040] Model-based detection methods use models to predict the methylation status of specific sites. Some researchers have proposed a detection method based on the Hidden Markov Model (HMM), which is included in the nanopolish tool for detecting 5-mC in CpG dinucleotide sequences from nanopore sequencing read events. The CpG dinucleotide sequence is the CG site, and p represents the phosphodiester bond, which is used to connect cytosine and guanine. The HMM model trained based on Escherichia coli data can detect the methylation of CpG dinucleotide sequences in human nanopore sequencing read events with an accuracy of 87% at the read level, but due to limited training data, the detection method can neither identify the methylation of non-CpG dinucleotide sequences nor distinguish between DNA sequence fragments that contain both methylated CpG dinucleotide sequences and non-methylated CpG dinucleotide sequences. Some researchers proposed the signalAlign tool, which uses HMM and Hierarchical Dirichlet Processes (HDP) to identify 5-mC at cytosine and 6-mA at GATC motifs inside CCWGG (W represents A or T, A represents adenine, and T represents thymine) motifs from nanopore sequencing read events, achieving an accuracy of 86%-95% at the genome level. Some researchers used four classifiers (neural network, random forest, naive Bayes, and logistic regression) to identify 6-mA in mouse, Escherichia coli, and Lambda phage data, achieving an accuracy of 84% at the read level and 94% at the genome level when the read coverage (i.e., the ratio of sequenced bases to the size of the whole genome) was high.
[0041] With the development of deep learning technology, more and more DNA methylation detection methods and tools based on deep learning models have emerged, such as the DeepSignal tool. The DeepSignal tool uses a deep learning method to predict the methylation status of DNA bases using nanopore sequencing reads. The DeepSignal tool uses two modules (signal feature module and sequence feature module) to construct features based on the original electrical signals generated by nanopore sequencing read events. Among them, the signal feature module uses convolutional neural networks (CNN) to directly construct features based on the original electrical signals around the methylated bases, and the sequence feature module uses a bidirectional recurrent neural network (BRNN) to construct features based on the information sequence of the original electrical signal; then, the features constructed by the two modules are connected and input into the fully connected neural network to predict the DNA methylation status. This detection method is more accurate and requires lower read coverage. However, although the bidirectional recurrent neural network used in this detection method can model long-range dependencies, it has the problems of gradient vanishing and gradient explosion.
[0042] In view of this, an embodiment of the present application proposes a DNA methylation detection method, which uses nanopore sequencing technology and a deep learning model based on the Transformer architecture and the Conformer architecture for methylation detection, which can improve the accuracy of identifying methylation sites and effectively alleviate the problems of gradient vanishing and gradient exploding in existing methylation detection methods based on deep learning models.
[0043] Figure 1 A flow chart of a DNA methylation detection method according to an embodiment of the present application is shown as follows: Figure 1 As shown, the method may include:
[0044] S101, obtaining a DNA sequence to be tested.
[0045] S102, obtaining original electrical signal data and base sequence corresponding to the DNA sequence to be tested by nanopore sequencing technology.
[0046] Nanopore sequencing technology detects the base sequence in the DNA molecule passing through the nanopore through the current changes caused by the nanopore. During the sequencing process, the DNA molecule passes through the nanopore step by step. Due to the different charged properties of different bases, they will cause different changes in the current when passing through the nanopore. These changes are captured and converted into base recognition information, so that sequencing can be achieved.
[0047] In a possible implementation, obtaining the original electrical signal data and base sequence corresponding to the DNA sequence to be tested by nanopore sequencing technology may include: inputting the DNA sequence to be tested into a nanopore sequencer to obtain the original electrical signal data and base sequence corresponding to the DNA sequence to be tested.
[0048] Exemplarily, a nanopore sequencer can be used to perform base recognition on the DNA sequence to be tested, and a FastQ file containing the base sequence and a path file containing the correspondence between the base sequence and the original electrical signal data can be obtained. The FastQ file is used to store DNA sequencing data, including the base sequence generated by the nanopore sequencer and sequencing quality information. The path file records the original electrical signal generated when each base in the DNA sequence to be tested passes through the nanopore during the sequencing process.
[0049] Exemplarily, after obtaining the base sequence corresponding to the DNA sequence to be tested, the base sequence can be compared with the reference sequence using a DNA sequence comparison tool to determine the positional information (starting position and ending position) of the base sequence in the reference sequence. The reference sequence can be obtained from a public database, such as the GEO (Gene Expression Omnibus) database. After obtaining the methylation test result corresponding to the DNA sequence to be tested, the standard result obtained from the EpiQC (Epigenomics Quality Control) project can be compared to verify the accuracy of the methylation test result. The positional annotation of the methylation site in the standard result of the EpiQC project is demarcated according to the position of the human standard reference genome, and determining the positional information of the base sequence in the reference sequence helps to match the subsequent methylation test result with the standard result of the EpiQC project.
[0050] Exemplarily, for each DNA sequence to be tested, the original electrical signal data corresponding to the DNA sequence to be tested can be stored in an HDF5 file in HDF5 file format; the base sequence corresponding to the DNA sequence to be tested, the correspondence table between each base in the base sequence and the original electrical signal data, whether the base sequence is a reverse complementary sequence, the starting position and ending position of the base sequence in the reference sequence, the name of the reference sequence and other information can be stored in a BAM file in BAM file format; one HDF5 file corresponds to one BAM file. The correspondence table between each base in the base sequence and the original electrical signal data is also called a shift table, and the shift table can be composed of 0 and 1, where 1 indicates that the electrical signal starting from this position is a base, until the next 1 appears, indicating a new base, so that it can be recorded in the shift table which points in the original electrical signal data a base corresponds to, and the original electrical signal data can be easily cut through the shift table.
[0051] S103. Obtaining a methylation detection result corresponding to the DNA sequence to be tested according to the original electrical signal data, the base sequence and the deep learning model.
[0052] Among them, the deep learning model is obtained based on the Transformer architecture and the Conformer architecture. The deep learning model may include a sequence feature extraction module, a signal feature extraction module, a feature fusion module and a classification module. The sequence feature extraction module includes a Transformer encoder, and the sequence feature extraction module is used to extract the features of the base sequence; the signal feature extraction module includes a Conformer encoder, and the signal feature extraction module is used to extract the features of the original electrical signal data; the feature fusion module includes a Transformer decoder, and the feature fusion module is used to fuse the features of the base sequence and the features of the original electrical signal data to obtain the fused features; the classification module includes a fully connected layer, and the classification module obtains the methylation detection result corresponding to the DNA sequence to be tested according to the fused features.
[0053] The Transformer architecture can effectively capture long-distance dependencies in sequences through self-attention mechanisms and multi-head attention mechanisms, and model the correlation between source sequences and target sequences through autoregressive decoding modes, showing powerful capabilities in protein generation, structure prediction, drug design, and biological sequence recognition. The Conformer architecture is a hybrid architecture that combines the advantages of Transformer and CNN, which can improve the efficiency and performance when processing long sequences. The DNA methylation detection method of the embodiment of the present application obtains the original electrical signal data and base sequence corresponding to the DNA sequence to be tested through nanopore sequencing technology, and obtains the methylation detection result by processing the base sequence and the original electrical signal data using a deep learning model based on the Transformer architecture and the Conformer architecture. The accuracy of identifying methylation sites can be improved, and high-precision methylation detection can be achieved, and the problems of gradient vanishing and gradient explosion in the existing methylation detection method based on the deep learning model can be effectively alleviated.
[0054] 5-mC methylation occurring at the CG site is the most common type of methylation, and accurate identification of methylation at the CG site is of great research significance. The following takes the identification of methylation at the CG site as an example to introduce the specific implementation process of obtaining the methylation detection result corresponding to the DNA sequence to be tested according to the original electrical signal data, the base sequence and the deep learning model in the above step S103.
[0055] Figure 2 A flow chart of a DNA methylation detection method according to an embodiment of the present application is shown as follows: Figure 2As shown, the method may include:
[0056] S1031. Determine the CG site in the base sequence.
[0057] S1032. For each CG site in the base sequence, extract a CG sequence fragment of a preset length containing the CG site from the base sequence.
[0058] Exemplarily, all CG sites in the base sequence can be found, and for each CG site, a CG sequence fragment of a preset length centered on the "C" base in the CG site can be obtained from the base sequence. For example, for each CG site, the "C" base in the CG site can be used as the center, and left and right windows can be opened, and the left window and the right window each contain 10 bases, forming a CG sequence fragment with a length of 21 bases.
[0059] S1033. Obtain first electrical signal data corresponding to each of the CG sequence fragments from the original electrical signal data.
[0060] Exemplarily, for each CG sequence fragment, the electrical signal fragments corresponding to each base in the CG sequence fragment can be obtained according to the path file, and these electrical signal fragments constitute the first electrical signal data corresponding to the CG sequence fragment.
[0061] S1034. For each of the CG sequence fragments, the CG sequence fragment, the first electrical signal data corresponding to the CG sequence fragment, and the second sequence feature corresponding to the CG sequence fragment are input into the deep learning model to obtain the methylation detection result corresponding to the CG sequence fragment.
[0062] Among them, the second sequence feature corresponding to the CG sequence fragment includes at least one of the signal mean, signal standard deviation and signal length of the first electrical signal data corresponding to the CG sequence fragment; the methylation detection result corresponding to the CG sequence fragment includes whether the CG site contained in the CG sequence fragment is methylated.
[0063] S1035. Obtain the methylation detection result corresponding to the DNA sequence to be tested according to the methylation detection result corresponding to each of the CG sequence fragments; the methylation detection result corresponding to the DNA sequence to be tested includes whether each CG site in the DNA sequence to be tested is methylated.
[0064] Exemplarily, for each CG sequence fragment, the methylation status of the CG site in the CG sequence fragment (i.e., whether the CG site is methylated) can be output by a deep learning model, thereby determining the methylation status of each CG site in the DNA sequence to be tested.
[0065] Figure 3 A schematic diagram of the structure of a deep learning model according to an embodiment of the present application is shown as follows: Figure 3 As shown, the deep learning model may include a sequence feature extraction module, a signal feature extraction module, a feature fusion module, and a classification module. Figure 3 Taking the structure of the deep learning model shown as an example, the specific implementation process of inputting the CG sequence fragment, the first electrical signal data corresponding to the CG sequence fragment and the second sequence feature corresponding to the CG sequence fragment into the deep learning model in the above step S1034 to obtain the methylation detection result corresponding to the CG sequence fragment is introduced.
[0066] Figure 4 A flow chart of a DNA methylation detection method according to an embodiment of the present application is shown as follows: Figure 4 As shown, the method may include:
[0067] S10341. Input the CG sequence fragment and the second sequence feature into the sequence feature extraction module to obtain a sequence fragment feature.
[0068] Exemplarily, the sequence feature extraction module may include an embedding layer, a first position encoder, an attention fusion submodule, and a Transformer encoder; inputting the CG sequence fragment and the second sequence feature into the sequence feature extraction module to obtain the sequence fragment feature may include:
[0069] (1) Inputting the CG sequence fragment into the embedding layer to obtain the embedding vector corresponding to the CG sequence fragment.
[0070] Exemplarily, after each base in the CG sequence fragment is converted into a number, the CG sequence fragment is input into the embedding layer of the sequence feature extraction module. The embedding layer can convert the CG sequence fragment into a dense vector representation (ie, an embedding vector).
[0071] (2) Inputting the CG sequence fragment into the first position encoder to obtain a position encoding vector corresponding to the CG sequence fragment.
[0072] When extracting the features of CG sequence fragments, the positional encoding (PE) mechanism is introduced. The base sequence information in the CG sequence fragments is input into the deep learning model. This allows the deep learning model to capture the relative position relationship of different nucleotides in the sequence, better handle long-distance dependencies in the sequence, and help understand the semantic differences between different positions in the sequence.
[0073] Exemplarily, the position encoding vector of each position in the sequence can be calculated according to the following formula:
[0074]
[0075]
[0076] Among them, dmodel represents the dimension of the position encoding vector, which has the same dimension as the embedding vector; PE(pos,2i) represents the value of the 2i-th element in the position encoding vector at the pos position in the sequence, and PE(pos,2i+1) represents the value of the 2i+1-th element in the position encoding vector at the pos position in the sequence.
[0077] (3) According to the embedding vector corresponding to the CG sequence fragment and the position encoding vector corresponding to the CG sequence fragment, a first sequence feature corresponding to the CG sequence fragment is obtained.
[0078] Exemplarily, the embedding vector corresponding to the CG sequence fragment and the position encoding vector corresponding to the CG sequence fragment can be added to obtain the first sequence feature corresponding to the CG sequence fragment. The first sequence feature contains the semantic information and position information of the CG sequence fragment. The specific process of adding the embedding vector and the position encoding vector can refer to the prior art, and the dimension of the vector obtained after the addition (i.e., the first sequence feature) is the same as the dimension of the embedding vector.
[0079] (4) Inputting the first sequence feature and the second sequence feature into the attention fusion submodule to obtain a third sequence feature corresponding to the CG sequence fragment.
[0080] Exemplarily, the signal mean, signal standard deviation and signal length of the first electrical signal data corresponding to the CG sequence segment can be calculated and combined into a vector as the second sequence feature corresponding to the CG sequence segment.
[0081] The attention fusion submodule is used to fuse the first sequence features and the second sequence features. Exemplarily, the attention fusion submodule may include a first feature concatenation submodule, an attention weight calculation submodule, a feature weighting submodule, a second feature concatenation submodule, and an output submodule.
[0082] The first feature splicing submodule is used to splice the first sequence feature and the second sequence feature to obtain a first splicing feature. The first sequence feature and the second sequence feature can be spliced in the last dimension to obtain the first splicing feature. The specific splicing process can refer to the prior art.
[0083] The attention weight calculation submodule is used to calculate the attention weights corresponding to the first sequence feature and the second sequence feature. The attention weight calculation submodule can be implemented by the attention layer, and the first splicing feature can be input into the attention layer to calculate the attention score, and the attention score can be normalized by the SoftMax function to obtain the attention weight.
[0084] The feature weighting submodule is used to perform weighted processing on the first sequence feature and the second sequence feature according to the attention weights corresponding to the first sequence feature and the second sequence feature to obtain the first weighted feature and the second weighted feature. The feature weighting submodule may include two channels, one channel is used to perform weighted processing on the first sequence feature to obtain the first weighted feature, and the other channel is used to perform weighted processing on the second sequence feature to obtain the second weighted feature.
[0085] The second feature splicing submodule is used to splice the first weighted feature and the second weighted feature to obtain a second splicing feature. The first weighted feature and the second weighted feature can be spliced in the last dimension to obtain the second splicing feature. The specific splicing process can refer to the prior art.
[0086] The output submodule is used to convert the second concatenation feature into a third sequence feature. The output submodule can be implemented by an output layer, and the second concatenation feature can be input into the output layer to obtain the third sequence feature output by the output layer.
[0087] (5) Inputting the third sequence feature into the Transformer encoder to obtain the sequence segment feature.
[0088] Exemplarily, the third sequence feature can be input into a 6-layer Transformer encoder, and finally the sequence segment feature output by the last layer of Transformer encoder can be obtained.
[0089] The Transformer encoder can better capture long-range dependencies in the sequence, can use computing resources more efficiently, and will not have the problem of gradient vanishing or gradient exploding when processing long sequences. By using the Transformer encoder, sequence fragment features can be extracted efficiently and accurately, and the problem of gradient vanishing and gradient exploding can be effectively alleviated.
[0090] S10342. Input the first electrical signal data into the signal feature extraction module to obtain electrical signal features.
[0091] Exemplarily, the signal feature extraction module may include a linear layer, a second position encoder, and a Conformer encoder; inputting the first electrical signal data into the signal feature extraction module to obtain the electrical signal feature may include:
[0092] (1) Inputting the first electrical signal data into the linear layer to obtain second electrical signal data.
[0093] Exemplarily, the first electrical signal data can be input into a linear layer to adjust the dimension of the first electrical signal data to obtain second electrical signal data output by the linear layer, and the dimension of the second electrical signal data can be the same as the dimension of the embedded vector corresponding to the CG sequence fragment.
[0094] (2) Inputting the second electrical signal data into the second position encoder to obtain a position encoding vector corresponding to the second electrical signal data.
[0095] (3) Obtaining a first signal feature corresponding to the first electrical signal data based on the second electrical signal data and the position encoding vector corresponding to the second electrical signal data.
[0096] Exemplarily, the position encoding vector may be added to the second electrical signal data to obtain the first signal feature, and the specific implementation process may refer to the relevant technology.
[0097] (4) Inputting the first signal feature into the Conformer encoder to obtain the electrical signal feature.
[0098] Exemplarily, the first signal feature can be input into a 6-layer Conformer encoder. The Conformer encoder combines a multi-head self-attention mechanism and a convolution module. Each layer of the Conformer encoder first calculates the global dependency of the input features through the multi-head self-attention mechanism, then extracts local features through the convolution module, and then performs nonlinear transformation through a feedforward neural network. Finally, the input features are added to the output features through a residual connection, and finally the electrical signal features output by the last layer of the Conformer encoder can be obtained.
[0099] The Conformer encoder combines the global self-attention mechanism of the Transformer architecture with the local feature extraction capability of the convolutional neural network, and can simultaneously capture the global dependencies and local patterns of the input features; by using the deep separable convolutional module, it can reduce the number of parameters while maintaining efficient feature extraction, improving computational efficiency; through residual connections, it can promote information flow, alleviate the gradient vanishing problem, and make the training of deep networks more stable. By using the Conformer encoder, electrical signal features can be extracted efficiently and accurately, and the gradient vanishing problem can be effectively alleviated.
[0100] S10343. Input the sequence segment feature and the electrical signal feature into the feature fusion module to obtain a fusion feature.
[0101] Exemplarily, the feature fusion module may include a Transformer decoder; inputting the sequence segment feature and the electrical signal feature into the feature fusion module to obtain the fused feature may include:
[0102] The sequence segment features and the electrical signal features are input into the Transformer decoder to obtain the fusion features.
[0103] The sequence segment features output by the sequence feature extraction module and the electrical signal features output by the signal feature extraction module can be fused through a Transformer decoder layer. The Transformer decoder layer can act as an attention mechanism, allowing the model to establish associations between sequence segment features and electrical signal features. The Transformer decoder layer can perform feature fusion of sequence segment features and electrical signal features through multi-head self-attention mechanism, cross-attention mechanism, feedforward neural network and residual connection. First, the Transformer decoder layer performs multi-head self-attention calculation on the electrical signal features to capture the global dependency of the electrical signal features; then, the Transformer decoder layer performs cross-attention calculation on the sequence segment features and the electrical signal features to establish associations between the sequence segment features and the electrical signal features. The cross-attention mechanism allows the model to exchange information between the two feature streams, thereby achieving feature fusion; then, the fused features are nonlinearly transformed through a feedforward neural network; finally, the input features are added to the output features through residual connections to promote information flow and alleviate the gradient vanishing problem, and finally the fused features output by the Transformer decoder layer are obtained.
[0104] S10344. Input the fusion feature into the classification module to obtain the methylation detection result corresponding to the CG sequence fragment.
[0105] Exemplarily, the classification module may include a plurality of fully connected layers connected in sequence; inputting the fusion feature into the classification module to obtain the methylation detection result corresponding to the CG sequence fragment may include:
[0106] The fusion feature is input into the first fully connected layer among the multiple sequentially connected fully connected layers to obtain the methylation detection result corresponding to the CG sequence fragment output by the last fully connected layer among the multiple sequentially connected fully connected layers.
[0107] The fused features can pass through a series of fully connected layers and finally output the classification result (i.e., whether the CG site in the CG sequence fragment is methylated). As an example, the classification module can include three fully connected layers connected in sequence. First, the fused features are flattened and input to the first fully connected layer (fc1), which can reduce the dimension of the input features, for example, the dimension of the electrical signal feature can be reduced to 64, and the linear rectification (Rectified Linear Unit, ReLU) activation function is applied. The formula of the ReLU activation function is:
[0108] ReLU(x)=max(0,x)
[0109] Where x represents the input value and ReLU(x) represents the output value. Applying the ReLU activation function can effectively alleviate the gradient vanishing problem and introduce nonlinear characteristics, enabling the model to learn more complex feature representations.
[0110] The features output by the first fully connected layer are then input into the second fully connected layer (fc2). The second fully connected layer can reduce the feature dimension from 64 to 32 and apply the ReLU activation function.
[0111] Finally, the features output by the second fully connected layer are input to the third fully connected layer (fc3), the feature dimension is reduced from 32 to 2, and the classification result is output. The classification result can be normalized by the SoftMax function, and the formula of the SoftMax function is:
[0112]
[0113] Among them, z i represents the unnormalized score of the i-th category, and K represents the total number of categories. The SoftMax function can convert the unnormalized score into a probability distribution so that the sum of the probabilities of each category is 1. In the embodiment of the present application, the final classification result is that the CG site is methylated or not methylated, so the total number of categories is 2.
[0114] For each CG sequence fragment, the above steps S10341 to S10344 are performed to obtain the methylation status of the CG site in each CG sequence fragment output by the deep learning model, thereby obtaining the methylation status of each CG site in the DNA sequence to be tested, that is, obtaining the methylation detection result corresponding to the DNA sequence to be tested.
[0115] The deep learning model of the embodiment of the present application adopts a dual-stream structure to process CG sequence fragments and electrical signal data respectively, and then perform feature fusion through the attention mechanism. The design of this deep learning model fully utilizes the advantages of the Transformer architecture and the Conformer architecture in capturing long-range dependencies and local features, and at the same time realizes the effective fusion of multimodal features through the attention fusion submodule, thereby improving the accuracy of methylation detection. In addition, the deep learning model can adapt to input sequences and electrical signal data of different lengths, has strong flexibility, and provides a powerful and general framework for nanopore sequencing data analysis.
[0116] Figure 5 A schematic diagram showing a deep learning model for DNA methylation detection according to an embodiment of the present application is shown. The structure of the deep learning model can be as follows: Figure 3 As shown. Figure 5 As shown, the first electrical signal data is dimensionally adjusted by a linear layer in a signal feature extraction module and positionally encoded, and then input into a Conformer encoder to obtain electrical signal features; the CG sequence fragment is embedded in the sequence feature extraction module to obtain an embedding vector and positionally encoded, and then fused with features consisting of the signal mean, signal standard deviation and signal length of the first electrical signal data, and the fused features are input into a Transformer encoder to obtain sequence fragment features; the electrical signal features output by the Conformer encoder and the sequence fragment features output by the Transformer encoder are input into a Transformer decoder in a feature fusion module, and feature fusion is performed based on an attention mechanism to obtain fused features; the fused features are input into a classification module, and the methylation detection results are output after a series of fully connected layers.
[0117] Figure 6 A schematic diagram of a processing flow of DNA methylation detection using a deep learning model according to an embodiment of the present application is shown. The structure of the deep learning model can be as follows: Figure 3 As shown. Figure 6 As shown, the data input into the deep learning model includes a CG sequence segment, the first electrical signal data corresponding to the CG sequence segment, and the signal mean, signal standard deviation and signal length of the first electrical signal data; wherein, the CG sequence segment, the signal mean, signal standard deviation and signal length of the first electrical signal data are input into the sequence feature extraction module, and the first electrical signal data is input into the signal feature extraction module.
[0118] The sequence processing flow in the sequence feature extraction module includes: first, the CG sequence fragment is input into the embedding layer to obtain the embedding vector corresponding to the CG sequence fragment and the position code is added to obtain the first sequence feature; then the first sequence feature and the second sequence feature composed of the signal mean, signal standard deviation and signal length of the first electrical signal data are input into the attention fusion submodule for fusion; in the attention fusion submodule, the first sequence feature and the second sequence feature are firstly concatenated, and then the concatenated features are input into the attention layer to calculate the attention weights corresponding to the first sequence feature and the second sequence feature, and then the first sequence feature and the second sequence feature are weighted according to the attention weight, and the weighted features are concatenated and input into the output layer; the third sequence feature output by the output layer is input into the Transformer encoder to obtain the sequence fragment feature output by the Transformer encoder.
[0119] The signal processing flow in the signal feature extraction module includes: inputting the first electrical signal data into the linear layer for dimension adjustment and adding the position vector and then inputting it into the Conformer encoder; the Conformer encoder may include multiple layers, in each layer of the Conformer encoder, firstly, the global dependency of the input features is calculated through the multi-head self-attention mechanism, then the local features are extracted through the convolution module, then the nonlinear transformation is performed through the feedforward neural network, and finally the input features are added to the output features through the residual connection; after passing through multiple layers of the Conformer encoder, the electrical signal features are finally output.
[0120] Then the sequence segment features and electrical signal features are input into the Transformer decoder in the feature fusion module for feature fusion. In the Transformer decoder, the global dependency of the electrical signal features is first captured through the multi-head self-attention mechanism, and then the association between the sequence segment features and the electrical signal features is calculated through the cross-attention mechanism. Then, a nonlinear transformation is performed through the feedforward neural network, and finally, the input features are added to the output features through the residual connection to obtain the fused features output by the Transformer decoder.
[0121] Finally, the fused features are input into a series of fully connected layers in the classification module. The classification module may include three fully connected layers. First, the fused features are input into the first fully connected layer and the ReLU activation function is applied. Then, the features are input into the second fully connected layer and the ReLU activation function is applied. Finally, the features are input into the third fully connected layer and the SoftMax function is applied for normalization, and the classification result (i.e., whether the CG site in the input CG sequence fragment is methylated) is output.
[0122] By performing DNA methylation detection using the deep learning model of the embodiment of the present application, the accuracy of identifying methylated CG sites can be improved, thereby achieving high-precision methylation detection.
[0123] The training process of the deep learning model of the embodiment of the present application is described below. The deep learning model of the embodiment of the present application can be trained using the Pytorch framework.
[0124] In the preparation of sample data, four human genome standards (NA12878 cell line and three cell lines of Han Chinese descent, HG005, HG006, and HG007, which are reference materials for genome benchmarks by the Genome in a Bottle Alliance) and a standard mouse genome NIH3T3 can be used, and the corresponding data can be obtained from the GEO database. For each genome, cytosine deamination and whole genome sequencing can be performed by existing short-read library preparation methods to prepare sample data. These library preparation methods may include whole genome bisulfite sequencing methods, oxidative bisulfite sequencing methods, and enzymatic deamination methods. Deamination technology is a method for distinguishing methylated and unmethylated cytosines in DNA methylation analysis. The methylation detection results obtained using deamination technology can be used as true labels for deep learning models. For each library preparation method, the counts of methylated and unmethylated cytosines repeated twice can be summed, and the obtained cytosine site information can be statistically analyzed.
[0125] After the sample data is prepared, a nanopore sequencer (such as PolyseqOne nanopore sequencer) can be used to perform base recognition on the sample data of the above-mentioned genome standards to obtain a FastQ file containing base sequence information and a path file containing the corresponding relationship between the base sequence and the original electrical signal data. Then, a DNA sequence alignment tool (such as minimap2 tool) can be used to align the obtained base sequence with the reference sequence to obtain the position information of the base sequence on the reference sequence. Then, a Python script can be used to find all the CG sites in the base sequence. For each CG site, a window is opened on the left and right with the "C" base as the center, and each window contains 10 bases on the left and right to form a sequence fragment with a length of 21 bases. At the same time, the electrical signal fragment corresponding to each base is found according to the path file. Finally, each sequence fragment is judged according to the standard results obtained from the EpiQC project. If the CG site in the sequence fragment is methylated, the label of the sequence fragment is "1", and if the CG site in the sequence fragment is not methylated, the label of the sequence fragment is "0". The above base sequence information, raw electrical signal data and labels can be combined into a matrix and stored as a Pytorch matrix file with the suffix ".pt" as a sample data set for subsequent training of the deep learning model.
[0126] Before training the deep learning model, first prepare the data, load the sample data set and split it into a training set and a validation set. The ratio of the training set to the validation set can be 9:1. Then set the batch size (for example, it can be set to 10,000), worker threads and other parameters, define the model class, initialize the model structure, loss function, etc. In terms of optimizer and learning rate scheduling, you can use the Adam optimizer and the cosine annealing learning rate scheduling with a warm-up period. In terms of training settings, specify the graphics processing unit (GPU) for training and set parameters such as the maximum number of training rounds.
[0127] The model training process includes: initializing the model and loading the pre-trained weights; printing the model structure and number of parameters; checking whether there is a recovery checkpoint, if so, resuming training from the checkpoint, if not, starting training from scratch. Model initialization includes: defining the basic parameters of the model, such as sequence length, signal length, number of categories, dimension of embedding vector, hidden layer size, and vocabulary size; initializing the embedding layer and Transformer encoder in the sequence feature extraction module; initializing the linear layer and Conformer encoder in the signal feature extraction module; initializing the Transformer decoder in the feature fusion module and the fully connected layer in the classification module. During the model training process, each training cycle (epoch) is trained and verified, and indicators such as training loss and verification loss are recorded. At the end of the verification phase, the accuracy, precision, and recall are calculated, and the best model is saved according to the accuracy of the verification set. The training ends when the maximum number of training rounds is reached or other stopping conditions are met, and a trained deep learning model is obtained.
[0128] The following is an explanation of the process of using the trained deep learning model for reasoning (i.e., the process of using the trained deep learning model for methylation detection).
[0129] First, load the model parameters from the configuration file, initialize the model and set the GPU or central processing unit (CPU) used to perform the inference process, and then load the pre-trained model weights from the specified path. For the DNA sequence to be tested, the corresponding raw electrical signal data is stored in the HDF5 file, and the base sequence, shift table, whether the base sequence is a reverse complementary sequence, the starting position and end position of the base sequence in the reference sequence, the reference sequence name and other information are stored in the BAM file. In the process of sequencing the DNA sequence to be tested, multiple reads will be generated. The HDF5 file stores the raw electrical signal data corresponding to each read, and the BAM file stores the base sequence information corresponding to each read. Each read corresponds to a read ID. By reading the ID, the data corresponding to the read can be read from the HDF5 file and the BAM file. Therefore, it is necessary to set a function to read the raw electrical signal data from the HDF5 file and a function to read the shift table and base sequence from the BAM file. During the inference process, all HDF5 files in the HDF5 directory can be traversed, and for each HDF5 file, its corresponding BAM file is found, and then each pair of HDF5 file and BAM file is processed.
[0130] The process of processing a pair of HDF5 files and BAM files includes: obtaining a list of read IDs; for each read ID, reading and normalizing the corresponding raw electrical signal data from the HDF5 file, and reading the corresponding shift table and base sequence from the BAM file; converting the shift table into a position to determine the raw electrical signal corresponding to each base; since the length of the raw electrical signal corresponding to each base is uneven, and the input matrix of the deep learning model needs to be aligned, the signal length can be adjusted to a preset length, for example, setting each base to retain 16 raw electrical signal points, if the number of raw electrical signal points corresponding to a base exceeds 16, 16 points are randomly selected, if the number of raw electrical signal points corresponding to a base is less than 16, 0 is added on both sides of the raw electrical signal to reach 16 points; finding all CG sites in the base sequence, for each CG site, extracting A CG sequence fragment of a preset length around the CG site and the original electrical signal data corresponding to the CG sequence fragment; the CG sequence fragment, the original electrical signal data corresponding to the CG sequence fragment, and the second sequence feature corresponding to the CG sequence fragment are input into the trained deep learning model to perform model reasoning, obtain the reasoning result and save it in CSV file format, and the reasoning result may include the read ID, the base sequence corresponding to the read ID, the reference sequence name, the starting position and the ending position of the base sequence corresponding to the read ID in the reference sequence, whether the base sequence corresponding to the read ID is a reverse complementary sequence, whether the CG site in the base sequence corresponding to the read ID is methylated, and other information; the extracted CG sequence fragments can be processed in batches, and model reasoning is performed on each batch of CG sequence fragments and their corresponding original electrical signal data, and the reasoning results are collected.
[0131] For the HDF5 files in the validation set, the base recognition program can be used to translate the raw electrical signal data into base sequences, and the path file of the correspondence between the raw electrical signal data and the base sequences can be obtained. According to the above reasoning process, the trained deep learning model is used for methylation detection, and the accuracy, precision, recall and F1 score (F1score) are calculated to verify the performance of the deep learning model. The calculation formulas for accuracy, precision, recall and F1score are as follows:
[0132]
[0133]
[0134]
[0135]
[0136] Wherein, TP represents a true positive example (i.e. predicted as a methylation site and actually a methylation site), TN represents a true negative example (i.e. predicted as a non-methylation site and actually a non-methylation site), FP represents a false positive example (i.e. predicted as a methylation site and actually a non-methylation site), and FN represents a false negative example (i.e. predicted as a non-methylation site and actually a methylation site). After experimental verification, the accuracy of the deep learning model of the embodiment of the present application reaches 93.3%, the precision reaches 94.8%, and the recall rate reaches 92.7%. After statistical calculation, the accuracy of the DNA methylation detection method of the embodiment of the present application at the gene level reaches 99%. Compared to the existing DNA methylation detection method based on the deep learning model, the DNA methylation detection method of the embodiment of the present application recognizes methylation sites with higher accuracy.
[0137] It should be noted that, although the embodiment of the present application introduces the DNA methylation detection method of the embodiment of the present application by taking the detection of the methylation status of the CG site in the DNA sequence to be tested as an example, those skilled in the art should understand that the present application should not be limited to this, and the DNA methylation detection method of the embodiment of the present application can also be used to detect the methylation status of other sites as long as the requirements are met.
[0138] Based on the same inventive concept of the above method embodiment, the embodiment of the present application also proposes a DNA methylation detection device.
[0139] Figure 7 FIG. 4 is a schematic diagram showing the structure of a DNA methylation detection device according to an embodiment of the present application. The device can be used to implement the above-mentioned DNA methylation detection method, such as Figure 7As shown, the device may include a first acquisition module 701, which is used to acquire a DNA sequence to be tested; a second acquisition module 702, which is used to acquire the original electrical signal data and base sequence corresponding to the DNA sequence to be tested through nanopore sequencing technology; a methylation detection module 703, which is used to obtain the methylation detection result corresponding to the DNA sequence to be tested according to the original electrical signal data, the base sequence and the deep learning model; wherein the deep learning model includes a sequence feature extraction module, a signal feature extraction module, a feature fusion module and a classification module; the sequence feature extraction module includes a Transformer encoder, and the sequence feature extraction module is used to extract the features of the base sequence; the signal feature extraction module includes a Conformer encoder, and the signal feature extraction module is used to extract the features of the original electrical signal data; the feature fusion module includes a Transformer decoder, and the feature fusion module is used to fuse the features of the base sequence and the features of the original electrical signal data to obtain the fused features; the classification module includes a fully connected layer, and the classification module is used to obtain the methylation detection result corresponding to the DNA sequence to be tested according to the fused features.
[0140] In a possible implementation, the methylation detection module 703 is further used to: determine the CG site in the base sequence; the CG site represents a dinucleotide sequence in which cytosine is followed by guanine; for each CG site in the base sequence, extract a CG sequence fragment of a preset length containing the CG site from the base sequence; obtain the first electrical signal data corresponding to each of the CG sequence fragments from the original electrical signal data; for each of the CG sequence fragments, input the CG sequence fragment, the first electrical signal data corresponding to the CG sequence fragment, and the second sequence feature corresponding to the CG sequence fragment into the deep learning model to obtain the methylation detection result corresponding to the CG sequence fragment; wherein the second sequence feature corresponding to the CG sequence fragment includes at least one of the signal mean, signal standard deviation and signal length of the first electrical signal data corresponding to the CG sequence fragment; the methylation detection result corresponding to the CG sequence fragment includes whether the CG site contained in the CG sequence fragment is methylated; according to the methylation detection result corresponding to each of the CG sequence fragments, the methylation detection result corresponding to the DNA sequence to be tested is obtained; the methylation detection result corresponding to the DNA sequence to be tested includes whether each CG site in the DNA sequence to be tested is methylated.
[0141] In a possible implementation, the methylation detection module 703 is further used to: input the CG sequence fragment and the second sequence feature into the sequence feature extraction module to obtain the sequence fragment feature; input the first electrical signal data into the signal feature extraction module to obtain the electrical signal feature; input the sequence fragment feature and the electrical signal feature into the feature fusion module to obtain the fusion feature; input the fusion feature into the classification module to obtain the methylation detection result corresponding to the CG sequence fragment.
[0142] In a possible implementation, the sequence feature extraction module also includes an embedding layer, a first position encoder and an attention fusion submodule; the methylation detection module 703 is also used to: input the CG sequence fragment into the embedding layer to obtain the embedding vector corresponding to the CG sequence fragment; input the CG sequence fragment into the first position encoder to obtain the position encoding vector corresponding to the CG sequence fragment; according to the embedding vector corresponding to the CG sequence fragment and the position encoding vector corresponding to the CG sequence fragment, obtain the first sequence feature corresponding to the CG sequence fragment; input the first sequence feature and the second sequence feature into the attention fusion submodule to obtain the third sequence feature corresponding to the CG sequence fragment; input the third sequence feature into the Transformer encoder to obtain the sequence fragment feature.
[0143] In a possible implementation, the attention fusion submodule includes a first feature splicing submodule, an attention weight calculation submodule, a feature weighting submodule, a second feature splicing submodule and an output submodule; the first feature splicing submodule is used to splice the first sequence feature and the second sequence feature to obtain a first splicing feature; the attention weight calculation submodule is used to calculate the attention weights corresponding to the first sequence feature and the second sequence feature; the feature weighting submodule is used to weight the first sequence feature and the second sequence feature according to the attention weights corresponding to the first sequence feature and the second sequence feature to obtain a first weighted feature and a second weighted feature; the second feature splicing submodule is used to splice the first weighted feature and the second weighted feature to obtain a second splicing feature; the output submodule is used to convert the second splicing feature into the third sequence feature.
[0144] In a possible implementation, the signal feature extraction module also includes a linear layer and a second position encoder; the methylation detection module 703 is also used to: input the first electrical signal data into the linear layer to obtain second electrical signal data; input the second electrical signal data into the second position encoder to obtain a position encoding vector corresponding to the second electrical signal data; obtain a first signal feature corresponding to the first electrical signal data based on the second electrical signal data and the position encoding vector corresponding to the second electrical signal data; input the first signal feature into the Conformer encoder to obtain the electrical signal feature.
[0145] In a possible implementation, the methylation detection module 703 is further used to: input the sequence segment feature and the electrical signal feature into the Transformer decoder to obtain the fusion feature.
[0146] In one possible implementation, the classification module includes a plurality of sequentially connected fully-connected layers; the methylation detection module 703 is further used to: input the fusion feature into the first fully-connected layer among the plurality of sequentially connected fully-connected layers, and obtain the methylation detection result corresponding to the CG sequence fragment output by the last fully-connected layer among the plurality of sequentially connected fully-connected layers.
[0147] The DNA methylation detection device of the embodiment of the present application obtains the original electrical signal data and base sequence corresponding to the DNA sequence to be tested through nanopore sequencing technology, and obtains the methylation detection result by processing the base sequence and the original electrical signal data using a deep learning model based on the Transformer architecture and the Conformer architecture. This can improve the recognition accuracy of methylation sites, achieve high-precision methylation detection, and effectively alleviate the problems of gradient vanishing and gradient exploding.
[0148] In some embodiments, the functions or modules included in the DNA methylation detection device provided in the embodiments of the present application can be used to execute the DNA methylation detection method described in the above method embodiments. Its specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.
[0149] The present application also provides a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the above-mentioned DNA methylation detection method is implemented. For example, the above-mentioned Figure 1 , Figure 2 or Figure 4 The DNA methylation detection method shown. The computer-readable storage medium may be a volatile or non-volatile computer-readable storage medium.
[0150] The present application also proposes an electronic device, comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to implement the above-mentioned DNA methylation detection method when executing the instructions stored in the memory. For example, the above-mentioned Figure 1 , Figure 2 or Figure 4 DNA methylation detection method shown.
[0151] The present application also provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code is executed in a processor of an electronic device, the processor in the electronic device executes the above-mentioned DNA methylation detection method. For example, the above-mentioned Figure 1 , Figure 2 or Figure 4 DNA methylation detection method shown.
[0152] Figure 8 1 is a block diagram of an electronic device 1900 according to an embodiment of the present application. For example, the electronic device 1900 may be provided as a server or a terminal device. Figure 8 The electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above-mentioned DNA methylation detection method. For example, the above-mentioned Figure 1 , Figure 2 or Figure 4 DNA methylation detection method shown.
[0153] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output interface 1958 (I / O interface). The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server 2003. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM or similar.
[0154] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to perform the above-mentioned DNA methylation detection method.
[0155] The present application may be a system, a method and / or a 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 application.
[0156] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may 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 of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) 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 disk 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 of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted 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 electrical signal transmitted through a wire.
[0157] 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, optical fiber transmissions, wireless transmissions, 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 for storage in the computer-readable storage medium in each computing / processing device.
[0158] The computer program instructions for performing the operation of the present application can be assembler instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related 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++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions can be executed completely on a user's computer, partially on a user's computer, executed as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet). In some embodiments, by using the state information of a computer-readable program instruction to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA), the electronic circuit can execute a computer-readable program instruction, thereby realizing various aspects of the present application.
[0159] Various aspects of the present application are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0160] 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 that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0161] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating 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 boxes in the flowchart and / or block diagram.
[0162] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can also be executed in the opposite order sometimes, depending on the function involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a dedicated hardware-based system that performs the function or action of the specification, or can be realized by a combination of special-purpose hardware and computer instructions.
[0163] The embodiments of the present application have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for detecting DNA methylation, characterized in that: include: Obtaining a DNA sequence to be tested; Obtaining raw electrical signal data and base sequence corresponding to the DNA sequence to be tested by nanopore sequencing technology; Obtaining a methylation detection result corresponding to the DNA sequence to be tested according to the original electrical signal data, the base sequence and the deep learning model; Among them, the deep learning model includes a sequence feature extraction module, a signal feature extraction module, a feature fusion module and a classification module; the sequence feature extraction module includes a Transformer encoder, and the sequence feature extraction module is used to extract the features of the base sequence; the signal feature extraction module includes a Conformer encoder, and the signal feature extraction module is used to extract the features of the original electrical signal data; the feature fusion module includes a Transformer decoder, and the feature fusion module is used to fuse the features of the base sequence and the features of the original electrical signal data to obtain the fused features; the classification module includes a fully connected layer, and the classification module is used to obtain the methylation detection result corresponding to the DNA sequence to be tested according to the fused features.
2. The method according to claim 1, characterized in that The method of obtaining the methylation detection result corresponding to the DNA sequence to be tested according to the original electrical signal data, the base sequence and the deep learning model includes: Determining a CG site in the base sequence; the CG site represents a dinucleotide sequence in which cytosine is followed by guanine; For each CG site in the base sequence, extracting a CG sequence fragment of a preset length containing the CG site from the base sequence; Acquire first electrical signal data corresponding to each of the CG sequence segments from the original electrical signal data; For each of the CG sequence fragments, the CG sequence fragment, the first electrical signal data corresponding to the CG sequence fragment, and the second sequence feature corresponding to the CG sequence fragment are input into the deep learning model to obtain a methylation detection result corresponding to the CG sequence fragment; wherein the second sequence feature corresponding to the CG sequence fragment includes at least one of the signal mean, signal standard deviation, and signal length of the first electrical signal data corresponding to the CG sequence fragment; the methylation detection result corresponding to the CG sequence fragment includes whether the CG site contained in the CG sequence fragment is methylated; According to the methylation detection result corresponding to each of the CG sequence fragments, the methylation detection result corresponding to the DNA sequence to be tested is obtained; the methylation detection result corresponding to the DNA sequence to be tested includes whether each CG site in the DNA sequence to be tested is methylated.
3. The method according to claim 2, characterized in that The step of inputting the CG sequence fragment, the first electrical signal data corresponding to the CG sequence fragment, and the second sequence feature corresponding to the CG sequence fragment into the deep learning model to obtain the methylation detection result corresponding to the CG sequence fragment comprises: Inputting the CG sequence fragment and the second sequence feature into the sequence feature extraction module to obtain a sequence fragment feature; Inputting the first electrical signal data into the signal feature extraction module to obtain electrical signal features; Inputting the sequence segment feature and the electrical signal feature into the feature fusion module to obtain a fusion feature; The fusion feature is input into the classification module to obtain the methylation detection result corresponding to the CG sequence fragment.
4. The method according to claim 3, characterized in that The sequence feature extraction module also includes an embedding layer, a first position encoder and an attention fusion submodule; The step of inputting the CG sequence fragment and the second sequence feature into the sequence feature extraction module to obtain the sequence fragment feature comprises: Inputting the CG sequence fragment into the embedding layer to obtain an embedding vector corresponding to the CG sequence fragment; Inputting the CG sequence fragment into the first position encoder to obtain a position encoding vector corresponding to the CG sequence fragment; Obtaining a first sequence feature corresponding to the CG sequence fragment according to the embedding vector corresponding to the CG sequence fragment and the position encoding vector corresponding to the CG sequence fragment; Inputting the first sequence feature and the second sequence feature into the attention fusion submodule to obtain a third sequence feature corresponding to the CG sequence fragment; The third sequence feature is input into the Transformer encoder to obtain the sequence segment feature.
5. The method according to claim 4, characterized in that The attention fusion submodule includes a first feature splicing submodule, an attention weight calculation submodule, a feature weighting submodule, a second feature splicing submodule and an output submodule; The first feature splicing submodule is used to splice the first sequence feature and the second sequence feature to obtain a first splicing feature; The attention weight calculation submodule is used to calculate the attention weights corresponding to the first sequence feature and the second sequence feature; The feature weighting submodule is used to perform weighted processing on the first sequence feature and the second sequence feature according to the attention weights corresponding to the first sequence feature and the second sequence feature to obtain a first weighted feature and a second weighted feature; The second feature splicing submodule is used to splice the first weighted feature and the second weighted feature to obtain a second splicing feature; The output submodule is used to convert the second splicing feature into the third sequence feature.
6. The method according to claim 3, characterized in that The signal feature extraction module also includes a linear layer and a second position encoder; The step of inputting the first electrical signal data into the signal feature extraction module to obtain electrical signal features includes: Inputting the first electrical signal data into the linear layer to obtain second electrical signal data; Inputting the second electrical signal data into the second position encoder to obtain a position encoding vector corresponding to the second electrical signal data; Obtaining a first signal feature corresponding to the first electrical signal data according to the second electrical signal data and a position encoding vector corresponding to the second electrical signal data; The first signal feature is input into the Conformer encoder to obtain the electrical signal feature.
7. The method according to claim 3, characterized in that The step of inputting the sequence segment feature and the electrical signal feature into the feature fusion module to obtain a fusion feature includes: The sequence segment features and the electrical signal features are input into the Transformer decoder to obtain the fusion features.
8. The method according to claim 3, characterized in that The classification module includes a plurality of fully connected layers connected in sequence; The step of inputting the fusion feature into the classification module to obtain the methylation detection result corresponding to the CG sequence fragment comprises: The fusion feature is input into the first fully connected layer among the multiple sequentially connected fully connected layers to obtain the methylation detection result corresponding to the CG sequence fragment output by the last fully connected layer among the multiple sequentially connected fully connected layers.
9. A DNA methylation detection device, characterized in that: include: A first acquisition module is used to acquire a DNA sequence to be tested; A second acquisition module is used to obtain the original electrical signal data and base sequence corresponding to the DNA sequence to be tested through nanopore sequencing technology; A methylation detection module, used to obtain a methylation detection result corresponding to the DNA sequence to be tested according to the original electrical signal data, the base sequence and the deep learning model; Among them, the deep learning model includes a sequence feature extraction module, a signal feature extraction module, a feature fusion module and a classification module; the sequence feature extraction module includes a Transformer encoder, and the sequence feature extraction module is used to extract the features of the base sequence; the signal feature extraction module includes a Conformer encoder, and the signal feature extraction module is used to extract the features of the original electrical signal data; the feature fusion module includes a Transformer decoder, and the feature fusion module is used to fuse the features of the base sequence and the features of the original electrical signal data to obtain the fused features; the classification module includes a fully connected layer, and the classification module is used to obtain the methylation detection result corresponding to the DNA sequence to be tested according to the fused features.
10. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to implement the method described in any one of claims 1 to 8 when executing the instructions stored in the memory.
Citation Information
Patent Citations
Solid forms of isoquinolinone derivatives, process of making same, compositions comprising same, and methods of using the same
CN108349985A
Speech recognition model construction method based on hot word feature vector self-attention mechanism
CN117437909A
Third-generation sequencing DNA methylation detection method based on electric signal and sequence fusion
CN117935909A
Base identification method and device for nanopore sequencing based on Transform architecture and storage medium
CN118038972A
Method, device, equipment, and medium for mining biosynthetic pathways of marine nutrients
JP7490168B1
Cited By
Nanopore sequencing signal identification method and system based on Transform
CN120873389A
Method and system for recognizing nanopore sequencing signal based on transformer
CN120873389B
DNA methylation recognition method based on deep learning and multi-scale feature fusion
CN121641195A
A DNA methylation recognition method based on deep learning and multi-scale feature fusion
CN121641195B