Data storage methods, decoding methods, devices and storage media

By identifying and replacing taboo strings in DNA storage, generating target strings, and recording the replacement process, the data preservation problem caused by taboo sequences in DNA storage is solved, ensuring data integrity and recoverability.

CN115374937BActive Publication Date: 2026-11-17SHENZHEN INST OF ADVANCED TECH CHINESE ACAD OF SCI +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210903661.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-28
Publication Date
2026-11-17
Estimated Expiration
2042-07-28

AI Technical Summary

Technical Problem

Existing DNA storage methods generate prohibited DNA sequences, leading to data ineffective preservation.

Method used

By DNA encoding the raw data, taboo strings are identified and replaced, target strings that do not contain taboo information are generated, and the replacement process is recorded to generate string replacement records, ensuring data integrity.

Benefits of technology

It enables effective recovery of original data even in the event of loss of information in external storage, avoiding data saving failures caused by prohibited information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115374937B_ABST
    Figure CN115374937B_ABST
Patent Text Reader

Abstract

This invention discloses a data storage method, a decoding method, a device, and a storage medium. The data storage method includes: DNA encoding of raw data, and concatenating the encoding result with the DNA encoding of a preset decoding program to obtain a first DNA base sequence; identifying taboo strings containing taboo information in the first DNA base sequence; generating target strings that do not contain taboo information based on a first preset rule and the first DNA base sequence, with each taboo string corresponding to a target string; replacing the taboo strings in the first DNA base sequence with the target strings to obtain a second DNA base sequence for storage, and generating a string replacement record. This application realizes the detection and replacement of taboo strings in DNA base sequences, thereby making the generated DNA base sequences effective and more secure and reliable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data storage technology, and in particular to a data storage method, decoding method, device and storage medium. Background Technology

[0002] With the rapid development of computer and network technologies, the growth rate of data will soon exceed the capacity of existing traditional storage media such as hard drives. Deoxyribonucleic acid (DNA) molecules, as a novel storage medium, have received widespread attention in recent years due to their advantages such as high storage density, long storage time, and low maintenance costs. DNA storage technology, with its stable and durable storage characteristics, has become one of the emerging storage technologies. It stores data by encoding it with the four bases A, T, G, and C, efficiently compressing and storing the data within DNA molecules. Currently, to ensure the long-term recoverability of information stored in DNA molecules—even if the decoding program is lost—the information stored in the DNA molecule can still be recovered. This is achieved by storing the DNA decoding program as part of the data itself. Therefore, even if the DNA decoding program stored on other external storage media is lost, the built-in DNA decoding program can still decode and recover the data stored in the DNA molecule.

[0003] However, this DNA storage method encounters the problem of forbidden strings in synthetic biology. In synthetic biology, certain DNA sequences are forbidden from appearing in DNA molecules, otherwise it will lead to serious biological reactions, such as difficulties in DNA synthesis and increased instability, making it difficult to preserve the generated DNA base sequences for long periods of time. Summary of the Invention

[0004] This application provides a data storage method, decoding method, device, and storage medium to solve the problem that existing DNA storage methods generate forbidden DNA sequences, resulting in data that cannot be effectively preserved.

[0005] To address the aforementioned technical problems, this application provides a data storage method comprising: DNA encoding of raw data, and concatenating the encoding result with the DNA encoding of a preset decoding program to obtain a first DNA base sequence; identifying taboo strings containing taboo information in the first DNA base sequence; generating target strings that do not contain taboo information based on a first preset rule and the first DNA base sequence, wherein each taboo string corresponds to a target string; replacing the taboo strings in the first DNA base sequence with the target strings to obtain a second DNA base sequence for storage, and generating a string replacement record.

[0006] As a further improvement of this application, the step of generating a target string that does not include taboo information based on the first preset rule and the first DNA base sequence includes: constructing a suffix automaton based on the first DNA base sequence, and constructing an AC automaton based on all the taboo strings; traversing from the initial node of the suffix automaton based on a breadth-first search algorithm to filter substrings that have not appeared in the first DNA base sequence; matching the AC automaton with each substring to confirm whether the substring includes the taboo information; if it includes the taboo information, deleting the substring; if it does not include the taboo information, retaining the substring as the target string.

[0007] As a further improvement of this application, the step of replacing the taboo string in the first DNA base sequence with the target string to obtain the second DNA base sequence includes: confirming the position of the taboo string in the first DNA base sequence; replacing the taboo string with the target string and obtaining a concatenated string obtained by concatenating the target string with a substring of a preset length before or after the position; using the AC automaton to confirm whether the taboo information exists in the concatenated string, and when the taboo information exists, sequentially inserting the base codes corresponding to four bases between the target string and the substring and confirming the taboo information again, until the taboo information does not exist in the concatenated string.

[0008] As a further improvement of this application, after generating the string replacement record, the method further includes: encoding the string replacement record based on a third preset rule to obtain a third DNA base sequence that does not include taboo information; splicing the second DNA base sequence and the third DNA base sequence to obtain the final DNA base sequence and saving it.

[0009] As a further improvement to this application, the string replacement record includes a starting position, a replacement length, a string to be replaced, and a string after replacement.

[0010] As a further improvement of this application, the step of encoding the string replacement record based on a third preset rule to obtain a third DNA base sequence excluding taboo information includes: encoding the starting position and the replacement length based on preset specific characters to generate position characters and length characters excluding taboo information; inserting preset delimiters excluding taboo information into both ends of each character in the position characters and the length characters to obtain position sequences and length sequences; inserting the delimiters into both ends of each character in the replaced string and the replaced string to obtain a replaced string sequence and a replaced string sequence; and concatenating the position sequences, length sequences, replaced string sequences, and replaced string sequences sequentially after inserting the delimiters into both ends to obtain the third DNA base sequence.

[0011] To address the aforementioned technical problems, another technical solution adopted in this application is: providing a data decoding method, comprising: acquiring a string replacement record corresponding to a DNA base sequence to be decoded; recovering the DNA base sequence to be decoded based on the string replacement record to obtain an initial DNA base sequence before the string replacement operation; decomposing the initial DNA base sequence to obtain a decoding program and a target DNA base sequence corresponding to the original data; and calling the decoding program to decode the target DNA base sequence to obtain the original data.

[0012] As a further improvement of this application, the step of obtaining the string replacement record corresponding to the DNA base sequence to be decoded includes: decomposing a pre-stored DNA base sequence to obtain the DNA base sequence to be decoded and the replacement record DNA base sequence; and parsing the replacement record DNA base sequence to obtain the string replacement record.

[0013] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide a computer device, the computer device including a processor and a memory coupled to the processor, the memory storing program instructions, and when the program instructions are executed by the processor, causing the processor to perform the steps of the data storage method or data decoding method as described above.

[0014] To solve the above-mentioned technical problems, another technical solution adopted in this application is to provide a storage medium storing program instructions capable of implementing any of the above-mentioned data storage methods or data decoding methods.

[0015] The beneficial effects of this application are as follows: The data storage method of this application involves DNA encoding of the original data and then splicing it with a decoding program to obtain a first DNA base sequence, thereby obtaining a taboo string in the first DNA base sequence. Then, based on a first preset rule, a target string that has not appeared in the first DNA base sequence and does not carry taboo information is generated. This target string is used to replace the taboo string in the first DNA base sequence, thereby obtaining a second DNA base sequence that does not carry taboo information. At the same time, in order to ensure that the original data can be recovered from the second DNA base sequence later, the string replacement process is recorded to obtain a string replacement record. The first DNA base sequence before the string replacement can be obtained by reverse deduction using the string replacement record. This ensures the integrity of the stored data and avoids the data not being effectively preserved due to the obtained DNA base sequence carrying taboo information. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating a data storage method according to an embodiment of the present invention;

[0017] Figure 2 yes Figure 1 A detailed flowchart of step S103 is shown below;

[0018] Figure 3 yes Figure 1 A detailed flowchart of step S104 is shown below;

[0019] Figure 4 This is another schematic flowchart of the data storage method according to an embodiment of the present invention;

[0020] Figure 5 yes Figure 4 A detailed flowchart of step S105 is shown below;

[0021] Figure 6 This is a flowchart illustrating a data decoding method according to an embodiment of the present invention;

[0022] Figure 7 This is a functional module diagram of the data storage device according to an embodiment of the present invention;

[0023] Figure 8 This is a functional module diagram of the data decoding device according to an embodiment of the present invention;

[0024] Figure 9 This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention;

[0025] Figure 10 This is a schematic diagram of the structure of the storage medium according to an embodiment of the present invention. Detailed Implementation

[0026] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0027] The terms "first," "second," and "third" in this application are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified. All directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of this application are only used to explain the relative positional relationships and movements between components in a specific orientation (as shown in the figures). If the specific orientation changes, the directional indications also change accordingly. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.

[0028] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0029] Figure 1 This is a flowchart illustrating the data storage method according to an embodiment of the present invention. It should be noted that if substantially the same result is achieved, the method of the present invention is not necessarily identical. Figure 1 The illustrated process sequence is limited. For example... Figure 1 As shown, the method includes the following steps:

[0030] Step S101: Encode the raw data with DNA and splice the encoding result with the DNA encoding of the preset decoding program to obtain the first DNA base sequence.

[0031] It should be noted that the general process of DNA storage involves encoding digital data into a DNA base sequence, synthesizing DNA fragments based on the encoded base sequence, and storing them in storage media both inside and outside the body. Specifically, DNA fragments can be synthesized by writing the nucleotide base sequence using a synthesizer, and then stored in a pooled liquid medium. Data retrieval involves reading and sequencing using a sequencer, and subsequent decoding processing to recover the data.

[0032] Specifically, the raw data is the data that needs to be stored. After obtaining the raw data, the raw data is encoded with DNA using the four bases A, T, C, and G to obtain the encoding result. At the same time, the decoding program is represented by DNA encoding and spliced ​​after the encoding result to obtain the first DNA base sequence.

[0033] Furthermore, in the process of DNA-based data storage, the raw data needs to be preprocessed before it is stored, such as by compression, redundancy removal, encryption, and encoding.

[0034] Step S102: Identify the taboo string containing taboo information in the first DNA base sequence.

[0035] Specifically, based on bioinformatics, the first DNA base sequence is detected and identified to determine whether a taboo string containing prohibitive information exists within the first DNA base sequence. This taboo string is a substring of the first DNA base sequence. This prohibitive information is summarized based on bioinformatics.

[0036] Step S103: Generate a target string that does not include taboo information based on the first preset rule and the first DNA base sequence, with each taboo string corresponding to a target string.

[0037] Specifically, after obtaining the first DNA base sequence and the taboo string therein, a target string that has not appeared in the first DNA base sequence and does not contain taboo information is generated based on a pre-set first preset rule.

[0038] Furthermore, in some embodiments, please refer to Figure 2 Step S103 specifically includes:

[0039] Step S201: Construct a suffix automaton based on the first DNA base sequence, and construct an AC automaton based on all the forbidden strings.

[0040] Specifically, after obtaining the first DNA base sequence, a suffix automaton (SAM) is constructed based on the first DNA base sequence. The construction of the suffix automaton depends on two concepts: endpos and suffix linkage. The end position refers to any non-empty substring t in the first DNA base sequence, and endpos(t) is denoted as all the end positions of t in the first DNA base sequence (assuming that the character numbering in the string starts from zero). The endpos sets of two substrings t1 and t2 may be equal: endpos(t1) = endpos(t2). Thus, non-empty substrings of the first DNA base sequence can be divided into several equivalence classes according to their endpos sets. Each state in the SAM corresponds to one or more substrings with the same endpos. The number of states in the SAM is equal to the number of equivalence classes of all substrings plus the initial state. That is, the number of states in the SAM is equivalent to the number of sets of one or more substrings with the same endpos plus 1. For suffix links, consider a state v in SAM that is not t0. This state v corresponds to an equivalence class with the same endpos. If w is defined as the longest of all substrings, then all other substrings are suffixes of w. The first few suffixes of string w in descending order of length are all contained in this equivalence class, and all other suffixes (at least one empty suffix) are in other equivalence classes. Let t be the longest suffix. Then, link the suffixes of w to t. That is, a suffix link (v) is connected to the state of the equivalence class corresponding to the longest suffix of w at another endpos. It must satisfy three conditions: 1. longest, 2. last, 3. another state. For each state, if one or more substrings match it, let longest(v) be the longest substring, len(v) be its length, and shortest(v) be the shortest substring with length minlen(v). Then, all strings corresponding to this state are distinct suffixes of the string longest(v), and the lengths of all strings exactly cover every integer in the interval [minlen(v), len(v)]. Understanding the concepts of ending position and suffix concatenation, we can create a suffix automaton:

[0041] The initial SAM contains only one state t0, numbered 0 (other states are numbered 1, 2, ...). For convenience, state t0 is assigned len = 0 and link = -1 (-1 represents a virtual state). Let last be the state corresponding to the entire string before adding character c (initially set last = 0, updated in the last step of the algorithm). Create a new state cur and assign len(cur) the value of len(last) + 1. At this point, the value of link(cur) is still unknown. Starting from state last, if there is no transition to character C, add a transition to state cur. Traverse the suffix links. If a transition to character C already exists at some point, stop and mark this state as p. If no state p is found, i.e., the virtual state -1 is reached, link(cur) is assigned 0 and the algorithm exits. Suppose a state p is found that can transition to character C, then mark the transition state as q. At this point, two states need to be discussed: one is len(p) + 1 = len(q), and the other is len(p) + 1 ≠ len(q). If len(p) + 1 = len(q), then simply assign link(cur) to q and exit. Otherwise, state q needs to be copied: create a new state clone, copy all information of q except for the value of len (suffix links and transitions), and assign len(clone) to len(p) + 1. After copying, point the suffix links from cur to clone, and also from q to clone. Finally, use the suffix links to traverse back from state p, and redirect the transition to state clone whenever there is a transition from p to state q. In all three cases, after completing this process, update the value of last to state cur. All termination states can be found after constructing a complete SAM for the first DNA base sequence. To do this, start from the state corresponding to the entire string (stored in the variable last), traverse its suffix links until the initial state is reached, and mark all traversed nodes as termination nodes. Then all suffixes of the first DNA base sequence can be marked, and these states are all termination states.

[0042] Next, an AC automaton needs to be created using all the taboo strings. The AC automaton is based on the Trie structure and incorporates the ideas of the KMP algorithm. Simply put, building an AC automaton involves two steps: first, a basic Trie structure is needed, with all taboo strings forming a Trie; then, using the KMP algorithm, mismatch pointers are constructed for all nodes in the Trie tree. Specifically, the basic algorithm for constructing the Trie tree is as follows:

[0043] Insert each letter of each tabu string into the Trie one by one. Before insertion, check if the prefix exists. If it exists, share the existing prefix; otherwise, create the corresponding node and edge. Then, borrowing the mismatch pointer from the KMP algorithm, use a fail pointer to assist in multi-string matching. The fail pointer of state u points to another state v, where v is another state in the Aho-Corasick automaton, and v is the longest suffix of u, i.e., the longest one among several suffix states is taken as the fail pointer. Then comes the process of constructing the fail pointer. Consider the current node u in the trie, u's parent node is p, and p points to u through the edge of character C, i.e., Trie[p,C] = u. Assume that the fail pointers of all nodes with depth less than u have been obtained. If Trie[fail[p],C] exists, then let u's fail pointer point to Trie[fail[p],C]. This is equivalent to adding the character C after p and fail[p], corresponding to u and fail[u] respectively. If Trie[fail[p],C] does not exist, continue searching for Trie[fail[fail[p]],C]. Repeat the above judgment process until the fail pointer jumps to the root node. This completes the construction of fail[u].

[0044] Step S202: Based on the breadth-first search algorithm, traverse from the initial node of the suffix automaton to filter substrings that have not appeared in the first DNA base sequence.

[0045] Specifically, we can start from the initial node of the established suffix automaton. Any string formed by taking any path from the initial node will be a substring of the first DNA base sequence. If there are all possible substrings of length 1, then the initial node is connected to all characters in the character set, that is, there are 4 edges. Using the breadth-first search algorithm (BFS) starting from the initial node, when it is found that the number of outgoing edges of a node is less than the size of the character set, it means that the gap length has been reached, that is, when the number of edges is less than the number of characters contained in the character set, the missing edge is the shortest substring of the character set that has not appeared in the first DNA base sequence.

[0046] Step S203: Match the AC automaton with each substring to determine whether the substring includes the taboo information. If it does, proceed to step S204; otherwise, proceed to step S205.

[0047] Specifically, after obtaining the AC automaton and the substrings, the AC automaton is used to match each substring separately to determine whether there is taboo information in the substring. If there is, step S204 is executed; if not, step S205 is executed.

[0048] Step S204: Delete the substring.

[0049] Step S205: Use the substring as the target string and retain it.

[0050] Specifically, if a substring does not contain any taboo information, then the substring can be used to replace the taboo string in the first DNA base sequence, and therefore the substring is retained as the target string.

[0051] It should be noted that, considering the actual need for taboo information in biological DNA, it is highly unlikely that all substrings will contain taboo information. Therefore, the above method is used to find a corresponding target string for each taboo string.

[0052] Step S104: Replace the forbidden string in the first DNA base sequence with the target string to obtain the second DNA base sequence, save it, and generate a string replacement record.

[0053] Specifically, after obtaining the target string corresponding to each taboo string, the target string is used to replace the corresponding taboo string, thereby replacing the taboo string carrying taboo information in the first DNA base sequence, so that the obtained second DNA base sequence does not contain taboo information. At the same time, string replacement records are generated during the taboo string replacement process.

[0054] Furthermore, in some embodiments, please refer to Figure 3 Step S104 specifically includes:

[0055] Step S301: Confirm the position of the forbidden string in the first DNA base sequence.

[0056] Step S302: Replace the forbidden string with the target string, and obtain the concatenated string obtained by concatenating the target string with a substring of a preset length before or after the position.

[0057] Step S303: Use the AC automaton to confirm whether the taboo information exists in the concatenated string. If the taboo information exists, insert the codes corresponding to four bases between the target string and the substring in sequence and confirm the taboo information again until the taboo information does not exist in the concatenated string.

[0058] Specifically, after obtaining the position of the taboo string in the first DNA base sequence, the first substring (m-1 characters, where m is the length of the longest taboo string) preceding that position is obtained. The target string is concatenated after the first substring to obtain the first concatenated string. An Aucma automaton is then used to check if the taboo information exists in this first concatenated string. If it does, four base codes corresponding to the first base are inserted sequentially between the first string and the target string. The Aucma automaton is then used again to check if the first concatenated string containing these four base codes contains the taboo information. This process is repeated until the first concatenated string no longer contains the taboo information. At this point, the string replacing the taboo string is the string composed of the inserted base codes and the target string. Similarly, the second concatenated string (m-1 characters after the taboo string) is processed in conjunction with the target string to ultimately replace the taboo string. It is important to understand that when this embodiment replaces the taboo string with the target string, it is necessary not only to confirm whether there is taboo information in the target string, but also to confirm whether new taboo information will be formed after the target string is spliced ​​into the first DNA base sequence, so as to avoid taboo information appearing in the second DNA base sequence after the taboo string replacement.

[0059] Furthermore, in some embodiments, to further improve the interpretability of the DNA base sequence, enabling decoding of the DNA base sequence even if externally stored string substitution records are lost, please refer to [link to relevant documentation]. Figure 4 After step S104, the method further includes:

[0060] Step S105: Encode the string replacement record based on the third preset rule to obtain a third DNA base sequence that does not include taboo information.

[0061] Specifically, the third preset rule is pre-defined, and encoding based on this rule yields a DNA base sequence that does not include taboo information. It's important to understand that when the amount of data to be encoded is small, methods can be used to restrict the DNA encoding process so that the generated DNA base sequence does not include taboo information. However, for large amounts of data, the complexity of the encoding increases significantly, and the encoding efficiency decreases considerably. Therefore, this encoding method is not suitable for large amounts of data. When saving original data, the amount of data is unknown and is usually large, making this method unsuitable for encoding the original data. String replacement records, on the other hand, are usually short data segments, making this method suitable for generating DNA base sequences that do not include taboo information.

[0062] Further, the string replacement record includes a start position, a replacement length, a replaced string, and a post-replacement string.

[0063] For example, assuming that the first DNA base sequence is ATCCATC and the second DNA base sequence after replacement is ATAGGTC, the string replacement record needs to store the information shown in Table 1 below:

[0064] Table 1

[0065]

[0066] The string formed by the third to sixth positions of the first DNA base sequence ATCCATC is replaced, so the start position, replacement length, replaced string and post-replacement string therein are recorded.

[0067] Further, in some embodiments, please refer to Figure 5 , step S105 specifically comprises:

[0068] Step S401: encoding the start position and the replacement length based on a preset specific character, so as to generate a position character and a length character that do not include forbidden information.

[0069] Specifically, the preset specific character is preset, and the DNA base sequence generated based on the preset specific character does not carry forbidden information.

[0070] Step S402: inserting a preset separation character that does not include forbidden information at both ends of each character in the position character and the length character respectively to obtain a position sequence and a length sequence, and inserting the separation character at both ends of each character in the replaced string and the post-replacement string respectively to obtain a replaced string sequence and a post-replacement string sequence.

[0071] Step S403: inserting the separation character at both ends of each of the position sequence, the length sequence, the replaced string sequence and the post-replacement string sequence respectively, and then performing splicing in sequence to obtain the third DNA base sequence.

[0072] Specifically, continuing to use the above example for description, assuming that the separation character is represented by "separate", the third DNA base sequence obtained after encoding the above string replacement record is:

[0073] separate 3 points separate 3 points separate Points C points C points A points separate Points A, points G, points G separate

[0074] Wherein, the first " 3 points " is the position sequence, and the second " 3 points " is a sequence of length, Points C points C points A points " is the sequence of strings to be replaced, Points A, points G, points G " represents the sequence of strings after replacement.

[0075] It should be understood that the DNA encoding method for the string replacement record described in this embodiment needs to meet the following conditions:

[0076] 1. The delimiter is not a forbidden string itself, and does not contain any forbidden strings;

[0077] 2. A string consisting of two delimiters is not a forbidden string itself, and does not contain any forbidden strings;

[0078] 3. The character is not a forbidden string itself, and does not contain any forbidden strings;

[0079] 4. A string consisting of two delimiters is not a forbidden string itself, and does not contain any forbidden strings;

[0080] 5. A string consisting of a character and a separator is not a forbidden string itself, and does not contain any forbidden strings;

[0081] 6. A string consisting of two delimiters is not a forbidden string itself and does not contain any forbidden strings;

[0082] 7. The delimiter is a substring that is not any character;

[0083] 8. The separator character and the end of the DNA base sequence do not constitute a taboo string itself, nor do they contain any taboo strings.

[0084] After finding the DNA expression form that satisfies the above conditions for characters and delimiters, the algorithm can ensure that storing string replacement records will not create new taboo strings.

[0085] Step S106: Splice the second DNA base sequence and the third DNA base sequence to obtain the final DNA base sequence and save it.

[0086] Specifically, the second DNA base sequence is spliced ​​with the third DNA base sequence to obtain the final DNA base sequence. This final DNA base sequence includes the original data, the decoding program, and the string replacement record. Therefore, even if the externally stored decoding program and string replacement record are lost, the original data can still be decoded and extracted, and the integrity and accuracy of the data are guaranteed.

[0087] The data storage method of this invention involves DNA encoding of the original data and then splicing it with a decoding program to obtain a first DNA base sequence. A taboo string in the first DNA base sequence is then obtained. Based on a first preset rule, a target string that has not appeared in the first DNA base sequence and does not carry taboo information is generated. This target string is used to replace the taboo string in the first DNA base sequence, thereby obtaining a second DNA base sequence without taboo information. Simultaneously, to ensure that the original data can be recovered from the second DNA base sequence, the string replacement process is recorded, resulting in a string replacement record. This string replacement record allows for the reverse deduction of the first DNA base sequence before the string replacement. This ensures the integrity of the stored data and prevents the obtained DNA base sequence from carrying taboo information, thus avoiding the ineffective preservation of the data.

[0088] Figure 6 This is a flowchart illustrating the data decoding method according to an embodiment of the present invention. It should be noted that if substantially the same result is obtained, the method of the present invention is not necessarily identical. Figure 6 The illustrated process sequence is limited. For example... Figure 6 As shown, the method includes the following steps:

[0089] Step S501: Obtain the string replacement record corresponding to the DNA base sequence to be decoded.

[0090] Furthermore, as can be seen from the above embodiments, the string replacement record can be encoded using a specific encoding method and then concatenated into the DNA base sequence for storage, in order to avoid the loss of the string replacement record causing the DNA base sequence to be undecoded. Therefore, step S501 specifically includes:

[0091] 1. Decompose the pre-stored DNA base sequence to obtain the DNA base sequence to be decoded and the replacement record DNA base sequence.

[0092] 2. Parse the DNA base sequence of the replacement record to obtain the string replacement record.

[0093] Step S502: Recover the DNA base sequence to be decoded based on the string replacement record to obtain the initial DNA base sequence before the string replacement operation.

[0094] Step S503: Decompose the initial DNA base sequence to obtain the decoding program and the target DNA base sequence corresponding to the original data.

[0095] Step S504: Call the decoding program to decode the target DNA base sequence to obtain the raw data.

[0096] In this embodiment, the decoding process of the DNA base sequence to be decoded is the reverse process of the data storage method of the present invention. Based on the obtained string replacement record, the DNA base sequence to be decoded is restored to obtain the initial DNA base sequence before the string replacement. The initial DNA base sequence consists of the string obtained by encoding the original data and the decoding program. By decomposing the initial DNA base sequence, the target DNA base sequence and the decoding program corresponding to the original data can be obtained. Then, the original data can be obtained by decoding the target DNA base sequence using the decoding program.

[0097] Figure 7 This is a functional module diagram of a data storage device according to an embodiment of the present invention. Figure 7 As shown, the data storage device 70 includes a first encoding module 71, an identification module 72, a generation module 73, and a replacement module 74.

[0098] The first encoding module 71 is used to encode the original data into DNA and splice the encoding result with the DNA encoding of the preset decoding program to obtain the first DNA base sequence.

[0099] The identification module 72 is used to identify taboo strings containing taboo information in the first DNA base sequence;

[0100] The generation module 73 is used to generate a target string that does not include taboo information based on the first preset rule and the first DNA base sequence, wherein each taboo string corresponds to a target string;

[0101] The replacement module 74 is used to replace the forbidden string in the first DNA base sequence with the target string to obtain a second DNA base sequence for storage, and to generate a string replacement record.

[0102] Optionally, the generation module 73 performs the operation of generating a target string that does not include taboo information based on the first preset rule and the first DNA base sequence, specifically including: constructing a suffix automaton based on the first DNA base sequence, and constructing an AC automaton based on all the taboo strings; traversing from the initial node of the suffix automaton based on a breadth-first search algorithm, and filtering substrings that have not appeared in the first DNA base sequence; matching the AC automaton with each substring to confirm whether the substring includes the taboo information; if it includes the taboo information, deleting the substring; if it does not include the taboo information, keeping the substring as the target string.

[0103] Optionally, the replacement module 74 performs the operation of replacing the taboo string in the first DNA base sequence with the target string to obtain the second DNA base sequence, specifically including: confirming the position of the taboo string in the first DNA base sequence; replacing the taboo string with the target string and obtaining a concatenated string obtained by concatenating the target string with a substring of a preset length before or after the position; using the AC automaton to confirm whether the taboo information exists in the concatenated string, and when the taboo information exists, sequentially inserting the base codes corresponding to four bases between the target string and the substring and confirming the taboo information again, until the taboo information does not exist in the concatenated string.

[0104] Optionally, it further includes a second encoding module and a splicing module, wherein: the second encoding module is used to encode the string replacement record based on a third preset rule to obtain a third DNA base sequence that does not include taboo information; the splicing module is used to splice the second DNA base sequence and the third DNA base sequence to obtain a final DNA base sequence and save it.

[0105] Optionally, the string replacement record includes a starting position, a replacement length, the string to be replaced, and the string after replacement.

[0106] Optionally, the second encoding module performs an operation to encode the string replacement record based on a third preset rule to obtain a third DNA base sequence that does not include taboo information. Specifically, this includes: encoding the starting position and the replacement length based on preset specific characters to generate position characters and length characters that do not include taboo information; inserting preset delimiters that do not include taboo information at both ends of each character in the position characters and the length characters to obtain position sequences and length sequences; inserting the delimiters at both ends of each character in the replaced string and the replaced string to obtain replaced string sequences; and concatenating the inserted delimiters at both ends of the position sequences, the length sequences, the replaced string sequences, and the replaced string sequences to obtain the third DNA base sequence.

[0107] For further details regarding the implementation techniques of each module in the data storage device of the above embodiments, please refer to the description of the data storage method in the above embodiments, which will not be repeated here.

[0108] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For apparatus embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

[0109] Figure 8 This is a functional module diagram of the data decoding device according to an embodiment of the present invention. Figure 8 As shown, the data decoding device 80 includes an acquisition module 81, a recovery module 82, a decomposition module 83, and a decoding module 84.

[0110] The acquisition module 81 is used to acquire the string replacement record corresponding to the DNA base sequence to be decoded;

[0111] Recovery module 82 is used to recover the DNA base sequence to be decoded based on the string replacement record, so as to obtain the initial DNA base sequence before the string replacement operation;

[0112] The decomposition module 83 is used to decompose the initial DNA base sequence to obtain the decoding program and the target DNA base sequence corresponding to the original data.

[0113] The decoding module 84 is used to call the decoding program to decode the target DNA base sequence to obtain the raw data.

[0114] Optionally, the acquisition module 81 performs the operation of acquiring the string replacement record corresponding to the DNA base sequence to be decoded, specifically including: decomposing the pre-stored DNA base sequence to obtain the DNA base sequence to be decoded and the replacement record DNA base sequence; parsing the replacement record DNA base sequence to obtain the string replacement record.

[0115] For other details regarding the implementation techniques of each module in the data decoding device of the above embodiments, please refer to the description of the data decoding method in the above embodiments, which will not be repeated here.

[0116] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For apparatus embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

[0117] Please see Figure 9 , Figure 9 This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. Figure 9 As shown, the computer device 30 includes a processor 31 and a memory 32 coupled to the processor 31. The memory 32 stores program instructions. When the program instructions are executed by the processor 31, the processor 31 performs the steps of the data storage method or data decoding method described in any of the above embodiments.

[0118] The processor 31 can also be referred to as a CPU (Central Processing Unit). The processor 31 may be an integrated circuit chip with signal processing capabilities. The processor 31 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor.

[0119] See Figure 10 , Figure 10 This is a schematic diagram of the structure of a storage medium according to an embodiment of the present invention. The storage medium of this embodiment stores program instructions 41 capable of implementing the above-described data storage method or data decoding method. These program instructions 41 can be stored in the storage medium in the form of a software product, including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks, or computer devices such as computers, servers, mobile phones, and tablets.

[0120] In the several embodiments provided in this application, it should be understood that the disclosed computer devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between devices or units, and may be electrical, mechanical, or other forms.

[0121] Furthermore, the functional units in the various embodiments of this invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated units described above can be implemented in hardware or as software functional units. The above are merely embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made based on the description and drawings of this application, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A data storage method, characterized in that, include: The raw data is DNA encoded, and the encoded result is spliced ​​with the DNA encoding of the preset decoding program to obtain the first DNA base sequence; Identify taboo strings containing taboo information in the first DNA base sequence; Based on the first preset rule and the first DNA base sequence, a target string without taboo information is generated, and each taboo string corresponds to a target string; The forbidden string in the first DNA base sequence is replaced with the target string to obtain the second DNA base sequence, which is then saved, and a string replacement record is generated; wherein: The generation of a target string excluding taboo information based on the first preset rule and the first DNA base sequence includes: Construct a suffix automaton based on the first DNA base sequence, and construct an AC automaton based on all the forbidden strings; Based on the breadth-first search algorithm, the algorithm traverses from the initial node of the suffix automaton to filter out substrings that have not appeared in the first DNA base sequence; The AC automaton is matched with each of the substrings to determine whether the substring contains the taboo information; If included, the substring is deleted; If not included, the substring is used as the target string and retained.

2. The data storage method according to claim 1, characterized in that, The step of replacing the forbidden string in the first DNA base sequence with the target string to obtain the second DNA base sequence includes: Confirm the position of the forbidden string in the first DNA base sequence; Replace the forbidden string with the target string, and obtain the concatenated string obtained by concatenating the target string with a substring of a preset length before or after the position; The AC automaton is used to confirm whether the taboo information exists in the concatenated string. If the taboo information exists, the code corresponding to four bases is inserted sequentially between the target string and the substring, and the taboo information is confirmed again until the taboo information does not exist in the concatenated string.

3. The data storage method according to claim 1, characterized in that, After generating the string replacement record, the method further includes: The string replacement record is encoded based on the third preset rule to obtain a third DNA base sequence that does not include taboo information; The second DNA base sequence and the third DNA base sequence are spliced ​​together to obtain the final DNA base sequence, which is then saved.

4. The data storage method according to claim 3, characterized in that, The string replacement record includes the starting position, replacement length, the string to be replaced, and the string after replacement.

5. The data storage method according to claim 4, characterized in that, The encoding of the string replacement record based on the third preset rule yields a third DNA base sequence that does not include taboo information, including: Encode the starting position and the replacement length based on preset specific characters to generate position characters and length characters that do not include taboo information; Preset delimiting characters (excluding taboo information) are inserted at both ends of each character in the position character and the length character to obtain a position sequence and a length sequence. The delimiting characters are then inserted at both ends of each character in the replaced string and the replaced string to obtain a replaced string sequence and a replaced string sequence. The third DNA base sequence is obtained by inserting the delimiter character at both ends of the position sequence, the length sequence, the replaced string sequence, and the replaced string sequence, and then concatenating them sequentially.

6. A data decoding method, which utilizes the data storage method of claim 1, characterized in that, include: Retrieve the string replacement records corresponding to the DNA base sequence to be decoded; The DNA base sequence to be decoded is recovered based on the string replacement record to obtain the initial DNA base sequence before the string replacement operation; The initial DNA base sequence is decomposed to obtain the decoding program and the target DNA base sequence corresponding to the original data; The decoding program is invoked to decode the target DNA base sequence to obtain the raw data.

7. The data decoding method according to claim 6, characterized in that, The step of obtaining the string replacement record corresponding to the DNA base sequence to be decoded includes: Decompose the pre-stored DNA base sequence to obtain the DNA base sequence to be decoded and the replacement record DNA base sequence; The replacement record DNA base sequence is parsed to obtain the string replacement record.

8. A computer device, characterized in that, The computer device includes a processor and a memory coupled to the processor, the memory storing program instructions that, when executed by the processor, cause the processor to perform the steps of the data storage method as described in any one of claims 1-5 or the steps of the data decoding method as described in any one of claims 6-7.

9. A storage medium, characterized in that, The system stores program instructions capable of implementing the data storage method as described in any one of claims 1-5 or the data decoding method as described in any one of claims 6-7.

Citation Information

Patent Citations

  • Character-string screening method and device based on AC (Aho-Corasick) automaton and postfix expressions

    CN107193843A

  • Encoding method and device, decoding method and device, terminal equipment and readable storage medium

    CN113539370A