Image encoding / decoding methods, systems, devices, and readable storage media for DNA storage
The encoding and decoding method using image data DNA storage solves the problems of low encoding density and poor compatibility, achieving efficient error correction and high-fidelity DNA storage, while meeting the requirements for GC content and homopolymer length.
Patent Information
- Application Number
- CN202410003863.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-03
- Publication Date
- 2026-03-06
- Estimated Expiration
- 2044-01-03
AI Technical Summary
Existing DNA storage technologies suffer from low coding density, poor compatibility and restoration accuracy, and existing error correction methods require multiple sequences or a large amount of redundant DNA to correct errors.
An image data DNA storage encoding and decoding method is adopted. By converting the image into a binary data string, wavelet transform and binary numbering are used to establish a base sequence mapping table, and check information and redundancy are added. DNA synthesis is then performed, and error detection and correction are carried out by combining error correction algorithms and deep learning.
It improves coding density, meets the requirements for GC content and homopolymer length, has good compatibility, high error correction rate, and can correct multiple errors in a single sequence while maintaining high fidelity.
Smart Images

Figure CN117834926B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of biological and information technology, and specifically relates to an image encoding and decoding method, system, device, and readable storage medium for DNA storage. Background Technology
[0002] Faced with the explosive growth of data, existing storage media are far from meeting the demands of big data storage. DNA storage, however, offers advantages such as high storage density, long storage time, small footprint, and low maintenance costs. DNA storage holds the promise of breaking through the bottleneck of big data storage and is a prime example of the integration of BitTorrent and IT technologies. Existing DNA data storage methods typically include the following steps:
[0003] 1. Encoding: Convert the data to be stored into a binary sequence, and then encode it into a base sequence using a pre-designed encoding method;
[0004] 2. Synthesis: Synthesize DNA according to the designed base sequence;
[0005] 3. Storage: The synthesized DNA molecules are stored, generally divided into two types: in vivo storage and in vitro storage;
[0006] 4. Sequencing: Extract the DNA and sequence it to obtain the base sequence;
[0007] 5. Decoding: Correct errors in the base sequence and decode the base sequence according to the set decoding method to restore the original data.
[0008] One existing technology proposes an encoding method that can satisfy some DNA sequence constraints and uses redundancy to correct a certain number of errors. However, it doesn't employ other methods to reduce the amount of DNA added due to redundancy, resulting in excessive DNA synthesis required during storage. Other technologies use checksums to correct errors, thus reducing the amount of DNA to be synthesized. However, regarding DNA sequence constraints, they can only guarantee that the homopolymer content is less than or equal to three, and cannot guarantee that the GC content is between 40% and 60%. The HEDGES and DBGPS methods can reduce the amount of DNA to be synthesized during storage and can resolve some errors without requiring duplicates, but some errors still require multiple sequences to correct. Summary of the Invention
[0009] To address the technical problems of low encoding density, poor compatibility, and poor fidelity, this invention provides an image encoding / decoding method, system, device, and storage medium for DNA storage.
[0010] This invention relates to an encoding and decoding method for DNA storage of image data, comprising the following steps:
[0011] Step S1: Convert the image to be encoded into a binary data string, split it into substrings, assign binary numbers to them in sequence, and concatenate the numbers with the binary substrings to obtain a combined data string.
[0012] Step S2: Establish a mapping table between binary strings and base sequences, and perform base conversion on the combined data strings to obtain base sequences;
[0013] Step S3: Add verification information to the base sequence and repeat to obtain a redundant base sequence. Add new primers and perform DNA synthesis to obtain DNA storage data.
[0014] Further, in step S1, the image to be encoded is obtained, converted from RGB space to YUV space, and then wavelet transform is performed on the image to convert the image into a binary data string.
[0015] Further, in step S2, all base sequences that meet the requirements of GC content and homopolymer length are enumerated, a mapping table between binary strings and base sequences is established, the combined data string is cut into multiple substrings of the same length as the binary string, the binary substrings are converted using the mapping table, and the resulting base sequences are spliced together to obtain the converted base sequence.
[0016] Furthermore, the following error correction steps are included:
[0017] Step S4: Perform error detection on the base sequence; if an error is detected, begin error correction; if no error is detected, return the correct sequence.
[0018] Step S5: Set the maximum number and type of errors; if an insertion or deletion error is detected, enumerate and record the possible situations, use an error correction algorithm to correct the error, obtain the correct sequence and return it;
[0019] Step S6: Use the sequence obtained after error detection and correction to obtain the restored image; repair and enhance the restored image to obtain the final image.
[0020] Furthermore, in step S4, if the length of the sequence is equal to the length set during encoding, and the number of segments is the same as the number of repetitions after adding verification information to the base sequence in step S3, and all substrings are completely identical, it is considered that no error has occurred; otherwise, it is considered that an error has occurred.
[0021] Further, in step S5, if the sequence length is less than the length set during encoding, a deletion error is considered to have occurred. All possible deletion positions are enumerated, and for each possible case, a possible base is inserted at the corresponding position. If the sequence length is greater than the length set during encoding, an insertion error is considered to have occurred. All possible insertion positions are enumerated, and for each possible case, the base at that position is deleted. If the length has not changed, no modification is made. All possible cases are generated and recorded, and then a dynamic programming algorithm is used to correct the error, obtain the correct base sequence, and return it.
[0022] Furthermore, in step S6, for the base sequence obtained after error detection and correction, a mapping table set during encoding is used to convert it into a binary string. The binary string is sorted according to the number in the binary string to obtain the restored image. The restored image is restored and enhanced using interpolation or deep learning methods to obtain the final image.
[0023] The present invention also relates to an encoding and decoding system for image data DNA storage, which applies the above-described encoding and decoding method for image data DNA storage.
[0024] The present invention also relates to a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described method.
[0025] The present invention also relates to a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.
[0026] Beneficial effects
[0027] The image encoding and decoding method for DNA storage of the present invention compresses data before encoding, which can improve encoding density and balance compression ratio and restoration quality according to the actual data and the requirements for restored data. The DNA sequence generated by the method of the present invention simultaneously meets the requirements of GC content between 40% and 60% and homopolymer length not greater than N, and has good compatibility.
[0028] The main types of errors that occur in DNA storage are insertion, deletion, and replacement. Some existing methods can only solve the situation where one or two of these errors exist simultaneously, while others can solve the situation where all three errors exist simultaneously, but these require a large number of copies or multiple sequences. However, this invention only requires one sequence to achieve an extremely high error correction rate, and even if the decoding of this sequence fails, it will not affect the error correction and decoding of other sequences, resulting in a high degree of restoration. Attached Figure Description
[0029] Figure 1 This is a flowchart of the DNA storage data process of the present invention.
[0030] Figure 2 This is a schematic diagram of the encoding and decoding process of the present invention.
[0031] Figure 3 This is a diagram of the neural network structure for enhancing image quality according to the present invention. Detailed Implementation
[0032] The following combination Figures 1 to 3 This implementation method will be described in detail.
[0033] This invention relates to an encoding and decoding method for DNA storage of image data, comprising the following steps:
[0034] Step S1: Obtain the image to be encoded, convert it from RGB space to YUV space, and then perform wavelet transform on the image to convert it into a binary data string; after splitting the binary data string into substrings, assign binary numbers to them in sequence, and concatenate the numbers with the binary substrings to obtain a combined data string.
[0035] Step S2: After establishing a mapping table between binary strings and base sequences, perform base conversion on the combined data string to obtain a base sequence; enumerate all base sequences that meet the requirements of GC content and homopolymer length, establish a mapping table between binary strings and base sequences, cut the combined data string into multiple substrings of the same length as the binary string, use the mapping table to perform base conversion on the binary substrings, and splice the obtained base sequences to obtain the converted base sequence.
[0036] Step S3: Add verification information to the base sequence and repeat to obtain a redundant base sequence. Add new primers and perform DNA synthesis to obtain DNA storage data.
[0037] In this invention, decoding is the inverse process of encoding, wherein decoding includes the following error correction steps:
[0038] Step S4: Perform error detection on the base sequence; if an error is detected, start error correction; if there is no error, return the correct sequence; in step S4, if the length of the sequence is equal to the length set during encoding, and the number of segments is the same as the number of repetitions after adding check information to the base sequence in step S3, and all substrings are completely identical, it is considered that no error has occurred; otherwise, it is considered that an error has occurred.
[0039] Step S5: Set the maximum number and type of errors; if an insertion or deletion error is detected, enumerate and record the possible cases, use an error correction algorithm to correct the error, obtain the correct sequence, and return it; in step S5, if the length of the sequence is less than the length set during encoding, a deletion error is considered to have occurred, enumerate all possible deletion positions, and for each possible case, insert a possible base at the corresponding position; if the length of the sequence is greater than the length set during encoding, an insertion error is considered to have occurred, enumerate all possible insertion positions, and for each possible case, delete the base at that position; if the length has not changed, no modification is made; generate all possible cases and record them, then use a dynamic programming algorithm to implement error correction, obtain the correct base sequence, and return it.
[0040] Step S6: Using the sequence obtained after error detection and correction, obtain the restored image; repair and enhance the restored image to obtain the final image. For the sequence obtained after error detection and correction, use the mapping table set during encoding to convert it into a binary string. Sort the binary string according to the number in the binary string to obtain the restored image. Use interpolation or deep learning to restore and enhance the restored image to obtain the final image.
[0041] The present invention also relates to an encoding and decoding system for image data DNA storage, which applies the above-described encoding and decoding method for image data DNA storage.
[0042] Example
[0043] This embodiment specifically illustrates the image encoding and decoding method for DNA storage of the present invention, including the following steps:
[0044] Step 1: Convert the image from RGB space to YUV space, perform wavelet transform on the image data to convert it into a binary data string, split the data string and assign it a number to obtain a data string with a length of 40 bits.
[0045] Step 2: Screen DNA sequences with a length of 14 nt that satisfy GC content = 50% and homopolymer length = 1. The data range that can be represented is 20.84 bits. Construct a mapping table between the 20-bit binary sequence and the above DNA sequence.
[0046] Step 3: Set the check bit to 2 bits, and divide it into high and low bits. Since each bit in binary can only be 0 or 1, construct a mapping table between 0, 1, and bases. The base sequence in the mapping table also satisfies the GC content.
[0047] =50%, homopolymer length =1.
[0048] Step 4: Divide the 40-bit data into two 20-bit substrings. Each substring is converted into a 14-nt base sequence according to the designed mapping table. Then, the two base sequences are concatenated to obtain the base sequence of the 40-bit data after conversion.
[0049] Step 5: When splicing the two 14nt sequences from Step 2, and subsequently during the repeated splicing in Step 6, the homopolymer length at the sequence junction may be equal to 2. Therefore, the high and low bits of the check bits are inserted at the sequence junction to ensure that the homopolymer length is 1. Because the high and low bit mapping table is a one-to-many mapping table, the base sequence that satisfies the requirement of a homopolymer length of 1 after splicing can be selected based on the actual two sequences when inserting the high and low bits.
[0050] Step 6: To perform error correction during decoding, use four times redundancy, repeat the base sequence four times and splice it together.
[0051] Effect verification
[0052] The method of the present invention is compared with various prior art techniques using the following formula:
[0053]
[0054] Where k is the number of DNA sequences, l is the average length of the sequences, n and m are the length and width of the image, respectively, 24 represents the percentage of a single pixel in the RGB image, h is the average maximum single base length of l sequences, c is the deviation of the average GC content of l sequences from 0.5, and s is the SSIM value of the final image compared to the original image.
[0055] The formula can be divided into three parts: the first part calculates the coding density score, and the coding density score is 0 when the information density is less than or equal to 1; the second part calculates the compatibility score, and the compatibility score is 0 when the average maximum single base length is greater than or equal to 6 and the average GC content is greater than or equal to 80% or less than or equal to 20%; the third part calculates the reproducibility score, and the reproducibility score is 0 when the SSIM value is less than 0.84 (i.e., below good performance).
[0056] Error rate:
[0057] In simulating real-world errors, a 3% error rate was introduced (comprising 1.5% substitutions, 0.75% insertions, and 0.75% deletions). This 3% error rate indicates that the erroneous bases represent 3% of the sequence length. Table 1 shows the control results.
[0058] Table 1 Comparison Results
[0059] Ranking experiment Fraction 1 This method 90.488 2 Control Experiment 1 86.501 3 Control Experiment 2 84.886 4 Control Experiment 3 84.73 5 Control Experiment 4 84.524 6 Control Experiment 5 84.1 7 Control Experiment 6 82.874 8 Control Experiment 7 82.581 9 Control Experiment 8 82.17 10 Control Experiment 9 82.092
[0060] The above description is only a preferred embodiment of the present invention and is not intended to limit the implementation of the present invention. Those skilled in the art can easily make corresponding modifications or alterations based on the main concept and spirit of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of protection claimed in the claims.
Claims
1. A coding method of image data DNA storage, characterized by, The method comprises the following steps: Step S1, converting the image to be encoded into a binary data string, splitting the binary data string into sub-strings, and then sequentially numbering the sub-strings to obtain a combined data string; Step S2, after establishing a mapping table between the binary string and the base sequence, performing base conversion on the combined data string to obtain a base sequence; Specifically, the method comprises the following steps: enumerating all base sequences meeting the GC content and homopolymer length requirements, establishing a mapping table between the binary string and the base sequence meeting the requirements, cutting the combined data string into multiple sub-strings with the same length as the binary string, using the mapping table to perform base conversion on the binary sub-strings, and splicing the obtained base sequences, wherein a check bit is inserted between each two base sequences during splicing, thereby obtaining the converted base sequence; Step S3, adding check information to the converted base sequence and repeating the process to obtain a redundant base sequence, adding a new primer, and performing DNA synthesis to obtain DNA storage data.
2. The method of claim 1, wherein, In step S1, the image to be encoded is obtained, and the image is converted from RGB space to YUV space, and then wavelet transform is performed on the image to convert the image into a binary data string.
3. The method of claim 1, wherein, The method comprises the following error correction steps: Step S4, error detection is performed on the base sequence; if an error is detected, error correction is started; if there is no error, the correct sequence is returned; Specifically, if the length of the sequence is equal to the length set during encoding, and the sequence is split into multiple sub-strings, the number of splits is equal to the number of repetitions after adding check information to the base sequence in step S3, and all sub-strings are identical, it is considered that no error has occurred, otherwise it is considered that an error has occurred; Step S5, setting the maximum number and type of errors; if an insertion or deletion error is detected, enumerate all possible cases and record them, use error correction algorithms to correct the errors, obtain the correct sequence and return it; Step S6, using the sequence obtained through error detection and correction to obtain a restored image; repairing and enhancing the restored image to obtain a final image.
4. The method of claim 3, wherein, In step S5, if the length of the sequence is less than the length set during encoding, it is considered that a deletion error has occurred, all possible deletion positions are enumerated, and for each possible case, the possible bases are inserted at the corresponding position; if the length of the sequence is greater than the length set during encoding, it is considered that an insertion error has occurred, all possible insertion positions are enumerated, and for each possible case, the bases at this position are deleted; if the length does not change, no modification is performed; all possible cases are generated and recorded, and then a dynamic programming algorithm is used to correct the errors to obtain the correct base sequence and return it.
5. The method of claim 1, wherein, In step S6, for the sequence obtained through error detection and correction, a mapping table set during encoding is used to convert the sequence into a binary string, the binary string is sorted according to the numbers in the binary string to obtain a restored image, and the restored image is restored and enhanced using interpolation or deep learning to obtain a final image.
6. A codec system for image data DNA storage, characterized by, The computer module is configured to implement the method of any one of claims 1 to 5. 7.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-6 when the computer program is executed by the processor. The processor is configured to implement the method of any one of claims 1 to 5.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program, which is executed by a processor, implements the steps of the method of any one of claims 1 to 5.
Citation Information
Patent Citations
Data error correction method and device and electronic equipment
CN114218937A
Coding method and coding device for DNA storage
CN114822695A