DNA methylation detection method, device and electronic device

By combining nanopore sequencing technology and deep learning models based on Transformer and Conformer architectures, the problem of low methylation site recognition accuracy in nanopore sequencing technology is solved, and high-precision DNA methylation detection is achieved, which alleviates the problems of gradient disappearance and gradient explosion.

CN119274648BActive Publication Date: 2025-08-12BEIJING POLYSEQ BIOTECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411415129.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2025-08-12
Estimated Expiration
2044-10-11

AI Technical Summary

Technical Problem

The existing nanopore sequencing technology has low methylation site recognition accuracy in DNA methylation detection, making it difficult to achieve high-accurate methylation detection.

Method used

Deep learning model based on Transformer architecture and Conformer architecture is adopted, combined with nanopore sequencing technology, by obtaining the original electrical signal data and base sequence of DNA sequences, the sequence feature extraction module, signal feature extraction module and feature fusion module are used to predict the methylation detection results.

Benefits of technology

It improves the recognition accuracy of methylation sites, achieves high-precision DNA methylation detection, and alleviates the problems of gradient disappearance and gradient explosion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119274648B_ABST
    Figure CN119274648B_ABST
Patent Text Reader

Abstract

The present application relates to a DNA methylation detection method, device and electronic device, wherein the method includes: obtaining a DNA sequence to be tested; obtaining original electrical signal data and base sequence corresponding to the DNA sequence to be tested through nanopore sequencing technology; obtaining a methylation detection result corresponding to the DNA sequence to be tested based on the original electrical signal data, base sequence and 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; the signal feature extraction module includes a Conformer encoder; the feature fusion module includes a Transformer decoder; and the classification module includes a fully connected layer; the method of the present application can improve the accuracy of identifying methylation sites, achieve high-precision methylation detection, and effectively alleviate the problems of gradient vanishing and gradient exploding.
Need to check novelty before this filing date? Find Prior Art

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 within the DNA molecule. DNA methylation primarily occurs at the 5' position of cytosine at CG sites (dinucleotide sequences consisting of cytosine followed by guanine, where C represents cytosine and G represents guanine), forming 5-methylcytosine (5-mC). DNA methylation is associated with gene expression regulation, genome stability, cell differentiation and development, and the development of various diseases. Accurately identifying methylation sites through DNA methylation testing is of great significance.

[0003] Nanopore sequencing DNA methylation detection is an emerging DNA methylation detection method. This method applies nanopore sequencing technology to DNA methylation detection. It uses nanoscale protein pores to directly detect the current changes generated when DNA molecules pass through. Since methylation sites will cause unique current changes, methylation sites can be identified by analyzing the current signal. Nanopore sequencing for DNA methylation detection offers the following advantages: 1. Direct sequencing: Nanopore sequencing can directly read the sequence and methylation status of individual DNA molecules, reducing sample processing steps and potential bias. 2. It can simultaneously detect DNA sequence and methylation status. 3. Nanopore sequencing offers the advantages of high throughput and long read length, covering the entire genome and providing a comprehensive methylation profile. 4. Nanopore sequencing performs DNA sequencing in real time, enabling rapid results. 5. It eliminates the need for polymerase chain reaction (PCR) amplification, avoiding amplification bias and PCR-induced errors, and more accurately reflects the methylation status of the original sample. 6. It is applicable to a variety of sample types. 7. Nanopore sequencing is highly sensitive, enabling the detection of 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 can be analyzed using a variety of bioinformatics tools, providing high flexibility in data analysis. These advantages make nanopore sequencing 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 DNA methylation detection method using nanopore sequencing technology in identifying methylation sites.

[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 based on 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 a methylation detection result corresponding to the DNA sequence to be tested based on the fused features.

[0006] In a possible implementation, the method of obtaining the methylation detection result corresponding to the DNA sequence to be tested based on the original electrical signal data, the base sequence and the deep learning model includes: 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 segment and the second sequence feature into the sequence feature extraction module to obtain the sequence segment feature includes: inputting the CG sequence segment into the embedding layer to obtain the embedding vector corresponding to the CG sequence segment; inputting the CG sequence segment into the first position encoder to obtain the position encoding vector corresponding to the CG sequence segment; according to the embedding vector corresponding to the CG sequence segment and the position encoding vector corresponding to the CG sequence segment, obtaining the first sequence feature corresponding to the CG sequence segment; 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 segment; inputting the third sequence feature into the Transformer encoder to obtain the sequence segment feature.

[0009] In one 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 spliced 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 spliced feature; the output submodule is used to convert the second splicing feature into the third sequence feature.

[0010] In one possible implementation, the signal feature extraction module also includes a linear layer and a second position encoder; 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 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 based on 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, inputting the sequence segment features and the electrical signal features into the feature fusion module to obtain the fused features includes: inputting the sequence segment features and the electrical signal features into the Transformer decoder to obtain the fused features.

[0012] In one possible implementation, the classification module includes multiple 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 includes: inputting the fusion feature into the first fully connected layer among the multiple fully connected layers connected in sequence, and obtaining the methylation detection result corresponding to the CG sequence fragment output by the last fully connected layer among the multiple fully connected layers connected in sequence.

[0013] According to another aspect of the present application, a DNA methylation detection device is provided, comprising: a first acquisition module for acquiring a DNA sequence to be tested; a second acquisition module for acquiring raw electrical signal data and a base sequence corresponding to the DNA sequence to be tested through nanopore sequencing technology; a methylation detection module for obtaining a methylation detection result corresponding to the DNA sequence to be tested based on 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 a methylation detection result corresponding to the DNA sequence to be tested based on the fused features.

[0014] In one 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 CG sequence fragment from the original electrical signal data; for each CG sequence fragment, 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; based on the methylation detection result corresponding to each CG sequence fragment, 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 one 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 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.

[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; obtain the first sequence feature corresponding to the CG sequence fragment based on the embedding vector corresponding to the CG sequence fragment and the position encoding vector 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 one 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 spliced 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 spliced feature; the output submodule is used to convert the second splicing feature into the third sequence feature.

[0018] In one possible implementation, the signal feature extraction module also includes a linear layer and a second position encoder; the methylation detection module is further 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 configured to: input the sequence segment feature and the electrical signal feature into the Transformer decoder to obtain the fusion feature.

[0020] In one possible implementation, the classification module includes multiple fully connected layers connected in sequence; the methylation detection module is further used to: input the fusion feature into the first fully connected layer among the multiple fully connected layers connected in sequence, and obtain the methylation detection result corresponding to the CG sequence fragment output by the last fully connected layer among the multiple fully connected layers connected in sequence.

[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 raw 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 raw 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 application and, together with the description, serve to explain the principles of the 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 structural diagram 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 is shown.

[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 indicated.

[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, numerous specific details are provided in the detailed description below to better illustrate the present application. Those skilled in the art will appreciate that the present application can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art are not described in detail in order to highlight the main purpose of the present application.

[0038] The performance of nanopore sequencing DNA methylation detection methods is primarily evaluated based on read-level accuracy and genome-level accuracy. Read-level accuracy refers to the accuracy with which methylation sites are detected and identified within a single sequencing read. A single sequencing read, also known as a read, is a continuous base sequence fragment read and measured during a single sequencing reaction during the DNA sequencing process. The complete DNA sequence can be reconstructed by aligning and splicing a large number of reads. Read-level accuracy reflects the ability of a nanopore sequencing DNA methylation detection method to correctly identify the methylation status of a single DNA sequence fragment. High read-level accuracy means that methylation sites in each sequencing read can be accurately detected and recorded. Genome-level accuracy refers to the accuracy with which methylation sites are detected and identified across the entire genome. Genome-level accuracy reflects the ability of a nanopore sequencing DNA methylation detection method to correctly identify methylation status 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 categorized as statistical-based and model-based. Statistical-based methods infer methylation status by performing statistical tests on the current signal between the target DNA sequence and a methylated DNA sequence. To identify methylated DNA bases, statistical-based methods require two sets of sequencing reads: one from native DNA and the other from matched amplified DNA. By measuring the difference between these two sets of sequencing reads, the methylation status of the target DNA base can be predicted at the genomic level. Researchers have used the Mann-Whitney U test to detect controlled DNA methylation in Escherichia coli, identifying 5-mC and N6-methylation (6-mA) with over 62% accuracy at the genome level. Researchers have also used the Kolmogorov-Smirnov test in the NanoMod tool to identify methylated bases, testing E. coli methylation data and achieving over 70% accuracy at the genome level. Statistical-based detection methods do not require a training dataset to detect methylated bases, but they do require matched amplified DNA as a control sample to identify methylated bases in natural DNA. Furthermore, 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. CpG dinucleotide sequences are CG sites, where p represents a 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. However, due to limited training data, this 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. Researchers have proposed the signalAlign tool, which uses HMM and Hierarchical Dirichlet Processes (HDP) to identify 5-mC at cytosine and 6-mA at GATC motifs within 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. 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 total genome size) 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 raw 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 raw 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 raw electrical signals; then, the features constructed by the two modules are connected and input into a fully connected neural network to predict the DNA methylation status. This detection method has higher accuracy 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 exploding.

[0042] In view of this, the embodiments of the present application propose 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. This 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. Obtain a DNA sequence to be tested.

[0045] S102 , obtaining original electrical signal data and base sequence corresponding to the DNA sequence to be tested through nanopore sequencing technology.

[0046] Nanopore sequencing technology detects the base sequence in a DNA molecule passing through a nanopore by detecting changes in the current induced by the nanopore. During the sequencing process, as a DNA molecule passes through the nanopore, the different bases have different electrical properties, causing different changes in the current as they pass through the nanopore. These changes are captured and converted into base identification information, enabling sequencing.

[0047] In one possible implementation, obtaining the raw 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 raw electrical signal data and base sequence corresponding to the DNA sequence to be tested.

[0048] For example, a nanopore sequencer can be used to perform base recognition on a DNA sequence to be tested, generating a FastQ file containing the base sequence and a path file containing the correspondence between the base sequence and the raw electrical signal data. The FastQ file is used to store DNA sequencing data and includes the base sequence generated by the nanopore sequencer as well as sequencing quality information. The path file records the raw 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 alignment tool to determine the positional information (starting position and ending position) of the base sequence in the reference sequence. Reference sequence can be obtained from a disclosed database, such as GEO (Gene Expression Omnibus) database. After obtaining the methylation test result corresponding to the DNA sequence to be tested, the accuracy of the methylation test result can be compared with the standard results obtained from the EpiQC (Epigenomics Quality Control) project. The positional annotation for the methylation site in the standard results of the EpiQC project is demarcated according to the position of the human standard reference genome, and determining that the positional information of the base sequence in the reference sequence helps to mate the subsequent methylation test result obtained with the standard results of the EpiQC project.

[0050] For example, for each DNA sequence to be tested, the raw 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 raw electrical signal data, whether the base sequence is a reverse complementary sequence, the starting and ending positions 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 raw electrical signal data is also called a shift table. The shift table can be composed of 0s and 1s, where 1 indicates that the electrical signal starting at this position is a base, until the next 1 appears, indicating a new base. In this way, the shift table can record which points in the raw electrical signal data a base corresponds to, and the shift table can be used to conveniently crop the raw electrical signal data.

[0051] S103. Obtain a methylation detection result corresponding to the DNA sequence to be tested based on 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 can 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 results corresponding to the DNA sequence to be tested based on 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 aspects such as 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. It can improve the accuracy of identifying methylation sites, achieve high-precision methylation detection, and effectively alleviate the problems of gradient vanishing and gradient explosion in the existing methylation detection method based on the deep learning model.

[0054] 5-mC methylation at CG sites is the most common type of methylation, and accurately identifying methylation at CG sites is of great research significance. The following describes the specific implementation process of obtaining the methylation detection result corresponding to the DNA sequence under test in step S103 based on the raw electrical signal data, the base sequence, and the deep learning model, using the identification of methylation at CG sites as an example.

[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] For example, all CG sites in a base sequence can be found, and for each CG site, a CG sequence segment of a predetermined length centered around the "C" base in that CG site can be obtained from the base sequence. For example, for each CG site, a left and right window can be opened centered around the "C" base in that CG site, with the left and right windows each containing 10 bases, forming a CG sequence segment of 21 bases in length.

[0059] S1033. Obtain first electrical signal data corresponding to each CG sequence segment from the original electrical signal data.

[0060] Exemplarily, for each CG sequence segment, the electrical signal segments corresponding to each base in the CG sequence segment can be obtained according to the path file, and these electrical signal segments constitute the first electrical signal data corresponding to the CG sequence segment.

[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 a methylation detection result corresponding to the DNA sequence to be tested based on the methylation detection result corresponding to each CG sequence fragment; 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 can 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 segment and the second sequence feature into the sequence feature extraction module to obtain the sequence segment 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] For example, 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 (i.e., an embedding vector).

[0071] (2) Inputting the CG sequence segment into the first position encoder to obtain a position encoding vector corresponding to the CG sequence segment.

[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] For example, 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 is the same as the dimension of the embedding vector; PE(pos,2i) represents the value of the 2i-th element in the position encoding vector of 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 of the pos position in the sequence.

[0077] (3) Obtaining a first sequence feature corresponding to the CG sequence segment based on the embedding vector corresponding to the CG sequence segment and the position encoding vector corresponding to the CG sequence segment.

[0078] Exemplarily, the embedding vector corresponding to the CG sequence segment and the position encoding vector corresponding to the CG sequence segment can be added to obtain the first sequence feature corresponding to the CG sequence segment. The first sequence feature contains the semantic information and position information of the CG sequence segment. The specific process of adding the embedding vector and the position encoding vector can refer to the existing technology. 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 segment.

[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 splicing submodule, an attention weight calculation submodule, a feature weighting submodule, a second feature splicing 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 spliced feature. The first sequence feature and the second sequence feature can be spliced in the last dimension to obtain the first spliced feature. The specific splicing process can refer to the existing technology.

[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 through the attention layer. The first spliced feature can be input into the attention layer to calculate the attention score, and the attention score is normalized by the SoftMax function to obtain the attention weight.

[0084] The feature weighting submodule is configured to weight the first sequence features and the second sequence features based on the attention weights corresponding to the first sequence features and the second sequence features to obtain a first weighted feature and a second weighted feature. The feature weighting submodule may include two channels, one channel for weighting the first sequence features to obtain the first weighted feature, and the other channel for weighting the second sequence features 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 spliced feature. The first weighted feature and the second weighted feature can be spliced in the last dimension to obtain the second spliced feature. The specific splicing process can refer to the existing technology.

[0086] The output submodule is used to convert the second concatenated features into the third sequence features. The output submodule can be implemented by the output layer, and the second concatenated features can be input into the output layer to obtain the third sequence features output by the output layer.

[0087] (5) Inputting the third sequence feature into the Transformer encoder to obtain the sequence segment feature.

[0088] For example, 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 sequences, more efficiently utilize computing resources, and avoid vanishing or exploding gradients when processing long sequences. By using the Transformer encoder, sequence segment features can be extracted efficiently and accurately, effectively alleviating the problems of vanishing and exploding gradients.

[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 embedding vector corresponding to the CG sequence segment.

[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. The specific implementation process may refer to related technologies.

[0097] (4) Inputting the first signal feature into the Conformer encoder to obtain the electrical signal feature.

[0098] For example, 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 to obtain the electrical signal features output by the last layer of the Conformer encoder.

[0099] The Conformer encoder combines the global self-attention mechanism of the Transformer architecture with the local feature extraction capabilities of convolutional neural networks, capable of simultaneously capturing global dependencies and local patterns in input features. By using depthwise separable convolutional modules, it reduces the number of parameters while maintaining efficient feature extraction, improving computational efficiency. Residual connections facilitate information flow, alleviate the vanishing gradient problem, and make deep network training more stable. The Conformer encoder allows for efficient and accurate extraction of electrical signal features and effectively mitigates the vanishing gradient problem.

[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 a 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 are fused through a Transformer decoder layer. The Transformer decoder layer acts as an attention mechanism, allowing the model to establish associations between the sequence segment features and the electrical signal features. The Transformer decoder layer fuses the sequence segment features and the electrical signal features through a multi-head self-attention mechanism, a cross-attention mechanism, a feedforward neural network, and residual connections. First, the Transformer decoder layer performs multi-head self-attention on the electrical signal features to capture the global dependencies of the electrical signal features. Then, the Transformer decoder layer performs cross-attention on the sequence segment features and the electrical signal features to establish associations between them. The cross-attention mechanism allows the model to exchange information between the two feature streams, thereby achieving feature fusion. The fused features are then nonlinearly transformed through a feedforward neural network. Finally, the input and output features are added through residual connections to promote information flow and alleviate the vanishing gradient problem, ultimately resulting in the fused features output by the Transformer decoder layer.

[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 dimensionality of the input features. For example, the dimensionality of the electrical signal features 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] Here, x represents the input value and ReLU(x) represents the output value. Applying the ReLU activation function can effectively alleviate the vanishing gradient 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. 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 performs 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, while realizing 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 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 5 As shown, the first electrical signal data is dimensionally adjusted by the linear layer in the signal feature extraction module and positionally encoded, and then input into the 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 the 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 the 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 the Transformer decoder in the feature fusion module, and feature fusion is performed based on the attention mechanism to obtain fused features; the fused features are input into the classification module, and the methylation detection results are output after passing through a series of fully connected layers.

[0117] 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. 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 CG sequence segments, first electrical signal data corresponding to the CG sequence segments, and the signal mean, signal standard deviation and signal length of the first electrical signal data; wherein, the CG sequence segments, 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 segment is input into the embedding layer to obtain the embedding vector corresponding to the CG sequence segment 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 first spliced, and then the spliced 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 spliced 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 segment 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, the global dependency of the input features is first calculated through the multi-head self-attention mechanism, and then the local features are extracted through the convolution module. Then, a nonlinear transformation is performed through the feedforward neural network, and finally, the input features and the output features are added through the residual connection; after passing through multiple layers of the Conformer encoder, the electrical signal features are finally output.

[0120] The sequence segment features and electrical signal features are then input into the Transformer decoder in the feature fusion module for feature fusion. In the Transformer decoder, the global dependencies of the electrical signal features are first captured through a multi-head self-attention mechanism. The association between the sequence segment features and the electrical signal features is then calculated and established through a cross-attention mechanism. A nonlinear transformation is then performed through a feedforward neural network. Finally, the input features and output features are added together through a 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 can 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. 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 following describes the training process of the deep learning model of the embodiment of the present application. 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 can be used (namely, the NA12878 cell line and three cell lines of Han Chinese descent, HG005, HG006, and HG007. These human genome standards are reference materials for the genome benchmark of the Genome in a Bottle Consortium) and a standard mouse genome NIH3T3, and the corresponding data can be obtained from the GEO database. For each genome, cytosine deamination and whole-genome sequencing can be performed using 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 methylated and unmethylated cytosine counts of two replicates can be summed, and the obtained cytosine site information can be statistically analyzed.

[0125] After preparing sample data, a nanopore sequencer (such as the PolyseqOne nanopore sequencer) can be used to perform base calling on the sample data of the aforementioned genomic standards, generating a FastQ file containing base sequence information and a path file containing the correspondence between the base sequence and the raw electrical signal data. The resulting base sequence can then be aligned with a reference sequence using a DNA sequence alignment tool (such as the minimap2 tool) to obtain the positional information of the base sequence within the reference sequence. A Python script can then be used to identify all CG sites in the base sequence. For each CG site, a window of 10 bases on each side is created, centered around the "C" base, to form a 21-base sequence segment. The corresponding electrical signal segment for each base is then found using the path file. Finally, each sequence segment is evaluated based on the standard results obtained from the EpiQC project. If the CG site in the sequence segment is methylated, the segment is labeled "1"; if the CG site in the sequence segment is not methylated, the segment is labeled "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 dataset for subsequent training of deep learning models.

[0126] Before training a deep learning model, first prepare the data. Load a sample dataset and split it into a training set and a validation set, with a ratio of 9:1. Then, set parameters such as the batch size (for example, 10,000) and worker threads, define the model class, and initialize the model structure and loss function. For the optimizer and learning rate schedule, use the Adam optimizer and a cosine annealing learning rate schedule with a warm-up period. For training settings, specify the graphics processing unit (GPU) to be used for training and set parameters such as the maximum number of training rounds.

[0127] The model training process includes: initializing the model and loading pre-trained weights; printing the model structure and number of parameters; checking for a recovery checkpoint; if so, resuming training from that checkpoint; otherwise, restarting training from scratch. Model initialization includes: defining basic model parameters such as sequence length, signal length, number of categories, embedding vector dimensions, 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 model training, training and validation are performed for each epoch, recording metrics such as training loss and validation loss. At the end of the validation phase, accuracy, precision, and recall are calculated. The best model based on the validation set accuracy is saved. Training ends when the maximum number of epochs is reached or other stopping conditions are met, resulting in a trained deep learning model.

[0128] The following describes the process of using the trained deep learning model for inference (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. 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 and ending positions of the base sequence in the reference sequence, the reference sequence name, and other information are stored in the BAM file. During the sequencing of the DNA sequence to be tested, multiple reads are 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 up 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 to both sides of the raw electrical signal to reach 16 points; finding all CG sites in the base sequence, and 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 inference, obtain the inference result and save it in CSV file format, and the inference 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 inference is performed on each batch of CG sequence fragments and their corresponding original electrical signal data, and the inference results are collected.

[0131] For the HDF5 files in the validation set, a base recognition program can be used to translate the raw electrical signal data into base sequences. A path file is then obtained that shows the correspondence between the raw electrical signal data and the base sequences. Methylation detection is then performed using the trained deep learning model according to the above reasoning process. 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 F1 score are as follows:

[0132]

[0133]

[0134]

[0135]

[0136] Wherein, TP represents a true positive example (i.e., predicted to be a methylation site and actually a methylation site), TN represents a true negative example (i.e., predicted to be a non-methylation site and actually a non-methylation site), FP represents a false positive example (i.e., predicted to be a methylation site and actually a non-methylation site), and FN represents a false negative example (i.e., predicted to be a non-methylation site and actually a methylation site). After experimental verification, the accuracy of the deep learning model of the present application embodiment 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 present application embodiment on the gene level reaches 99%. Compared to the existing DNA methylation detection method based on deep learning model, the DNA methylation detection method of the present application embodiment identifies 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. 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 needs 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. 1 shows a schematic structural diagram of a DNA methylation detection device according to an embodiment of the present application, which 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 for acquiring a DNA sequence to be tested; a second acquisition module 702 for acquiring original electrical signal data and a base sequence corresponding to the DNA sequence to be tested through nanopore sequencing technology; a methylation detection module 703 for obtaining a methylation detection result corresponding to the DNA sequence to be tested based on the original electrical signal data, the base sequence and a 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 based on the fused features.

[0140] In one 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 CG sequence fragment from the original electrical signal data; for each CG sequence fragment, 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; based on the methylation detection result corresponding to each CG sequence fragment, 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 one 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; obtain the first sequence feature corresponding to the CG sequence fragment based on the embedding vector corresponding to the CG sequence fragment and the position encoding vector 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 one 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 spliced 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 spliced feature; the output submodule is used to convert the second splicing feature into the third sequence feature.

[0144] In one possible implementation, the signal feature extraction module also includes a linear layer and a second position encoder; the methylation detection module 703 is further 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 configured 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 multiple fully connected layers connected in sequence; the methylation detection module 703 is further used to: input the fusion feature into the first fully connected layer among the multiple fully connected layers connected in sequence, and obtain the methylation detection result corresponding to the CG sequence fragment output by the last fully connected layer among the multiple fully connected layers connected in sequence.

[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 having computer program instructions stored thereon, which implement the above-mentioned DNA methylation detection method when the computer program instructions are executed by a processor. For example, the above-mentioned Figure 1 、 Figure 2 or Figure 4 The DNA methylation detection method shown. The computer-readable storage medium can 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 computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, and 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 FIG1 shows a block diagram of an electronic device 1900 according to an embodiment of the present application. For example, the electronic device 1900 can 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 that can be executed 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 further 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, method and / or computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present application.

[0156] A computer-readable storage medium can be a tangible device that can hold and store instructions for use by an instruction execution device. A computer-readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination thereof. As used herein, a computer-readable storage medium is not to be construed as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through an electrical 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, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in the computer-readable storage medium in each computing / processing device.

[0158] The computer program instructions for performing the operation of the present application can be assembly 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, wherein the programming language includes object-oriented programming languages such as Smalltalk, C++, and conventional procedural programming languages such as "C" language or similar programming languages. Computer-readable program instructions can be executed completely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or executed 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 by any type of network including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (such as by using an Internet service provider to connect to the Internet). In certain embodiments, by utilizing the state information of computer-readable program instructions to personalize electronic circuits, such as programmable logic circuits, field programmable gate arrays (FPGAs) or programmable logic arrays (PLAs), the electronic circuits can execute computer-readable program instructions, thereby realizing various aspects of the present application.

[0159] Various aspects of the present application are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.

[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 is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[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 operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0162] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the system, method and computer program product according to multiple embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a special hardware-based system that performs the function or action of the specification, or can be implemented by a combination of special hardware and computer instructions.

[0163] While various embodiments of the present application have been described above, the above descriptions are illustrative, non-exhaustive, and not intended to be limiting of the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, their practical applications, or technological improvements in the marketplace, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A DNA methylation detection method, characterized in that: include: Obtaining a deoxyribonucleic acid 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 based on 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 based on the fused features.

2. The method according to claim 1, characterized in that Obtaining a methylation detection result corresponding to the DNA sequence to be tested based on 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 includes: 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 features and the electrical signal features into the feature fusion module to obtain fusion features; 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 segment and the second sequence feature into the sequence feature extraction module to obtain the sequence segment 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 segment into the first position encoder to obtain a position encoding vector corresponding to the CG sequence segment; Obtaining a first sequence feature corresponding to the CG sequence segment according to the embedding vector corresponding to the CG sequence segment and the position encoding vector corresponding to the CG sequence segment; 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 segment; 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 configured 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 spliced 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; Inputting the fusion feature into the classification module to obtain the methylation detection result corresponding to the CG sequence fragment includes: 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 obtain 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 is used to obtain a methylation detection result corresponding to the DNA sequence to be tested based on 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 based on 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 according to 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

  • Base identification method and device for nanopore sequencing based on Transform architecture and storage medium

    CN118038972A