A DNA sequence clustering method and system based on a local sensitive hash function, an electronic device and a readable storage medium
By using a DNA sequence clustering method based on locality-sensitive hashing (LSH), combined with dual sorting and LSH techniques, the problems of long processing time and insufficient accuracy in DNA sequence clustering are solved, achieving efficient and accurate data reconstruction.
Patent Information
- Application Number
- CN202410847922.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2044-06-27
Smart Images

Figure CN118629513B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of DNA storage data reconstruction technology, specifically to a DNA sequence clustering method, system, electronic device, and readable storage medium based on locality-sensitive hash functions. Background Technology
[0002] With the rapid advancement of big data and artificial intelligence technologies, the global data volume is growing at an astonishing rate. DNA, as the core carrier of life's genetic information, has now been transformed into a stable and sustainable data storage medium. In 2012, Church pioneered a method of randomly mapping binary data to bases, first verifying the feasibility of DNA as a large-scale data storage medium. Subsequently, Goldman further advanced this field, successfully storing a total of 739KB of data in DNA, including text, PDFs, photos, MP3 files, and Huffman codes, based on the ternary information conversion model of Huffman coding. These two landmark studies not only achieved high-capacity DNA storage but also greatly promoted the development of DNA storage technology, sparking a research boom in the field.
[0003] A complete DNA storage system encompasses several key steps, including coding, synthesis, amplification, sequencing, and decoding. However, imperfections in synthesis and sequencing technologies often lead to various errors in the DNA sequence. Furthermore, the sequenced sequences frequently exhibit repetitive and disordered characteristics, undoubtedly increasing the complexity of data reconstruction. Therefore, efficient and accurate clustering of large quantities of sequenced DNA sequences is crucial for improving the efficiency and accuracy of data reconstruction.
[0004] However, current sequence clustering methods in DNA storage are inadequate when faced with high error rates in third-generation sequencing data, exhibiting problems such as long clustering times and insufficient accuracy. To overcome these challenges, it is necessary to explore new clustering methods to better adapt to the evolving needs of DNA storage technology. Summary of the Invention
[0005] The purpose of this invention is to propose a DNA sequence clustering method, system, electronic device, and readable storage medium based on locality-sensitive hashing (LSH). By combining the number of repetitions, length deviation, and LSH techniques, this invention achieves efficient clustering of DNA sequences, thereby improving the efficiency and accuracy of data reconstruction.
[0006] According to a first aspect of the present disclosure, a DNA sequence clustering method based on a locality-sensitive hash function is provided, comprising the following steps:
[0007] The sequenced DNA sequences were sorted from highest to lowest frequency of repetition; the sorted DNA sequences were then sorted again according to the difference in sequence length.
[0008] Using a sliding window of a specific size, each DNA sequence is cut into DNA fragments of length k, i.e., k-mers; select several k-mers at certain positions and k-mers offset to the left and right at fixed positions to form multiple k-mer sets.
[0009] Obtain the local sensitivity hash of each element in the k-mer set;
[0010] Combine all the hash values together to form a hash sketch of the sequence;
[0011] A hash error list is automatically obtained based on the value of k.
[0012] Select the first sequence as the initial cluster center; add the hash sketch of this sequence to the core index set;
[0013] Perform a similarity search between the hash sketches of all other sequences and the elements in the core index set: if the difference between the hash sketches of two sequences is in the hash error list, the search is considered successful, and the two sequences are considered similar and are classified into the same category.
[0014] After all sequences have been retrieved, the number of neighborhood samples of each element in each cluster is obtained; the sequence with the most neighborhood samples is taken as the new cluster center of that cluster.
[0015] Obtain the Levenstein distance between all cluster centers; merge clusters smaller than a set threshold into a larger cluster to obtain the final clustering result.
[0016] Furthermore, the calculation method for the locality-sensitive hash value is as follows:
[0017]
[0018] Where k is the length of k-mer, x i The hash value mapped to the corresponding base.
[0019] Furthermore, the hash error list is as follows:
[0020] {y i ×4 i |y i ∈[-3,3],i∈[1,k]}
[0021] Among them, y i It is the hash difference when a base substitution error occurs.
[0022] Furthermore, when performing a similarity search, if the search fails, the sequence is treated as a new cluster, and its hash sketch is added to the core index set.
[0023] Furthermore, the sequenced DNA sequences are sorted from highest to lowest frequency of repetition. Specifically, the sequences are reordered from highest to lowest frequency by counting the repetition count of each DNA sequence in the dataset.
[0024] Furthermore, the sorted DNA sequences are then sorted a second time according to the sequence length difference. Specifically, the length difference between each sequence and the original coding sequence is calculated, and the sequences are then sorted in descending order.
[0025] According to a second aspect of the present disclosure, a DNA sequence clustering system based on a locality-sensitive hash function is provided, comprising:
[0026] The sorting module sorts the sequenced DNA sequences from highest to lowest frequency of repetition; it then performs a secondary sorting of the sorted DNA sequences based on their sequence length differences.
[0027] k-mer extraction module: Using a sliding window of a specific size, each DNA sequence is cut into DNA fragments of length k, i.e., k-mers; select several k-mers at certain positions and k-mers offset to the left and right at fixed positions to form multiple k-mer sets;
[0028] Hash sketch building module: obtains the local sensitivity hash value of each element in the k-mer set; combines all hash values together to form a hash sketch of the sequence;
[0029] Hash Error List Calculation Module: Automatically obtains a hash error list based on the value of k;
[0030] Initial cluster center selection module: Selects the first sequence as the initial cluster center; adds the hash sketch of this sequence to the core index set;
[0031] Similarity retrieval and clustering module: Performs similarity retrieval between the hash sketches of all other sequences and the elements in the core index set: If the difference between the hash sketches of two sequences is in the hash error list, the retrieval is considered successful, and the two sequences are considered similar and are classified into the same category;
[0032] Cluster center correction module: After all sequences have been retrieved, the number of neighborhood samples of each element in each cluster is obtained; the sequence with the most neighborhood samples is taken as the new cluster center of the cluster.
[0033] Cluster merging module: obtains the Levenstein distance between all cluster centers; merges clusters smaller than a set threshold into a larger cluster to obtain the final clustering result.
[0034] According to a third aspect of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and running on the memory, wherein the processor executes the program to implement the DNA sequence clustering method based on a locality-sensitive hash function.
[0035] According to a fourth aspect of the present disclosure, a readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the aforementioned DNA sequence clustering method based on a locality-sensitive hash function.
[0036] The advantages of the above technical solutions adopted in this invention compared with the prior art are as follows:
[0037] 1. Dual Sorting Strategy Improves Clustering Accuracy: Before performing sequence clustering, this invention introduces a dual sorting strategy. This strategy first sorts the sequences based on the number of repetitions, and then performs a secondary sorting based on the sequence length deviation. This sorting method prioritizes sequences with lower error rates, effectively reducing the splitting problem caused by sequence errors during clustering, thereby significantly improving the accuracy of clustering.
[0038] 2. Locality Sensitive Hashing (LSH) Enhances Clustering Robustness: To reduce the time complexity of clustering and improve tolerance to sequence errors, this invention employs a sequence representation method based on LSH. This method not only significantly reduces the computational cost during clustering but also adapts to more sequence variations by setting a reasonable offset range, thereby greatly enhancing the robustness of clustering.
[0039] 3. Cluster Center Correction and Cluster Merging Strategies Optimize DNA Sequence Clustering: Addressing the fragmentation problem caused by inaccurate initial cluster centers and computational errors in DNA sequence clustering, this invention proposes an innovative solution. By calculating neighborhoods and correcting cluster centers, the accuracy of cluster centers is effectively improved. Simultaneously, utilizing the Levenstein distance calculation method, similar clusters can be merged, significantly reducing the fragmentation of clustering results and further improving the efficiency and success rate of DNA storage data reconstruction. Attached Figure Description
[0040] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute an undue limitation of this application.
[0041] Figure 1This is a flowchart of a DNA sequence clustering method based on locality-sensitive hashing. Specific implementation methods
[0042] The present disclosure will be further described below with reference to the accompanying drawings and embodiments.
[0043] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.
[0044] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0045] It should be noted that the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of methods and systems according to various embodiments of this disclosure. It should be noted that each block in a flowchart or block diagram may represent a module, segment, or portion of code, which may include one or more executable instructions for implementing the logical functions specified in the various embodiments. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that shown in the drawings. For example, two consecutively represented blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, may be implemented using a dedicated hardware-based system that performs the specified functions or operations, or using a combination of dedicated hardware and computer instructions.
[0046] Example 1:
[0047] This embodiment provides a DNA sequence clustering method based on locality-sensitive hash functions, including the following steps:
[0048] Step S1. Sort the sequenced DNA sequences from highest to lowest frequency of repetition; then sort the sorted DNA sequences again according to the difference in sequence length.
[0049] Specifically, by counting the repetitions of each DNA sequence in the dataset, they are reordered in descending order. Then, the length difference between each sequence and the original coding sequence is calculated, and they are reordered in descending order.
[0050] Step S2. Using a sliding window of a specific size, cut each DNA sequence into DNA fragments of length k, i.e., k-mers; select several k-mers at certain positions and k-mers offset to the left and right at fixed positions to form multiple k-mer sets;
[0051] Specifically, if a DNA sequence is ACGTTCGATACGCTA with k=3, then the sequence is cut into 13 k-mers: ACG, CGT, GTT, TTC, TCG, CGA, GAT, ATA, TAC, ACG, CGC, GCT, and CTA. The k-mers at positions 2, 7, and 12, along with the k-mers offset to the left and right, are selected to form three k-mer sets: {ACG, CGT, GTT}, {CGA, GAT, ATA}, and {CGC, GCT, CTA}, which serve as index regions.
[0052] Step S3. Obtain the local sensitivity hash value of each element in the k-mer set; combine all hash values together to form a hash sketch of the sequence;
[0053]
[0054] Specifically, for the above sequence, the hash values of its three k-mer sets are obtained through equation (1), and the sequence is represented using a hash sketch: {{36,57,62},{9,50,12},{25,54,13}}.
[0055] Step S4. Automatically obtain a hash error list based on the value of k, as shown in equation (2):
[0056] {y i ×4 i |y i ∈[-3,3],i∈[1,k]} (2)
[0057] Specifically, when k equals 3, the hash error list obtained according to equation (2) is: [-48,-32,-16,-12,-8,-4,-3,-2,-1,0,1,2,3,4,8,12,16,32,48].
[0058] Step S5. Select the first sequence as the initial cluster center; add the hash sketch of this sequence to the core index set;
[0059] Step S6. Perform a similarity search between the hash sketches of all other sequences and the elements in the core index set: if the difference between the hash sketches of two sequences is in the hash error list, the search is considered successful, and the two sequences are similar and classified into the same category; otherwise, the sequence is treated as a new cluster and its hash sketch is added to the core index set.
[0060] Specifically, if we have two hash sketches for sequences {{36,57,62},{9,50,12},{25,54,13}} and {{48,57,62},{9,50,12},{25,54,13}}, then since the difference between 36 and 48 is -12, which exists in the 3-mer hash error list, the two sequences are considered similar and are grouped into the same category.
[0061] Step S7. After all sequences have been retrieved, obtain the number of neighborhood samples of each element in each cluster; take the sequence with the most neighborhood samples as the new cluster center of that cluster.
[0062] Specifically, after all sequences have been retrieved, the number of matches between all paired sequences in each cluster is calculated by setting a higher similarity threshold. If the number of matches exceeds the threshold, the two sequences are considered neighbors. Finally, the sequence with the most neighbors in the cluster is set as the new cluster center.
[0063] Step S8. Obtain the Levenstein distance between all cluster centers; merge clusters smaller than a set threshold into a larger cluster to obtain the final clustering result.
[0064] This invention reduces erroneous sequence splitting during clustering through dual sorting, thereby improving clustering accuracy. The sequence representation method based on locality-sensitive hashing (LSH) reduces clustering time complexity and improves robustness. By correcting cluster centers and merging clusters, the fragmentation of clustering results is reduced, improving the efficiency and success rate of data reconstruction from DNA storage.
[0065] Example 2:
[0066] This embodiment provides a DNA sequence clustering system based on locality-sensitive hash functions, including:
[0067] The sorting module sorts the sequenced DNA sequences from highest to lowest frequency of repetition; it then performs a secondary sorting of the sorted DNA sequences based on their sequence length differences.
[0068] k-mer extraction module: Using a sliding window of a specific size, each DNA sequence is cut into DNA fragments of length k, i.e., k-mers; select several k-mers at certain positions and k-mers offset to the left and right at fixed positions to form multiple k-mer sets;
[0069] Hash sketch building module: obtains the local sensitivity hash value of each element in the k-mer set; combines all hash values together to form a hash sketch of the sequence;
[0070] Hash Error List Calculation Module: Automatically obtains a hash error list based on the value of k;
[0071] Initial cluster center selection module: Selects the first sequence as the initial cluster center; adds the hash sketch of this sequence to the core index set;
[0072] Similarity retrieval and clustering module: Performs similarity retrieval between the hash sketches of all other sequences and the elements in the core index set: If the difference between the hash sketches of two sequences is in the hash error list, the retrieval is considered successful, and the two sequences are considered similar and are classified into the same category;
[0073] Cluster center correction module: After all sequences have been retrieved, the number of neighborhood samples of each element in each cluster is obtained; the sequence with the most neighborhood samples is taken as the new cluster center of the cluster.
[0074] Cluster merging module: obtains the Levenstein distance between all cluster centers; merges clusters smaller than a set threshold into a larger cluster to obtain the final clustering result.
[0075] Example 3:
[0076] An electronic device includes a memory, a processor, and a computer program stored in the memory and running thereon. When the processor executes the program, it implements the aforementioned DNA sequence clustering method based on a locality-sensitive hash function, comprising:
[0077] The sequenced DNA sequences were sorted from highest to lowest frequency of repetition; the sorted DNA sequences were then sorted again according to the difference in sequence length.
[0078] Using a sliding window of a specific size, each DNA sequence is cut into DNA fragments of length k, i.e., k-mers; select several k-mers at certain positions and k-mers offset to the left and right at fixed positions to form multiple k-mer sets.
[0079] Obtain the local sensitivity hash of each element in the k-mer set; combine all hash values together to form a hash sketch of the sequence;
[0080] A hash error list is automatically obtained based on the value of k.
[0081] Select the first sequence as the initial cluster center; add the hash sketch of this sequence to the core index set;
[0082] Perform a similarity search between the hash sketches of all other sequences and the elements in the core index set: if the difference between the hash sketches of two sequences is in the hash error list, the search is considered successful, and the two sequences are considered similar and are classified into the same category.
[0083] After all sequences have been retrieved, the number of neighborhood samples of each element in each cluster is obtained; the sequence with the most neighborhood samples is taken as the new cluster center of that cluster.
[0084] Obtain the Levenstein distance between all cluster centers; merge clusters smaller than a set threshold into a larger cluster to obtain the final clustering result.
[0085] Example 4:
[0086] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the aforementioned DNA sequence clustering method based on a locality-sensitive hash function, comprising:
[0087] The sequenced DNA sequences were sorted from highest to lowest frequency of repetition; the sorted DNA sequences were then sorted again according to the difference in sequence length.
[0088] Using a sliding window of a specific size, each DNA sequence is cut into DNA fragments of length k, i.e., k-mers; select several k-mers at certain positions and k-mers offset to the left and right at fixed positions to form multiple k-mer sets.
[0089] Obtain the local sensitivity hash of each element in the k-mer set; combine all hash values together to form a hash sketch of the sequence;
[0090] A hash error list is automatically obtained based on the value of k.
[0091] Select the first sequence as the initial cluster center; add the hash sketch of this sequence to the core index set;
[0092] Perform a similarity search between the hash sketches of all other sequences and the elements in the core index set: if the difference between the hash sketches of two sequences is in the hash error list, the search is considered successful, and the two sequences are considered similar and are classified into the same category.
[0093] After all sequences have been retrieved, the number of neighborhood samples of each element in each cluster is obtained; the sequence with the most neighborhood samples is taken as the new cluster center of that cluster.
[0094] Obtain the Levenstein distance between all cluster centers; merge clusters smaller than a set threshold into a larger cluster to obtain the final clustering result.
[0095] This invention was tested using Python in an environment with an AMD R7-6800H CPU 3.20GHz, 16.0GB of memory, and Windows 11. The experimental results show that the method of this embodiment outperforms the experimental results of other algorithms.
[0096] Table 1 Comparison of clustering results with Minhash on different real datasets
[0097]
[0098] In Table 1, NMI (Normalized Mutual Information) directly measures the degree of information sharing between the clustering results and the true distribution of sequences; a higher value indicates a better match between the clustering results and the actual situation. AMI (Adjusted Mutual Information) corrects the inaccuracy of mutual information when the number of clusters is large by adjusting the probability of the clusters. ARI (Adjusted Rand Index) calculates the degree of agreement between two clustering results; a higher value indicates a better match between the predicted clustering and the actual situation. FMI (Fowlkes-Mallows Scores) is a comprehensive evaluation index of precision and recall, with a value range of [0,1], where closer to 1 is better. HOMO (Homogeneity of Clustering) refers to the proportion of sequences in each cluster that come from the same class. COMP (Completeness of clustering) is the index that measures the difference between the number of clusters obtained from clustering and the number of original sequences.
[0099] Those skilled in the art will understand that the modules or steps described above can be implemented using general-purpose computer devices. Optionally, they can be implemented using computer-executable program code, which can then be stored in a storage device for execution by a computer device. Alternatively, they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. This disclosure is not limited to any particular combination of hardware and software.
[0100] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
[0101] While the specific embodiments of this disclosure have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of this disclosure. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of this disclosure are still within the scope of protection of this disclosure.
Claims
1. A DNA sequence clustering method based on locality-sensitive hashing (LSH), characterized in that, Includes the following steps: The sequenced DNA sequences were sorted from highest to lowest frequency of repetition; the sorted DNA sequences were then sorted again according to the difference in sequence length. Using a sliding window of a specific size, each DNA sequence is cut into segments of length [length missing]. k DNA fragments, namely k-mer Select several positions k-mer And the position shifted to the left and right by a fixed position. k-mer Composed of multiple k-mer gather; Get each k-mer The locality-sensitive hash value of each element in the set; combining all hash values together to form a hash sketch of the sequence; according to k The value is automatically calculated using a hash error list. Select the first sequence as the initial cluster center; add the hash sketch of this sequence to the core index set; Perform a similarity search between the hash sketches of all other sequences and the elements in the core index set: if the difference between the hash sketches of two sequences is in the hash error list, the search is considered successful, and the two sequences are considered similar and are classified into the same category. After all sequences have been retrieved, the number of neighborhood samples of each element in each cluster is obtained; the sequence with the most neighborhood samples is taken as the new cluster center of that cluster. Obtain the Levenstein distance between all cluster centers; merge clusters smaller than a set threshold into a larger cluster to obtain the final clustering result; The calculation method for the locality-sensitive hash value is as follows: in, k for k-mer Length, x i The hash value mapped to the corresponding base; The list of hash errors is shown below: in, y i It is the hash difference when a base substitution error occurs.
2. The DNA sequence clustering method based on locality-sensitive hash function according to claim 1, characterized in that, When performing a similarity search, if the search fails, the sequence is treated as a new cluster and its hash sketch is added to the core index set.
3. The DNA sequence clustering method based on locality-sensitive hash function according to claim 1, characterized in that, The sequenced DNA sequences were sorted from highest to lowest frequency of repetition. Specifically, the sequences were reordered in descending order of frequency by counting the number of repetitions of each DNA sequence in the dataset.
4. The DNA sequence clustering method based on locality-sensitive hash function according to claim 1, characterized in that, The sorted DNA sequences are then reordered according to their sequence length differences. Specifically, the length difference between each sequence and the original coding sequence is calculated, and the sequences are then reordered in descending order.
5. A DNA sequence clustering system based on locality-sensitive hashing (LSH), used to implement the method described in any one of claims 1-4, characterized in that, include: Sorting module: Sorts the sequenced DNA sequences from highest to lowest frequency of repetition; The sorted DNA sequences are then reordered according to their sequence length differences. k-mer Extraction module: Uses a sliding window of a specific size to cut each DNA sequence into segments of a length of [length missing]. k DNA fragments, namely k-mer Select several locations in km er And the position shifted to the left and right by a fixed position. k-mer Composed of multiple k-mer gather; Hash Draft Building Module: Get Each k-mer The locality-sensitive hash value of each element in the set; combining all hash values together to form a hash sketch of the sequence; Hash Error List Calculation Module: Automatically obtains a hash error list based on the value of k; Initial cluster center selection module: Selects the first sequence as the initial cluster center; adds the hash sketch of this sequence to the core index set; Similarity retrieval and clustering module: Performs similarity retrieval between the hash sketches of all other sequences and the elements in the core index set: If the difference between the hash sketches of two sequences is in the hash error list, the retrieval is considered successful, and the two sequences are considered similar and are classified into the same category; Cluster center correction module: After all sequences have been retrieved, the number of neighborhood samples of each element in each cluster is obtained; the sequence with the most neighborhood samples is taken as the new cluster center of the cluster. Cluster merging module: obtains the Levenstein distance between all cluster centers; merges clusters smaller than a set threshold into a larger cluster to obtain the final clustering result.
6. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and running thereon, characterized in that, When the processor executes the program, it implements a DNA sequence clustering method based on locality-sensitive hash function as described in any one of claims 1-4.
7. A readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements a DNA sequence clustering method based on a locality-sensitive hash function as described in any one of claims 1-4.
Citation Information
Patent Citations
DNA sequence cluster of Locality Sensitive Hashing based on standard entropy
CN107103206A
Positional hashing method for performing DNA sequence similarity search
US20040002816A1
