Abstract
Abstract
Contig assembly is the first stage that most assemblers solve when reconstructing a genome from a set of reads. Its output consists of contigs—a set of strings that are promised to appear in any genome that could have generated the reads. From the introduction of contigs 20 years ago, assemblers have tried to obtain longer and longer contigs, but the following question remains: given a genome graph G (e.g., a de Bruijn, or a string graph), what are all the strings that can be safely reported from G as contigs? In this article, we answer this question using a model in which the genome is a circular covering walk. We also give a polynomial-time algorithm to find such strings, which we call omnitigs. Our experiments show that omnitigs are 66%–82% longer on average than the popular unitigs, and 29% of dbSNP locations have more neighbors in omnitigs than in unitigs.
1. Introduction
T
In most theoretical studies, the assembly problem is formulated as finding one genomic reconstruction, that is, a single string that represents the sequence of the genome. However, the presence of repeats means that a unique genomic reconstruction usually does not exist. In practice, assemblers instead output several strings, called contigs, which are “promised” to occur in the genome. We refer to this restatement of the genome assembly problem as contig assembly. Contigs can then be used to answer biological questions (e.g., about gene content) or perform comparative genomic analysis. When mate pairs are available, contigs can be fed to later assembly stages, such as scaffolding (Boetzer et al., 2011; Luo et al., 2012; Sahlin et al., 2014) and then gap filling (Boetzer and Pirovano, 2012; Salmela et al., 2015).
Assemblers implement different strategies for finding contigs. The common strategy is to find unitigs, an idea that can be traced back to Kececioglu and Myers (1995). Unitigs have the desired property that they can be mathematically proven to occur in all possible genomic reconstructions, under clear assumptions on what “genomic reconstruction” means. We will refer to strings that satisfy such a property as being safe (Definition 3), and will say that a contig assembly algorithm is safe if it outputs only safe strings. Although most assemblers have a safe strategy at their core, they also incorporate heuristics to handle erroneous data and extend contig length (e.g., bubble popping, tip removal, and path disambiguation). Properties of such heuristics, however, are difficult to prove, and this article focuses on core algorithms that are safe.
Although the unitig algorithm is safe, it does not identify all possible safe strings (see Fig. 2). An improved safe algorithm was used in the EULER assembler (Pevzner et al., 2001), and further improvements were suggested based on iteratively simplifying the graph used for assembly (Pevzner et al., 2001; Jackson, 2009; Medvedev and Brudno, 2009; Kingsford et al., 2010). However, we show that these algorithms still do not always output all the safe strings. In fact, since the initial consideration of contig assembly 20 years ago, the fundamental question of finding all the safe strings of a graph remains poorly studied.
In this article, we answer this question by giving a polynomial-time algorithm for outputting all the safe strings in the common genome graph models (de Bruijn and string graphs) when the genome is a circular covering walk (Section 6). The key ingredient for this result is a graph-theoretic characterization of the walks that correspond to safe strings (Section 5). We call such walks omnitigs and our algorithm the omnitig algorithm. In our experiments on de Bruijn graphs built from data simulated according to our assumptions, maximal omnitigs are on average 66%–82% longer than maximal unitigs, and 29% of dbSNP locations have more neighbors in omnitigs than in unitigs.
results are naturally limited to the context of our model and its assumptions. Intuitively, we assume that (i) the sequenced genome is circular, (ii) there are no gaps in coverage, and (iii) there are no errors in the reads. A mathematically precise definition of our model is presented in Section 4. We argue that such a model is necessary if we want to prove even the simplest results about unitigs (Section 4). Similar to previous studies, we also do not deal with multiple chromosomes or the double-strandedness of DNA and assume that the genome is represented by a covering walk. As with previous articles that developed better theoretical underpinnings (Pevzner, 1989; Idury and Waterman, 1995; Myers, 2005; Medvedev et al., 2011), it is necessary to prove results in a somewhat idealized setting. Although this article falls short of analyzing real data, we believe that omnitigs can be incorporated into practical genome analysis and assembly tools—similar to the way that error-free studies of de Bruijn graphs (Pevzner, 1989) and paired de Bruijn graphs (Medvedev et al., 2011) became the basis of practical assemblers (Pevzner et al., 2001; Bankevich et al., 2012; Vyahhi et al., 2012).
2. Related Work
The number of related assembly articles is vast, and we refer the reader to some surveys (Miller et al., 2010; Nagarajan and Pop, 2013). For an empirical evaluation of the correctness of several state-of-the-art assemblers, see Salzberg et al. (2011). Here, we discuss work on the theoretical underpinnings of assembly.
There are many formulations of the genome assembly problem. One of the first formulations asks to reconstruct the genome as a shortest superstring of the reads (Peltola et al., 1983; Kececioglu, 1992; Kececioglu and Myers, 1995). Later formulations referred to a graph built from the reads, such as a de Bruijn graph (Idury and Waterman, 1995; Pevzner et al., 2001) or a string graph (Myers, 2005; Simpson and Durbin, 2011). In an (edge-centric) de Bruijn graph, the reconstructed genome can be modeled as a circular walk covering every edge exactly once—Eulerian (Pevzner et al., 2001)—or at least once—a Chinese Postman tour (Medvedev et al., 2007; Medvedev and Brudno, 2009; Nagarajan and Pop, 2009; Kapun and Tsarev, 2013a). In a string graph, the reconstructed genome can be modeled as a circular walk covering every node exactly once—Hamiltonian (Iu et al., 1988; Narzisi et al., 2014), or at least once (Nagarajan and Pop, 2009). These models have also been considered in their weighted versions (Medvedev and Brudno, 2009; Nagarajan and Pop, 2009; Narzisi et al., 2014), or augmented to include other information, such as mate pairs (Rubinov and Gelfand, 1995; Medvedev et al., 2011; Kapun and Tsarev, 2013b).
Each such notion of genomic reconstruction brought along questions concerning its validity. For example, under which conditions on the sequencing data (e.g., coverage, read length, and error rate) are there at least one reconstruction (Lander and Waterman, 1988; Motahari et al., 2013), or exactly one reconstruction (Pevzner et al., 2001; Bresler et al., 2013; Lam et al., 2014). If there are many possible reconstructions, then what is their number (Guénoche, 1992; Kingsford et al., 2010) and in which aspects one is different from all others (Guénoche, 1992). In contrast to the framework of this article, most of these formulations deal with finding a single genomic reconstruction as opposed to a set of safe strings (i.e., contigs).
There are a few notable exceptions. Boisvert et al. (2010) also define the assembly problem in terms of finding contigs, rather than a single reconstruction. Nagarajan and Pop (2009) observe that Waterman's (1995) characterization of the graphs with a unique Eulerian tour leads to a simple algorithm for finding all safe strings when a genomic reconstruction is an Eulerian tour. They also suggest an approach for finding all the safe strings when a genomic reconstruction is a Chinese Postman tour. We note, however, that in the Eulerian model, the exact copy count of each edge should be known in advance, whereas in the Chinese Postman model (minimizing the length of the genomic reconstruction), the solution will over-collapse all tandem repeats. Furthermore, these approaches have not been implemented and hence their effectiveness is unknown.
In practice, the most commonly employed safe strings are those spelled by maximal unitigs, where unitigs are paths whose internal nodes have in- and out-degree 1. Figure 2 shows an example of the output of the unitig algorithm, and also illustrates that it does not identify all safe strings. The EULER assembler (Pevzner et al., 2001) takes unitigs a step further and identifies strings spelled by paths whose internal nodes have out-degree equal to 1 (with no constraint on their in-degree). It can be shown that such strings are also safe. However, the most complete characterization of safe strings that we found is given by the Y-to-V algorithm (Medvedev et al., 2007; Jackson, 2009; Kingsford et al., 2010). Consider a node v with exactly one in-neighbor u and more than one out-neighbors w1,…,wd. The Y-to-V reduction applied to v removes v and its incident edges from the graph and adds nodes v1,…,vd with edges from u to vi and from vi to wi, for all 1 ≤ i ≤ d. The Y-to-V reduction is defined symmetrically for nodes with out-degree exactly 1 and in-degree greater than 1. Figure 1 illustrates the definition. The Y-to-V algorithm proceeds by repeatedly applying Y-to-V reductions, in arbitrary order, for as long as possible. The algorithm then outputs the strings spelled by the maximal unitigs in the final graph (see Fig. 2d for an example). The Y-to-V algorithm can also be shown to be safe, but, as we will show in Figure 2, it does not always output all the safe strings. We are not aware of any study that compares the merits of Y-to-V contigs with those of unitigs, and we therefore perform this analysis in Section 8.

The output of the three algorithms on the edge-centric de Bruijn graph G from

The Y-to-V reduction applied to node v.
3. Basic Definitions
Given a string x and an index 1 ≤ i ≤ |x|, we define pre(x, i) and suf(x, i) as its length i prefix and suffix, respectively. If x and y are two strings, and suf(x, k) = pre(y, k) for some k ≤ |x| − 1, then we define x ⨁
k
y as x[1..|x|−k] concatenated with y. This captures the notion of merging two overlapping strings. A k-mer of x is a substring of length k. Let R be a set of strings, which we equivalently refer to as reads. The node-centric de Bruijn graph built on R, denoted
Let G be a graph, possibly with parallel edges and self-loops. The number of nodes and edges in a graph is denoted by n and m, respectively. We use N −(v) to denote the set of in-neighbors and N +(v) to denote the set of out-neighbors of a node v. A walk w is a sequence (v0, e0, v1, e1,…,vt, et, vt+1) where v0,…,vt+1 are nodes, and each ei is an edge from vi to vi+1, and t ≥ − 1. Its length is its number of edges, namely t + 1. A path is a walk in which the nodes are all distinct, except possibly the first and last nodes may be the same, in which case it will also be called a cycle. Walks and paths of length at least 1 are called proper. A walk whose first and last nodes coincide is called circular walk. A path (walk) with first node u and last node v will be called a path (walk) from u to v, and denoted as (u)-(v) path (walk). A walk is called node-covering if it passes through each node of G, and edge-covering if it passes through each edge of G. The notions of prefix and subwalk are defined for walks in the natural way, for example, by interpreting a walk to be a string made up by concatenating its edges. In particular, we say that a walk w1 is a subwalk of a circular walk w2 if w1 interpreted as string is a substring of w2 interpreted as circular string. In this article, we allow strings and walks to have overlapping extremities when viewed as substrings of a circular string, that is, when aligned to a circular string (see, e.g., the two omnitigs from Figure 2f that have an overlapping tail and head).
Let ℓ be a function labeling the nodes of G and let c be a function giving weights to the edges (intuitively, c should represent the length of overlaps). One can apply the notion of string spelled by a walk w = (v0, e0, v1, e1,…,vt, et, vt+1) by defining the string spelled by w as spell
4. Problem Formulation
There are various theoretical approaches to formulating the assembly problem. Here, we adopt a model that captures the most popular models: the node-centric de Bruijn graph, the edge-centric de Bruijn graph, and the string graph (Myers, 2005). We generalize these using the notion of a genome graph:
Both node- and edge-centric de Bruijn graphs are genome graphs, directly by their definition. Similarly, the interested reader can verify that string graphs, as commonly defined by Myers (2005), Nagarajan and Pop (2009), Medvedev et al. (2007), Simpson and Durbin (2010), are genome graphs. Intuitively, the first condition states that the edge-weights represent the length of overlaps between strings, whereas the second condition prohibits a certain redundancy in the graph. It can be broken if, for example, there are nodes with duplicate labels, or if some labels are substrings of others. Or, for string graphs, it can be broken if transitive edges are not removed from the graph (Myers, 2005). We now augment a genome graph with a rule defining a “genomic reconstruction.”
• An algorithm that transforms a set of reads R into a genome graph, denoted by
• A rule that determines whether a walk in
Intuitively, a genomic reconstruction spells a genome that could have generated the observed set of reads R. In this article, we consider two graph models. In the edge-centric model, a genomic reconstruction is a circular edge-covering walk; its underlying genome graph can be, for example, an edge-centric de Bruijn graph. In the node-centric model, a genomic reconstruction is a circular node-covering walk; its underlying genome graph can be a node-centric de Bruijn graph or a string graph. As mentioned in the introduction, we assume, without always explicitly stating it onward, that
We now define the strings that belong to all genomic reconstructions.
In particular, for a node-centric (respectively, edge-centric) graph model
Solving the following problem gives all the information that can be safely retrieved from a graph model.
In this article, we solve this problem for the node- and edge-centric models already defined. In Sections 5 and 6, we first deal with the edge-centric model, and then in Section 7, we show how these results can be modified for the node-centric model.
As a technical aside, our algorithms will output only maximal safe strings, in the sense that they are not a substring of any other safe string. In fact, this is desirable in practice, and moreover, the set of all safe strings is the set of all substrings of the maximal safe strings.
A note on assumptions: Our model makes three implicit assumptions, as outlined at the end of the Introduction. Here, we observe that such assumptions are necessary to prove even the simplest desired property: that the unitig algorithm outputs only safe strings. Let w = (v0,e0,v1,e1,v2) be a unitig in an edge-centric de Bruijn graph G built from the (k + 1)-mers of a genome S. If the genome is not circular [assumption (i)], then, for example, the last k-mer of S can be v0, its first k-mer can be v1, the string v0 ⨁ k v1 can appear inside S, but v0 ⨁ k v1 ⨁ k v2 does not have to appear in S. If there are gaps in coverage [assumption (ii)], then both an in-neighbor v′ and an out-neighbor v′′ of v1 may be missing from G making w look safe, whereas in reality v0 ⨁ k v1 ⨁ k v2 may not be a substring of S. If a read contains a sequencing error [assumption (iii)], then this creates a bubble in G with one of its paths being a unitig not spelling a substring of S.
5. Characterization of Safe Strings: Omnitigs
In this section, we provide a characterization of walks that spell safe strings (see Fig. 3 for an illustration). This characterization is the basis of our omnitig algorithm in the next section.

An illustration of the omnitig definition, edge-centric model.
The following theorem proves that the omnitigs spell all the safe strings, using the help of an intermediary characterization of omnitigs.
(1) s is a safe string for G;
(2) s is spelled by a walk w = (v0, e0, v1, e1, …, vt, et, vt+1) in G and w is an omnitig;
(3) s is spelled by a walk w = (v0, e0, v1, e1, …, vt, et, vt+1) in G and for all 1 ≤ j ≤ t all proper vj−vj (circular) walks w′ fulfill at least one of the following conditions:
(i) the subwalk (vj, ej, …, vt, et, vt+1) of w is a prefix w′, or
(ii) the subwalk (v0, e0, …, vj-1, ej−1, vj) of w is a suffix of w′, or
(iii) w is a subwalk of w′.
We prove Theorem 1 by proving the cyclical sequence of implications (1) ⇒ (2) ⇒ (3) ⇒ (1).
Proof of (1) ⇒ (2). Assume that s is a safe string for G. By definition of a genome graph, s is spelled by a unique walk in G. Let w = (v0, e0, v1, e1, …, vt, et, vt+1) be this walk, and let A be a circular edge-covering walk of G; thus A contains w as subwalk, and s is a substring of spell(A).
Assume for a contradiction that there exist 1 ≤ i ≤ j ≤ t, and a proper vj−vi path p with first edge different from ej and last edge different from ei−1. From A, we construct another circular edge-covering walk B of G that does not contain w as subwalk, and hence, by the definition of a genome graph, also spell(B) does not contain s as substring. This contradicts the safeness of s. Whenever A visits node vj, then B follows the vj−vi path p, then follows (vi, ei, …, ej−1, vj), and finally continues as A. To see that w does not appear as a subwalk of B, consider the subwalk w′ = (vi−1,ei−1,vi,ei,…,ej−1,vj,ej,vj+1) of w (recall that 1 ≤ i ≤ j ≤ t). Since p is proper, and its first edge is different from ej and its last edge is different from ei−1, then, by construction, the only way that w′ can appear in B is as a subwalk of p. However, this implies that both vj and vi appear twice on p, contradicting the fact that p is a path. ■
Proof of (2) ⇒ (3). Suppose that w is an omnitig, and assume for a contradiction that there exists a proper vj−vj walk (for some 1 ≤ j ≤ t) not satisfying (i)–(iii). Let w′ be the shortest such walk. Since w′ does not have (vj,ej,…,vt,et,vt+1) as prefix, then there exists a first node vℓ on w, j ≤ ℓ ≤ t, such that from vℓ, w′ continues with an edge
Suppose for a contradiction that it is not, thus that it contains a cycle c, with c ≠ w′. Let w′′ be the walk obtained from w′ by removing the cycle c. Observe that w″ is still a proper vj−vj walk. We show that w″ still does not satisfy (i)–(iii), which will contradict the minimality of w′. Assume for a contradiction that w″ satisfies at least one of (i), (ii), or (iii).
First, if w″ satisfies (i), this implies that the edge

Illustration of three cases in the proof of the implication (2) ⇒ (3) of Theorem 1.
The second case when w″ satisfies (ii) is entirely symmetric.
Third, assume that w″ contains w as subwalk. Since w is not a subwalk of w′, this implies that c is a proper vr−vr walk, for some 1 ≤ r ≤ t, not satisfying (i)–(iii), which again contradicts the minimality of w′ (Fig. 4c). This completes the proof of (2) ⇒ (3) ■
Proof of (3) ⇒ (1). Assume w satisfies (3), and let A be a circular edge-covering walk of G. We need to show that w is a subwalk of A. Let wj = (v0,e0,…,vj−1,ej−1,vj) be the longest prefix of w that A ever traverses, ending at some vj. Since A covers all edges, then it also covers e0, and thus j ≥ 1. Suppose for a contradiction that j ≠ t + 1.
Since A is circular and covers all edges of G, then after traversing wj, the walk A eventually visits the edge ej. The walk A may visit vj multiple times before traversing the edge ej. Let w′ denote the subwalk of A between the last two occurrences of vj before A traverses the edge ej. Since w′ is a proper vj−vj walk, 1 ≤ j ≤ t, and w satisfies (3), we have that one of the following must hold:
• the walk (vj,ej,…,vt,et,vt+1) is a prefix of w′: this contradicts the fact that w′ is a subwalk of A between vj and the immediately next occurrence of ej (since in this case w′ contains ej); • the walk (v0,e0,…,vj−1,ej−1,vj) is a suffix of w′: this implies that (w′, ej, vj+1) is a longer prefix of w that is a subwalk of A, contradicting the maximality of wj; • the walk w appears on w′: since w′ is a subwalk of A, this implies that also w is a subwalk of A, contradicting again the maximality of wj.
6. Omnitig Algorithm
In this section, we use Theorem 1 to give the omnitig algorithm (Algorithm 1) and prove that it runs in polynomial time (Theorem 2). The algorithm finds all maximal omnitigs of
Omnitig algorithm to find all safe strings of a graph G.
The idea of the algorithm is to start an exhaustive traversal of G from every edge (Lines 11 and 12), which by definition is an omnitig, and to keep traversing edges as long as the current walk is an omnitig. An omnitig w is thus recursively constructed, by possibly extending to the right with each edge e out going from its last vertex (Lines 3–7). If w extended with e is not an omnitig, then we abandon this extension because Observation 1 tells us that no further extension could be an omnitig. To check whether this extension is an omnitig or not, it is enough to check whether condition (ii) of Observation 1 is satisfied. Condition (i) is automatically satisfied because of the structure of the algorithm—we extend only walks that are omnitigs. The omnitigs found are saved in a set W (Line 9), except for those omnitigs that are obviously nonmaximal (Line 8). In the final step (Lines 13 and 14), we remove the nonmaximal omnitigs from W and report the rest.
To check whether condition (ii) is satisfied (Lines 4–6), we take the set X (Line 4) and check whether there is a path starting with an edge out going from vt and different from e, and leading to a node of X. The correctness of this procedure can be seen as follows. If there is no such path, then we know that there is no path satisfying (ii). If we do find a path p from vt to some in-neighbor x ∈X of some vi, and p does not use vi, then the path obtained by extending p to vi contradicts (ii). If p contains vi, then such an extension is not possible, because a path cannot repeat a vertex; however, we will show that p cannot use vi by contradiction. Assume that it does, and observe that after passing through vi, the path p cannot pass again through vt. Let vj, i ≤ j < t, be the first vertex that p visits after vi such that from vj it continues with an edge e′ ≠ ej. Let p′ denote the vj−x subpath of p from vj until x. We obtained that p′ followed by vi is a proper vj−vi path with first edge different from ej, last edge different from ei−1, and 1 ≤ i ≤ j ≤ t. This contradicts the fact that w (the walk we are extending) is an omnitig.
Next, we show that the algorithm runs in polynomial time. First, we show that the number of omnitigs included in W and their length, before removal of nonmaximal omnitigs, is polynomial:
Proof. We first show that we can visit the edges of G =
By Theorem 1, we have that any omnitig of G is a subwalk of C. We can associate every w ∈W with all the start positions in C (in terms of nodes) where it is a subwalk. Because W does not contain walks that are prefixes of other walks, a position of C can have at most one walk associated with it. Since |C| ≤ nm, W can contain at most nm walks.
It remains to prove that the length of any omnitig in W is O(nm). To simplify notation, rename C as (v0, e0, v1, e1,…,vt, et, vt+1) with vt+1 = v0. Since G is different from a single cycle, then there exist vj and vi on C, such that e = (vj, vi) is an edge of G, and
(As an aside, it remains open whether the bound on |W| can be reduced to m, which is the case for unitigs; our experiments in Section 8 suggest that this may be the case in practice.) Note that Line 8 guarantees that W, before removal of subwalks in Line 13, satisfies the prefix condition of Lemma 1. Lemma 1 then implies that reporting one omnitig by our algorithm takes polynomial time, and there are only polynomially many omnitigs reported. Furthermore, removing the nonmaximal omnitigs (Line 13) can be done in linear time in the sum of the omnitig lengths, by appropriately traversing a suffix tree constructed from them. Thus, we have our main theorem:
Finally, we note some implementation details that are crucial in practice. Before starting, we apply the Y-to-V algorithm and the standard graph compaction algorithm to compact unitigs (Chikhi et al., 2014). This significantly reduces the number of nodes/edges in the graph without changing the maximal safe strings. We also precompute all omnitigs of length 2 and store them in a hash table so that whenever we want to extend the omnitig w in Line 6, we check beforehand whether the pair (et−1,e) is stored in the hash table. This significantly limits, in practice, the number of graph traversals we have to do at Line 6. Finally, we do not compute the set X every time, but instead incrementally built it up as we extend the omnitig w. Our implementation is freely available for use (https://github.com/alexandrutomescu/complete-contigs).
7. Node-Centric Model
In this section, we obtain analogous results for node-centric models, although both the definitions, algorithms, and proofs need to be modified. The following definition is similar to that for the edge-centric model, the only addition being its second bullet (see Fig. 5 for an illustration).

An illustration of the omnitig definition, node-centric model.
• for all 1 ≤ i ≤ j ≤ t, there is no proper vj−vi path with first arc being different from ej, and last arc being different from ei−1.
• for all 0 ≤ j ≤ t, the arc ej is the only vj−vj+1 path.
The following theorem is analogous to Theorem 1 and characterizes the safe strings in the node-centric model.
(1) s is a safe string for G;
(2) s is spelled by a walk w = (v0,e0,v1,e1…,vt,et,vt+1) in G and w is a omnitig;
(3) s is spelled by a walk w = (v0,e0,v1,e1…,vt,et,vt+1) in G and w satisfies: for all 0 ≤ j ≤ t, the arc ej of w is the only vj−vj+1 path, and for all 1 ≤ j ≤ t, all proper vj−vj (circular) walks w′ fulfill at least one of the following conditions:
(i) the subwalk (vj,ej,…,vt,et,vt+1) of w is a prefix w′, or
(ii) the subwalk (v0,e0,…,vj−1,ej−1,vj) of w is a suffix of w′, or
(iii) w is a subwalk of w′.
We analogously prove Theorem 3 by proving the cyclical sequence of implications (1) ⇒ (2) ⇒ (3) ⇒ (1).
Proof of (1) ⇒ (2). Assume that s is a safe string for R. By definition of a graph model, a safe string for R is spelled by a unique walk in a node-centric model for R. Let this walk be w, and let A be a circular node-covering walk of G (thus containing w as subwalk).
First, assume for a contradiction that there exist 1 ≤ i ≤ j ≤ t and a proper vj−vi path p whose first arc is different from ej and its last arc is different from ei−1. From A, we can construct another circular node-covering walk B of G that does not contain w as subwalk, and thus spell(B) does not contain s as substring. This will contradict the fact that s is a safe string for G.
Whenever A visits node vj, then B follows the (vj)-(vi) path p, then it follows (vi,ei,…,ej−1,vj), and finally continues as A. To see that w does not appear as a subwalk of B, consider the subwalk w′ = (vi−1,ei−1,vi,ei,…,ej−1,vj,ej,vj+1) of w (recall that 1 ≤ i ≤ j ≤ t). Since p is proper, and its first arc is different from ej and its last arc is different from ei−1, then, by construction, the only way that w′ can appear in B is as a subwalk of p. However, this implies that both vj and vi appear twice on p, contradicting the fact that p is a vj−vi path.
Second, assume for a contradiction that there is some 0 ≤ j ≤ t and another vj−vj+1 path p′ than the arc ej. Just as above, from A we can construct another node-covering walk C that avoids w [and thus spell(C) does not contain s as substring] as follows. Whenever A traverses the arc ej, C traverses instead p′. The walk C is node covering because it still covers all nodes of w, and otherwise C coincides with A. However, it does not contain w as subwalk because p′ is different from the arc ej, and, since it is a path, it cannot pass through ej again, as otherwise it would visit twice either vj, vj+1, or both. ■
The proof of (2) ⇒ (3) is identical to the corresponding proof of (2) ⇒ (3) for Theorem 1.
Proof of (3) ⇒ (1). Assume w satisfies (3), and let A be a circular node-covering walk of G. We need to show that w is a subwalk of A. Let wj = (v0, e0, …, vj−1, ej−1, vj) be the longest prefix of w that A ever traverses, ending at some vj. Since A covers all nodes, then j ≥ 0. Suppose for a contradiction that j≠t + 1. Since A is circular and covers all nodes of G, then after traversing wj, the walk A eventually visits the node vj+1. The walk A may, or may not, visit vj again before visiting the node vj+1.
First, suppose that after visiting vj at the end of wj, A visits again vj before visiting vj+1. Let w′ denote the subwalk of A between the last two occurrences of vj before visiting the node vj+1. If 1 ≤ j ≤ t, since w′ is a vj−vj walk, and w satisfies (3), we have that either:
• the walk (vj, ej, vj+1, …, vt,et, vt+1) is a prefix of w′: this contradicts the fact that w′ is a subwalk of A between vj and the immediately next occurrence of vj+1, since in this case w′ would contain vj+1 more times; • the walk (v0, e0, …, vj−1, ej−1, vj) is a suffix of w′: this implies that (w′, ej, vj+1) is a longer prefix of w that is a subwalk of A, contradicting the maximality of wj; • the walk w appears on w′: since w′ is a subwalk of A, this implies that also w is a subwalk of A, contradicting again the maximality of wj.
If j = 0, then by removing all cycles from w′, we obtain a vj−vj+1 path, different from the arc e0, since otherwise we would contradict the maximality of wj. But this contradicts the fact that w satisfies (3).
Second, suppose that the walk A does not visit vj again after wj and before visiting vj+1. Let w′′ be the vj−vj+1 subwalk of A between wj and this next occurrence of vj+1. The walk w′′′ may not be a path, but by removing all cycles from it, we obtain a vj−vj+1 path w′′′. This path is different from ej by the maximality of wj, contradicting again the fact that w satisfies (3). ■
Analogous to the edge-centric case, we can prove the following polynomial upper bound on the number and length of all omnitigs.
We also leave open the question whether the bound on the number of maximal omnitigs in the node-centric model can be reduced to n. We now combine Theorem 3 and Lemma 2 for obtaining our polynomial-time safe and complete assembly algorithm.
Proof. The proof is identical to that for the edge-centric case (Algorithm 1 and Theorem 2). The only difference that needs to be made to Algorithm 1 is to check whether the second bullet in the definition of omnitig for the node-centric case holds. This can be similarly performed by a single graph traversal, and only for the last edge added to the omnitig. ■
8. Experimental Results
We wanted to test the potential of omnitigs as an alternative to unitigs, under the assumptions of Section 4. We chose two genomes: one bacterial genome, Escherichia coli, and one larger genome, Human chr10 (circularized). The graph model was the edge-centric de Bruijn graph built on the set of all (k + 1)-mers of the genome. We used k = 31 and k = 55 for E. coli and chr10, respectively, according to what has been used in practice for the assembly of such genomes.
We wanted to measure the effect of omnitigs on assembly contiguity in terms of (1) increase in contig length and (2) increase of biological context for elements of interest. To measure the increase in length, we measured the average contig length and the E-size. Since multiple contigs can cover overlapping regions, we found the E-size metric (Salzberg et al., 2011) to be more appropriate than the N50 metric. The E-size of a set of substrings of a genome is defined as the average, over all genomic positions i, of the mean length of all substrings spanning position i. This was computed by aligning the contigs to the reference. Table 1 shows that omnitigs exhibit significantly more contiguity than unitigs, with an average contig length that is 62%–82% higher. There is very little improvement in the E-size (1%–4%), indicating that most of the improvement comes from increasing the length of shorter contigs.
We wanted to also measure the potential of omnitigs to improve downstream biological analysis, relative to unitigs. Longer contigs can provide more flanking context around important genomic elements such as single nucleotide polymorphisms (SNPs). One general type of study collects statistics about the relationship of each SNP with other SNPs on the same contig; such a study is necessarily limited by the number of SNPs present on the same contig (Uricaru et al., 2015). We call this number the block size of an SNP. To see the effect of omnitigs on such a study, we identified chr10 locations of SNPs in the human population (using dbSNP), and the block size of each SNP in the omnitig versus the unitig algorithms. Figure 6A shows that omnitigs in many cases provide more SNP context. The number of SNPs whose block size increased was ∼1.7 million (out of ∼5.9 million) and whose block size increased by more than 10 was ∼137,000. The average number of SNPs per omnitig was 41, with only 26 per unitig. Consistent with the contiguity results given in Table 1, the effect is more pronounced on contigs with less SNPs on them.

The increase in SNP block size in omnitigs compared with unitigs
We also compared omnitigs with Y-to-V contigs. Y-to-V contigs have been proposed in the literature (Medvedev et al., 2007; Jackson, 2009; Kingsford et al., 2010), but, to the best of our knowledge, there has not been a quantitative study comparing their merits against other contig assembly algorithms. Omnitigs also provide more SNP context than Y-to-V contigs, with ∼266,000 SNPs having an increase in block size (Fig. 6B). Omnitigs are only marginally better than Y-to-V contigs in terms of average contiguity (Table 1). Our results suggest that, although not as beneficial as omnitigs, Y-to-V contigs may nevertheless provide a better alternative to unitigs that is faster than the omnitig algorithm.
Table 1 also shows the wall clock running times of our algorithms. The experiments were run on a node with two Xeon 2.53 GHz CPUs. We parallelized the omnitig algorithm so that it utilized all eight available cores. We observe negligible running times for all algorithms on E. coli. On chr10, the running time of the omnitig algorithm is significantly longer (by 18 mins) than the unitig or Y-to-V algorithm, although it would still not form a bottleneck in an assembly pipeline. The memory usage did not exceed 1 GB at any point, although we believe it can be significantly reduced with a more careful implementation.
9. Conclusion
There are two natural directions for future work: practical and theoretical. In the practical direction, the omnitig algorithm should be extended to handle the complexities of real data such as sequencing errors, imperfect coverage, linear genomes, and double-strandedness. This is a nontrivial task that is outside the scope of the current study, but it will be important in facilitating the application to genome analysis and assembly. In the theoretical direction, we believe that omnitigs exhibit more structure that can be exploited in a faster algorithm for finding all maximal omnitigs. We are also currently studying the graph model in which a genomic reconstruction is any collection of circular walks that together cover all nodes/edges of the graph (as in metagenomic sequencing of bacteria). We are also studying the class of genome graphs admitting a single safe walk covering all of their nodes or edges, question related to those about unique reconstructions.
Footnotes
Acknowledgments
We would like to thank Daniel Lokshtanov for initial discussions, Rayan Chikhi for feedback on the article, and Nidia Obscura Acosta for very helpful discussion on the article. This work was supported, in part, by NSF awards DBI-1356529, IIS-1453527, and IIS-1421908 to P.M. and by Academy of Finland grant 274977 to A.I.T.
Author Disclosure Statement
No competing financial interests exist.
