A codeword design method for DNA storage
By using the method of minimum variance Hoffman tree compression and dictionary codeword encoding in DNA storage, the problems of low encoding rate and high sequence error probability in existing DNA encoding methods are solved, and efficient and reliable DNA storage is achieved.
Patent Information
- Application Number
- CN202111301348.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-04
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2041-11-04
AI Technical Summary
The existing DNA encoding methods have problems with low coding rates and high synthesis costs, and it is difficult to effectively solve the problem of high probability of sequence errors in DNA storage.
A simple codeword design method is adopted to compress data through the minimum variance Hoffman tree, and encode binary data according to the codewords in the dictionary, ensuring that the GC content of the DNA sequence is between 40%-60%, and limiting the running length of the homopolymer to not exceed 3.
It improves the encoding rate of DNA storage, reduces the cost of biological research, enhances the reliability and accuracy of DNA storage processes, and can effectively store text and image data.
Smart Images

Figure CN114023392B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of coding design, and in particular to a codeword design method for DNA storage. Background Art
[0002] Currently, the global demand for data storage exceeds the growth rate of global storage capacity. As a carrier of natural genetic information, DNA provides a stable, resource-efficient and sustainable data storage solution. It was not until the first decade of the 21st century that the pioneering work of Church and Goldman made DNA storage mainstream. Church et al. successfully stored up to 659KB of data in DNA molecules, while before this work, the maximum amount of stored data was less than 1KB. Goldman et al. stored even more data, reaching 739KB. It is worth noting that the data stored in these two studies not only contained text, but also images, sounds, PDFs, etc., which confirmed that DNA can store a variety of data types.
[0003] Specifically, DNA data storage is an emerging research, which is to convert binary digital information into DNA sequences for dense and persistent data storage in the form of synthetic DNA. However, the current DNA encoding method simply maps binary data into DNA sequences, which has the disadvantages of low encoding rate and high synthesis cost. Summary of the invention
[0004] In view of the above problems in the prior art, the present application proposes a codeword design method with a simple structure and high coding rate, and the encoded sequence also meets the constraints that the GC content is between 40%-60% and the homopolymer run length does not exceed 3.
[0005] To achieve the above purpose, the technical solution of the present application is: a codeword design method for DNA storage, comprising:
[0006] Step 1: Get input data and convert it into binary data;
[0007] Step 2: compressing the binary data;
[0008] Step 3: The compressed binary data is divided into non-overlapping blocks of length 4, and the non-overlapping blocks have at most 16 combinations;
[0009] Step 4: Get the probability of non-overlapping blocks appearing;
[0010] Step 5: Encode the non-overlapping blocks according to the codewords in the dictionary:
[0011] Step 6: Obtain the GC content of the encoded DNA sequence. If the GC content is lower than 40% or higher than 60%, proceed to step 5, change the mapping relationship and continue encoding. Otherwise, proceed to step 7.
[0012] Step 7: Find the case where the homopolymer run length is not less than 3. If so, replace and modify it. If not, execute step 8.
[0013] Step 8: Get the coding rate and output the DNA sequence.
[0014] Furthermore, if the input data is text data, each character is converted into an ACSII code; if the input data is image data, the image is converted into a pixel value; and then the ACSII code and pixel value are converted into 8-bit binary data.
[0015] Furthermore, the minimum variance Huffman tree is used for binary data compression.
[0016] Furthermore, the Huffman tree contains n leaf nodes, corresponding to n source symbols, whose probability of occurrence is p i , the distance from n leaf nodes to the root node is l i The variance σ 2 , is obtained by the following formula:
[0017]
[0018] in, is the average length of each codeword, obtained by the following formula:
[0019]
[0020] Among all possible Huffman trees, the one with minimum variance is called minimum variance Huffman tree.
[0021] Furthermore, the non-overlapping blocks are encoded according to the codewords in the dictionary, specifically:
[0022] Dictionary C1 = {C, A}
[0023] Dictionary C2 = {TA, TG, TC}
[0024] Dictionary C3 = {GAT, GTA, GAC, GAG, GTC, GTG, GCA, GCT, GGT, GGA, GCG}.
[0025] Furthermore, GC content refers to the percentage of bases G and C in a DNA sequence, as shown in the following formula:
[0026]
[0027] Wherein, GC(s) represents the GC content of sequence s, |G| and |C| represent the number of bases G and C in sequence s, and |s| represents the total number of bases in sequence s.
[0028] Furthermore, the situation where the homopolymer run length is not less than 3 is sought, specifically: the situation where the same base appears three or more times consecutively in the DNA sequence is sought.
[0029] Furthermore, the coding rate represents how many bits of raw data can represent one DNA nucleotide, which is obtained using formula (4):
[0030]
[0031] Among them, b represents the number of bits of the original data, and n represents the total number of DNA nucleotides that store the same data.
[0032] The present invention adopts the above technical solution, and can achieve the following technical effects:
[0033] 1. Before encoding, the present invention first uses the minimum variance Huffman tree to perform data compression, which can effectively reduce the cost of biological research and improve the encoding rate of the entire DNA encoding;
[0034] 2. During the DNA storage process, the probability of errors occurring in different sequences is different. For DNA sequences with long homopolymer runs and high GC content, the probability of errors occurring during DNA synthesis and sequencing will be significantly increased; therefore, the present invention introduces constraints to limit the occurrence of such DNA sequences, thereby improving the reliability and accuracy of the DNA storage process.
[0035] 3. The DNA storage coding method based on codeword design can not only store text but also images, and has the characteristics of simple structure and low algorithm complexity. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 A flowchart for a codeword design method for DNA storage. DETAILED DESCRIPTION
[0037] The following will be combined with the accompanying drawings in the present invention to clearly and completely describe the technical solutions in the implementation of the present invention. It can be understood that the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the protection scope of the present invention.
[0038] The constraints involved in the present invention are that the GC content is between 40% and 60% and the homopolymer run length cannot exceed 3. Among them, the GC content refers to the percentage of bases G and C in a DNA sequence; the homopolymer run length cannot exceed 3 means that the same base cannot appear three times or more in a row in a DNA sequence.
[0039] Example 1
[0040] The embodiments of the present invention are implemented on the premise of the technical solution of the present invention, and detailed implementation methods and specific operation processes are given, but the protection scope of the present invention is not limited to the following embodiments. In the embodiment, the encoding algorithm is used to encode a text file of size 511B, and the constraints satisfied are as described above.
[0041] Step 1: Get the input data and convert it into binary data.
[0042] Specifically, first use the abs function to convert the characters in the text file into ACSII codes, and then convert them into 8-bit binary numbers. A 511B text file can be converted into 4088 bits of binary data after the above operation.
[0043] Step 2: compress the binary data.
[0044] It should be noted that every 16-bit binary number is taken as a group and then compressed using the minimum variance Huffman tree, where the Huffman tree is constructed based on the probability of the source symbol. All source symbols are sorted according to their probability of occurrence, with symbols with lower probabilities placed farther from the root node and symbols with higher probabilities placed closer to the root node, which reduces the average length and expected value of the encoded string, thereby achieving the purpose of lossless data compression;
[0045] Specifically, firstly, the binary data is divided into 16-bit groups, then the unique function is used to remove duplicates, then the tabulate function is used to calculate the probability, and then the Huffman tree is constructed based on the probability, and finally the minimum variance Huffman tree is used to compress the binary data;
[0046] Step 3: The compressed binary data is divided into non-overlapping blocks of length 4, and the non-overlapping blocks have at most 16 combinations;
[0047] Step 4: Get the probability of non-overlapping blocks appearing;
[0048] Specifically, the tabulate function is used to calculate the probability of non-overlapping blocks appearing;
[0049] Step 5: Encode the non-overlapping blocks according to the codewords in the following dictionary;
[0050] Dictionary C1 = {C, A}
[0051] Dictionary C2 = {TA, TG, TC}
[0052] Dictionary C3 = {GAT, GTA, GAC, GAG, GTC, GTG, GCA, GCT, GGT, GGA, GCG};
[0053] Specifically, code words are selected from the dictionary C1-C3 in order according to the probability of the 16 combinations. Combinations with higher probabilities are encoded by selecting shorter code words from the dictionary. For example, the combination with the highest probability is encoded as C, the combination with the second highest probability is encoded as A, the combination with the third highest probability is encoded as TA, and so on. The mapping relationship of the text file is shown in Table 1.
[0054] Table 1 Mapping relationship
[0055] symbol Probability Codeword 1110 0.0819 C 1111 0.0819 A 0110 0.0699 TA 1101 0.0699 TG 0010 0.0675 TC 0011 0.0675 GAT 1010 0.0675 GTA 1001 0.0627 GAC 0101 0.0627 GAG 0100 0.0578 GTC 0111 0.0578 GTG 0000 0.0530 GCA 1011 0.0530 GCT 1000 0.0506 GGT 0001 0.0482 GGA 1100 0.0482 GCG
[0056] Step 6: Obtain the GC content of the encoded DNA sequence. If the GC content is lower than 40% or higher than 60%, proceed to step 5, change the mapping relationship and continue encoding. Otherwise, proceed to step 7.
[0057] Specifically, the GC content of the text encoded as a DNA sequence is 56.40%.
[0058] Step 7: Find the case where the homopolymer run length is not less than 3. If so, replace and modify it. If not, execute step 8.
[0059] Specifically, when the homopolymer length is not less than 3, the third character is replaced. For example, GGG and AAAA are modified to GGC and AATA, respectively, using C to replace G and T to replace A, which will not affect the GC content.
[0060] Step 8: Get the coding rate and output the DNA sequence.
[0061] Specifically, the text file is encoded into a DNA sequence as shown in Table 2, and the encoding rate is about 4.0.
[0062] Table 2 DNA sequences
[0063]
[0064] The present invention proposes a codeword design method for DNA storage, first converting data information into binary data, then compressing the binary data using a minimum variance Huffman tree to obtain a higher coding rate, then dividing the compressed binary number into non-overlapping blocks of length 4, and then mapping the non-overlapping blocks according to the codewords in the dictionary to obtain a DNA sequence, and finally calculating the GC content of the DNA sequence and checking whether there is a homopolymer run length of not less than 3. If the GC content is too high or too low, a new mapping relationship will be regenerated; if there is a homopolymer run length of not less than 3, it will be modified according to the modification rule. The present invention uses MATLAB to perform simulation experiments on the algorithm under Intel (R) CPU 3.6GHz, 10.0GB memory, and Windows 10 operating environment. The experimental results show that the method results of this embodiment are better than the experimental results of other algorithms.
[0065] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. It should be pointed out that ordinary technicians in this technical field can make several improvements and modifications without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A codeword design method for DNA storage, characterized in that: include: Step 1: Get input data and convert it into binary data; Step 2: compressing the binary data using a minimum variance Huffman tree; The Huffman tree contains n leaf nodes, corresponding to n source symbols, whose probability of occurrence is p i , the distance from n leaf nodes to the root node is l i The variance σ 2 , is obtained by the following formula: in, is the average length of each codeword, obtained by the following formula: Among all possible Huffman trees, the one with the minimum variance is called the minimum variance Huffman tree; Step 3: The compressed binary data is divided into non-overlapping blocks of length 4, and the non-overlapping blocks have at most 16 combinations; Step 4: Get the probability of non-overlapping blocks appearing; Step 5: Encode the non-overlapping blocks according to the codewords in the dictionary, specifically: dictionary C1 = {C, A} Dictionary C2 = {TA, TG, TC} Dictionary C3 = {GAT, GTA, GAC, GAG, GTC, GTG, GCA, GCT, GGT, GGA, GCG}; Step 6: Obtain the GC content of the encoded DNA sequence. If the GC content is lower than 40% or higher than 60%, proceed to step 5, change the mapping relationship and continue encoding. Otherwise, proceed to step 7. Step 7: Find the case where the homopolymer run length is not less than 3. If so, replace and modify it. If not, execute step 8; Step 8: Get the coding rate and output the DNA sequence.
2. A codeword design method for DNA storage according to claim 1, characterized in that: If the input data is text data, each character is converted into an ACSII code; if the input data is image data, the image is converted into a pixel value; and then the ACSII code and pixel value are converted into 8-bit binary data.
3. A codeword design method for DNA storage according to claim 1, characterized in that: GC content refers to the percentage of bases G and C in a DNA sequence, as shown in the following formula: Wherein, GC(s) represents the GC content of sequence s, |G| and |C| represent the number of bases G and C in sequence s, and |s| represents the total number of bases in sequence s.
4. A codeword design method for DNA storage according to claim 1, characterized in that: Find the case where the homopolymer run length is not less than 3, specifically: find the case where the same base appears 3 or more times in a row in the DNA sequence.
5. The method for designing a codeword for DNA storage according to claim 1, characterized in that: The coding rate represents how many bits of raw data can represent one DNA nucleotide, which is obtained using formula (4): Among them, b represents the number of bits of the original data, and n represents the total number of DNA nucleotides that store the same data.
Citation Information
Patent Citations
DNA information storage coding method
CN109979540A