On Coding for an Abstracted Nanopore Channel for DNA Storage
Abstract
In the emerging field of DNA storage, data is encoded as DNA sequences and stored. The data is read out again by sequencing the stored DNA. Nanopore sequencing is a new sequencing technology that has many advantages over other methods; in particular, it is cheap, portable, and can support longer reads. While several practical coding schemes have been developed for DNA storage with nanopore sequencing, the theory is not well understood. Towards that end, we study a highly abstracted (deterministic) version of the nanopore sequencer, which highlights key features that make its analysis difficult. We develop methods and theory to understand the capacity of our abstracted model, and we propose efficient coding schemes and algorithms.
1 Introduction
In the emerging field of DNA storage, data is encoded as DNA sequences and stored; the data can be read back by sequencing the stored DNA. This technology promises high storage density and stability, as well as efficient duplication of data and random access using PCR-based technologies; we refer the reader to [4] and the references therein for an excellent overview.
Both the synthesis and sequencing processes are noisy, and as a result the data must be encoded before the synthesis stage to ensure accurate data recovery. Prior work has studied methods for encoding data in order to protect it against (aspects of) the noise introduced by these processes, for example [10, 3, 7, 22, 17, 14, 15, 5].
In this work, we focus on one particular stage of this noisy process, the nanopore sequencer. Nanopore sequencing—and in particular the MinION sequencer developed by Oxford Nanopore Technologies [12]—is an emerging sequencing technology. While initial works in DNA storage used Illumina sequencing, nanopore sequencing has been attracting interest due to its portability, low cost, and ability to support significantly longer reads than Illumina.
At a high level, the nanopore sequencer works as follows. A single strand of DNA is passed through a pore, leading to variations in a current readout. The pore can hold nucleotides (for our purposes, a nucleotide is just a value in ) at a time; in practice is about six. The value of the current readout depends on which nucleotides are in the pore. For example, if the strand of DNA is AGCTAAT, and the pore sees the sub-strand AGCT, it will output one current reading. As the strand is passed through the pore, the contents of the pore will shift, say from AGCT to GCTA, then to CTAA, then to TAAT, and so on. This will result in a change in the current reading, according to some function that maps -mers to current levels. The process is depicted in Figure 1. Given the current readout, the goal is to recover the original DNA sequence.
This channel is difficult to analyze, for several reasons. First, the output at any given time depends on bases, and so there is inter-symbol interference. Second, there may be collisions in the output: two different pore contents may lead to similar current readouts. Third, the current readout can be noisy. Fourth, the amount of time that each -mer spends in the pore can vary, and sometimes never occur at all, leading to synchronization errors in the output.
Due to this complexity, typical basecallers (that is, methods for recovering the original sequence from the current readouts) rely on machine learning techniques [21, 9, 20]. This is effective in practice, but difficult to get a theoretical handle on. While there are several practical approaches to error correction for nanopore sequencing in DNA storage [22, 17, 14, 15, 5], the theoretical limits of this channel are not well understood. The work [16], discussed more below, proposed a probabilistic model of the nanopore sequencer and developed bounds on the capacity of the resulting channel. However, this problem is quite difficult; in particular, taking into account the possibility of synchronization errors places this problem as more difficult than determining the capacity of the deletion channel, a notorious open problem.
In this work, we take a different approach to developing a theoretical understanding of the nanopore sequencer. We develop a highly abstracted, deterministic model, which is meant to highlight the first two sources of noise mentioned above: the inter-symbol interference, and the prospect of collisions when multiple -mers lead to similar current outputs. We develop methods and theory to understand the capacity of our abstracted channel, and we propose efficient coding schemes and algorithms.
Our goal in this work is to open up a research direction towards a theoretical understanding of the nanopore sequencer. We fully acknowledge that our work is not yet practical; in particular our abstracted channel does not include noise in the current readings or synchronization errors that can arise from variable pore dwelling times. It is our hope that a solid understanding of our abstracted channel can then be combined with (much more well-studied) theories of coding for substitution and synchronization errors, in order to make progress on a more realistic channel model.
Contributions. Our contributions are as follows.
-
1.
We propose a novel abstraction of the nanopore sequencer, which highlights the inter-symbol interference and the prospect of collisions. This abstraction is simple enough that it is tractable, yet complex enough that it (a) captures some fundamental properties of the nanopore sequencer, and (b) already gives rise to extremely interesting problems from a theoretical perspective. We hope that our abstraction will lead to future work in this area.
-
2.
In Section 3, we develop an algorithm to determine the capacity of this channel. The algorithm is inefficient as pore size grows, but we can use it to determine the capacity for small .
-
3.
In Section 4, we develop simple bounds on the “best” and “worst” capacity for an arbitrary pore size (where “best” and “worst” refers to the choice of the map from -mers to current readouts). We use our algorithms mentioned above to compare these bounds to the exact values for . These preliminary results suggest there may be some intriguing “bumpiness” in the worst-case capacity as the number of distinct current levels increases, but that the average-case is closer to best- than worst-case.
-
4.
In Section 5, we develop efficient coding schemes for our abstracted channel. In particular, we develop a scheme that achieves rate , where is the capacity, that requires preprocessing time , and has encoding/decoding time , where the notation hides a constant that depends on . We also present an efficient coding scheme that improves over the “naive” one with high probability, where the probability is over a random map from -mers to current readouts.
1.1 Related Work
DNA storage has been around as an idea since the 1960’s, and there has been renewed interest in it in the past decade, starting with the works [6, 10]. We refer the reader to [4] for an excellent survey on DNA storage. Most works on DNA storage have focused on other sequencing technologies like Illumina, but starting with the work of [22], there have been several works which developed practical DNA storage systems for nanopore sequencers, including [22, 17, 14, 15, 5]. All of these works developed practical coding schemes for DNA storage with a nanopore sequencer, but did not explicitly model the sequencer or analyze the theoretical limits.
Perhaps the work most related to ours is that of [16], who also developed a model of the nanopore sequencer and studied the capacity of their model. In particular, they give a multi-letter capacity formula for their channel, and derive computable bounds for the capacity, in terms of a Markov transition matrix that captures the probability of transitioning from one -mer to the next in the pore. Our work complements that work by focusing on different aspects of the problem. In more detail, that work differs from ours in several ways. First, the model in [16] is stochastic, while ours is deterministic. As a result, they take an information-theoretic approach, while our approach is more combinatorial in nature. Second, their model includes the possibility that -mers might get dropped; in particular, the binary deletion channel appears as one part of their model. Since understanding the capacity of the binary deletion channel is a difficult open problem, this makes their problem extremely difficult. In contrast, we ignore this aspect in order to more cleanly focus in on the effects of the inter-symbol interaction and the potential confusability between the -mers. Third, that work focuses on the nanopore sequencer for general applications (not necessarily for DNA storage), and in particular does not consider efficient coding schemes for their model. Finally, that work derives bounds on the channel capacity for a particular choice of (a stochastic analog of) the map from -mers to current levels, derived from experimental data. In contrast, we are interested in results for any , and in particular for the best and worst such functions . While the former direction is obviously of immediate interest for existing technology, it is our hope that understanding how the capacity of the channel changes with could perhaps guide how nanopore technology is developed in the future. We note that this is still an emerging area and the technology is evolving; see [11] for an overview of recent advances.
2 Abstract Model of Nanopore Sequencer
In this section we formalize our model. As mentioned above, our goal is to focus on the challenges of (1) inter-symbol interference, and (2) the possibility of different -mers producing similar current readouts. With that in mind, we propose a very simple model for the nanopore sequencer. As input, we take an encoded string . This is transformed into a sequence of -mers according to a sliding window, to obtain . Finally, each of these -mers is mapped to one of distinct current levels, according to a mapping . This mapping defines the channel.
Definition 1 (Abstract Nanopore Channel).
Given a mapping from -mers to current levels, let represent the mapping from DNA strands to their full current readout, i.e.,
We call the abstract nanopore channel given by .
Given a mapping , we are interested in the capacity (in bits-per-base), which we define as follows.
Definition 2.
Let . The capacity of the abstract nanopore channel determined by is defined as
(1) |
Observe that if is a collection of strings so that are all distinct for , then by assigning a different message to each , we can communicate perfectly (if not necessarily efficiently) across the abstract nanopore channel.
We will focus on balanced mappings . These are mappings so that is the same for all .
3 Computing the Capacity
Our first contribution is an algorithm (Algorithm 1 below) that computes , given . The basic idea is to consider a finite automaton on the alphabet that accepts exactly those current readouts that can be generated by some DNA strand; then we use the transfer matrix method [2, 8] for counting accepting paths in that finite automaton.
Formally, an Nondeterministic Finite Automaton (NFA) is a tuple where is the set of states, is the alphabet, is the transition function, is the set of initial states, and is the set of accepting states. Likewise, a Deterministic Finite Automaton (DFA) is a tuple , defined analogously except that is the transition function and there is only a single initial state .
We consider the NFA and the DFA described in Algorithm 1. The NFA has states indexed by strings in and alphabet , the current levels. Given a state and an input current level , the NFA can transition to any other state of the form so that . All states are accepting states. By construction, a sequence of current readings can be an output of the nanopore sequencer if and only if is accepted by . The DFA accepts exactly the same strings as , and is obtained using the classic subset construction [18], such that each state of the DFA corresponds to a subset of the states of the NFA.
The transfer matrix method is a method for obtaining a generating function for the number of states accepted by a given DFA. In more detail, given the transfer matrix for the automaton (so that is the number of transitions from state to state ), the transfer matrix method gives an expression for a function (in terms of the matrix ), so that
so that is the number of strings of length accepted by the finite automaton. We will use the notation to denote the coefficient on .
Lemma 1 (Transfer Matrix Method [2]).
Given a DFA , let be obtained from the DFA by adding a new state and new symbol , along with -transitions from each of the accepting states of to . Let be the transfer matrix of , where is the number of transitions from state to state , with being state and being state . Then the generating function for is
where is the minor of index , i.e., the matrix with the row and column deleted.
In our case, the number of strings of length accepted by our finite automaton will be the number of current readouts of length that can be generated by some DNA strand of length .
From , we can derive the asymptotic behavior of the number of possible current readouts required to determine . As shown in the proof below, it is related to the smallest positive singularity of .
Theorem 2.
Given a mapping , Algorithm 1 computes .
Proof.
First, observe that the NFA accepts exactly those current readouts that can be generated by some DNA strand under the mapping . For any current readout accepted by , consider an accepting path . Then by construction, the DNA strand generates that current readout. In the other direction, for any DNA strand , the path is an accepting path for .
The DFA obtained from the subset construction accepts the same current readouts as [18]. Then we apply the transfer matrix method described in Lemma 1 to obtain the generating function , which counts the number of current readouts accepted by .
Finally, we need to extract the asymptotic behavior of . Since is a generating function with non-negative coefficients, the Exponential Growth Formula [8] tells us that where is the smallest positive singularity of . Note that the number of possible current readouts is monotonically non-decreasing in , so the lim sup is equal to the limit. Therefore, based on equation (1), and the fact that the length of the current readouts for DNA strands of length is ,
∎
3.1 Complexity of Algorithm 1
Unfortunately, the DFA obtained from the subset construction has states, so the runtime of Algorithm 1 is exponential in the problem size (i.e., the description length of ).
It is possible that calculating may be hard, because computing such a statistic for NFAs in general is PSPACE-complete [19]. Specifically, even determining whether for or 4 ( is the highest possible capacity over all mapping functions ; see Lemma 5) is equivalent to determining whether the corresponding NFA is universal (i.e., accepts every string in the alphabet). We make this precise in the following lemma.
Lemma 3.
For or and any , is equal to if and only if every current readout in can be generated by some DNA strand.
Proof.
First we verify the “if” direction. Indeed, if every current readout can be generated, then .
To show the “only if” direction we show the contrapositive. Suppose there is some current readout of length which cannot be generated by any DNA strand. Observe that any current readout which contains as a contiguous substring can also not be generated by any DNA strand (otherwise we could generate by truncation). Thus, consider any current readout of length which can be generated by some DNA strand. If we divide it up into sections of length , obviously none of those sections can be equal to . So we see that
∎
Since universality is PSPACE-complete for general NFAs, an efficient algorithm would have to in some way leverage the highly structured nature of the NFAs corresponding to some mapping .
Remark 4.
Although we currently don’t know how to calculate (or approximate) efficiently, it is possible to approximate the capacity for strands of fixed length , . Specifically, there are existing randomized approximation algorithms for counting the number of strings of a given length accepted by an NFA, in time polynomial in and the size of the NFA [13, 1].
4 Bounding the Capacity
The above approach for computing exactly given a mapping is only practical for small window sizes . However, we can derive some general bounds that apply to any mapping . In particular, we are interested in the worst-case mapping (e.g., the one that attains ), as well as the best-case mapping (e.g., the one that attains ). We prove the following lemma.
Lemma 5.
For a given window size and with distinct current levels, we have the following bounds on :
-
1.
-
2.
-
3.
when
Proof.
We prove each bound independently:
-
1.
Observe that the the size of the set in the numerator of equation (1) is bounded above both by the number of possible current readouts () and the number of DNA strands (). Therefore .
Furthermore, this rate is achievable. For , it is achieved by, for instance,
since then all possible current readouts are achievable: given , simply replace all the 0’s with ’s and the 1’s with ’s, and add any bases to the end.
For , the optimal rate is achieved by any mapping where implies , since then every DNA strand ending with A’s gives rise to a unique current readout.
-
2.
Regardless of the mapping , we can always generate at least distinct current readouts: any choice of desired , , , etc. current readings can be obtained because they correspond to non-overlapping length- windows. Thus .
-
3.
When , we can effectively make the bases and indistinguishable from each other, and likewise the bases and indistinguishable from each other. Consider any balanced mapping — in this case, balanced means that for each ,
Then define where is obtain from by replacing all ’s with ’s and all ’s with ’s. Observe that is a balanced mapping, and also the size of the set in the numerator of equation (1) is now at most . Thus .
∎
Combining these bounds, we obtain the plot in Figure 3. One might wonder how tight the bounds shown in Figure 3 are, and also about where lies for a “typical” mapping function . Using Algorithm 1, we are able to exactly calculate the maximum, minimum, and average for , restricted to balanced mappings. These empirical results are shown in Figure 3.
The lower bound is on curious. Our theoretical bounds on are not tight, but the results suggest there may be some “bumpiness” in the true bound. Also based on the results, it appears that random (balanced) mappings are closer to the best-case scenario than the worst-case. Section 5.2 illustrates one coding scheme that takes advantage of a property shared by most random mappings for , and we may hope there exist more general coding schemes that perform well for random mappings.
5 Coding Schemes
In the proof of Lemma 5, we observed that given a mapping with window size and distinct current levels, we can achieve a rate of by coding only on the etc. current readings. Here, we propose two generalizations of this trivial scheme to improve the rate with additional preprocessing based on the mapping .
5.1 “Block” Encoding
Instead of coding on non-overlapping windows of length , each of which maps to one of current readings, we may instead choose a block length and code on non-overlapping blocks of length . This requires precomputing an alphabet such that is an injective function with the same range as . That is, each DNA strand in generates a unique current readout, and together they generate every possible current readout of length given the mapping . Provided our desired strand length is divisible by or tends to infinity, this coding scheme obtains the rate
Since , it is possible to get arbitrarily close to the optimal rate by picking a sufficiently large .
Theorem 6.
Given a mapping , for all , there is a coding scheme achieving rate with linear time encoding and decoding that requires preprocessing time , where the notation hides constants that may depend on the mapping .
Proof.
We will exhibit such a scheme by choosing an appropriate block length . Let be the number of distinct current readouts that can be generated from DNA strands of length . Equivalently, is the number of current readouts of length accepted by the NFA constructed by Algorithm 1. Because is a counting function for a regular language, and because is non-decreasing in , the asymptotic behavior of has a simple form ([8], Theorem V.3):
where is a polynomial.
Thus, there must exist some and some constant depending only on the mapping , such that for all , . Therefore, if we choose , we see that
Therefore, to achieve rate , we should choose proportional to , with the constants depending only on the mapping .
Given the block length , we now describe how to compute the alphabet . We will construct an array containing the alphabet and a hash table mapping current readouts of length to the index in of the DNA strand that generates that readout.
For each DNA strand of length , compute . If has not yet been added to the hash table , append to the end of array and map to the appropriate index. This preprocessing takes time for each of DNA strands, for a total of .
Encoding and decoding are then quite straightforward: Convert the message to base and use lookup table to map each digit to a block of length . Similarly, decode each block of current readings using the hash table (skipping the readings that straddle each pair of adjacent blocks). ∎
As an example, consider the case when or and is any mapping with the highest-possible capacity . Per Lemma 3, this implies that every current readout can be generated by some DNA strand, so and . In this case, we can calculate the dependence of on exactly:
For instance, when and , we would require .
5.2 “Greedy” Encoding
Alternatively, instead of changing the lengths of the blocks used in the trivial scheme, we may relax the “non-overlapping” requirement.
This may not always be possible, depending on the mapping . Indeed, in the worst case, it is possible that once you have fixed the first bases, the next current readings may also be fixed—for instance, if the first bases are all , and all windows starting with map to the same current level. However, this pessimal case shouldn’t happen for most mappings.
Consider the case of current levels, and suppose that for some length , for every “prefix” , at least one window in and at least one window in starts with that prefix. Then it is possible to have every current reading code for one binary symbol independently. This would give us a rate of rather than . Such an event is not too unlikely with a random mapping .
Lemma 7.
Given a random mapping with distinct current levels and a length , admits the coding scheme described above with rate with probability at least
Furthermore,
-
1.
we can determine whether such a scheme exists for a given and in .
-
2.
we can find the maximum for which such a scheme exists for a given in .
-
3.
we can implement such a scheme with preprocessing and linear encoding and decoding.
Proof.
Let be a uniformly random mapping from (not necessarily balanced). For a given prefix of length and current level , the probability that all windows beginning with that prefix belong to is . Thus by the union bound, the probability of being able to execute this scheme for a given length is at least
This probability would only be higher if we restrict to be a random balanced mapping.
Given a specific mapping and desired length , we can trivially check whether this property is satisfied by checking, for each prefix of length , the current level corresponding to each of the windows beginning with that prefix, in time .
Naturally, we could determine the maximum that works for a given mapping in by repeating the above procedure for each .
Furthermore, such a scheme could be straightforwardly implemented for a given . For instance, we could construct tries — trie 0 corresponding to and trie 1 corresponding to — in . For ease of encoding, we will also equip each leaf node of the tries with two pointers, pointing to the internal nodes in both trie 0 and trie 1. To encode from binary to a DNA strand, we then start with any length- window in the trie corresponding to the first bit. For each subsequent bit, follow the pointer from our current leaf to the internal node of the trie corresponding to that bit, then append an arbitrary path from that prefix to a leaf in the appropriate trie. Decoding is simply a matter of extracting every current reading. Thus both encoding and decoding are linear in the length of the DNA strand. ∎
For example, with , we see that we can obtain a rate of (compared to the trivial ) with probability at least .
6 Conclusion
We have initiated a theoretical study of coding for a highly abstracted version of the nanopore sequencer for DNA storage. We have provided algorithms and bounds for understanding the capacity, and we have given efficient coding schemes. However, we view our work as the tip of an iceberg. First, even for this abstracted model, much remains open. Can one derive better bounds on the capacity, or compute it efficiently for, say, ? Second, we hope that our insights will generalize to more practical models, including with substitution and synchronization errors.
References
- [1] Marcelo Arenas, Luis Alberto Croquevielle, Rajesh Jayaram and Cristian Riveros “Efficient Logspace Classes for Enumeration, Counting, and Uniform Generation” In Proceedings of the 38th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, 2019
- [2] Abdulbaki Aydin, Lucas Bang and Tevfik Bultan “Automata-Based Model Counting for String Constraints” In Computer Aided Verification Cham: Springer International Publishing, 2015, pp. 255–272
- [3] Meinolf Blawat et al. “Forward error correction for DNA data storage” In Procedia Computer Science 80 Elsevier, 2016, pp. 1011–1022
- [4] Luis Ceze, Jeff Nivala and Karin Strauss “Molecular digital data storage using DNA” In Nature Reviews Genetics 20.8 Nature Publishing Group, 2019, pp. 456–466
- [5] Shubham Chandak et al. “Overcoming high nanopore basecaller error rates for DNA storage via basecaller-decoder integration and convolutional codes” In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2020, pp. 8822–8826 IEEE
- [6] George M Church, Yuan Gao and Sriram Kosuri “Next-generation digital information storage in DNA” In Science 337.6102 American Association for the Advancement of Science, 2012, pp. 1628–1628
- [7] Yaniv Erlich and Dina Zielinski “DNA Fountain enables a robust and efficient storage architecture” In Science 355.6328 American Association for the Advancement of Science, 2017, pp. 950–954
- [8] Philippe Flajolet and Robert Sedgewick “Analytic Combinatorics” Cambridge University Press, 2009
- [9] “Flappie: Flip-flop basecaller for Oxford Nanopore reads” Last accessed: January 2021, https://github.com/nanoporetech/flappie
- [10] Nick Goldman et al. “Towards practical, high-capacity, low-maintenance information storage in synthesized DNA” In Nature 494.7435 Nature Publishing Group, 2013, pp. 77–80
- [11] Yusuke Goto, Rena Akahori, Itaru Yanagi and Ken-ichi Takeda “Solid-state nanopores towards single-molecule DNA sequencing” In Journal of human genetics 65.1 Nature Publishing Group, 2020, pp. 69–77
- [12] Miten Jain, Hugh E Olsen, Benedict Paten and Mark Akeson “The Oxford Nanopore MinION: delivery of nanopore sequencing to the genomics community” In Genome biology 17.1 Springer, 2016, pp. 1–11
- [13] Sampath Kannan, Z. Sweedyk and Steve Mahaney “Counting and Random Generation of Strings in Regular Languages” In Proceedings of the Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA ’95 San Francisco, California, USA: Society for IndustrialApplied Mathematics, 1995, pp. 551–557
- [14] Henry H Lee et al. “Terminator-free template-independent enzymatic DNA synthesis for digital information storage” In Nature communications 10.1 Nature Publishing Group, 2019, pp. 1–12
- [15] Randolph Lopez et al. “DNA assembly for nanopore data storage readout” In Nature communications 10.1 Nature Publishing Group, 2019, pp. 1–9
- [16] Wei Mao, Suhas N Diggavi and Sreeram Kannan “Models and information-theoretic bounds for nanopore sequencing” In IEEE Transactions on Information Theory 64.4 IEEE, 2018, pp. 3216–3236
- [17] Lee Organick et al. “Random access in large-scale DNA data storage” In Nature biotechnology 36.3 Nature Publishing Group, 2018, pp. 242
- [18] M. O. Rabin and D. Scott “Finite Automata and Their Decision Problems” In IBM Journal of Research and Development 3.2, 1959, pp. 114–125 DOI: 10.1147/rd.32.0114
- [19] Narad Rampersad, Jeffrey Shallit and Zhi Xu “The computational complexity of universality problems for prefixes, suffixes, factors, and subwords of regular languages” In CoRR abs/0907.0159, 2009 arXiv: http://arxiv.org/abs/0907.0159
- [20] “Scrappie: a technology demonstrator for the Oxford Nanopore Research Algorithms group” Last accessed: January 2021, https://github.com/nanoporetech/scrappie
- [21] Ryan R Wick, Louise M Judd and Kathryn E Holt “Performance of neural network basecalling tools for Oxford Nanopore sequencing” In Genome biology 20.1 Springer, 2019, pp. 1–10
- [22] SM Hossein Tabatabaei Yazdi, Ryan Gabrys and Olgica Milenkovic “Portable and error-free DNA-based data storage” In Scientific reports 7.1 Nature Publishing Group, 2017, pp. 1–6