# Image Storage in DNA by an Extensible Quaternary Codec System
## 2 Materials and Research Methods
### Error Correction  
The ETQ employs a Reed-Solomon error correction code (RS code) under the BCH view as a logical redundancy. RS codes, as multilevel error correction codes, are particularly suitable for multilevel modulation scenarios and possess strong error correction capabilities, capable of correcting both random and burst errors [26]. During DNA storage and retrieval, base sequences may encounter insertion, deletion, and substitution errors, which are unevenly distributed [8]. RS codes are highly effective at correcting these types of errors and have been adopted in multiple DNA storage systems as the error correction strategy [11; 20; 25; 27; 28; 29]. An RS code with parameters (n, k) can correct up to (n - k)/2 errors, where k represents the original data length and n is the length of the encoded data. Within the BCH coding framework, RS error correction codes encode messages by treating their symbols as coefficients of a polynomial defined over the finite field (Galois field, GF). Through polynomial multiplication and modulo operations in GF, the original message polynomial is systematically transformed into an extended codeword polynomial, where the resultant coefficients constitute the error correcting encoded sequence. This algebraic approach ensures the codeword's redundancy adheres to the designed minimum distance properties critical for bounded-distance decoding. In the presence of storage-induced errors, the received polynomial during decoding is expressed as  
\[r(x)=s(x)+e(x)\]  
where \(s(x)\) denotes the original message polynomial and \(e(x)\) represents the error polynomial. The fundamental objective of Reed-Solomon (RS) error correction algorithms resides in computationally deriving \(e(x)\) from \(r(x)\), followed by algebraic subtraction \(s(x)=r(x)-e(x)\) to achieve error-free message recovery. All mathematical operations are rigorously executed within the finite field (Galois field, GF) framework. Figure 4 schematically illustrates the workflow of the RS error correction decoding algorithm. Let \(\mu\) denote the number of errors introduced during transmission. The error polynomial is defined as  
\[e(x)=\sum_{i=1}^{\mu}\gamma_{i}x^{l_{i}}\]  
where \(\gamma_{i}\in GF(2^{m})\) represents the error magnitude at position \(l_{i}\). The decoding procedure unfolds as follows:  
1. Syndrome Computation: The syndrome values \(S_{i}\) are computed by evaluating the received polynomial \(r(x)\) at consecutive powers of the primitive element \(\alpha\), specifically at \(\alpha^{j}\), for j = 1, 2, \(\ldots\), n - k, within the \(GF(2^{m})\). This operation mathematically corresponds to \[S_{j}=r\Big{(}\alpha^{j}\Big{)}=0+e\Big{(}\alpha^{j}\Big{)}=\sum_{i=1}^{\mu} \gamma_{i}X_{i}^{j}\] where \(X_{i}=\alpha^{l_{i}}\), \(S_{j}\) has n - k terms. 2. Error Locator Polynomial: Employ the Berlekamp-Massey algorithm to derive coefficients \(\lambda\lambda_{i}\) of the error locator polynomial \[\sigma(x)=\prod_{i=1}^{\mu}(1-xX_{i})=1+\sum_{i=1}^{\mu}\lambda_{i}x^{i}\]
3. Root Identification: Execute a Chien search [30] to determine roots \(X_{i}^{-1}\) of \(\sigma(x)\), yielding error positions \(l_{i}=\log X_{i}\). 4. Error Magnitude Calculation: Apply [PERSON]'s algorithm [31] to compute error magnitudes \[\gamma_{i}=-\frac{X_{i}^{1-i_{0}}\omega\left(X_{i}^{-1}\right)}{\sigma^{{}^{ \prime}}\left(X_{i}^{-1}\right)}\] where \(\omega(x)\) is the error evaluator polynomial and the first syndrome index. 5. Error Correction: reconstruct \(e(x)\) using \(\{l_{i},\ \gamma_{i}\}\) and recover the codeword \[c(x)=r(x)-e(x)\]  
In this study, RS codes are constructed within GF (256) because the decoding time of RS codes increases nonlinearly with code length [17], and the RS error correction framework under GF (256) is well established [32]. Building upon this foundation, each group of four bases is treated as an error correction block, The final encoded sequence, obtained after the \"two mapping\" process, is divided into 80 nt base fragments, which are sequentially indexed to generate the data segment indices.