A cuckoo hashing growing tree DNA assembly sequencing method and computer readable medium
The Cuckoo Hash Tree DNA Assembly Sequencing Method utilizes hash tables to accelerate the search and matching in the read library and dynamically expands the hash table to store assembly growth information, thus solving the problem of low efficiency in existing DNA assembly tree algorithms and achieving efficient DNA assembly sequencing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WUHAN UNIV
- Filing Date
- 2024-03-28
- Publication Date
- 2026-05-19
AI Technical Summary
Existing DNA splicing and tree growth algorithms are inefficient and wasteful of resources. They cannot effectively prevent the growth of circular DNA, resulting in severe branching and the formation of a huge tree structure.
The Cuckoo Hash Tree DNA Assembly Sequencing Method was adopted. Through row partitioning and iterative replacement storage, reads in the reads library were stored in the Cuckoo Hash Table. The assembly growth was determined by combining the Cuckoo Hash Table. A dynamic Cuckoo Hash Table was used to store read information during the assembly growth process, and the hash table was dynamically expanded to save space resources.
It improves the efficiency of splicing and growth, reduces time complexity, saves storage space resources, prevents the formation of ring structures, and improves the load rate and space utilization of hash tables.
Smart Images

Figure CN118280443B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of DNA splicing and sequencing algorithms, and more particularly to a cuckoo hash-growing tree DNA splicing and sequencing method and a computer-readable medium. Background Technology
[0002] DNA splicing and sequencing is a crucial step in genetic engineering, stemming from the in-depth research and demand for gene sequences. With the development of biological sciences, researchers have increasingly recognized the importance of gene sequences in understanding biological problems. However, genes in nature are often very long, making direct sequencing difficult and costly. Therefore, DNA splicing and sequencing technology emerged, which reduces sequencing difficulty and improves research efficiency by dividing the target gene into small fragments for sequencing and then splicing these fragments into a complete gene sequence. Sequence splicing algorithms are a key technology in the DNA sequencing process. With the development of sequencing technology, achieving high-throughput and high-efficiency sequencing has become a significant challenge in the field of bioinformatics, and sequence splicing algorithms are constantly being improved to enhance splicing results.
[0003] In the process of implementing this invention, the inventors of this application discovered the following problems with the current growing tree algorithm used for DNA splicing:
[0004] Reads refer to short DNA fragments obtained directly through DNA sequencing, typically ranging from 50 to 500 bases in length. These short DNA fragments contain every base from the original long DNA sequence. All reads obtained from sequencing the same long DNA sequence together constitute a read library.
[0005] Traditional DNA splicing and tree-growing algorithms are given a deduplicated and error-free library of reads. The algorithm randomly selects a read from the library as the starting point, labeled A. Next, a certain length of fragment is truncated from the end of A and compared with all the remaining reads in the library. If the header bases of some reads match the truncated fragment, the overlap is considered successful, and the remaining bases of the matching read are spliced to the end of A, completing one growth cycle. During read growth, there may be multiple matching reads. Unable to determine which is true and which is false, all reads are grown, leading to branching and multiple branches. As the growth process continues, the branching becomes more pronounced, eventually forming a large tree-like structure, i.e., a tree.
[0006] However, during the algorithm implementation, it was found that comparing with all remaining reads was very slow, and because all reads grow, it was impossible to prevent the already formed circular DNA from stopping its growth, resulting in wasted resources. Therefore, the existing growing tree DNA splicing algorithm has certain drawbacks in practical engineering implementation and application. Summary of the Invention
[0007] To address the low efficiency of existing tree splicing algorithms in DNA splicing sequencing, this invention proposes a cuckoo hash tree splicing DNA splicing sequencing method and a computer-readable medium.
[0008] The technical solution adopted in this invention is a cuckoo hash tree DNA splicing and sequencing method, specifically including:
[0009] The head and tail of each read are obtained by dividing the line into segments;
[0010] Each read in the reads library is stored in a Cuckoo Hash Table by iteratively replacing the storage;
[0011] By combining the cuckoo hash table to determine splicing growth, and combining the position of the head of the successfully matched reads, the information of the reads in the splicing growth process is stored in a dynamic cuckoo hash table.
[0012] DNA sequencing is achieved by iteratively growing a tree.
[0013] The specific steps of the method of the present invention are as follows:
[0014] Step 1: Obtain the reads library; determine the length of the cuckoo hash table based on the number of reads in the reads library; further construct the cuckoo hash table; determine the maximum number of collisions in the cuckoo hash table and the number of hash values corresponding to each read; number the reads in the reads library to obtain the number of each read in the reads library.
[0015] Step 2: Based on the number of bases in each read in the reads library, select the base length for overlap comparison during the splicing process for each read;
[0016] Step 3: Based on the base lengths of each read during the splicing process, divide each read in the reads library into segments sequentially to obtain the head and tail of each read.
[0017] Step 4: Store the head of the current round of reads, the tail of the current round of reads, and the number of the current round of reads in the Cuckoo Hash Table in sequence;
[0018] Step 5: Repeat step 4 to restore the replaced reads in the Cuckoo Hash Table;
[0019] Step 6: Repeat steps 4 and 5 until each read in the reads library is stored in the Cuckoo Hash Table, thus obtaining the Cuckoo Hash Table storing the reads;
[0020] Step 7: Construct a dynamic cuckoo hash table to store information about reads in the reads library used in subsequent splicing processes, and determine the maximum number of collisions in the dynamic cuckoo hash table and the number of hash values corresponding to the number of each read.
[0021] Step 8: Randomly select a read from the reads library as the starting point for the growth tree. Select consecutive bases with overlapping matching lengths from the last base of the starting point to define the query search segment. Determine whether splicing growth can be performed based on whether the query search segment is the same as the read header stored in the Cuckoo Hash Table where the reads are stored. Look up the number of the read stored at the position of the successfully matched read header in the dynamic Cuckoo Hash Table. Store the information of the reads used in the splicing growth process in the dynamic Cuckoo Hash Table.
[0022] Step 9: Repeat step 8 to grow the tree, and achieve DNA sequencing by continuously extending the sequence until all branches can no longer grow or have stopped growing.
[0023] Preferably, the reads library in step 1 includes multiple reads;
[0024] Each read includes multiple bases;
[0025] Step 1, which determines the length of the Cuckoo Hash Table based on the number of reads in the reads library, is as follows:
[0026] The length of the Cuckoo Hash Table is set to 1.2 times the number of reads in the reads library. If the value corresponding to 1.2 times the number of reads in the reads library is not odd, then the value corresponding to 1.2 times the number of reads in the reads library is incremented until the nearest odd value corresponding to 1.2 times the number of reads in the reads library is obtained, which is used as the length of the Cuckoo Hash Table.
[0027] The cuckoo hash table described in step 1 is used to store multiple reads in the reads library;
[0028] The number of hash values corresponding to each read in step 1 is defined as:
[0029] The number of positions that the multiple hash values corresponding to each read are mapped to in the Cuckoo Hash Table, i.e., the number of hash values corresponding to each read;
[0030] Preferably, step 3 involves sequentially dividing each read in the reads library into segments, as detailed below:
[0031] Specifically, the first base of each read in the reads library is used as the dividing point. The base length of each read that is continuously selected during the splicing process is defined as the head of each read. The remaining consecutive bases in each read, excluding the head, are used as the tail of each read.
[0032] In step 3, the base length for overlapping and comparison during the splicing process of each read is x, the number of bases in each read in the read library is L, the head of each read includes x bases, and the tail of each read includes Lx bases.
[0033] Preferably, step 4 involves storing the header, tail, and number of the current round of reads in a Cuckoo Hash Table, as follows:
[0034] Step 4.1: append k to the end of the header of the current round of reads as the kth similar segment of the header of the current round of reads, k∈[1,K], where K represents the number of hash values of the current round of reads;
[0035] Step 4.2: Calculate the hash value of the kth similar segment in the header of the current round of reads by sequentially applying the SHA256 algorithm;
[0036] Step 4.3: Perform a modulo operation on the length of the Cuckoo Hash Table based on the hash value of the kth similar segment in the header of the current round of reads to obtain the storage location of the kth similar segment in the Cuckoo Hash Table.
[0037] Step 4.4: If there are multiple empty storage locations in the Cuckoo Hash Table for the K similar segments of the head of the current round of reads, then randomly select one of the multiple empty storage locations to store the head of the current round of reads. Construct a linked list in the corresponding empty storage location and store the tail of the current round of reads and the number of the current round of reads in the linked list.
[0038] If the K similar segments at the head of the current round of reads are all stored in non-empty locations in the Cuckoo Hash Table, then iterate through and compare the head of the current round of reads with the heads of the reads corresponding to the K similar segments at the head of the current round of reads in the Cuckoo Hash Table. If they are the same, then store the tail of the current round of reads and the number of the current round of reads in the linked list with the same head location. Otherwise, randomly select a storage location from the storage locations of the K similar segments at the head of the current round of reads in the Cuckoo Hash Table, then replace the head of the reads originally stored in the storage location with the head of the current round of reads, and replace the tail of the reads and the number of the reads originally stored in the linked list in the storage location with the tail of the current round of reads and the number of the current round of reads.
[0039] Preferably, the number of hash values corresponding to the number of each read in step 7 is defined as:
[0040] The number of positions that the multiple hash values corresponding to the number of each read are mapped to in the dynamic cuckoo hash table, that is, the number of hash values corresponding to each read;
[0041] As a preferred embodiment, the growth tree described in step 8 is defined as follows:
[0042] A growth tree refers to a situation where, during the growth of reads, there may be multiple reads that can be successfully matched at a given time. Since it's impossible to determine which read is true and which is false, all reads must be grown. This process leads to branching, where branches are formed during the growth process. The trunk is the line segment between two branching points. As growth continues, more and more branches appear, forming a large tree-like structure, thus creating a growth tree.
[0043] Step 8, which determines whether splicing and growth can be performed based on whether the search fragment is the same as the header stored in the Cuckoo Hash Table storing reads, is as follows:
[0044] The query search fragment is processed through steps 4.1-4.3 to obtain the K positions that can be stored in the cuckoo hash table storing reads obtained in step 6. The K positions that can be stored in the query search fragment are then searched sequentially in the cuckoo hash table storing reads according to the obtained K positions. During the search, the K positions of the query search fragment are directly located.
[0045] The headers of the reads stored in the K storable locations of the query search segment are compared with the query search segment in turn. If a successfully matching read header is found, a successful match means that the header of the stored read is the same as the query search segment. Then, the number of the read stored at the location of the successfully matching read header is searched in the dynamic cuckoo hash table.
[0046] If the number of the reads stored at the head position of the successfully matched reads is not found in the dynamic cuckoo hash table, the tail of the linked list stored at the head position of the successfully matched reads is appended to the end of the starting point.
[0047] If the linked list stored at the position of the head of a successfully matched read contains only one tail, it is directly appended to the end of the starting point. If the linked list stored at the position of the head of a successfully matched read contains more than one tail, then multiple tails need to be appended to the end of the starting point, thus forming a branch. This completes one appending growth process, extends the starting point, and stores the information of the reads used in the appending growth process in a dynamic cuckoo hash table.
[0048] If the number of the reads stored at the head position of a successfully matched read is found in the dynamic cuckoo hash table, then growth stops, that is, the starting point is no longer extended.
[0049] If no matching reads header is found, the splicing will fail.
[0050] The formation of branches is as follows:
[0051] If a branch is formed during the splicing growth process, a new dynamic cuckoo hash table needs to be created for the newly formed branch according to step 7. The information of reads used in the subsequent splicing growth process of the newly formed branch is stored in this newly created dynamic cuckoo hash table. A pointer list is set in the header of the dynamic cuckoo hash table associated with the branch, and a pointer is added to the pointer list to point to this newly created dynamic cuckoo hash table.
[0052] Step 8 involves searching for the ID of the successfully matched read at the header location in the dynamic cuckoo hash table, as follows:
[0053] Following steps 4.1, 4.2, and 4.3, the read numbers stored at the header positions of successfully matched reads are used to obtain M storable positions in the dynamic cuckoo hash table, where M represents the number of hash values corresponding to the read numbers to be stored. Then, based on these M storable positions, the dynamic cuckoo hash table is searched sequentially, directly locating the M storable positions for the read numbers stored at the header positions of successfully matched reads.
[0054] Step 8 involves storing the information of the reads used in the splicing growth process in a dynamic cuckoo hash table. The specific process is as follows:
[0055] Step 8.1: Store the information of the reads used in the splicing growth process into a dynamic cuckoo hash table. Following steps 4.1, 4.2, and 4.3, obtain the M possible locations for storing the read numbers in the dynamic cuckoo hash table. If multiple empty locations exist within the M possible locations for storing the read numbers, randomly select one of these empty locations to store the read number and its position in the growth tree. The position of the read in the growth tree is the number of bases from the head base of the branch to which the read is located.
[0056] If all M locations in the dynamic cuckoo hash table where the number of the reads to be stored are non-empty, then randomly select one of the M locations in the dynamic cuckoo hash table where the number of the reads to be stored is stored. Then replace the original number of the reads stored in the storage location and the original position of the reads stored in the growth tree with the head of the reads to be stored and the position of the reads to be stored in the growth tree.
[0057] Step 8.2: Repeat step 8.1 for the data to be replaced until the insertion is successful;
[0058] Step 8.3: If the dynamic cuckoo hash table is not large enough, expand it to accommodate the remaining data. To determine if the dynamic cuckoo hash table is large enough, it is considered ready to be expanded when the load rate exceeds 95%.
[0059] The specific method for expanding the dynamic cuckoo hash table as described in step 8.3 is as follows:
[0060] The expansion is a multiple expansion. For example, if the original length of the dynamic cuckoo hash table is N = 2000, the length of the dynamic cuckoo hash table after expansion will be 2 * N. The number of hash values corresponding to the number of each read also needs to be expanded at the same time, increasing by one each time. For example, if the original number of hash values corresponding to the number of each read is C = 3, then the number of hash values corresponding to the number of each read will increase to C + 1.
[0061] The storage location of the hash value corresponding to the newly added (C+1)th read in the dynamic cuckoo hash table will only be mapped to the expanded N space. When determining the storage location of the hash value corresponding to the newly added (C+1)th read in the dynamic cuckoo hash table, a modulo operation is first performed on the original length of the dynamic cuckoo hash table. This modulo operation is then added to the original length of the dynamic cuckoo hash table to obtain the storage location of the hash value corresponding to the (C+1)th read in the dynamic cuckoo hash table. Furthermore, in step 8.1, when randomly selecting an empty storage location from multiple empty storage locations, the probability of selecting the hash value corresponding to the (C+1)th read in the dynamic cuckoo hash table is adjusted to ensure that the absolute probability of selecting each location in the table is the same throughout the entire data insertion process. If the dynamic cuckoo hash table is further expanded from 2*N to 4*N, and the hash value corresponding to the number of each read increases to C+2, then the storage location of the dynamic cuckoo hash table based on the hash value corresponding to the number of the newly added C+2th read will only be mapped to the expanded 2*N space.
[0062] Preferably, the growth described in step 9 is the extension of the tail of the growth tree, that is, the sequence length increases, and the known sequence becomes longer.
[0063] The present invention also provides a computer-readable medium storing a computer program executed by an electronic device, which, when run on the electronic device, performs the steps of the cuckoo hash growth tree DNA splicing and sequencing method.
[0064] The advantage of this invention is that it uses a hash table to accelerate the efficiency of searching and matching in the reads library during the growth of the tree, and uses a dynamic cuckoo hash table to save space resources for storing the reads used in the splicing and growth process.
[0065] By processing the reads and storing them in a hash table, the time complexity of step 8, which involves determining whether a splicing and growth process can be performed based on whether the query search fragment matches the header of the reads stored in the Cuckoo Hash Table, is reduced from O(n) to O(1). Simultaneously, the Cuckoo Hash algorithm improves the hash table's load rate and space utilization.
[0066] During the read splicing and growth process, the same read may be reused repeatedly, which can lead to a circular structure and an infinite loop. To prevent the formation of a circular structure within the tree structure, it is necessary to record information about all reads used during the splicing and growth process. Therefore, a dynamic cuckoo hash table is used to store and retrieve all reads used during the growth process.
[0067] The dynamic cuckoo hash table can quickly locate whether a particular read has been used in previous assembly and growth processes, and can also pinpoint the read's exact location within the growth tree. Each read in the library is numbered according to its position within the library, ensuring that all reads have a unique number. A dynamic cuckoo hash table is built for each branch. A head node is set in each dynamic cuckoo hash table to connect the dynamic cuckoo hash tables associated with branches growing from that branch, facilitating future read traversal and searching. Because the number of reads in each branch is uncertain, the size of the hash table cannot be determined during its creation. Therefore, a dynamically expanding cuckoo hash table is designed to store read numbers and locations, expanding when the hash table size is insufficient, thus saving space resources. This method is suitable for DNA assembly and sequencing projects. Attached Figure Description
[0068] Figure 1 : Flowchart of the method in the embodiments of the present invention; Detailed Implementation
[0069] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0070] In specific implementation, the method proposed in the technical solution of this invention can be automatically executed by those skilled in the art using computer software technology. System devices for implementing the method, such as computer-readable storage media storing the corresponding computer program of the technical solution of this invention and computer equipment including the computer program running the corresponding computer program, should also be within the protection scope of this invention.
[0071] The following is combined Figure 1 The technical solution described in this invention is a method for DNA splicing and sequencing of a cuckoo hash tree and a computer-readable medium.
[0072] The specific implementation of the method of the present invention is a cuckoo hash tree DNA splicing and sequencing method, which specifically includes:
[0073] The head and tail of each read are obtained by dividing the line into segments;
[0074] Each read in the reads library is stored in a Cuckoo Hash Table by iteratively replacing the storage;
[0075] By combining the cuckoo hash table to determine splicing growth, and combining the position of the head of the successfully matched reads, the information of the reads in the splicing growth process is stored in a dynamic cuckoo hash table.
[0076] DNA sequencing is achieved by iteratively growing a tree.
[0077] The specific steps of the method of the present invention are as follows:
[0078] Step 1: Obtain the reads library; determine the length of the cuckoo hash table based on the number of reads in the reads library; further construct the cuckoo hash table; determine the maximum number of collisions in the cuckoo hash table and the number of hash values corresponding to each read; number the reads in the reads library to obtain the number of each read in the reads library.
[0079] The reads library mentioned in step 1 includes multiple reads;
[0080] Each read includes multiple bases;
[0081] Step 1, which determines the length of the Cuckoo Hash Table based on the number of reads in the reads library, is as follows:
[0082] The length of the Cuckoo Hash Table is set to 1.2 times the number of reads in the reads library. If the value corresponding to 1.2 times the number of reads in the reads library is not odd, then the value corresponding to 1.2 times the number of reads in the reads library is incremented until the nearest odd value corresponding to 1.2 times the number of reads in the reads library is obtained, which is used as the length of the Cuckoo Hash Table.
[0083] The cuckoo hash table described in step 1 is used to store multiple reads in the reads library;
[0084] The number of hash values corresponding to each read in step 1 is defined as:
[0085] The number of positions that the multiple hash values corresponding to each read are mapped to in the Cuckoo Hash Table, i.e., the number of hash values corresponding to each read;
[0086] Step 2: Based on the number of bases in each read in the reads library, select the base length for overlap comparison during the splicing process for each read;
[0087] Step 3: Based on the base lengths of each read during the splicing process, divide each read in the reads library into segments sequentially to obtain the head and tail of each read.
[0088] Step 3 involves sequentially dividing each read in the reads library into segments, as detailed below:
[0089] Specifically, the first base of each read in the reads library is used as the dividing point. The base length of each read that is continuously selected during the splicing process is defined as the head of each read. The remaining consecutive bases in each read, excluding the head, are used as the tail of each read.
[0090] In step 3, the base length for overlapping and comparison during the splicing process of each read is x, the number of bases in each read in the read library is L, the head of each read includes x bases, and the tail of each read includes Lx bases.
[0091] Step 4: Store the head of the current round of reads, the tail of the current round of reads, and the number of the current round of reads in the Cuckoo Hash Table in sequence;
[0092] Step 4 involves storing the header, tail, and number of the current round of reads sequentially in a Cuckoo Hash Table, as detailed below:
[0093] Step 4.1: append k to the end of the header of the current round of reads as the kth similar segment of the header of the current round of reads, k∈[1,K], where K represents the number of hash values of the current round of reads;
[0094] Step 4.2: Calculate the hash value of the kth similar segment in the header of the current round of reads by sequentially applying the SHA256 algorithm;
[0095] Step 4.3: Perform a modulo operation on the length of the Cuckoo Hash Table based on the hash value of the kth similar segment in the header of the current round of reads to obtain the storage location of the kth similar segment in the Cuckoo Hash Table.
[0096] Step 4.4: If there are multiple empty storage locations in the Cuckoo Hash Table for the K similar segments of the head of the current round of reads, then randomly select one of the multiple empty storage locations to store the head of the current round of reads. Construct a linked list in the corresponding empty storage location and store the tail of the current round of reads and the number of the current round of reads in the linked list.
[0097] If the K similar segments at the head of the current round of reads are all stored in non-empty locations in the Cuckoo Hash Table, then iterate through and compare the head of the current round of reads with the heads of the reads corresponding to the K similar segments at the head of the current round of reads in the Cuckoo Hash Table. If they are the same, then store the tail of the current round of reads and the number of the current round of reads in the linked list with the same head location. Otherwise, randomly select a storage location from the storage locations of the K similar segments at the head of the current round of reads in the Cuckoo Hash Table, then replace the head of the reads originally stored in the storage location with the head of the current round of reads, and replace the tail of the reads and the number of the reads originally stored in the linked list in the storage location with the tail of the current round of reads and the number of the current round of reads.
[0098] Step 5: Repeat step 4 to restore the replaced reads in the Cuckoo Hash Table;
[0099] Step 6: Repeat steps 4 and 5 until each read in the reads library is stored in the Cuckoo Hash Table, thus obtaining the Cuckoo Hash Table storing the reads;
[0100] Step 7: Construct a dynamic cuckoo hash table to store information about reads in the reads library used in subsequent splicing processes, and determine the maximum number of collisions in the dynamic cuckoo hash table and the number of hash values corresponding to the number of each read.
[0101] The number of hash values corresponding to the number of each read in step 7 is defined as:
[0102] The number of positions that the multiple hash values corresponding to the number of each read are mapped to in the dynamic cuckoo hash table, that is, the number of hash values corresponding to each read;
[0103] Step 8: Randomly select a read from the reads library as the starting point for the growth tree. Select consecutive bases with overlapping matching lengths from the last base of the starting point to define the query search segment. Determine whether splicing growth can be performed based on whether the query search segment is the same as the read header stored in the Cuckoo Hash Table where the reads are stored. Look up the number of the read stored at the position of the successfully matched read header in the dynamic Cuckoo Hash Table. Store the information of the reads used in the splicing growth process in the dynamic Cuckoo Hash Table.
[0104] The definition of the growth tree mentioned in step 8 is as follows:
[0105] A growth tree refers to a situation where, during the growth of reads, there may be multiple reads that can be successfully matched at a given time. Since it's impossible to determine which read is true and which is false, all reads must be grown. This process leads to branching, where branches are formed during the growth process. The trunk is the line segment between two branching points. As growth continues, more and more branches appear, forming a large tree-like structure, thus creating a growth tree.
[0106] Step 8, which determines whether splicing and growth can be performed based on whether the search fragment is the same as the header stored in the Cuckoo Hash Table storing reads, is as follows:
[0107] The query search fragment is processed through steps 4.1-4.3 to obtain the K positions that can be stored in the cuckoo hash table storing reads obtained in step 6. The K positions that can be stored in the query search fragment are then searched sequentially in the cuckoo hash table storing reads according to the obtained K positions. During the search, the K positions of the query search fragment are directly located.
[0108] The headers of the reads stored in the K storable locations of the query search segment are compared with the query search segment in turn. If a successfully matching read header is found, a successful match means that the header of the stored read is the same as the query search segment. Then, the number of the read stored at the location of the successfully matching read header is searched in the dynamic cuckoo hash table.
[0109] If the number of the reads stored at the head position of the successfully matched reads is not found in the dynamic cuckoo hash table, the tail of the linked list stored at the head position of the successfully matched reads is appended to the end of the starting point.
[0110] If the linked list stored at the position of the head of a successfully matched read contains only one tail, it is directly appended to the end of the starting point. If the linked list stored at the position of the head of a successfully matched read contains more than one tail, then multiple tails need to be appended to the end of the starting point, thus forming a branch. This completes one appending growth process, extends the starting point, and stores the information of the reads used in the appending growth process in a dynamic cuckoo hash table.
[0111] If the number of the reads stored at the head position of a successfully matched read is found in the dynamic cuckoo hash table, then growth stops, that is, the starting point is no longer extended.
[0112] If no matching reads header is found, the splicing will fail.
[0113] The formation of branches is as follows:
[0114] If a branch is formed during the splicing growth process, a new dynamic cuckoo hash table needs to be created for the newly formed branch according to step 7. The information of reads used in the subsequent splicing growth process of the newly formed branch is stored in this newly created dynamic cuckoo hash table. A pointer list is set in the header of the dynamic cuckoo hash table associated with the branch, and a pointer is added to the pointer list to point to this newly created dynamic cuckoo hash table.
[0115] Step 8 involves searching for the ID of the successfully matched read at the header location in the dynamic cuckoo hash table, as follows:
[0116] Following steps 4.1, 4.2, and 4.3, the read numbers stored at the header positions of successfully matched reads are used to obtain M storable positions in the dynamic cuckoo hash table, where M represents the number of hash values corresponding to the read numbers to be stored. Then, based on these M storable positions, the dynamic cuckoo hash table is searched sequentially, directly locating the M storable positions for the read numbers stored at the header positions of successfully matched reads.
[0117] Step 8 involves storing the information of the reads used in the splicing growth process in a dynamic cuckoo hash table. The specific process is as follows:
[0118] Step 8.1: Store the information of the reads used in the splicing growth process into a dynamic cuckoo hash table. Following steps 4.1, 4.2, and 4.3, obtain the M possible locations for storing the read numbers in the dynamic cuckoo hash table. If multiple empty locations exist within the M possible locations for storing the read numbers, randomly select one of these empty locations to store the read number and its position in the growth tree. The position of the read in the growth tree is the number of bases from the head base of the branch to which the read is located.
[0119] If all M locations in the dynamic cuckoo hash table where the number of the reads to be stored are non-empty, then randomly select one of the M locations in the dynamic cuckoo hash table where the number of the reads to be stored is stored. Then replace the original number of the reads stored in the storage location and the original position of the reads stored in the growth tree with the head of the reads to be stored and the position of the reads to be stored in the growth tree.
[0120] Step 8.2: Repeat step 8.1 for the data to be replaced until the insertion is successful;
[0121] Step 8.3: If the dynamic cuckoo hash table is not large enough, expand it to accommodate the remaining data. To determine if the dynamic cuckoo hash table is large enough, it is considered ready to be expanded when the load rate exceeds 95%.
[0122] The specific method for expanding the dynamic cuckoo hash table as described in step 8.3 is as follows:
[0123] The expansion is a multiple expansion. For example, if the original length of the dynamic cuckoo hash table is N = 2000, the length of the dynamic cuckoo hash table after expansion will be 2 * N. The number of hash values corresponding to the number of each read also needs to be expanded at the same time, increasing by one each time. For example, if the original number of hash values corresponding to the number of each read is C = 3, then the number of hash values corresponding to the number of each read will increase to C + 1.
[0124] The storage location of the hash value corresponding to the newly added (C+1)th read in the dynamic cuckoo hash table will only be mapped to the expanded N space. When determining the storage location of the hash value corresponding to the newly added (C+1)th read in the dynamic cuckoo hash table, a modulo operation is first performed on the original length of the dynamic cuckoo hash table. This modulo operation is then added to the original length of the dynamic cuckoo hash table to obtain the storage location of the hash value corresponding to the (C+1)th read in the dynamic cuckoo hash table. Furthermore, in step 8.1, when randomly selecting an empty storage location from multiple empty storage locations, the probability of selecting the hash value corresponding to the (C+1)th read in the dynamic cuckoo hash table is adjusted to ensure that the absolute probability of selecting each location in the table is the same throughout the entire data insertion process. If the dynamic cuckoo hash table is further expanded from 2*N to 4*N, and the hash value corresponding to the number of each read increases to C+2, then the storage location of the dynamic cuckoo hash table based on the hash value corresponding to the number of the newly added C+2th read will only be mapped to the expanded 2*N space.
[0125] Step 9: Repeat step 8 to grow the tree, and achieve DNA sequencing by continuously extending the sequence until all branches can no longer grow or have stopped growing.
[0126] The growth described in step 9 is the extension of the tail of the growth tree, that is, the sequence length increases, and the known sequence becomes longer.
[0127] The present invention also provides a computer-readable medium storing a computer program executed by an electronic device, which, when run on the electronic device, performs the steps of the cuckoo hash growth tree DNA splicing and sequencing method.
[0128] The main principle of the specific embodiments of the present invention is as follows:
[0129] Hash tables are used to accelerate the efficiency of searching for matches in the reads library during the tree growth process. By processing the reads and storing them in a hash table, the time complexity of finding matching fragments is reduced from O(n) to O(1). Simultaneously, to improve the space utilization of the hash table, the Cuckoo Hash algorithm is used to increase the hash table's load rate. Each read in the reads library is numbered according to its position in the library, ensuring that all reads have a unique number. During the read splicing and growth process, the same read may be reused, potentially forming a circular structure and entering an infinite loop. To prevent the formation of circular structures within the tree structure, it is necessary to record the numbering information of all reads used during the growth process.
[0130] To quickly determine if a read has been used previously and pinpoint its location within the growth tree, a dynamically expanding cuckoo hash table is used to store and retrieve all reads used during the generation process. A dynamically lengthened cuckoo hash table is created for each branch, which is the line segment connecting two branches in the growth tree. Each dynamically expanding cuckoo hash table has a head node to connect all dynamically expanding cuckoo hash tables associated with the branches growing from that branch, facilitating future read traversal and searching. Because the number of reads in each branch is uncertain, the hash table size cannot be determined during creation. To conserve space, a dynamically expanding cuckoo hash table is designed to store read numbers and positions, expanding when the hash table size is insufficient.
[0131] The computer-readable medium is a server workstation;
[0132] The server workstation stores the computer program executed by the electronic device. When the computer program runs on the electronic device, it causes the electronic device to perform the steps of the cuckoo hash growth tree DNA splicing and sequencing method of the present invention.
[0133] It should be understood that any parts not described in detail in this specification belong to the prior art.
[0134] It should be understood that the above description of the preferred embodiments is quite detailed, but it should not be considered as a limitation on the scope of protection of this invention. Those skilled in the art, under the guidance of this invention, can make substitutions or modifications without departing from the scope of protection of the claims of this invention, and all such substitutions or modifications fall within the scope of protection of this invention. The scope of protection of this invention should be determined by the appended claims.
Claims
1. A method for DNA splicing and sequencing of a cuckoo hash tree, characterized in that, include: The head and tail of each read are obtained by dividing the line into segments; Each read in the reads library is stored in a Cuckoo Hash Table by iteratively replacing the storage; By combining the cuckoo hash table to determine splicing growth, and combining the position of the head of the successfully matched reads, the information of the reads in the splicing growth process is stored in a dynamic cuckoo hash table. The specific process for determining whether splicing and growth is feasible is as follows: The system obtains the K possible locations in the Cuckoo Hash Table storing reads for the query search segment, and then searches sequentially in the Cuckoo Hash Table storing reads based on the K possible locations of the query search segment. During the search, the system directly locates the K storage locations of the query search segment. The headers of the reads stored in the K storable locations of the query search segment are compared with the query search segment in turn. If a successfully matching read header is found, a successful match means that the header of the stored read is the same as the query search segment. Then, the number of the read stored at the location of the successfully matching read header is searched in the dynamic cuckoo hash table. If the number of the reads stored at the head position of the successfully matched reads is not found in the dynamic cuckoo hash table, then the tail of the linked list stored at the head position of the successfully matched reads is appended to the end of the starting point. If the linked list where the head of a successfully matched read is located contains only one tail, it is directly appended to the end of the starting point; if the linked list where the head of a successfully matched read is located contains more than one tail, then the multiple tails need to be appended to the end of the starting point respectively, thus forming a branch. This completes a splicing growth process, extending the starting point and storing the information of the reads used in the splicing growth process in a dynamic cuckoo hash table; If the number of the reads stored at the head position of a successfully matched read is found in the dynamic cuckoo hash table, then growth stops, that is, the starting point is no longer extended. If no matching reads header is found, the splicing will fail. DNA sequencing is achieved by iteratively growing a tree.
2. The cuckoo hash tree DNA splicing and sequencing method according to claim 1, characterized in that: Step 1: Obtain the reads library; determine the length of the cuckoo hash table based on the number of reads in the reads library; further construct the cuckoo hash table; determine the maximum number of collisions in the cuckoo hash table and the number of hash values corresponding to each read; number the reads in the reads library to obtain the number of each read in the reads library. Step 2: Based on the number of bases in each read in the reads library, select the base length for overlap comparison during the splicing process for each read; Step 3: Based on the base lengths of each read during the splicing process, divide each read in the reads library into segments sequentially to obtain the head and tail of each read. Step 4: Store the head of the current round of reads, the tail of the current round of reads, and the number of the current round of reads in the Cuckoo Hash Table in sequence; Step 5: Repeat step 4 to restore the replaced reads in the Cuckoo Hash Table; Step 6: Repeat steps 4 and 5 until each read in the reads library is stored in the Cuckoo Hash Table, thus obtaining the Cuckoo Hash Table storing the reads; Step 7: Construct a dynamic cuckoo hash table to store information about reads in the reads library used in subsequent splicing processes, and determine the maximum number of collisions in the dynamic cuckoo hash table and the number of hash values corresponding to the number of each read. Step 8: Randomly select a read from the reads library as the starting point for the growth tree. Select consecutive bases with overlapping matching lengths from the last base of the starting point to define the query search segment. Determine whether splicing growth can be performed based on whether the query search segment is the same as the read header stored in the Cuckoo Hash Table where the reads are stored. Look up the number of the read stored at the position of the successfully matched read header in the dynamic Cuckoo Hash Table. Store the information of the reads used in the splicing growth process in the dynamic Cuckoo Hash Table. Step 9: Repeat step 8 to grow the tree by continuously extending the sequence to achieve DNA sequencing until all branches can no longer grow or have stopped growing.
3. The cuckoo hash tree DNA splicing and sequencing method according to claim 2, characterized in that: The reads library mentioned in step 1 includes multiple reads; Each read includes multiple bases; Step 1, which determines the length of the Cuckoo Hash Table based on the number of reads in the reads library, is as follows: The length of the Cuckoo Hash Table is set to 1.2 times the number of reads in the reads library. If the value corresponding to 1.2 times the number of reads in the reads library is not odd, then the value corresponding to 1.2 times the number of reads in the reads library is incremented until the nearest odd value corresponding to 1.2 times the number of reads in the reads library is obtained, which is used as the length of the Cuckoo Hash Table. The cuckoo hash table described in step 1 is used to store multiple reads in the reads library; The number of hash values corresponding to each read in step 1 is defined as: The number of positions that the multiple hash values corresponding to each read are mapped to in the Cuckoo Hash Table, i.e., the number of hash values corresponding to each read.
4. The cuckoo hash tree DNA splicing and sequencing method according to claim 3, characterized in that: Step 3 involves sequentially dividing each read in the reads library into segments, as detailed below: Specifically, the first base of each read in the reads library is used as the dividing point. The base length of each read that is continuously selected during the splicing process is defined as the head of each read. The remaining consecutive bases in each read, excluding the head, are used as the tail of each read. In step 3, the base length for overlapping and comparison during the splicing process of each read is x, the number of bases in each read in the read library is L, the head of each read includes x bases, and the tail of each read includes Lx bases.
5. The cuckoo hash tree DNA splicing and sequencing method according to claim 4, characterized in that: Step 4 involves storing the header, tail, and number of the current round of reads sequentially in a Cuckoo Hash Table, as detailed below: Step 4.1: append k to the end of the header of the current round of reads as the kth similar segment of the header of the current round of reads, k∈[1,K], where K represents the number of hash values of the current round of reads; Step 4.2: Calculate the hash value of the kth similar segment in the header of the current round of reads by sequentially applying the SHA256 algorithm; Step 4.3: Perform a modulo operation on the length of the Cuckoo Hash Table based on the hash value of the kth similar segment in the header of the current round of reads to obtain the storage location of the kth similar segment in the Cuckoo Hash Table. Step 4.4: If there are multiple empty storage locations in the Cuckoo Hash Table for the K similar segments of the head of the current round of reads, then randomly select one of the multiple empty storage locations to store the head of the current round of reads. Construct a linked list in the corresponding empty storage location and store the tail of the current round of reads and the number of the current round of reads in the linked list. If the K similar segments at the head of the current round of reads are all stored in non-empty locations in the Cuckoo Hash Table, then the head of the current round of reads is sequentially compared with the head of the reads corresponding to the K similar segments at the head of the current round of reads in the Cuckoo Hash Table. If they are the same, then the tail of the current round of reads and the number of the current round of reads are stored in the linked list with the same head location. Otherwise, randomly select a storage location from the storage locations of the Cuckoo Hash Table from the K similar segments at the head of the current round of reads. Then replace the head of the original reads stored in the storage location with the head of the current round of reads, and replace the tail and the number of the original reads stored in the linked list in the storage location with the tail and the number of the current round of reads.
6. The cuckoo hash tree DNA splicing and sequencing method according to claim 5, characterized in that: The number of hash values corresponding to the number of each read in step 7 is defined as: The number of positions that the multiple hash values corresponding to each read's number are mapped to in the dynamic Cuckoo Hash Table, i.e., the number of hash values corresponding to each read.
7. The cuckoo hash tree DNA splicing and sequencing method according to claim 6, characterized in that: The definition of the growth tree mentioned in step 8 is as follows: A growing tree refers to a situation where, during the growth of reads, there may be a situation where more than one read can be successfully matched. Since it is impossible to determine whether the match is true or false, all reads can only be grown. This will result in branching during the growth process, i.e., branches are formed during the splicing and growth process. A branch refers to the line segment between two forking points; as growth continues, more and more branches will appear, forming a tree-like structure, that is, a growth tree.
8. The cuckoo hash tree DNA splicing and sequencing method according to claim 7, characterized in that: The formation of branches is as follows: If a branch is formed during the splicing growth process, a new dynamic cuckoo hash table needs to be created for the newly formed branch according to step 7. The information of reads used in the subsequent splicing growth process of the newly formed branch is stored in this newly created dynamic cuckoo hash table. Then, a pointer list is set in the header of the dynamic cuckoo hash table that forms the branch, and a pointer is added to the pointer list to point to this newly created dynamic cuckoo hash table.
9. The cuckoo hash tree DNA splicing and sequencing method according to claim 8, characterized in that: Step 8 involves searching for the ID of the successfully matched read at the header location in the dynamic cuckoo hash table, as follows: The numbers of the reads stored at the header positions of the successfully matched reads are obtained by following steps 4.1, 4.2, and 4.
3. M positions can be stored in the dynamic cuckoo hash table for the numbers of the reads stored at the header positions of the successfully matched reads. M represents the number of hash values corresponding to the numbers of the reads to be stored. Then, based on the M positions of the numbers of the reads stored at the header positions of the successfully matched reads, the dynamic cuckoo hash table is searched sequentially. During the search, the M positions of the numbers of the reads stored at the header positions of the successfully matched reads are directly located. Step 8 involves storing the information of the reads used in the splicing growth process in a dynamic cuckoo hash table. The specific process is as follows: Step 8.1: Store the information of the reads used in the splicing growth process into the dynamic cuckoo hash table. For the number of the reads to be stored, follow the steps of steps 4.1, 4.2 and 4.3 to obtain the M positions in the dynamic cuckoo hash table where the number of the reads to be stored can be stored. If there are multiple empty storage locations in the M available locations of the reads to be stored in the dynamic cuckoo hash table, then one of the multiple empty storage locations is randomly selected to store the reads to be stored and the position of the reads to be stored in the growth tree. The position of the reads to be stored in the growth tree is the number of bases from the head base of the branch where the reads are located at their current position. If all M locations in the dynamic cuckoo hash table where the number of the reads to be stored are non-empty, then randomly select one of the M locations in the dynamic cuckoo hash table where the number of the reads to be stored is stored. Then replace the original number of the reads stored in the storage location and the original position of the reads stored in the growth tree with the head of the reads to be stored and the position of the reads to be stored in the growth tree. Step 8.2: Repeat step 8.1 for the data to be replaced until the insertion is successful; Step 8.3: If the dynamic cuckoo hash table is not large enough, expand the dynamic cuckoo hash table to continue to accommodate the data that needs to be stored; How to determine if the dynamic cuckoo hash table is large enough? When the load rate of the dynamic cuckoo hash table exceeds 95%, it should be expanded. The specific method for expanding the dynamic cuckoo hash table as described in step 8.3 is as follows: The expansion is a multiple expansion. For example, if the original length of the dynamic cuckoo hash table is N=2000, the length of the dynamic cuckoo hash table after expansion will be 2*N. The number of hash values corresponding to the number of each read also needs to be expanded at the same time, increasing by one each time. For example, if the original number of hash values corresponding to the number of each read is C=3, then the number of hash values corresponding to the number of each read will increase to C+1. The storage location of the newly added (C+1)th read in the dynamic cuckoo hash table, based on its hash value, will only be mapped to the expanded N space. To determine the storage location of the newly added (C+1)th read in the dynamic cuckoo hash table, the original length of the dynamic cuckoo hash table is first moduloed, and then the original length of the dynamic cuckoo hash table is added to the modulo result to obtain the storage location of the hash value corresponding to the (C+1)th read in the dynamic cuckoo hash table. Furthermore, in step 8.1, multiple empty storage spaces... When randomly selecting an empty storage location, the probability of selecting the hash value corresponding to the (C+1)th read's number in the dynamic cuckoo hash table is adjusted so that the absolute probability of selecting each location in the table is the same throughout the entire data insertion process. If the dynamic cuckoo hash table is further expanded from 2*N to 4*N, and the hash value corresponding to each read's number increases to C+2, then the storage location of the (C+2)th read in the dynamic cuckoo hash table will only be mapped to the expanded 2*N space.
10. A computer-readable medium, characterized in that, It stores a computer program executed by an electronic device, which, when run on the electronic device, causes the electronic device to perform the steps of the method as described in any one of claims 1-9.