PMCCPMCCPMCC

Search tips
Search criteria 

Advanced

 
Logo of frontbbLink to Publisher's site
 
Front Bioeng Biotechnol. 2016; 4: 35.
Published online 2016 June 8. doi:  10.3389/fbioe.2016.00035
PMCID: PMC4896921

Accurate Prediction of the Statistics of Repetitions in Random Sequences: A Case Study in Archaea Genomes

Abstract

Repetitive patterns in genomic sequences have a great biological significance and also algorithmic implications. Analytic combinatorics allow to derive formula for the expected length of repetitions in a random sequence. Asymptotic results, which generalize previous works on a binary alphabet, are easily computable. Simulations on random sequences show their accuracy. As an application, the sample case of Archaea genomes illustrates how biological sequences may differ from random sequences.

Keywords: K-mers, combinatorics, probability

1. Introduction

This paper provides combinatorial tools to distinguish biologically significant events from random repetitions in sequences. This is a key issue in several genomic problems as many repetitive structures can be found in genomes. One may cite microsatellites, retrotransposons, DNA transposons, long terminal repeats (LTR), long interspersed nuclear elements (LINE), ribosomal DNA, and short interspersed nuclear elements (SINE). In Treangen and Salzberg (2012), it is claimed that half of the genome consists of different types of repeats. Knowledge about the length of a maximal repeat is a key issue for assembly, notably the design of algorithms that rely upon de Bruijn graphs. In re-sequencing, it is a common assumption for aligners that any sequenced “read” should map to a single position in a genome: in the ideal case where no sequencing error occurs, this implies that the length of the reads is larger than the length of the maximal repetition. Average lengths of the repeats are given in Gu et al. (2000). Recently, heuristics have been proposed and implemented (Devillers and Schbath, 2012; Rizk et al., 2013; Chikhi and Medvedev, 2014).

A similar problem has been extensively studied: the prediction of the length of maximal common prefixes for words in a random set. Typical parameters are the background probability model, the size V of the alphabet, the length n of the sequence, and so on. Deviation from uniformity was studied for a uniform model as early as 1988 (Flajolet et al., 1988). A complexity index that captures the richness of the language is addressed in Janson et al. (2004). A distribution model, valid for binary alphabets and biased distributions, was introduced in Park et al. (2009), the so-called trie profile and extended to Patricia tries in Magner et al. (2014). The authors pointed out different “regimes” of randomness and a phase transition, by means of analytic combinatorics (Sedgewick and Flajolet, 2009). It was observed in Jacquet and Szpankowski (1994) that the average length of maximal common prefixes in a random set of n words is asymptotically equivalent to the average length of maximal repetitions in a random sequence of length n. Sets of words are considered below in the theoretical analysis. A comparison with the distribution of maximal repetitions in random sequences or real Archaea genomic sequences is presented in Section 3.

Our first goal is to extend results of Park et al. (2009) to the case of a general V-alphabet, including the special case {A, C, G, T} where V is 4. A second goal is to compare the results consistency with random data and real genomic data in the finite range.

To achieve the first goal, we rely on an alternative, and simpler, probabilistic and combinatorial approach that is interesting per se. It avoids generating functions and the Poissonization–dePoissonization cycle that is used in Park et al. (2009) and it extends to non-binary alphabets. In that case, there is no closed formula for the asymptotic behavior. Nevertheless, the Lagrange multipliers allow to derive it as the solution of an equation that can be computed numerically.

Explicit and computable bounds for the profile of a random set of n words are provided. Three domains can be observed. A first domain is defined by a threshold k for the length, called the completion length: any prefix with a length smaller than this threshold occurs at least twice. This threshold is extremely stable over the data sets and it is highly predictable. A similar phenomenon was observed for a uniform model in Fagin et al. (1979a) and a biased model (Mahmoud, 1992; Park et al., 2009). For larger lengths, some prefixes occur only once. In a second domain, called the transition phase, the number of maximal common prefixes is sublinear in the size n of the sequence: increasing first, then decreasing slowly, and, finally, dropping rapidly. In the third domain, for a length larger than some extinction length, almost no common prefix of that length occurs. Despite the fact that these bounds are asymptotic, a good convergence is shown in practice for random texts when a second-order term is known.

Differences between the model and the observation are studied on the special case of Archaea genomes. A dependency to the GC-content, which is a characteristic of each genome, is exhibited. Regimes and transitions are studied on these genomic data and theoretical results are confirmed, with a drift in the values of transition thresholds. Notably, the length of the largest repetitions is much larger than expected. This difference between the model and the observation arises from the occurrences of long repeated regions.

Section 2 is devoted to Main Results, to be proved in Section 4. First, some notations are introduced; then, an algebraic expression for the expectation of the number of maximal common prefixes in a sequence is derived in Theorem 2.1. Second, this expression is split between two sums that are computable in practical ranges. Then, it is shown that a Large Deviation principle applies. It yields first and second order asymptotic terms, and oscillations, that are provided in Theorem 2.2. A comparison between exact, approximate, and asymptotic expressions is presented in Section 3.

2. Main Results

It is assumed throughout this study that sequences and words are randomly generated according to a biased Bernoulli model on an alphabet of size V. Let p1, (...), pV denote the probabilities of the V characters χ1, (...) V.

Definition 2.1. For any i in {1, (...) ,V }, one notes

βi=log1pi.

Additionally,

pmin=min{pi;1iV}andαmin=1log1pmin=1max(βi);
(1)

pmax=max{pi;1iV}andαmax=1log1pmax=1min(βi).
(2)

The two values min(βi) and max(βi) are different when the Bernoulli model is non-uniform.

2.1. Enumeration

Definition 2.2. Given U a set of words and an integer k, k  2, a unique k-mer in U is a word i of length k such that

  1. w is a prefix of at least two words in U;
  2. and i is a prefix of a single word.

By convention, a unique 1-mer is a character χi that is a prefix of a single word.

Definition 2.3. Let U be a set of n words.

For k  1, one denotes B(n, k) the number of unique k-mers in U.

One denotes μ(n, k  1) the expectation of B(n, k) over all sets of n words.

Remark: It follows from Definition 2.2 that quantity B(n, k) is upper bounded by n. Observe that, for each random set U, it is the sum of a large number – Vk – of correlated random variables. Expectation μ(n, k) is studied below and compared in Section 3 with B(n, k + 1).

Profiles of repetitions can be expressed as a combinatorial sum.

Theorem 2.1. Given a length k, the expectation μ(n, k) satisfies:

μ(n,k)=nk1+kv=kkk1,,kVϕ(k1,,kV)ψn(k1,,kV)
(3)

where

ϕ(k1,,kV)=p1k1pVkV
(4)

ψn(k1,,kV)=i=1Vpi[(1φ(k1,,kV)pi)n1(1φ(ki,,kV))n1].
(5)

Proof. A word i is a unique (k + 1)-mer iff (i) w has length k and is the prefix of at least two words, including i; (ii) i is not repeated.

Event (i) has probability

nϕ(k1,,kV)pi[1(1ϕ(k1,,kV))n1].

Event (ii), which is a sub-event of (i), has probability

nϕ(k1,,kV)pi[1(1ϕ(k1,,kV)pi)n1].

2.2. A Combinatorial Expression

Definition 2.4. Given a k-mer w, let α denote klogn and ki denote the number of occurrences of character χi in w. The objective function is

ρ(k1,,kV)=i=1Vkikβi1α.
(6)

The character distribution (k1, (...) , kV) of a k-mer may be viewed as barycentric coordinates for a point β(k1,,kV)=i=1Vkikβi that lies in [min(βi);max(βi)]=1αmax;1αmin. The order of β points on that interval allows for a classification of k-mers that is a key to this study.

Definition 2.5. A k-mer w is said

  • a common k-mer if ρ(k1,…, kV) < 0;
  • a transition k-mer if ρ(k1, (...) , kV)  0 and its ancestor is a common k-mer;
  • a rare k-mer, otherwise.

Remark: If ρ(k1, (...) , kV) = 0, the condition on the ancestor is trivially satisfied.

Definition 2.6. Given a set U of n words and an integer k, let Dk(n) denote the set of character distributions (k1, (...) , kV) for rare and transition k-mers. Let Ek(n) denote the set of character distributions for common k-mers.

The set Dk(n) is the empty set if k < αmin log n and is the set of character distributions (k1, (...) , kV) if k > αmax log n. Computation of (3) is split among the two sets Dk(n) and Ek(n). Computations show that the main contribution arises from transition k-mers. A probabilistic interpretation will be discussed in 2.4.

Notation: Let S(k) and T(k) be

S(k)=nDk(n)kk1kVϕ(k1,,kV)ψn(k1,,kV);
(7)

T(k)=nEk(n)kk1kVϕ(k1,,kV)ψn(k1,,kV).
(8)

So μ(n, k) rewrites

μ(n,k)=S(k)+T(k).
(9)

These sums S(k) and T(k) can be efficiently computed for moderate k, up to a few hundred, approximately. In practice, αmax log n is below this threshold for the sizes of actual genomes and for their ordinary GC content value. The simulations in Section 3 show that this estimation is rather tight. Behavior and asymptotic estimates are derived and discussed in the next section.

2.3. Asymptotic Estimates

In this section, asymptotic estimates for (3) are derived. First, some characteristic functions are introduced. Then, it is observed that a Large Deviation Principle applies for the combinatorial sums to be computed and asymptotics for the dominating term follow. Amortized terms are also computed. It is shown in Section 3 that this second-order term cannot be neglected in the finite range.

2.3.1. Notations

For general alphabets, asymptotic behavior is a function of the solution of an equation and depends on domains whose bounds are defined below.

Definition 2.7. Let (pi)1≤iV be a Bernoulli probability distribution. Let σ2 denote i=1Vpi2.

The fundamental ratio, noted α˜, is ipilog1pi1.

The transition ratio, noted α¯, is σ2ipi2log1pi1.

The extinction ratio, noted αext, is 2log1σ2.

Definition 2.8. Let α be a real value in [αmin, αmax]. Let τα be the unique real root of the equation

1α=i=1Vβieβiτi=1Veβiτ
(10)

Let ψ be the function defined in [αmin, αext] as

αminαα¯:ψ(α)=τα+αlogi=1Veβiτα;α¯α:ψ(α)=2αlog1σ2.

Proposition 2.1. The following property holds

αminα˜α¯αmaxαext.

Function ψ increases on [αmin,α˜] and decreases on [α˜,]. It satisfies

ψ(αmin)=ψ(αext)=0andψ(α˜)=1.
(11)

Remark: Uniqueness of τα is shown in Section 4.2. As τα¯=2, ψ is continuous at α = α¯, with ψ(α¯)=2α¯log1σ2.

2.3.2. Asymptotic Results

Theorem 2.2. Given a length α log n, when n tends to ∞ the ratio logμ(n,αlogn)logn satisfies:

0ααminorαextα:logμ(n,αlogn)logn0;
(12)

αminααext:logμ(n,αlogn)lognψ(α).
(13)

Moreover, let ξ be the function defined in [αmin, αext] as ξ(α)=μ(n,αlogn)lognψ(α). It satisfies

αminαα¯:ξ(α)V12log(αlogn)logn;
(14)

α¯ααext:ξ(α)log(1σ2)logn.
(15)

Proof. The key to the proof when α ranges in [αmin, αmax] is that ψn(k1, (...) kV) is maximal when ρ(k1, (...) kV) is close to 0. Sum T(k) satisfies a Large Deviation Principle.

logT(k˜)kmaxi=1Vkiklogkik;ρ(k1,,kV)=0.
(16)

The maximization problem rewrites as

maxi=1Vθilog1θi;i=1Vθi=1;i=1Vβiθi=1α;0θi1
(17)

The maximum value is τα+αlogi=1Veβiτα that is reached for the V-tuple θi=eβiταi=1Veβiτα1iV.

S(k) satisfies again a Large Deviation Principle when α < α¯, which yields the asymptotic result in this range. For larger α, S(k) is approximately (1σ2)n1αlog1σ2 that dominates T(k).

Details for the proof, including the short and long lengths, are provided in Section 4.

Remark: The discussion will depend of the ratio α=klogn. Possible values for α range over a discrete set as they are constrained to be the ratio of an integer by the log of an integer. An interesting property is that, for any real α, the set T = {n [set membership] N; α log n [set membership] N} is either empty or infinite. Indeed, when T is non-empty, it contains all values n(α)p where n(α) denotes the minimum value of T. It is beyond the scope of this paper to establish the number of other possible solutions.

2.3.3. Domains

Different domains arise from this Theorem, which were observed in Park et al. (2009). Equalities ψ(αmin) = 0 and ψ(α¯)=2α¯log1σ2 show that there is a continuity between domains.

When α lies inside the domain [αmin, αext], the ratio logμ(n,αlogn)logn is positive and parameters μ(n, α log n) are sub-linear in the size n of the text: some k-mers – mostly transition k-mers – are unique k-mers. Observe that the maximum value for ψ(α) is 1. When the Bernoulli model is uniform, this central domain is empty.

When the length is smaller than the completion length αmin log n or greater than the extinction length αext log n, the ratio logμ(n,αlogn)logn is negative.

2.3.4. Oscillations

Parameters (k1, (...) , kV) in the combinatorial sums are integers. As the optimum values (i)1≤iV may not be integers, the practical maximum is a close point on the lattice (k1, (...) , kV). The difference introduces a multiplicative factor that ranges in logpmaxpmin,logpmaxpmin. This leads to a small oscillation of log μ(n, k). For large n, this contribution to logμ(n,k)logn becomes negligible. As mentioned above, the set of lengths n that are admissible for a given α is very sparse. Nevertheless, an approximate value may be used: for instance, for an integer k′, 1klogn(α)kk is very close to α. This oscillation phenomenon was first observed in Nicodème (2005).

2.3.5. Binary Alphabets

Results for binary alphabets in Park et al. (2009) steadily follow from Theorem 2.2. A rewriting of ψ leads to alternative expression (18). This explicit expression points out the dependency to the distances to αmin and αmax, and the behavior around these points.

Corollary 2.1. Assume that the alphabet is binary. Then

ψ(α)=αlogpmaxpminlog[sα1α1αmin+sα1α1αmax]
(18)

where

sα=αminαmaxααminαmaxα.
(19)

A similar result holds for DNA sequences when the alphabet is 4-ary and the probability distribution satisfies pA = pT and pC = pG. Such a distribution is defined by its GC-content pG + pC.

2.4. A Probabilistic Interpretation

The main contribution to μ(n, k) arises from k-mers with an objective function close to 0, i.e., transition k-mers. Such k-mers exist in the transition phase [αmin log n, αmax log n] where they coexist with rare or common k-mers. Observe that this phase is shrinked when the Bernoulli model is uniform, as pmin = pmax and αmin = αmax. Therefore, most unique k-mers are concentrated on the two lengths [left floor]αmin log n[right floor] and [left ceiling]αmin log n[right ceiling], as observed initially in Fagin et al. (1979b).

Let k be some integer in the transition phase. First, the relative contribution of S(k) and T(k) to μ(n, k) varies with the length k. For lengths close to αmin log n, most words are common and T(k) dominates S(k). When k increases, the proportion of common words decreases and the relative contribution of T(k) decreases.

Second, the dominating term in μ(n, k) arises from transition k-mers. Let w be a word of length k, the character distribution in w be (k1, (...) , kV) and χi be some character. The number of words that admit w or i as a prefix fluctuates around the expectations (k1, (...) , kV) and (k1, (...) , kV)pi, respectively. On the one hand, when word i is a rare word, (k1, (...) , kV) is less than 1. The smallest (k1, (...) , kV) is, the less likely the actual number of occurrences of w is greater than 2 and the smallest the contribution of i to S(k), and μ(n, k), is. On the other hand, let i be a common k + 1-mer; w is a common k-mer and then (k1, (...) , kV) is greater than 1. The largest (k1, (...) , kV) is, the more likely the word i is repeated and the smallest the contribution to T(k), and μ(n, k), is.

For a short length, i.e., k smaller than the completion length kmin, all words are common. In a given sequence, most k-mers are repeated at least twice and there is (almost) no unique k-mers.

For a large length k, i.e., k greater than kmax, all words are rare. Nevertheless the number of unique k-mers remains sublinear in n in the range [αmax log n, αext log n]: the sum of small contributions arising from a large number of possible words is significant.

A folk theorem (Szpankowski, 2001; Jacquet and Szpankowski, 2015) claims that the objective function is concentrated around 1α˜1α. Consequently, when α = α˜, most k-mers are transition k-mers and the exponent, the ψ function, is maximal.

3. Experiments and Analysis

Simulations are presented for random and real data. For each simulation, a suffix tree (Ukkonen, 1995) is built, where each leaf represents a unique k-mer. For random cases, the Ukkonen’s insertion step is iterated until a tree with exactly n leaves is build. This requires n + kins insertions of symbols, where kins > 0 is relatively small (there is a value of a few dozen in practice for considered n). One can observe that the event of having n leaves after n + k  1 insertions corresponds to the fact that the trailing k-mer is unique in the sequence of length n + k  1.

Even if a statistical bias exists, with respect to the case of a set of N random words analyzed in previous sections, this bias for respective values on k and n is below the numeric precision used for tables below.

Then, one simulation that is related to the case of a set of n random words, requires the generation of the order of N random symbols from a small alphabet, following a Bernoulli scheme. For this range of n, and even in the case of a hundred consecutive simulations, this corresponds to a regular use of a common random number generator (Knuth, 1998).

A first set of simulation deals with the case of random sequences over a binary alphabet, since the results can be compared with previous work. A second set addresses the case of random sequences over a quaternary alphabet {A, C, G, T} with a constrained distribution such that probabilities pApT and pCpG as it is the case for DNA sequences (where the sum pC + pG is also known as the GC-content). Results on such random sequences are then compared with the sample biological sequence of an Archaea (Haloferax volcanii).

An implementation with a suffix array (Manber and Myers, 1993) allows for a compact representation and an efficient counting (Beller et al., 2013).

3.1. Random data

A hundred binary sequences were randomly generated. The number of leaves in each tree was fixed to n = 5000000 and the Bernoulli parameter was pmax = 0.7000. Therefore, pmin = 0.3000, p˜=0.5429, and log n = 15.4249. The thresholds for α and the corresponding lengths α log n are:

Table thumbnail

3.1.1. Statistical Behavior on Random Sets

Throughout experiments, every sample profile for a given sequence fluctuates very little around the expectation.

Table Table11 provides experimental results averaged over a hundred binary sequences. Short length with no observed unique k-mer is removed. Column 2 gives the mean of B(k + 1), i.e., the mean number of observed leaves at depth k + 1, over the set of a hundred simulations. Columns 3 to 5 give the computed values for S(k), T(k), and μ(k), using the expressions, equations (79).

Table 1

Mean profile for 100 random binary sequences.

The actual number of leaves B(n, k + 1) is very close to the average value μ(n, k), and simulations show that this is the general case when (only) a hundred simulations are performed: μ(n, k) is a very good prediction.

Observed lengths of extinction also show very little variations. In array below, each column gives nk, the number of sequences out of the one hundred sample set for which the longest repetition had length k.

Distribution of the extinction level for 100 random binary sequences.pmax is 0.7.

Table thumbnail

In the binary case, the predicted extinction length is between 56 and 57. It is noticeable that, in most cases, the observed depth is slightly smaller than this value. In Table Table1,1, value 0.04 for μ(n, 61) means that one expects a total of four leaves at depth 60 over one hundred sequences. In that run, exists a total amount of 8.

3.1.2. Quality of Estimates

  1. Tightness of the asymptotic estimates. Asymptotic estimates (13) given in Column 7 significantly overestimate the observed values in Column 6 that is computed directly from Column 2 and n. A first conclusion is that first-order asymptotics provide a poor prediction: next term is O1logn that goes slowly to 0.
  2. Tightness of the second-order asymptotics. Second term for the asymptotic ξ(α) ensures a much better approximation in Column 8.
  3. Growth of asymptotic estimates. Observed values increase with length until k=k˜ and then decrease. This is consistent with the variation of asymptotic values ψ(α).

3.1.3. Dependency to Probability Bias

Thresholds were computed for a given sequence length n and various probabilities. The more pmax departs from 0.5, the value for the uniform model, the largest the extinction length is. The completion length, kmin, slightly decreases, while the extinction length significantly increases. Nevertheless, this effect is limited when the largest probability pmax remains in the range [0.5;0.7].

Dependency of thresholds to pmax for binary alphabets, n = 5,000,000.

Table thumbnail

3.2. Long Repetitions in Archaea Genomes

The experimental data set is the sequence from Haloferax volcanii DS2 chromosome, complete genome (Hartman et al., 2010). The alphabet is quaternary. Profile results are shown in Table Table22.

Table 2

Profile for the sequence from Haloferax volcanii DS2 chromosome, complete genome.

Sequence length is n = 2847757. The observed symbol frequencies are pA = 0.1655; pC = 0.3334; pG = 0.3330; pT = 0.1681. Therefore, observed GC-content is 0.6664. Parameters for an approximate degenerated quaternary model are pA = pT = pmin = 0.1668; pC = pG = pmax = 0.3332; p˜=0.2645; and log n = 14.8620. The thresholds for the domain are

Table thumbnail

Statistics on one hundred random sequences with same parameters are shown in Table Table3.3. GC-content is 0.6664. Extinction level is provided in Table Table4.4. Observe first a good match between the observed values, the predicted values for μ(n, k), and the asymptotic values for random data. As shown for binary alphabets, the observed extinction level for random sequences departs very little from the predicted kext level.

Table 3

Mean profile for 100 random degenerated quaternary sequences.

Table 4

Distribution of the extinction level for 100 random degenerated quaternary sequences.

Numerous differences with random data can be observed on real genomes.

Interestingly, the behavior for short lengths and in the transition phase is similar to the random behavior. Observation and prediction have the same order of magnitude. In particular, the number of unique k-mers is maximum for length k˜ where observation and prediction coincide. For a real genome and a length k smaller than kmin, observed B(n, k + 1) is larger than predicted μ(n, k). This indicates, at a level k + 1 where completion is expected, more leaves in the real trie, more missing words at level k + 2. Simultaneously, less internal nodes occur at level k + 1 because the total sum is constant and equal to Vk+1.

The effect of (non-random) repetitions is more sensible in the decreasing domain. First, the number of unique k-mers decreases much more slowly than expected for lengths larger than kmax. A significant gap can be observed around extinction level kext. The decrease rate, which was around 0.02–0.04 drops to 0.007 and then becomes even lower. Finally, the extinction level is much larger than the predicted value 23: the largest repetition is 1395 bp long.

To evaluate the contribution of long repetitions, one may erase the longest ones. When a word w is repeated, any proper suffix of w is also repeated. Consequently, once the longest repeated word is erased, one unique k-mer (only) disappears for each length larger than the length of the second largest subsequence (here, 935). The profile remains far from the random profile. This observation is still true if the 10 longest subsequences are erased.

4. Combinatorial and Analytic Derivation

4.1. Lagrange Multipliers

Lagrange multipliers method allows to maximize an expression under constraints. To compute (17), one sets

F=i=1Vθilogθi;
(20)

G=i=1Vθi;
(21)

H=i=1Vθiβi.
(22)

Two constraints are given:

G=1andH=1α.

An intermediary function ϕα(τ1, (...) τV) is defined

ϕα=F+λαG+ταH
(23)

In order to maximize ϕ under these two constraints, ϕ function is derived with respect to each random variable τi. This yields V equations

1+logθi+λα+ταβi=0.
(24)

Two indices imin and imax are chosen that satisfy βiminβimax. For instance

βimin=min(βi)1iV=log1pmax;βimax=max(βi)1iV=log1pmin.

Solving equation (24) with indices imin and imax yields

τα=logθiminlogθimaxβimaxβimin=logθiminθimax1βimaxβimin;1+λα=βiminlogθimaxβimaxlogθiminβimaxβimin.

Remaining equations rewrite:

logθi=logθimin+τα(βiminβi).
(25)

Using the constraint i=1Vθi=1 that yields

θimineβiminταi=1Veβiτα=1,

and an expression for θimin follows. Therefore Equation 25 rewrites:

θi=eβiταi=1Vβieβiτα.
(26)

Finally, Equation i=1Vθiβi=1α yields equation (10).

1α=i=1Vβieβiταi=1Veβiτα.

For this V-tuple

i=1Vθilogθi=i=1Vθiβiταi=1Vθilogi=1Veβiτα=τααlogi=1Veβiτα.

4.2. Approximation Orders

Derivating the RHS of (10) yields ij(βi+βj)2e(βi+βj)τ(ieβiτ)2 that is positive. Therefore, for any α, the solution to (10) is unique. Moreover, τα increases with α. Let

ψ1(α)=τα+αlogi=1Veβiτα;
(27)

ψ2(α)=2αlog1σ2.
(28)

Notably, the solutions τα of (10) associated with the four increasing values of α: (αmin,α˜,α¯,αmax) are (–∞, 1 + 2, + ∞). Computing ψ for these values yields (11) and Equality ψ1(α˜)=ψ2(α˜).

Derivating both expressions yields

ψ1α(α)=logi=1Veβiτα;
(29)

ψ1α(α)ψ2α(α)=log1σ2i=1Veβiτα.
(30)

Both derivatives are monotone functions of τα. In equation (30), derivative is 0 when α=α¯. Therefore, ψ is the maximum of the two values ψ1 and ψ2 over the interval [αmin, αmax]. The former equation is 0 if α = α˜. Therefore, ψ is maximum when α = α˜.

4.3. Approximations

4.3.1. Short Lengths

Assume that k  αmin log n. Each term ϕ(k1, (...) , kV) is lower bounded by pmink=nαlogpmin=nααmin. Each term ψn(k1, (...) , kV) is trivially bounded by en1ααmin that is upper bounded by 1 and n(k1, (...) , kV) tends to 0 when n goes to ∞. As (kk1,kv)ϕ(k1,,kV)=1, the ratio logμ(n,k)logn is negative.

4.3.2. Moderate and Large Lengths

For a length k in the transition domain [αmin log n, αmax log n], the objective function may be either positive or negative. When k > αmax log n, set Ek(n) is empty and μ(n, k) reduces to S(k).

The maximum M among the terms ekikiklogkik1klognϕ(k1,,kV) in T(k) is reached when ρ(k1,  (...) , kV) is 0. Due to the exponential decrease of enϕ(k1,,kV) when (k1, (...) , kV)  1, T(k)k is upper bounded. Computation of log M is done with Lagrange multipliers, as explained above.

Computation of S(k) relies on the local development of ψn(k1, (...) , kV), that is n(1–σ2)ϕ (k1, (...) , kV). S(k) rewrites σ2kS˜(k)+(S(k)σ2kS˜(k)) where S˜(k)=ρ(k1,,kV)0kkip12σ2k1pV2σ2kV. This sum satisfies a Large Deviation Principle when ρ(k1,,kV)+1α1α˜, or α < α˜. In this range, S˜(k)kmaxi=1Vkiklogkik, which was shown to be ψ(α).

When α > α˜, sum S˜(k) rewrites 1S¯(k) where

S¯(k)=ρ(k1,,kV)+1α<1α˜kkip12σ2k1pV2σ2jV.

This sum satisfies a Large Deviation Principle and

S¯(k)kmaxi=1Vkiklogkik+i=1Vkiklogpi2σ2.

As i=1Vkiklogpi2σ2=2α+log1σ2, this maximum is

1α[2αlog1σ2ψ(α)]

that is negative.

4.4. Binary Case

Barycentric coordinates of α are unique. Indeed, equation (10) reduces to a linear equation on the variable e(β2β1)τ

1α=β1+β2e(β2β1)τ1+e(β2β1)τ

where β2β1=βminβmax=logpmaxpmin. Therefore, e(β2β1)τ=1αβ1αβ21. Finally

τα=1logpmaxpminlogαβ211αβ1=1logpmaxpminlog1αmin1α1α1αmax.

Function ψ rewrites, in the binary case:

ψα=τα=αloge1αταeβ11ατα+eβ21ατα.

Observing that e(β2β2)τα=sα and changing variable τα into (β2  β1) yields eβ11ατα=sα1αmin1α and eβ21ατα=sα1αmax1α.

5. Conclusion

This paper describes the behavior of the number of unique or repeated k-mers in a random sequence, on a general alphabet. Derivation relies on a combination of analytic combinatorics and on Lagrange multipliers. It simplifies an approach provided for binary alphabets and allows to address larger alphabets, including the quaternary alphabets, such as DNA alphabet. Precise asymptotic estimates are provided and a probabilistic interpretation is given. They are validated on random simulated data and shown to be valid in the finite range. Therefore, they provide a valuable tool to estimate a suitable read length for assembly purposes and tune parameters for assembly algorithms. Real genomes significantly depart from the random behavior for long repetitions. The general shape of the trie profile is observed, with a maximum of the number of unique k-mers at the expected length. However, for real genomes, a number of very short k-mers are missing and, on the contrary, one observes a number of very long repetitions. Besides these events, the behaviors are rather similar.

In the future, it is worth extending the method to generalized Patricia tries, Markov models and approximate repetitions.

Author Contributions

Both authors contributed equally.

Conflict of Interest Statement

The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

Funding

Inria-Cnrs-Poncelet grant Carnage.

References

  • Beller T., Gog S., Ohlebusch E., Schnattinger T. (2013). Computing the longest common prefix array based on the burrows–wheeler transform. J. Discrete Algorithms 18, 22–31.10.1016/j.jda.2012.07.007 [Cross Ref]
  • Chikhi R., Medvedev P. (2014). Informed and automated k-mer size selection for genome assembly. Bioinformatics 30, 31–37.10.1093/bioinformatics/btt310 [PubMed] [Cross Ref]
  • Devillers H., Schbath S. (2012). Separating significant matches from spurious matches in dna sequences. J. Comput. Biol. 19, 1–12.10.1089/cmb.2011.0070 [PMC free article] [PubMed] [Cross Ref]
  • Fagin R., Nievergelt J., Pippenger N., Strong H. R. (1979a). Extendible hashingâ – a fast access method for dynamic files. ACM Trans. Database Syst. 4, 315–344.10.1145/320083.320092 [Cross Ref]
  • Fagin R., Nievergelt J., Pippenger N., Strong R. (1979b). Extendible hashing: a fast access method for dynamic files. ACM Trans. Database Syst. 4, 315–344.10.1145/320083.320092 [Cross Ref]
  • Flajolet P., Kirschenhofer P., Tichy R. F. (1988). Deviations from uniformity in random strings. Probab. Theory Relat. Fields 80, 139–150.10.1007/BF00348756 [Cross Ref]
  • Gu Z., Wang H., Nekrutenko A., Li W. H. (2000). Densities, length proportions, and other distributional features of repetitive sequences in the human genome estimated from 430 megabases of genomic sequence. Gene 259, 81–88.10.1016/S0378-1119(00)00434-0 [PubMed] [Cross Ref]
  • Hartman A. L., Norais C., Badger J. H., Delmas S., Haldenby S., Madupu R., et al. (2010). The complete genome sequence of haloferax volcanii ds2, a model archaeon. PLoS One 5:e9605.10.1371/journal.pone.0009605 [PMC free article] [PubMed] [Cross Ref]
  • Jacquet P., Szpankowski W. (1994). Autocorrelation on words and its applications: analysis of suffix trees by string-ruler approach. J. Comb. Theory A 66, 237–269.10.1016/0097-3165(94)90065-5 [Cross Ref]
  • Jacquet P., Szpankowski W. (2015). Analytic Pattern Matching: From DNA to Twitter. Reading, MA: Cambridge University Press.
  • Janson S., Lonardi S., Szpankowski W. (2004). “On the average sequence complexity,” in Combinatorial Pattern Matching, eds Sahinalp S. C., Muthukrishnan S., Dogrusoz U., editors. (Berlin Heidelberg: Springer; ), 74–88.
  • Knuth D. (1998). The Art of Computer Programming, Volume Two, Seminumerical Algorithms. Reading, MA.
  • Magner A., Knessl C., Szpankowski W. (2014). “Expected external profile of patricia tries,” in Proceedings of the Meeting on Analytic Algorithmics and Combinatorics (Society for Industrial and Applied Mathematics), 16–24.
  • Mahmoud H. (1992). Evolution of Random Search Trees. New York: John Wiley & Sons.
  • Manber U., Myers G. (1993). Suffix arrays: a new method for on-line string searches. SIAM J. Comput. 22, 935–948.10.1137/0222058 [Cross Ref]
  • Nicodème P. (2005). “Average profiles, from tries to suffix-trees,” in 2005 International Conference on Analysis of Algorithms, Volume AD of DMTCS Proceedings, ed. Martìnez C., editor. (Barcelona, Spain: Discrete Mathematics and Theoretical Computer Science), 257–266.
  • Park G., Hwang H.-K., Nicodeme P., Szpankowski W. (2009). Profile of trie. SIAM J. Comput. 38, 1821–1880.10.1137/070685531 [Cross Ref]
  • Rizk G., Lavenier D., Chikhi R. (2013). Dsk: k-mer counting with very low memory usage. Bioinformatics 29, 652–653.10.1093/bioinformatics/btt020 [PubMed] [Cross Ref]
  • Sedgewick R., Flajolet P. (2009). Analytic Combinatorics. Reading, MA: Cambridge University Press.
  • Szpankowski W. (2001). Average Case Analysis of Algorithms on Sequences. New York: John Wiley and Sons.
  • Treangen T. J., Salzberg S. L. (2012). Repetitive dna and next-generation sequencing: computational challenges and solutions. Nat. Rev. Genet. 13, 36–46.10.1038/nrg3117 [PMC free article] [PubMed] [Cross Ref]
  • Ukkonen E. (1995). On-line construction of suffix trees. Algorithmica 14, 249–260.10.1007/BF01206331 [Cross Ref]

Articles from Frontiers in Bioengineering and Biotechnology are provided here courtesy of Frontiers Media SA