DNA image storage encoding method and system based on position index, decoding method and system, and computer readable storage medium
By using location-indexed DNA image storage technology, pseudo-random masks are generated using the spatial location information of image data and XOR operations are performed. This solves the problems of low coding efficiency, poor biochemical stability and limited storage density in existing technologies, and achieves efficient parallel processing and high-density storage.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN INST OF ADVANCED TECH
- Filing Date
- 2026-03-30
- Publication Date
- 2026-07-14
AI Technical Summary
Existing DNA image storage technologies suffer from low coding efficiency, poor biochemical stability, weak system robustness, and limited storage density. They are particularly difficult to parallelize when processing large-scale image data, and traditional index sequences occupy valuable payload space.
By using a location index-based method, a deterministic pseudo-random mask is generated using the spatial location information of the image data. An XOR operation is performed on the Galois domain GF(4). Combined with a short index header, efficient encoding and decoding of the image data is achieved. A nonlinear hash function is used to generate an index seed, and a pseudo-random DNA mask sequence is generated. During decoding, CRC check is used to ensure the correctness of the data.
It achieves highly parallel processing capabilities for image data, improves biochemical stability and storage density, enhances system robustness and data security, reduces error rate, and improves storage efficiency.
Smart Images

Figure CN121937546B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data storage technology, and in particular to a location-indexed DNA image storage encoding method and system, decoding method and system, and computer-readable storage medium. Background Technology
[0002] With the advent of the big data era, the global data volume is growing exponentially, and traditional storage media (such as magnetic tape, hard disks, and optical discs) are gradually approaching their physical limits in terms of storage density, energy consumption, and lifespan. Deoxyribonucleic acid (DNA), as a natural carrier of biological information, is considered a disruptive technology for solving future data storage challenges due to its advantages such as ultra-high storage density (theoretically up to 455 EB / g), ultra-long storage life (hundreds to thousands of years), and extremely low maintenance energy consumption. Existing image DNA storage technologies typically follow a process of "image compression, binary conversion, base mapping, synthesis, and sequencing."
[0003] However, existing technologies generally suffer from the following bottlenecks when dealing with large-scale image data.
[0004] Encoding efficiency is lower than serial dependency: Mainstream encoding methods, such as rotating codes or differential codes based on Huffman coding, typically depend on the previous base for their encoding state. This chain-like dependency in streaming processing makes it difficult to parallelize the encoding and decoding process, failing to fully utilize the computing power of modern multi-core processors or GPUs, resulting in low efficiency when processing large-scale image data.
[0005] Poor biochemical stability: Image data exhibits high spatial correlation, such as large areas of solid-color backgrounds, which, even after compression, may still generate numerous repetitive binary bit strings (e.g., consecutive "0"s or "1"s). Directly mapping these repetitive patterns can easily lead to long homopolymer fragments (e.g., "AAAA...") in DNA sequences or cause GC content to deviate significantly from the optimal biochemical reaction range of 40%-60%. This can significantly increase the error rate during DNA synthesis and sequencing (e.g., polymerase slippage, sequencing signal attenuation).
[0006] The system has weak robustness: Under the serial encoding mechanism, a synthesis or sequencing error of a single base may propagate along the sequence, causing the cascade failure of subsequent decoding, resulting in the entire data block or even the entire file becoming unrecoverable.
[0007] Limited storage density: To correctly assemble data from a massive pool of DNA molecules, traditional methods typically require adding a long, uniquely identifiable index sequence (i.e., an explicit address) to each data fragment. Since the synthetic length of a single DNA strand is currently limited (typically 200-300 nucleotides), this index occupies valuable payload space, thus reducing the information storage density per unit length.
[0008] Therefore, designing a DNA image storage scheme that can support highly parallel processing, inherently suppress biochemical instability factors, possess error isolation capabilities, and maximize storage density is a technical challenge that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0009] To overcome some or all of the deficiencies of the prior art, the purpose of this disclosure is to provide a DNA image storage encoding method and system, a decoding method and system, and a computer-readable storage medium based on location indexing. In the technical solution of this disclosure, by utilizing the spatial location information of the image data itself, a deterministic pseudo-random mask is generated through nonlinear mapping, and the data is "whitened" and decoupled by combining the XOR operation of the Galois field (GF(4)), thereby improving parallel processing capabilities, ensuring biochemical stability, and achieving high-density storage.
[0010] To achieve the above objectives, the present invention employs the following technical solutions.
[0011] In a first aspect, this disclosure proposes a DNA image storage encoding method based on position indexing, comprising the following steps: dividing the image to be stored into multiple image blocks and assigning unique position coordinates to each image block; for each image block, firstly generating an index seed using a preset nonlinear hash function based on its position coordinates, and then using the generated index seed to drive a deterministic pseudo-random number generator to generate a pseudo-random DNA mask sequence adapted to the data length of the image block; for each image block, converting its corresponding error-corrected binary data into the original DNA sequence according to a preset base mapping rule; performing a bitwise XOR operation on the Galois domain GF(4) for the original DNA sequence and the pseudo-random DNA mask sequence corresponding to each image block to obtain the encoded DNA sequence; adding an index header to the encoded DNA sequence of each image block and encapsulating it to form the final DNA sequence to be synthesized.
[0012] In the above technical solution, the preset nonlinear hash function is specifically a linear congruent hash function, the expression of which is: Where x and y are the row and column indices of an image patch location coordinate, P1 and P2 are two distinct prime numbers, and M is a preset large modulus. This indicates a modulo operation.
[0013] In the above technical solution, the bitwise XOR operation on the Galois domain GF(4) is to map the bases A, C, G, and T to the elements 0, 1, 2, and 3 in the finite domain, respectively. The operation result is defined as the addition of the two elements modulo 4 and then the reverse mapping back to the bases.
[0014] In the above technical solution, the length of the index header is less than the length required to directly encode the position coordinates into bases, and it at least contains hash digest information generated from the position coordinates for fast filtering during decoding.
[0015] In the above technical solution, before performing an XOR operation on the original DNA sequence and the pseudo-random DNA mask sequence, the method further includes: calculating the texture complexity index of the corresponding image block; if the texture complexity index is lower than a preset threshold, it is determined to be a flat block, and after performing a scrambling operation on the original DNA sequence of the block, an XOR operation is performed.
[0016] Secondly, this disclosure proposes a DNA image storage decoding method based on position indexing, used to decode DNA sequences obtained by the encoding method described in this disclosure, including the following steps: acquiring multiple sequencing reads, extracting the encoded DNA sequence and its index header from each sequencing read, parsing the index header, and filtering one or more candidate position coordinates based on the coordinate summary information therein; generating a pseudo-random DNA mask sequence based on the candidate position coordinates, the steps including: generating an index seed based on a candidate position coordinate using a preset nonlinear hash function, and using the obtained index seed to drive a deterministic pseudo-random number generator to generate a sequence corresponding to the image. A pseudo-random DNA mask sequence adapted to the block data length; when there are multiple candidate position coordinates, the step of generating a pseudo-random DNA mask sequence based on the candidate position coordinates is performed in parallel; on the Galois domain GF(4), the encoded DNA sequence is XORed with each of the pseudo-random DNA mask sequences bit by bit to obtain the candidate original DNA sequence; the candidate original DNA sequence is inversely mapped to binary data and its integrity is verified; the candidate position coordinates that pass the integrity verification are confirmed as the real coordinates, and the decoded binary data is filled into the corresponding position in the image according to the real coordinates to reconstruct the original image.
[0017] Thirdly, this disclosure proposes a DNA image storage and encoding system based on position indexing, comprising: a block segmentation module configured to segment the image to be stored into multiple image blocks and assign a unique position coordinate to each image block; a seed generation module configured to generate a corresponding index seed according to the position coordinate of each image block using a preset nonlinear hash function; a mask generation module configured to use the index seed of each image block as input to drive a determined pseudo-random number generator to generate a pseudo-random DNA mask sequence corresponding to the data length of the image block; a conversion module configured to convert the error-corrected binary data corresponding to each image block into the original DNA sequence according to a preset base mapping rule; an encoding module configured to perform a bitwise XOR operation on the galois domain GF(4) to obtain the encoded DNA sequence of each image block; and an encapsulation module for adding an index header to the encoded DNA sequence of each image block and encapsulating it to form the final DNA single-stranded sequence to be synthesized.
[0018] Fourthly, this disclosure proposes a DNA image storage and decoding system based on position indexing for decoding DNA sequences obtained by the encoding system of this disclosure, comprising: an extraction module configured to acquire sequencing reads and extract the encoded DNA sequence and its index header from the sequencing reads; a filtering module configured to parse the coordinate summary information in the index header and filter one or more candidate position coordinates from the set of all possible image block coordinates; and a mask generation module configured to generate an index seed based on a candidate position coordinate using a preset nonlinear hash function, and use the obtained index seed to drive a deterministic pseudo-random number generator to generate a mask corresponding to the candidate position coordinate. A pseudo-random DNA mask sequence adapted to the length of the image block data; a decoding module configured to perform a bitwise XOR inverse operation on the Galois domain GF(4) to obtain the candidate original DNA sequence and inversely map it into binary data; a verification and reconstruction module configured to perform integrity verification on the binary data, confirm the candidate position coordinates that pass the verification as the real coordinates, and fill the corresponding position in the image with the decoded binary data according to the real coordinates to reconstruct the original image; wherein, the number of mask generation modules is the same as the number of candidate position coordinates, and they are called and executed in parallel.
[0019] Fifthly, this disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the encoding method described in this disclosure.
[0020] This disclosure provides beneficial technical effects.
[0021] (1) High parallel processing capability: By decoupling the encoding process from the image block coordinates, the encoding of each image block is performed independently. This "stateless" encoding mode completely breaks the serial dependency of traditional streaming encoding, enabling large-scale image data to be fully encoded and decoded in parallel on GPUs or multi-core CPUs, greatly improving processing efficiency (experiments have shown that the processing speed can be improved by 1-2 orders of magnitude).
[0022] (2) High biochemical stability: The GF(4) XOR operation based on pseudo-random mask is essentially a "data whitening" process. No matter how high the redundancy of the original image data is (such as a solid color background), the encoded DNA sequence will exhibit approximately random statistical characteristics. This characteristic fundamentally suppresses the generation of long fragment homopolymers and ensures that the GC content is stable at around 50%, which perfectly matches the optimal biochemical reaction conditions of existing DNA synthesis and sequencing technologies, thereby significantly reducing the error rate.
[0023] (3) Natural robustness and error isolation: The independent encoding of each image block constructs a natural "error isolation wall". Synthesis or sequencing errors within any block, or even the complete loss of individual blocks, will not affect the decoding of other blocks. This effectively prevents the cascading spread of errors and greatly enhances the fault tolerance and robustness of the entire storage system.
[0024] (4) High storage density: The present invention adopts an implicit indexing mechanism of "short index header + content self-verification". The decoding end verifies the correctness of the coordinates by the data itself (such as CRC check), so that a very short coordinate digest (such as 8-10bp) can be used to replace the traditional long address index (such as 20-30bp), which significantly improves the effective payload ratio within the limited DNA single strand length and increases the storage density.
[0025] (5) High data security: The encoding process is equivalent to performing a location-based one-time pad encryption on the image data. Since the pseudo-random mask is completely determined by the coordinates and the preset key (i.e., hash function parameters, PRNG parameters, etc.), even if an unauthorized party obtains the DNA sequence, it will not be able to recover the original image without cracking the mapping rules and parameters, thus providing a natural biochemical-level security guarantee for the data. Attached Figure Description
[0026] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1This is a schematic diagram of the overall process of an image DNA encoding method in one embodiment.
[0028] Figure 2 This is a schematic diagram of the overall process of an image DNA decoding method in one embodiment.
[0029] Figure 3 This is a schematic diagram comparing an implicit index structure in one implementation with a traditional explicit index structure. Detailed Implementation
[0030] Terminology explanation.
[0031] Image DNA encoding: a technology that translates and stores digital image information into artificially synthesized DNA molecules through specific encoding rules.
[0032] Image DNA Decoding: The reverse process of image DNA encoding.
[0033] The following description, in conjunction with the accompanying drawings, clearly and completely describes how the technical solution of this case is implemented. Obviously, the described embodiments are only a part of the embodiments of this case, and not all of them. Based on the embodiments in this case, all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of this application.
[0034] In one embodiment, a method is provided for generating a pseudo-random mask using image patch location indices, thereby achieving high-density, high-parallelism, and high-biochemical-stability encoding of image data on DNA molecules. See [link to previous document]. Figure 1 The process includes the following steps.
[0035] Step S1: Image segmentation and coordinate assignment
[0036] The original image to be stored is divided into several image blocks of a preset size that do not overlap with each other, and each image block is assigned a unique spatial coordinate (x, y), where x represents the row index and y represents the column index.
[0037] For example, input a color image to be stored with a resolution of 1024×1024 pixels. Divide it into non-overlapping 16×16 pixel image blocks, resulting in (1024 / 16)×(1024 / 16)=64×64=4096 image blocks. Assign coordinates (x, y) to each image block, where x and y range from 0 to 63, representing the row and column of the image block, respectively. The original data size of each image block is 16×16×3 bytes (assuming 24-bit true color) = 768 bytes.
[0038] Step S2: Generate index seed
[0039] Using a pre-defined non-linear hash function, the coordinates (x, y) of each image patch are mapped to a unique, seemingly random index seed value S.
[0040] The pre-defined nonlinear hash function is used to ensure that even if the coordinates change slightly, the generated seed S will show significant differences. Its general form is as follows.
[0041] The general form of the pre-defined nonlinear hash function is: .
[0042] For example, but not limited to ,in and Given two distinct large prime numbers, Modulo operation is represented. For a pre-set large modulus (such as ).
[0043] For example, for an image patch with coordinates (x, y), a 32-bit index seed S is generated using a linear congruential hash function with large prime number multiplication, as follows: S = (x, y) 1664525 + y 1013904223) mod 1664525 and 1013904223 are two known large prime numbers that perform well in pseudo-random number generation. This function ensures that the seed S generated by adjacent coordinates (such as (0,0) and (0,1)) is numerically significantly different, thus guaranteeing the independence and randomness of subsequent masks.
[0044] Step S3: Obtain pseudo-random DNA sequences
[0045] For each image patch, a deterministic pseudo-random number generator (PRNG) is driven by its corresponding index seed S as the initial value. By iteratively operating on the PRNG, a pseudo-random number sequence matching the binary data length of the image patch is generated.
[0046] Subsequently, according to a preset mapping rule, the pseudo-random number sequence is converted into a pseudo-random DNA mask sequence of the same length. The preset mapping rule, for example, maps a 2-bit binary number to a specific base: 00→A, 01→C, 10→G, 11→T.
[0047] For example, a linear congruential generator (LCG) is initialized with the seed S generated in step 102, and its iterative formula is as follows, generating a 32-bit random number in each iteration. .
[0048]
[0049] For the example image patch, its data size is 768 bytes, or 6144 bits, which can be mapped to 6144 ÷ 2 = 3072 bases. Therefore, the Linear Congruence Generator (LCG) needs to be iterated 3072 times, extracting each base. The two highest bits (such as bits 31 and 30) are mapped to a single base according to the following rules: 00 → A; 01 → C; 10 → G; 11 → T. This yields a pseudo-random DNA mask sequence of 3072 bases, denoted as Mask.
[0050] Step S4: Obtain the original DNA sequence
[0051] The binary data of the image blocks after error correction and verification is divided into groups of 2 bits each, and converted into an initial DNA sequence, denoted as RawSeq, according to the same mapping rules as in step S3. Here, the binary data of the image blocks can be either raw pixel data or compressed or preprocessed data. The error correction uses FEC, and the error verification uses CRC.
[0052] For example, the 768 bytes of binary data of the image patch are treated as a bitstream. Two bits are read sequentially and converted into a raw DNA sequence, RawSeq, according to the mapping rules exactly the same as in step 103 (00→A, 01→C, 10→G, 11→T). The length of RawSeq is also 3072 bases.
[0053] Step S5: Obtain the coding DNA sequence
[0054] For each image patch, in the Galois domain GF(4), the raw DNA sequence RawSeq obtained in step S4 and the pseudo-random DNA mask sequence Mask obtained in step S3 are XORed bit by bit to obtain the final encoded DNA sequence EncSeq. The XOR operation is defined as addition in the GF(4) domain, and its correspondence rule is: the bases A, C, G, and T are mapped to the elements 0, 1, 2, and 3 in the finite domain, respectively. The above correspondence rule is an example, and the actual correspondence is not limited to the above correspondence rule.
[0055] As an example, first construct a mapping relationship from bases to elements in the GF(4) field: A corresponds to 0, C corresponds to 1, G corresponds to 2, and T corresponds to 3. Subsequently, perform a bitwise exclusive OR operation on RawSeq and Mask. For example, for the i-th bit of the original DNA sequence RawSeq and the j-th bit of the pseudo-random DNA mask sequence Mask, let the values corresponding to their bases be a and m respectively. Then, the encoded base value e is calculated according to the formula e = (a + m) mod 4. Finally, convert e back to a base according to the inverse mapping (0 corresponds to A, 1 corresponds to C, 2 corresponds to G, 3 corresponds to T), thereby obtaining the final encoded DNA sequence EncSeq.
[0056] The complete operation rules on the GF(4) field are shown in Table 1.
[0057]
[0058] To further improve the robustness of encoding for large flat areas (such as solid-color backgrounds), step S106: texture adaptive enhancement processing can be selectively added before step S5.
[0059] Specifically, step S106a: texture analysis. Calculate the variance σ² of pixel values within each image block as the texture complexity, and set a threshold T.
[0060] Step S106b: flat block processing. If σ² < T, then determine that the image block is a flat block. Before performing the GF(4) exclusive OR, perform an additional scrambling operation on the original DNA sequence RawSeq, such as circular left shift by k bits, or exclusive OR with a fixed global mask. This operation aims to further destroy the extremely weak patterns that may remain before mask encoding, and the inverse operation of this operation needs to be synchronized at the decoding end.
[0061] Step S6. Obtain the DNA sequence
[0062] Add short index headers and index tails to the encoded DNA sequences EncSeq corresponding to each image block. The index header at least covers the coordinate summary information for preliminary positioning. The length of the index header is less than the length required to directly encode the position coordinates as bases. Subsequently, the universal primer sequences required for PCR amplification can be selectively added to the head and tail of the entire sequence, thereby forming the final single-stranded DNA to be synthesized.
[0063] As an example, add an 8-base pair (bp) short index header to the encoded sequence EncSeq of each image block. This index header consists of a flag bit and a coordinate hash summary.
[0064] The flag bit is used to indicate whether the block is a flat block. The flag bit size is 1 bp. For example, A represents a texture block and T represents a flat block. This flag bit corresponds to step S106.
[0065] The coordinate hash digest is used for fast filtering during decoding. The coordinate hash digest is 7bp in size. Perform a simple hash operation, such as The calculation result is mapped to 7 bases (because...) ).
[0066] Finally, universal forward and reverse primer sequences are added to the very beginning and end of the sequence, respectively, to form a complete sequence that can be used for DNA synthesis: 5'-[forward primer]-[8bp index header]-[3072bp EncSeq]-[reverse primer]-3'. Each of the forward and reverse primer sequences is 20bp in size.
[0067] The structural advantages of implicit indexes include: Figure 3 As shown. For DNA single-strand lengths of limited length, traditional schemes use explicit indexes, directly reading and locating data by carrying the complete address sequence, resulting in low complexity. The scheme of this invention uses an implicit index, achieving location through a computational path of "short digest → candidate coordinate selection → mask generation → CRC self-verification," increasing computational complexity. However, compared to the 20-30bp space occupied by the complete address sequence in traditional schemes, the scheme of this invention contains only a 1bp flag bit and a 7bp hash digest, making the encoded sequence (EncSeq) of this invention have more space in its data payload than traditional schemes. This scheme achieves higher data storage density by sacrificing computational complexity.
[0068] Step S7: Send the DNA sequence obtained in step S6 for commercial synthesis.
[0069] The above implementation methods involve key steps such as image segmentation, seed generation, mask construction, sequence conversion, encoding operations, and encapsulation output. In step S1, the original image is divided into image blocks of a preset size and without overlap. Each image block is assigned a unique spatial coordinate (x, y), where x is the row index and y is the column index, which serves as the spatial identifier for subsequent processing. In step S2, the image block coordinates (x, y) are mapped to a unique index seed value S that is sensitive to small changes in coordinates through a preset nonlinear hash function, ensuring the randomness and uniqueness of the seed. In step S3, the pseudo-random number generator is driven with the seed S as the initial value to generate a pseudo-random number sequence that matches the length of the binary data of the image block. Then, it is converted into a pseudo-random DNA mask sequence Mask through a preset mapping rule. In step S4, the binary data of the image block (original pixels or preprocessed data) is grouped into groups of 2 bits and converted into the original DNA sequence RawSeq using the same mapping rule as in step S3. In step S5, the original DNA sequence RawSeq and the mask sequence Mask are XORed bit by bit in the Galois domain GF(4) to obtain the final encoded DNA sequence EncSeq. Step S6 adds an index header and index tail containing coordinate summary information to the EncSeq, and optionally adds universal PCR primer sequences to form the DNA single strand to be synthesized; finally, step S7 performs DNA synthesis.
[0070] The core of the above-described encoding implementation lies in utilizing the spatial location information of the image data itself to generate a deterministic pseudo-random mask through nonlinear mapping, and combining this with the XOR operation of the Galois field (GF(4)) to achieve data "whitening" and decoupling. This allows for high-density storage while improving parallel processing capabilities and ensuring biochemical stability. The above-described encoding implementation can reduce errors in DNA synthesis, storage, and sequencing processes, such as base substitution, insertion, and loss, thus ensuring correct decoding.
[0071] In one embodiment, a decoding method corresponding to the above-described encoding method is provided, see [link to documentation]. Figure 2 This includes the following steps.
[0072] Step D1: Obtain the payload sequence
[0073] High-throughput sequencing was performed on a DNA pool containing image data to obtain multiple sequencing reads. Based on the known primer sequences, the payload sequence, i.e., the encoding DNA sequence EncSeq and its index header, was identified and extracted from each sequencing read. Multiple sequencing reads may include one, two, or more than two segments.
[0074] As an example, high-throughput sequencing was performed on the synthesized DNA pool to obtain millions of sequencing reads. Sequence alignment was used to identify the forward and reverse primer sequences at both ends of each read. The primer sequences were removed, and the middle sequence portion, containing an 8 bp index header and a 3072 bp coding sequence (EncSeq), was extracted.
[0075] Step D2: Filter candidate coordinates
[0076] The coordinate summary information in the index header of each sequencing read is parsed, and one or more candidate coordinates (x', y') are selected from the set of all possible image patch coordinates.
[0077] As an example, a flag is read to determine if the block is flat. The coordinate hash digest H is read. Based on H, candidate coordinates are selected from all possible coordinate sets. Specifically, the hash value of all (x, y) coordinates is calculated, and coordinates with a hash value equal to H are listed as candidate coordinates. Due to the possibility of hash collisions, multiple candidate coordinates may be obtained, thus forming a candidate coordinate list.
[0078] Step D3: Parallel acquisition of candidate pseudo-random DNA masks
[0079] For each candidate coordinate (x', y') obtained from the screening, the same steps S2 and S3 as those during encoding are executed in parallel, that is, using the same non-linear hash function and pseudo-random number generator (PRNG) to generate the corresponding candidate pseudo-random DNA mask Mask'.
[0080] As an example, for each candidate coordinate (x', y') in the candidate coordinate list, a separate computation thread is started. Within each thread, the operations are performed exactly the same as those on the encoding side.
[0081] First, apply the formula S' = (x') 1664525 + y' 1013904223) mod Calculate the candidate seed S'.
[0082] The same linear congruential generator (LCG) is initialized with S' and iteratively generated to produce 3072 bases, thus obtaining the candidate mask Mask'. Given that the candidate coordinates are independent of each other, this step can be highly parallelized on a multi-core central processing unit (CPU) or graphics processing unit (GPU).
[0083] Step D4, XOR decoding and verification on the GF(4) field
[0084] On the Galois domain GF(4), a bitwise XOR inverse operation is performed on EncSeq and each candidate pseudo-random DNA mask Mask' to obtain the candidate raw DNA sequence RawSeq'. Then, RawSeq' is inversely mapped to binary data, and integrity verification is performed using check information embedded in the data. This check information includes, for example, FEC + CRC checksums.
[0085] As an example, within each thread, a bitwise XOR operation is performed on EncSeq and Mask' over the GF(4) field (this operation is consistent with the encoding end, since the XOR operation is its own inverse operation), thereby obtaining the candidate original sequence RawSeq'. Subsequently, based on the flag bits parsed in step D2, RawSeq' is subjected to reverse scrambling (if this processing method was used in the encoding process).
[0086] Next, the RawSeq' is converted into binary data according to the base-to-bit mapping rules—A maps to 00, C to 01, G to 10, and T to 11. The embedded CRC32 checksum is then extracted from this binary data and verified.
[0087] Step D5: Coordinate Confirmation and Image Reconstruction
[0088] The candidate coordinates (x', y') that pass the integrity check are determined as the true coordinates of the read segment. The decoded binary data is then filled into the corresponding positions (x', y') in the image. This process is repeated for all successfully decoded read segments to ultimately reconstruct the original image.
[0089] As an example, only when a thread's CRC32 checksum passes will its corresponding candidate coordinates (x', y') be recognized as the true coordinates of that read segment. The checked binary data (excluding the checksum portion) is written to the corresponding (x', y') position in the image memory. Steps D2-D5 can be performed in parallel for all sequencing reads. Once all blocks have been decoded, the complete original image can be obtained. For the very few blocks that failed to be decoded for specific reasons, interpolation algorithms can be used to repair them using pixel information from surrounding successfully decoded blocks.
[0090] The above decoding implementation method describes five key steps for reconstructing the original image based on DNA sequencing data, covering the process from obtaining sequencing reads to final image reconstruction, so as to accurately reconstruct the original image.
[0091] To verify the technical effectiveness of the encoding method of this invention, extreme cases were selected for testing. A pure black image block with a size of 16×16 pixels and all pixel values of 0 was selected as the test sample.
[0092] Raw binary data: all zeros, totaling 768 bytes.
[0093] Traditional direct mapping maps every two bits of "00" to "A", resulting in a DNA sequence "AAA..." consisting of 3072 "A"s. This sequence has a 0% GC content and contains extremely long homopolymers, making it unsuitable for practical DNA synthesis and sequencing.
[0094] Method of the present invention:
[0095] Assume the coordinates of the image patch are (10, 20). The seed S generated from the coordinates is a large number (e.g., calculated as S = 2365189326).
[0096] The linear congruential generator (LCG) generates a pseudo-random mask based on this seed, such as "CTGACTGA...".
[0097] The original sequence RawSeq is all “AAA…” (all 0s).
[0098] Performing an XOR operation on the Galois field GF(4), the result EncSeq is equal to Mask itself, i.e., "CTGACTGA...".
[0099] Results analysis: The encoded sequence “CTGACTGA…” does not contain long homopolymer fragments, and the GC content is approximately 50%, which fully meets the biochemical requirements for DNA synthesis and sequencing.
[0100] This pure black image encoding example fully demonstrates that the present invention, by means of a "position coordinate-driven mask XOR" mechanism, fundamentally solves the biochemical instability problem caused by image data redundancy.
[0101] In one embodiment, an image encoding system for DNA storage is provided, comprising the following modules.
[0102] The segmentation module is configured to segment the input image into multiple image blocks and assign coordinates to each image block.
[0103] The seed generation module is configured to generate an index seed based on coordinates using a non-linear hash function.
[0104] Mask generation module: It is configured to generate pseudo-random DNA mask sequences based on an index seed using a pseudo-random number generator (PRNG).
[0105] The encoding module is configured to convert image patch data into raw DNA sequences and perform an XOR operation on the raw DNA sequence and the mask sequence in the Galois domain GF(4) to obtain the encoded DNA sequence.
[0106] The encapsulation module is configured to add an index header and primer sequences to the coding DNA sequence, thereby outputting the final single-stranded DNA sequence to be synthesized.
[0107] In one embodiment, an image decoding system for DNA storage is provided for decoding DNA sequences obtained by the above-described encoding method or encoding system, comprising the following modules.
[0108] The extraction module is configured to acquire sequencing reads and extract the coding DNA sequence and its index header from those reads.
[0109] The filtering module is configured to parse the index header and filter out one or more candidate location coordinates based on the coordinate summary information therein.
[0110] The parallel mask generation module is configured to perform the same index seed generation and pseudo-random DNA mask generation operations as the encoding end for each candidate position coordinate to obtain the corresponding candidate mask sequence.
[0111] The decoding module is configured to perform a bitwise XOR inverse operation on the galois domain GF(4) to obtain the candidate original DNA sequence and then inversely map it into binary data.
[0112] The verification and reconstruction module is configured to perform integrity verification on the binary data using the verification information in the data, confirm the candidate position coordinates that pass the verification as the true coordinates, and fill the corresponding positions in the image with the decoded binary data according to the true coordinates to realize the reconstruction of the original image.
[0113] This invention can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of the invention.
[0114] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example, but not limited to, electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0115] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0116] The computer program instructions used to perform the operations of this invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, Python, etc., and conventional procedural programming languages such as "C" or similar languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing state information from the computer-readable program instructions. This electronic circuitry can execute the computer-readable program instructions to implement various aspects of the invention.
[0117] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein. The scope of the invention is defined by the appended claims.
Claims
1. A DNA image storage and encoding method based on location indexing, characterized in that, Includes the following steps: The image to be stored is divided into multiple image blocks, and each image block is assigned a unique location coordinate. For each image block, an index seed is first generated using a preset non-linear hash function based on its position coordinates. Then, the generated index seed is used to drive a deterministic pseudo-random number generator to generate a pseudo-random DNA mask sequence that matches the data length of the image block. For each image block, the corresponding error-corrected binary data is converted into the original DNA sequence according to the preset base mapping rules; For each image block, the original DNA sequence and the pseudo-random DNA mask sequence are XORed bitwise in the Galois field GF(4) to obtain the encoded DNA sequence. An index header is added to the encoded DNA sequence of each image patch and then encapsulated to form the final DNA sequence to be synthesized.
2. The method according to claim 1, characterized in that, The preset nonlinear hash function is specifically a linear congruent hash function, and its expression is: Where x and y are the row and column indices of an image patch location coordinate, P1 and P2 are two distinct prime numbers, and M is a preset large modulus. This indicates a modulo operation.
3. The method according to claim 1, characterized in that, The bitwise XOR operation on the Galois domain GF(4) is to map the bases A, C, G, and T to the elements 0, 1, 2, and 3 in the finite domain, respectively. The result of the operation is defined as the addition of the two elements modulo 4 and then the inverse mapping back to the bases.
4. The method according to claim 1, characterized in that, The length of the index header is less than the length required to directly encode the position coordinates into bases, and it contains at least hash digest information generated from the position coordinates for fast filtering during decoding.
5. The method according to claim 1, characterized in that, Before performing an XOR operation between the original DNA sequence and the pseudo-random DNA mask sequence, the method further includes: Calculate the texture complexity index of the corresponding image patches; If the texture complexity index is lower than a preset threshold, it is determined to be a flat block. The original DNA sequence of the block is then scrambled and then XORed.
6. A location-index-based DNA image storage decoding method for decoding DNA sequences obtained by the method according to any one of claims 1-5, characterized in that, Includes the following steps: Multiple sequencing reads are acquired, and the coding DNA sequence and its index header are extracted from each sequencing read. The index header is parsed, and one or more candidate position coordinates are selected based on the coordinate summary information therein. The steps for generating a pseudo-random DNA mask sequence based on candidate location coordinates include: generating an index seed using a preset nonlinear hash function based on a candidate location coordinate; using the obtained index seed to drive a deterministic pseudo-random number generator to generate a pseudo-random DNA mask sequence that matches the data length of the image patch; when there are multiple candidate location coordinates, the steps for generating a pseudo-random DNA mask sequence based on candidate location coordinates are performed in parallel. On the Galois domain GF(4), the encoded DNA sequence is XORed with each of the pseudo-random DNA mask sequences bitwise to obtain the candidate original DNA sequence. The candidate original DNA sequence is reverse mapped to binary data and its integrity is verified. The candidate position coordinates that pass the integrity check are confirmed as the true coordinates, and the decoded binary data is filled into the corresponding positions in the image according to the true coordinates to reconstruct the original image.
7. A DNA image storage and encoding system based on location indexing, characterized in that, include: The segmentation module is configured to divide the image to be stored into multiple image blocks and assign unique location coordinates to each image block; The seed generation module is configured to generate a corresponding index seed based on the position coordinates of each image block using a preset non-linear hash function. The mask generation module is configured to take the index seed of each image patch as input and drive a deterministic pseudo-random number generator to generate a pseudo-random DNA mask sequence corresponding to the data length of that image patch. The conversion module is configured to convert the error-corrected binary data corresponding to each image block into the original DNA sequence according to a preset base mapping rule; The encoding module is configured to perform a bitwise XOR operation on the original DNA sequence of each image block and the pseudo-random DNA mask sequence in the Galois domain GF(4) to obtain the encoded DNA sequence of each image block. The encapsulation module is used to add an index header to the encoded DNA sequence of each image patch and encapsulate it to form the final DNA single-stranded sequence to be synthesized.
8. The system according to claim 7, characterized in that, Before the XOR operation, the encoding module is also configured to calculate the texture complexity of an image block; if the texture complexity is lower than a preset threshold, it is determined to be a flat block, and the original DNA sequence of the image block is scrambled.
9. A location-indexed DNA image storage and decoding system for decoding DNA sequences encoded by the method according to any one of claims 1-5, characterized in that, include: The extraction module is configured to acquire sequencing reads and extract the coding DNA sequence and its index header from the sequencing reads; The filtering module is configured to parse the coordinate summary information in the index header and filter out one or more candidate location coordinates from the set of all possible image block coordinates; The mask generation module is configured to generate an index seed based on a candidate position coordinate using a preset nonlinear hash function, and use the obtained index seed to drive a deterministic pseudo-random number generator to generate a pseudo-random DNA mask sequence that matches the length of the image patch data. The decoding module is configured to perform a bitwise XOR inverse operation on the Galois domain GF(4) to obtain the candidate original DNA sequence and inversely map it into binary data. The verification and reconstruction module is configured to perform integrity verification on the binary data, confirm the candidate position coordinates that pass the verification as the real coordinates, and fill the corresponding positions in the image with the decoded binary data according to the real coordinates to reconstruct the original image. The number of mask generation modules is the same as the number of candidate position coordinates. When the number is greater than 1, they are executed in parallel.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 5.