Mapping single molecule sequencing reads using basic local alignment with successive refinement (BLASR): application and theory
 Mark J Chaisson^{1} and
 Glenn Tesler^{2}Email author
DOI: 10.1186/1471210513238
© Chaisson and Tesler; licensee BioMed Central Ltd. 2012
Received: 12 March 2012
Accepted: 17 September 2012
Published: 19 September 2012
Abstract
Background
Recent methods have been developed to perform highthroughput sequencing of DNA by Single Molecule Sequencing (SMS). While NextGeneration sequencing methods may produce reads up to several hundred bases long, SMS sequencing produces reads up to tens of kilobases long. Existing alignment methods are either too inefficient for highthroughput datasets, or not sensitive enough to align SMS reads, which have a higher error rate than NextGeneration sequencing.
Results
We describe the method BLASR (Basic Local Alignment with Successive Refinement) for mapping Single Molecule Sequencing (SMS) reads that are thousands of bases long, with divergence between the read and genome dominated by insertion and deletion error. The method is benchmarked using both simulated reads and reads from a bacterial sequencing project. We also present a combinatorial model of sequencing error that motivates why our approach is effective.
Conclusions
The results indicate that it is possible to map SMS reads with high accuracy and speed. Furthermore, the inferences made on the mapability of SMS reads using our combinatorial model of sequencing error are in agreement with the mapping accuracy demonstrated on simulated reads.
Background
The first step in a resequencing study is to map reads from a sample genome onto a reference, accounting for sample variance and sequencing error. An accurate and sensitive approach is to use SmithWaterman[1] alignment; however, this is computationally infeasible for mapping to nearly any genome. Instead, methods have been created using heuristics and data structures that are appropriate for rapid mapping of the type of read considered. For example, reads produced by Sanger sequencing that are highly accurate and nearly 1000 bases long are successfully mapped using hashbased methods such as MEGABLAST[2], cross_match (Green P.,http://www.phrap.org, unpublished), and BLAT[3]. These methods are too inefficient to map read sets from next generation sequencing (NGS) instruments by Illumina (San Diego, CA, USA) and Life Technologies (Carlsbad, CA, USA), since they contain hundreds of millions of short reads. Instead, methods such as Bowtie, Bwa, and Soap2 are used[4–6]. These are based on querying the BurrowsWheeler Transform Fulltext Minutespace index (BWTFM)[7] of a genome. They are able to rapidly align reads when there is little variation between the read and the genome.
Sequencing methods based on single molecule sequencing (SMS) also produce large datasets that have high computational demands for mapping. SMS datasets do not have the length limitations of NGS or Sanger sequencing, but have a higher number of errors, and the errors are primarily insertions and deletions rather than substitutions. Thus, mapping methods created for NGS sequencing do not extend well to SMS reads. A recent study using the PacBioRS platform[8] included a large number of reads over 10 kilobases long. As reads become longer, the computational problem begins to resemble the whole genome alignment (WGA) problems that were examined when multiple mammalian genomes were sequenced[9–11]. The problem arises of how to align long (many kilobase) reads with moderate divergence from the genome (up to 20% divergence, concentrated in insertions and deletions) at the speed and sensitivity that NGS alignment methods operate.
Advances in isolation and detection of single molecules and reactions have enabled SMS methods[24–26]. These SMS methods monitor processes in real time. The PacBioRS instrument produces reads by detecting which fluorescently labeled nucleotides are incorporated into a DNA chain as a template sequence is replicated by DNA polymerase. Other SMS methods have been proposed using detection of cleaved bases that pass through a protein nanopore[25], and identifying bases that have translocated through a nanopore fabricated in a graphene membrane[27]. In the case of the PacBioRS sequencing, a missing or weak signal of nucleotide incorporation results in a deleted base, and nucleotides that give fluorescence signal without being incorporated lead to insertions.
We propose aligning SMS reads with high indel rates to genomes as follows. First, find clusters of short exact matches between the read and the genome using either a suffix array or BWTFM index[7]. Then, perform a more detailed alignment of the regions where reads are matched to assign the alignment. To investigate the feasibility of doing this in the human genome, we need to determine two metrics: (1) the number of matches of minimal length expected to exist between a read and the genome at a given sequencing accuracy and read length, and (2) the number of false positive clusters the read is expected to have elsewhere in the genome. If the chances of finding a match between the read and the genome are low, or if there are many regions a read may map to incorrectly with high identity, our proposed approach would not be feasible. For a particular read length and accuracy, we present a method to determine the probability that the read contains a sufficient number of anchors to map; this method is based on counting integer compositions. We next examine the repeat structure of the human genome to determine how difficult it is to map to due to the repetitive nature of the genome. Rather than defining repeat content as the amount of sequence sharing high percent identity, we measure a different similarity metric on the human genome, the anchor similarity, where sequence similarity is measured as the number of shared anchors between the two sequences from the genome. We find that there are both a high number of expected matches between the read and the genome, and few false positive clusters of matches of the same size elsewhere in the genome, indicating that the proposed approach is feasible for mapping reads to the human genome.
We implemented our method in a program called BLASR (Basic Local Alignment with Successive Refinement), which combines the data structures used in short read mapping with alignment methods used in whole genome alignment. A BWTFM index or suffix array of a genome is queried to generate short exact matches that are clustered and give approximate coordinates in the genome for where a read should align. A rough alignment is generated using sparse dynamic programming on a set of short exact matches in the read to the region it maps to, and a final detailed alignment is generated using dynamic programming within an area guided by the sparse dynamic programming alignment.
Results and discussion
Our results are broken down into two sections; in the first, we examine characteristics of PacBioRS reads, and present theory on how these sequences contain matches that may be used to anchor alignments to the genome. In the next, we present a practical comparison of alignment methods on PacBioRS sequences.
Mapping feasibility
Our strategy to map SMS reads is to locate a relatively small number of candidate intervals where the read may map and then use detailed pairwise alignments to determine the best candidate. The candidate intervals may be found by locating all exact matches between the read and the genome, and then finding dense clusters of exact matches (anchors) in spans of similar length and the same (or reverse complement) order and orientation in both the genome and read, as described in detail in Methods. The feasibility of the method depends on the balance of having enough anchors to detect the correct interval to align a read to, vs. having so many anchors that clustering takes a prohibitive amount of time.
Other alignment methods such as Gapped BLAST[28] and BLAT[3] have shown that it is useful to initiate alignments at pairs of anchors. The waiting lengths may be used to compute the length of read required to be certain of having at least N anchors. Instead of using waiting lengths, it is possible to directly compute the probability of sequencing a certain number of anchors when the error rate is known. We do this with a model that approximates all errors as point mutations on a scan across a template. Given a fixed template length L, a minimal anchor length K, a number of errors M, and a number of anchors N, define NumConfigurations (M,N,K,L) as the number ways to distribute the positions of M errors when reading from the template such that there are at least N maximal substrings of length ≥ K not interrupted by error. In Appendix 1, we compute this using generating functions, allowing us to apply the result across the read lengths and error profiles found in SMS sequencing. Weese et al.[29] considered a similar problem for short reads and low error rates, and set bounds for filtering alignment hits in a qgram based mapping method by using a dynamic programming approach.
When a read is sampled from a repeat in the genome, there are likely to be many dense clusters of anchors mapping the read across the genome. Assuming the repeat is divergent, it is necessary to perform a detailed alignment (SmithWaterman) to all intervals containing dense clusters of anchors in order to distinguish the correct mapping location from other repeats. For copies of a repeat such as Alu or LINE in the human genome, the computational demands are too prohibitive to align the read against all instances of the repeat. On the other hand, if only a limited number of mapped locations are aligned in detail, the chance of finding the correct location is small. The similarity of repeats in a genome is typically defined by percent identity from a pairwise alignment of the two sequences[30]. However, sequences that have a high percent similarity may not share many long stretches of exact matches, which is how they are compared when using anchorbased mapping. To characterize repeats with respect to anchorbased mapping, we introduce an alternative metric: the anchor similarity of two sequences is the maximum number of fixedlength, nonoverlapping, ordered anchors, shared between two sequences, with certain constraints on anchor spacing. If the anchor similarity is S, we also say the two sequences are S similar, and ≥ S similar when two sequences have anchor similarity that is at least S. Using fixedlength anchors simplifies the presentation, although the BLASR method uses variable length anchors. Anchor similarity requires two parameters: K, the minimum anchor size; and δ, the indel rate, which may change the spacing between anchors. The constraints reflect the spacing one would expect between anchors of a read with indel errors and a genome. For example, consider a sequence that contains anchors at coordinates a and b, matching anchors at coordinates a^{′} and b^{′}in another sequence. If the ratio of the gaps between anchors is bounded by$1\delta \le \frac{ba}{{b}^{\prime}{a}^{\prime}}\le 1+\delta $ (consistent with the indel rate), then a and b may be included in the count for the anchor similarity of the two sequences. Further details on computing anchor similarity are given in the Additional file1: Text S1, Section 1.1.
We compared the distribution of values of anchor similarity from the human genome with values of$\text{NumConfigurations}(M,N,K,L)/\left(\genfrac{}{}{0ex}{}{L}{M}\right)$ to see how the mapability of sequences compares to the expected distributions of matching anchors. Reads from intervals of a genome that have low anchorsimilarity to the rest of the genome are likely to have few spurious matching clusters and are thus likely to be uniquely mapped. Conversely, a read sampled from an interval that has high anchorsimilarity with many other intervals likely has many clusters of matches to the genome. Figure5 shows an estimate of the number of intervals that must be searched when using anchorbased seeding to gain a certain degree of sensitivity of finding the true match. For example, when requiring only one or more matches of length 15 to find an interval, 22% of the sequences have up to 100 matching intervals in the genome (Figure5A, point P). If instead 20 or more matches were required in order to find an interval, 97% of the regions of the regions sampled have up to 100 matching intervals in the genome (Figure5D, point Q). The combination of the values of$\text{NumConfigurations}(M,N,K,L)/\left(\genfrac{}{}{0ex}{}{L}{M}\right)$ and intuition for the feasibility of mapping sequences at various error rates in the human genome. From Figure4, for reads sequenced at 85% accuracy, it is very likely there are least 8 anchors of there are least 8 anchors of length 20 or greater in any read. The green points in C show the number of matching intervals when using a similar set of parameters: at least 10 anchors of length 20. Importantly, 95% of the samples match uniquely in the genome.
As shown in Figure4B, a read with a 15% error rate has a 97% chance of having 10 anchors of length 15 or more. The anchor similarity corresponding to these reads uses parameters δ = 0. 15,L = 1000, and k = 15, and is shown by the red curve in Figure5A. Over 90% of the sampled intervals only have one location with at least 10 anchors of length 15, indicating they map uniquely under this repeat under this repeat metric. The other two genomes, E. coli, and A. thaliana, are shown for
Mapping benchmarks
Datasets used in benchmarking
Dataset  Description 

E. coliPacBioRS  E. coli O104:H4 sequenced at 48× coverage by the 
Pacific BiosciencesRS sequencer.  
E. colisimulated  50× coverage of reads simulated from E. coli O104:H4. 
H. sapiens  100 MB of reads simulated from the human genome. 
A comparison of the BLASR, BWASW, and BLAT methods on E. coli reads
Method  Number of aligned reads  Number of aligned bases  Run time 

BLASRSA  94057  230.8 M  20m 54s 
BLASRBWT  94527  230.1 M  33m 57s 
BWASW  97729  132.4 M  434m 5s 
BLAT  99530  181.7 M  4724m 40s 
A comparison of the BLASR, and BWASW methods on simulated reads
Method  Correctly mapped  Incorrectly mapped  Skipped  Runtime  Memory  

reads  bases  reads  bases  reads  footprint  
E. coli  
BLASRSA  108789  266.5M  229  0.38M  3766  48m 18s  202 MB 
BLASRBWT  108795  265.3M  259  0.45M  3604  59m 39s  46 MB 
BWASW  111192  261.9M  1835  0.91M  3005  223m 57s  190 MB 
H. sapiens  
BLASRSA  41726  102.3M  1074  1.89M  413  92m 26s  14.7 GB 
BLASRBWT  41582  101.7M  1159  1.75M  472  53m 26s  8.1 GB 
BWASW  40381  96.3M  292  1.16M  1554  105m 24s  4.2 GB 
Conclusion
Methods to produce reads through single molecule sequencing were mostly theoretical a decade ago and are now produced in high throughput on an industrial platform. The different characteristics of the sequences produced by SMS relative to Next Generation sequencing (sequences several orders of magnitude longer than previous technologies, at the expense of a higher error rate concentrated in insertions and deletions), require new computational techniques to be efficiently analyzed. Here, we addressed the problem of mapping SMS reads to a reference genome by first examining the feasibility of mapping SMS reads, and then by benchmarking our new alignment method on reads produced by the PacBioRS instrument. The source code is available under the BSD license athttps://github.com/PacificBiosciences/blasr and is the default alignment method available to all running the PacBioRS.
There are many emerging problems for processing SMS sequences. As the length of the reads produced by SMS increases, the computational problem resembles whole genome alignment more than the read mapping problem. This increases the need to have methods that accurately detect structural rearrangements covered by single reads. Furthermore, with the inevitable exponential increase in sequencing throughput, the current methods will not be sufficient to align SMS reads without a large amount of time or computational resources, and further algorithmic improvements will be necessary. We did not address the issue of using multiple sequence alignment to produce a consensus sequence or variant calls. It has been shown that the additional information one may gain by observing the signal from singlemolecule events in real time may indicate DNA modifications such as methylation[25, 31]. Thus, methods that produce consensus calls from SMS sequences may reveal more information about the sample sequence if this extra information is used. We aim to address many of these problem in subsequent iterations of the BLASR method.
Methods
Detecting candidate intervals
The input to the BLASR method is a read r with nucleotides r_{1},…,r_{ R }; a genome g with nucleotides g_{1},…,g_{ G }; and a minimum match length, K. Other parameters that modify small details of mapping are introduced in their context later. We find all exact matches of substrings (of length at least K) from the read and the genome. An exact match of anchor a to the genome may be described by a triplet (Read(a), Genome(a), l(a)), where Read(a) is the start of the match in the read; Genome(a) is the start of the match in the genome; and l(a) is the length of the match. The set of all matches is$\mathcal{A}$.
We use either a suffix array (SA) or BWTFM index on the genome to query for exact matches, depending on time and space requirements. While some NGS alignment methods such as mrFAST and RazerS match using hash tables on fixed width words (qgrams)[29, 32], the SA and BWTFM index allow matching long exact matches if they exist, and also encode positions of shorter matches if a more sensitive search is required. The two data structures support the same queries: c = Count(q t), the number of times a query sequence r occurs exactly in a text g; and$\mathcal{P}=\{{p}_{1},\dots ,{p}_{c}\}=\text{Locate}(q,t)$, the starting positions of all instances of r in g. Without changing the computational complexity of these queries, they may be modified to answer equivalent queries for counts and locations of the longest common prefix (LCP) between a query and a genome. Let (c l) = COUNTLCP(q t) be the operation that finds the count c and length l of the LCP between q and t. We locate anchors by greedily finding matches slightly shorter than the LCP (specified by a parameter defaulting to 1 base shorter than the LCP) to increase sensitivity and avoid using an LCP that erroneously ends in a sequencing error. The minimum length anchor that is allowed is of length K, where K = 12 in most applications. To build$\mathcal{A}$, we scan across all positions in a read i ∈ {1,…,R − k}; we compute (c l_{ i }) = COUNT LCP(r_{i,…,R}g) and${\mathcal{P}}_{i}=\text{Locate}({r}_{i,\dots ,i+{l}_{i}e},g)$; and then for all positions${p}_{j}^{i}\in {\mathcal{P}}^{i}$, we include in$\mathcal{A}$ a match a with Read(a)=i,$\left(\right)close="">\text{Genome}\left(a\right)={p}_{j}^{i}$, and l(a) = l_{ i }. We choose a parameter MaxCount, which specifies the maximum number of times we allow a match to appear to generate an anchor. We exclude positions mapped when$\left{\mathcal{P}}^{i}\right>\mathrm{\text{MaxCount}}$, or short matches when l_{ i } < k.
Descriptions of the implementation and methods for the Count and Locate queries using suffix arrays are given in[33]. Similar descriptions for the BWTFM index are in[7] and[4]. The CountLcp operation is about 1.5× faster using a suffix array than a BWTFM index, in our tests searching the human genome and limiting the number of times an LCP occurs to 10,000; however, the space usage for the index on a human genome is 12.8 GB with a suffix array, vs. 4.8 GB in our implementation of a BWTFM index. Our implementation of the Locate operation is faster for larger genomes using the BWTFM index than the suffix array when using SIMD hardware optimization. Because either index is shared across many threads, the amortized space usage is modest for both data structures.
Once the set of anchors$\mathcal{A}$ is generated, we cluster anchors using global chaining[34]. To do so, we first sort$\mathcal{A}$ by position in the genome and then by position in the read. Next, clusters of anchors are found in intervals roughly the length of the read. For every anchor${a}_{i}\in \mathcal{A}$, a set${\mathcal{A}}_{i}$ is created with${\mathcal{A}}_{i}=\{{a}_{j}\in \mathcal{A}:0\le \phantom{\rule{0.3em}{0ex}}\text{Genome}({a}_{j})+\u0142({a}_{j})\phantom{\rule{0.3em}{0ex}}\text{Genome}({a}_{i})\le R\}$. For every set$\left(\right)close="">{\mathcal{A}}_{i}$, we find a maximal subset (using global chaining) of anchors,$\left(\right)close="">{\mathcal{C}}_{i}\subset {\mathcal{A}}_{i}$, that are not overlapping and are increasing in both Read(a) and Genome(a). For later use in evaluating the mapping quality value of a read, for each cluster, we record the sum of all ł(a) values for all anchors in$\left(\right)close="">{\mathcal{C}}_{i}$.
The clusters are assigned a frequency weighted score that is the sum$\left(\right)close="">\sum _{{a}_{j}\in {\mathcal{C}}_{i}}\text{log}(1/\phantom{\rule{0.3em}{0ex}}\text{Freq}({a}_{j}\left)\right)$, where Freq(a_{ j }) is the frequency of the sequence of a_{ j } in the genome, and are ranked by this score. Only the top MAXCANDIDATES clusters are retained (typically 10). The original indexing of clusters by anchor position is replaced by indexing by rank of the frequencyweighted score. The subscript notation is dropped and rank of a cluster is indicated by the superscript. The remaining clusters are denoted$\left(\right)close="">{\mathcal{C}}^{1},{\mathcal{C}}^{2},\dots ,{\mathcal{C}}^{n}$, where$\left(\right)close="">\text{rank}\left({\mathcal{C}}^{1}\right)\le \text{rank}\left({\mathcal{C}}^{2}\right)\le \dots \le \text{rank}\left({\mathcal{C}}^{n}\right)$, and n ≤ MAXCANDIDATES.
While limiting the number of clusters retained may miss alignments to repetitive regions, filtering clusters on this frequencyweighted score was shown to be highly discriminative in our tests.
Refining alignments
Each cluster$\left(\right)close="">{\mathcal{C}}^{i}$ is used to define an interval to which the read is realigned and rescored using sparse dynamic programming (SDP)[35]. To help describe how the interval is defined, let a^{FIRST}(a^{LAST}) be the anchors with least (greatest) Genome(a) and Read(a) coordinates in$\left(\right)close="">{\mathcal{C}}^{i}$, ordered by position in genome and then by read. The anchors in$\left(\right)close="">{\mathcal{C}}^{i}$ frequently do not contain the first and last bases in the read, and the actual starting and ending positions of the read are unknown due to insertion and deletion error in the read. Considering δ to be the maximum insertion rate of the instrument, the starting position of the interval aligned from the genome is s = Genome(a^{FIRST}) − (1 + δ)Read(a^{FIRST}), and ending position f = Genome(a^{LAST}) + (1 + δ)(R−(Read(a^{LAST}) + l(a^{LAST}))), of length$\left(\right)close="">{l}_{\mathcal{C}}=fs$.
The read must be quickly aligned to a candidate interval, even if it is many tens of kilobases long. Similar to the method of anchoring the interval to the genome but on a smaller scale, a set of matches are found between the read and the candidate interval. The matches used in SDP are of a short fixed length, K^{SDP} (typically 8–11 bases). Let$\left(\right)close="">{\mathcal{A}}^{\text{SDP}}$ be the set of anchors of length K^{SDP} that are exact matches between the read and the genome interval g_{ s },…,g_{ f }. Sparse dynamic programming finds the largest subset of anchors$\left(\right)close="">{\mathcal{C}}^{\text{SDP}}\subseteq {\mathcal{A}}^{\text{SDP}}$ that are of increasing Read(a) and Genome(a) values.
The SDP alignment does not align all bases in a read, and so it is necessary to realign a final time using banded dynamic programming. For long reads with indels, the size of the band used to contain the entire alignment becomes prohibitively large. The set of anchors$\left(\right)close="">{\mathcal{C}}^{\text{SDP}}$ forms a guide for performing a banded dynamic programming alignment where the band follows the layout of the anchors in$\left(\right)close="">{\mathcal{C}}^{\text{SDP}}$, shown in Figure9C. The subset of cells included from full$\left(\right)close="">R\times {l}_{\mathcal{C}}$ dynamic programming grid include a band of length b^{SDP}centered about the diagonal where there are anchors, as well as a banded alignment of size b^{drift} between anchors where b^{drift} is the offdiagonal distance between adjacent anchors + b^{SDP}.
The MISMATCHPRIOR and DELETIONPRIOR are PHRED scaled penalties that reflect the global mismatch and deletion rates. In practice, MISMATCHPRIOR is 20 and DELETIONPRIOR is 15.
Mapping quality values
Due to the repetitive nature of genomes, a read often maps with a high alignment score to many locations. It is informative to calculate the probability that the interval a read is mapped to by an alignment is the correct location in the genome. This probability may be interpreted as a mapping quality value$\left(\right)close="">\mathcal{Q}$ for an alignment, allowing downstream analysis such as variant calling to filter alignment by quality.
where i runs over all positions in the genome. The probability that position i is sampled by the sequencer is denoted Pr(i), and is considered to be uniform both here and in[20]. The quantity Pr(rg_{i,…,i + R−1}) is the probability of observing the read r if the sequence at positions i,…,i + R − 1 in the genome is read by the sequencer. For reads that include base quality values q, let q_{ i } denote the probability that a base in a read is incorrect. Then Pr(rg) may be replaced by Pr(rg q). In[20], Pr(rg q) is rapidly approximated by summing the quality values of bases that mismatch in the ungapped alignment between r and g_{i,…,i + R − 1}. When there are insertions and deletions in the sequence, the value Pr(rg_{i,…,i + R − 1}) may be computed as$\left(\right)close="">\underset{f}{\text{Pr}}\left(r\right{g}_{i,\dots ,i+R1},\mathcal{H})$; this denotes the forward algorithm probability using a pairwise hidden Markov model (PairHMM)$\left(\right)close="">\mathcal{H}$ that encodes probabilities for substitution, insertion, and deletion at every position.
The denominator of Equation 1 gives the marginal probability that the read is observed from anywhere in the genome. Evaluating this full sum is computationally infeasible even for short reads and ungapped alignments. Since the probability of observing a read given a template sequence drops geometrically with divergence, most positions in the genome do not contribute significantly to the sum. For short reads, the sum is approximated in[20] as the sum of the probability of the top scoring alignment and all second best alignments.
In BLASR, the mapping quality value is calculated in a similar manner. The sum in Equation 1 is limited to the top MaxCandidates alignments, and is then scaled by a factor that reflects the limited sample size by aligning only at most MaxCandidates clusters. When the read is sampled from a unique region of the genome, there will be few clusters of high score, and the highest scoring cluster will likely contain the true match to the genome. However, when the read is sampled entirely from a repetitive sequence, there will be many high scoripng clusters. In this case, it is possible the cluster from the correct interval on the genome will not have high enough score to be retained in MaxCandidates clusters. To account for this, we assume that the correct interval in the genome may correspond to any significantly highly scoring cluster, and multiply the sum in Equation 1 by the ratio of the number of significant clusters found in the genome to MaxCandidates, as long as the number of significantly highly scoring clusters is greater than MaxCandidates. The significance of a cluster may be measured by comparing the number of anchors in a cluster to the number of anchors expected at the correctly mapped location. The distributions of numbers of anchors expected to correctly map were found using simulations of error processes for different error rates and read lengths; however, it is possible to model this theoretically (see the next section). The expected number of anchors a read has when mapped to the correct location is genomeindependent: it depends only on the error rate, length of the read, and minimum anchor length. We use a slightly different metric, the number of anchorbases (the total number of bases in all anchors) to measure cluster significance, and this is similarly genomeindependent. For efficiency, in BLASR we precompute the expectation and variance for the number of anchorbases for a range of feasible accuracies, read lengths, and minimum match lengths, and minimum match size. The accuracy of the highest scoring alignment is used as a proxy for the true accuracy of the read. Given the accuracy, the length of the aligned sequence, and the minimum match length, we look up the mean μ and variance σ^{2} for number of anchor bases, and count all clusters with more than μ−2σ anchor bases as significant.
Appendix 1
Enumeration of configurations with specified numbers of errors and anchors
In this section, we will show how to explicitly compute NumConfigurations(M,N,K,L).
Consider a read of length L with exactly M errors, at positions 1 ≤ x_{1} < x_{2} < … < x_{ M } ≤ L. Also set x_{0} = 0 and x_{M + 1} = L + 1.
For the sake of simplicity, we assume all sequencing errors are of length 1, but this can be generalized to insertions and deletions that change the length of the read.
The error positions split the read into parts of sizes λ = x_{ i } − x_{i−1} ≥ 1 for i = 1,…,M + 1. Each part λ_{ i } (i = 1,…,M) consists of λ_{ i } − 1 matches followed by one mismatch. The last part consists of λ_{M + 1} − 1 matches. Note that if there are two consecutive mismatches, there will be a part λ_{ i } = 1 corresponding to 0 matches followed by one mismatch.
Part sizes λ_{ i } are related to the notation W of the Results section by λ_{ i } = W + 1. Note that W counted only the correct positions, and we did not have a subscript (W_{ i }) to specify the word number. In this section, λ_{ i } counts the correct bases and also counts one incorrect base at the end, based on our simplification that all sequencing errors are of length one.
Set λ = (λ_{1},λ_{2},…,λ_{M + 1}). These are positive integers that add up to L + 1. In Combinatorics, this is called a strict composition of L + 1 into M + 1 parts. Let K be the minimum anchor length (a parameter).
Consecutive errors greater than K apart (λ_{ i } > K) give segments that are anchors while consecutive errors shorter than this (λ ≤ K) give segments called short matches.
For reads of length 7 with 2 errors, and minimum anchor length 3, the number of compositions with exactly one anchor (allowing it to be any of the parts, via permutations of these compositions) is 6·3 = 18.
For arbitrary values of the parameters, we first compute the number of configurations where all N anchors come first and all M + 1−N short parts come last. Then we multiply the count of these by$\left(\right)close="">\left(\genfrac{}{}{0ex}{}{M+1}{N}\right)$ to allow any of the N parts to be the anchors.
Let N ≥ 0 be an integer. For given parameters M,N,K,L, we will enumerate the number of arrangements of error positions that result in exactly N anchors. This is equivalent to the combinatorial problem of counting integer compositions of L + 1 with certain restrictions on the sizes of the parts. We will use generating function techniques from combinatorics to count arrangements of M error positions that give exactly N anchors (so the other N + 1−M parts are short fragments). Let c_{M,N,K}(L) denote the number of arrangements of M error positions that result in exactly N anchors, where the read length is L and anchors are defined as parts λ_{ i } > K. Let$\left(\right)close="">{c}_{M,N,K}^{\prime}\left(L\right)$ be the number of arrangements where all the anchors precede all the short parts (λ_{1},…,λ_{ N } > K) and λ_{N + 1},…,λ_{M + 1} ≤ K). These are related by$\left(\right)close="">{c}_{M,N,K}\left(L\right)=\left(\genfrac{}{}{0ex}{}{M+1}{N}\right){c}_{M,N,K}^{\prime}\left(L\right)$ since we can select any N of the M + 1 parts to be the anchors.
The compositions of L + 1 into M + 1 parts, where the first N parts are anchors and the remaining M + 1 − N parts are short, have the following constraints:

λ_{1},…,λ_{ N } ∈ 1,2,…,K(short parts).

λ_{N + 1},λ_{N + 2},…,λ_{ M } ∈ K + 1,K + 2,… (anchors).

λ_{1} + ⋯ + λ_{ M } = L + 1.
To compute c_{M,N,K}(L), we use Taylor series methods to compute the coefficient of t^{L + 1}in (A5). We present two methods to do this.
First Taylor series method: The coefficient of t in (A5) may be determined by polynomial multiplication. We truncate the middle expression in (A3) to terms of degree ≤ L + 1, which turns it into a polynomial; the middle expression of (A2) is already a polynomial. We take powers and products of the polynomials, truncating terms of degree > L + 1 at intermediate steps. The coefficient of t^{L + 1} in the result is c_{M,N,K}(L). All intermediate products and sums involve only nonnegative integers.
Second Taylor series method: We present an exact closedform solution. Mathematically, closedform solutions are usually preferred. However, the first method above may be preferable for computation because intermediate steps of this second method require much higher precision, as discussed in Appendix 2.
Theorem A1
For K = 0: if N = M + 1 then$\left(\right)close="">{c}_{M,N,K}\left(L\right)=\left(\genfrac{}{}{0ex}{}{M+1}{N}\right)$; otherwise, c_{M,N,K}(L) = 0.
For K ≥ 1, set D = L − NK − M and i_{max} = min(⌈D/K),M + 1−N⌉.
Proof
For K=0, there are no short parts; all parts are anchors. This is equivalent to counting the number of strict compositions of L + 1 into M + 1 parts, which is wellknown to be$\left(\right)close="">\left(\genfrac{}{}{0ex}{}{L}{M}\right)$.
In (A5), the coefficient of t^{L + 1} is c_{M,N,K}(L). Collecting together the terms in (A8) where the exponent of t is L + 1 gives (A6). We omit the detailed but straightforward derivation. □
Appendix 2
Numerical precision of the closed form solution for the number of anchors
For M = 75, N = 1, K = 15, L = 1000, this has 61 alternating terms of magnitude between 2^{93} and 2^{401}, while the value of the sum is much smaller, with magnitude 2^{294}. Using high precision floating point, we need at least 110 bits for the mantissa to get the first decimal digit correct. This is significantly more bits than is currently standard: the current standard for floating point, IEEE 754, provides for a 53 bit mantissa in double precision. Alternatively, using high precision integers, we would need 294 bits of integer precision, plus a sign bit. However, software for arbitrary precision integers, such as Maple or Mathematica, will handle this example correctly.
By contrast, the “First Taylor series method” only involves sums and products of positive integers, each bounded above by the value of c_{M,N,K}(L). Thus, if the integer precision is adequate to store the value of c_{M,N,K}(L), it is also adequate to perform all intermediate calculations.
Appendix 3
Statistics of number of anchors
We may estimate the number of anchors using the following theorem.
Theorem A2
and thus the probability of exactly N anchors is$\left(\right)close="">{c}_{M,N,K}\left(L\right)/\left(\genfrac{}{}{0ex}{}{L}{M}\right)$.
 1.The derivative in Eq. (A14) is$\begin{array}{ll}\frac{\partial}{\mathrm{\partial u}}{H}_{M,K}(t,u)& =\frac{\partial}{\mathrm{\partial u}}{\left(\frac{(u1){t}^{K+1}+t}{1t}\right)}^{M+1}\phantom{\rule{2em}{0ex}}\\ =(M\phantom{\rule{0.3em}{0ex}}+\phantom{\rule{0.3em}{0ex}}1){\left(\frac{(u\phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}}1){t}^{K+1}+t}{1t}\right)}^{M}\frac{{t}^{K+1}}{1t}\phantom{\rule{2em}{0ex}}\end{array}$
 2.Plug in u = 1:$\begin{array}{l}{\left(\right)close="">\frac{\partial}{\mathrm{\partial u}}{H}_{M,K}(t,u)}_{}u=1\\ =(M+1){\left(\frac{t}{1t}\right)}^{M}\frac{{t}^{K+1}}{1t}\phantom{\rule{2em}{0ex}}\end{array}=(M+1)\frac{{t}^{M+K+1}}{{(1t)}^{M+1}}\phantom{\rule{2em}{0ex}}$
 3.Expand the Taylor series and extract the coefficient of t ^{L + 1}:$\begin{array}{ll}(M\phantom{\rule{0.3em}{0ex}}+\phantom{\rule{0.3em}{0ex}}1)\frac{{t}^{M+K+1}}{{(1t)}^{M+1}}& \phantom{\rule{0.3em}{0ex}}=\phantom{\rule{0.3em}{0ex}}(M\phantom{\rule{0.3em}{0ex}}+\phantom{\rule{0.3em}{0ex}}1)\sum _{j=0}^{\infty}\left(\genfrac{}{}{0ex}{}{M+j}{M}\right){t}^{M+K+1+j}\phantom{\rule{2em}{0ex}}\end{array}$
The term t^{L + 1}occurs when j = L − M − K.If j < 0, this coefficient is 0. If j ≥ 0, this coefficient is$\left(\right)close="">(M+1)\left(\genfrac{}{}{0ex}{}{LK}{M}\right)$.
 4.Evaluate E[N] to obtain Equation (A9):$E\left[N\right]=\frac{(M+1)\left(\genfrac{}{}{0ex}{}{LK}{M}\right)}{\left(\genfrac{}{}{0ex}{}{L}{M}\right)}\phantom{\rule{2.77695pt}{0ex}}.$
Note that if L − K < M, then E[N] = 0.
 1.The derivative in Eq. (A15) is$\begin{array}{ll}\frac{{\partial}^{2}}{\partial {u}^{2}}{H}_{M,K}(t,u)& =\frac{{\partial}^{2}}{\partial {u}^{2}}{\left(\frac{(u1){t}^{K+1}+t}{1t}\right)}^{M+1}\phantom{\rule{2em}{0ex}}\\ =M(M+1){\left(\frac{(u1){t}^{K+1}+t}{1t}\right)}^{M1}\phantom{\rule{2em}{0ex}}\\ \phantom{\rule{1em}{0ex}}\times {\left(\frac{{t}^{K+1}}{1t}\right)}^{2}\phantom{\rule{2em}{0ex}}\end{array}$
 2.Plug in u = 1:$\begin{array}{l}{\left(\right)close="">\frac{{\partial}^{2}}{\partial {u}^{2}}{H}_{M,K}(t,u)}_{}u=1\\ \phantom{\rule{0.3em}{0ex}}=\phantom{\rule{0.3em}{0ex}}M(M\phantom{\rule{0.3em}{0ex}}+\phantom{\rule{0.3em}{0ex}}1){\left(\phantom{\rule{0.3em}{0ex}}\frac{t}{1\phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}}t}\phantom{\rule{0.3em}{0ex}}\right)}^{M1}{\left(\phantom{\rule{0.3em}{0ex}}\frac{{t}^{K+1}}{\phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}}t}\phantom{\rule{0.3em}{0ex}}\right)}^{2}\phantom{\rule{2em}{0ex}}\end{array}=M(M+1)\frac{{t}^{M+1+2K}}{{(1t)}^{M+1}}\phantom{\rule{2em}{0ex}}$
 3.Expand the Taylor series and extract the coefficient of t ^{L + 1}:$\begin{array}{l}M(M+1)\frac{{t}^{M+1+2K}}{{(1t)}^{M+1}}\phantom{\rule{2em}{0ex}}\\ =M(M+1){t}^{M+1+2K}\sum _{j=0}^{\infty}\left(\genfrac{}{}{0ex}{}{M+j}{M}\right){t}^{j}\phantom{\rule{2em}{0ex}}\\ =M(M+1)\sum _{j=0}^{\infty}\left(\genfrac{}{}{0ex}{}{M+j}{M}\right){t}^{M+1+2K+j}\phantom{\rule{2em}{0ex}}\end{array}$
 4.Evaluate E[N(N − 1)]:$E\left[N(N1)\right]=\frac{M(M+1)\left(\genfrac{}{}{0ex}{}{L2K}{M}\right)}{\left(\genfrac{}{}{0ex}{}{L}{M}\right)}$
 5.Evaluate σ ^{2} = Var[N] to prove Equation (A10):$\begin{array}{ll}{\sigma}^{2}& =\text{Var}\left[N\right]=E\left[N\right(N1\left)\right]+E\left[N\right]E{\left[N\right]}^{2}\phantom{\rule{2em}{0ex}}\\ =\frac{M(M+1)\left(\genfrac{}{}{0ex}{}{L2K}{M}\right)}{\left(\genfrac{}{}{0ex}{}{L}{M}\right)}+\frac{(M+1)\left(\genfrac{}{}{0ex}{}{LK}{M}\right)}{\left(\genfrac{}{}{0ex}{}{L}{M}\right)}\phantom{\rule{2em}{0ex}}\\ \phantom{\rule{1em}{0ex}}{\left(\frac{(M+1)\left(\genfrac{}{}{0ex}{}{LK}{M}\right)}{\left(\genfrac{}{}{0ex}{}{L}{M}\right)}\right)}^{2}\phantom{\rule{2em}{0ex}}\end{array}$
Appendix 4
Asymptotic number of anchors
Theorem A3
where$\left(\right)close="">\varphi \left(z\right)=\frac{1}{\sqrt{2\Pi}}{e}^{{z}^{2}/2}$ and Φ(z) are the probability density function and cumulative distribution function of the standard normal distribution.
Proof
Thus, we obtain Eqs. (A16) and (A17) as approximations for the coefficients c_{M,N,K}(L) and the survival function NumConfigurations(M,N,K,L). In Eq. (A17), note that$\left(\right)close="">\frac{1}{2}$ is a continuity correction. □
Author’s contributions
MJC proposed and implemented the mapping method, performed the analysis, and wrote the manuscript. GT solved and implemented the combinatorial analysis, and wrote the manuscript. Both authors read and approved the final manuscript.
Declarations
Acknowledgements
We thank Jon Sorenson, James Bullard, Eric Schadt, and Jonas Korlach for useful comments in writing this manuscript.
Authors’ Affiliations
References
 Smith T, Waterman M: Identification of Common Molecular Subsequences. J Mol Biol 1981, 147: 194–197.View ArticleGoogle Scholar
 Zhang Z, Schwartz S, Wagner L, Miller W: A greedy algorithm for aligning DNA sequences. J Comput Biol 2000, 7: 203–214. 10.1089/10665270050081478View ArticlePubMedGoogle Scholar
 Kent W: BLAT–the BLASTlike alignment tool. Genome Res 2002, 12: 656–664.PubMed CentralView ArticlePubMedGoogle Scholar
 Langmead B, Trapnell C, Pop M, Salzberg S: Ultrafast and memoryefficient alignment of short DNA sequences to the human genome. Genome Biol 2009, 10: R25. 10.1186/gb2009103r25PubMed CentralView ArticlePubMedGoogle Scholar
 Li H, Durbin R: Fast and accurate short read alignment with BurrowsWheeler transform. Bioinformatics 2009, 25: 1754–1760. 10.1093/bioinformatics/btp324PubMed CentralView ArticlePubMedGoogle Scholar
 Li R, Yu C, Li Y, Lam T, Yiu S, Kristiansen K, Wang J: SOAP2: an improved ultrafast tool for short read alignment. Bioinformatics 2009, 25: 1966–1967. 10.1093/bioinformatics/btp336View ArticlePubMedGoogle Scholar
 Ferragina P, Manzini G: Opportunistic data structures with applications. Proc. of the 41st IEEE Symp on Found of Comput Sci 2000, 390–398.Google Scholar
 Rasko D, Webster D, Sahl J, Bashir A, Boisen N, Scheutz F, Paxinos E, Sebra R, Chin C, Iliopoulos D, Klammer A, Peluso P, Lee L, Kislyuk A, Bullard J, Kasarskis A, Wang S, Eid J, Rank D, Redman J, Steyert S, FrimodtMller J, Struve C, Petersen A, Krogfelt K, Nataro J, Schadt E, Waldor M: Origins of the E. coli strain causing an outbreak of hemolyticuremic syndrome in Germany. New England J Med 2011, 365: 709–717. 10.1056/NEJMoa1106920View ArticleGoogle Scholar
 Brudno M, Poliakov A, Salamov A, Cooper G, Sidow A, Rubin E, Solovyev V, Batzoglou S, Dubchak I: Automated WholeGenome Multiple Alignment of Rat, Mouse, and Human. Genome Res 2004, 14: 685–692. 10.1101/gr.2067704PubMed CentralView ArticlePubMedGoogle Scholar
 Schwartz S, Kent W, Smit A, Zhang Z, Baertsch R, Hardison R, Haussler D Miller: HumanMouse Alignments with BLASTZ. Genome Res 2003, 13: 103–107. 10.1101/gr.809403PubMed CentralView ArticlePubMedGoogle Scholar
 Kurtz S, Phillippy A, Delcher A, Smoot M, Shumway M, Antonescu C, Salzberg S: Versatile and open software for comparing large genomes. Genome Biol 2004, 5: R122R129.View ArticleGoogle Scholar
 Altschul S, Gish W, Miller W, Myers E, Lipman D: Basic local alignment search tool. J Mol Biol 1990, 215: 403–410.View ArticlePubMedGoogle Scholar
 Lipman D, Pearson W: Rapid and sensitive protein similarity searches. Science 1985, 4693: 1435–1441.View ArticleGoogle Scholar
 Bray N, Dubchak I, Pachter L: AVID: A global alignment program. Genome Res 2003, 13: 97–102. 10.1101/gr.789803PubMed CentralView ArticlePubMedGoogle Scholar
 Darling A, Mau B, Blatter F, Perna N: Mauve: multiple alignment of conserved genomic sequence with rearrangements. Genome Res 2004, 14: 1394–1403. 10.1101/gr.2289704PubMed CentralView ArticlePubMedGoogle Scholar
 Brudno M, Do C, Cooper G, Kim M, Davydov E, Green E, Sidow A, Batzoglou S: LAGAN and MultiLAGAN: efficient tools for largescale multiple alignment of genomic DNA. Genome Res 2003, 13: 721–731. 10.1101/gr.926603PubMed CentralView ArticlePubMedGoogle Scholar
 Kent WJ, Baertsch R, Hinrichs A, Miller W, Haussler D: Evolution’s cauldron: Duplication, deletion, and rearrangement in the mouse and human genomes. Proc Nat Acad Sci 2003, 100: 11484–11489. 10.1073/pnas.1932072100PubMed CentralView ArticlePubMedGoogle Scholar
 Li H, Durbin R: Fast and accurate longread alignment with Burrows Wheeler transform. Bioinformatics 2010, 26: 589–595. 10.1093/bioinformatics/btp698PubMed CentralView ArticlePubMedGoogle Scholar
 Li R, Li Y, Kristiansen K, Wang J: SOAP: short oligonucleotide alignment program. Bioinformatics 2008, 24: 713–714. 10.1093/bioinformatics/btn025View ArticlePubMedGoogle Scholar
 Li H, Ruan J, R D: Mapping short DNA sequencing reads and calling variants using mapping quality scores. Genome Res 2008, 18: 1851–1858. 10.1101/gr.078212.108PubMed CentralView ArticlePubMedGoogle Scholar
 Rumble S, Lacroute P, Dalca A, Fiume M, Sidow A, et al.: SHRiMP: Accurate Mapping of Short Colorspace Reads. PLoS Comput Biol 2009, 5: e1000386. 10.1371/journal.pcbi.1000386PubMed CentralView ArticlePubMedGoogle Scholar
 Durbin R, Eddy S, Krobh A, Mitchison G: Biol Sequence Anal: Probabilistic Models of Proteins and Nucleic Acids. The Edinburgh Building, Cambridge, CB2 2RU. United Kingdom: Cambridge University Press; 1998.View ArticleGoogle Scholar
 Needleman S, Wunsch C: A general method applicable to the search for similarities in the amino acid sequence of two proteins. J Mol Biol 1970, 48: 443–453. 10.1016/00222836(70)900574View ArticlePubMedGoogle Scholar
 Eid J, Fehr A, Korlach J, Turner S, et al.: Realtime DNA sequencing from single polymerase molecules. Science 2009, 323: 133–138. 10.1126/science.1162986View ArticlePubMedGoogle Scholar
 Clarke J, Wu H, Jayasinghe L, Patel A, Reid S, Bayley H: Continuous base identification for singlemolecule nanopore DNA sequencing. Nat Nanotechnol 2009, 4: 265–270. 10.1038/nnano.2009.12View ArticlePubMedGoogle Scholar
 Cherf G, Lieberman K, Rashid H, Lam C, Karplus K, Akeson M: Automated forward and reverse ratcheting of DNA in a nanopore at 5Å precision. Nat Nanotechnol 2012, 14: 344–348.Google Scholar
 Garaj S, Hubbard W, Reina A, Kong J, Branton D, Golovchenko J: Graphene as a subnanometre transelectrode membrane. Nature 2010, 467: 190–193. 10.1038/nature09379PubMed CentralView ArticlePubMedGoogle Scholar
 Altschul S, Madden T, Schäffer A, Zhang J, Zhang Z, Miller W, Lipman D: Gapped BLAST and PSIBLAST: a new generation of protein database search programs. Nucleic Acids Res 1997, 17: 3389–3402.View ArticleGoogle Scholar
 Weese D, Emde A, Rausch T, Döring A, Reinert K: RazerSfast read mapping with sensitivity control. Genome Res 2009, 19: 1646–1654. 10.1101/gr.088823.108PubMed CentralView ArticlePubMedGoogle Scholar
 Bao Z, Eddy S: Automated de novo identification of repeat sequence families in sequenced genomes. Genome Res 2002, 12: 1269–1276. 10.1101/gr.88502PubMed CentralView ArticlePubMedGoogle Scholar
 Flusberg B, Webster D, Lee J, Travers K, Olivares E, Clark T, Korlach J, SW T: Direct detection of DNA methylation during singlemolecule, realtime sequencing. Nat Methods 2010, 7: 461–465. 10.1038/nmeth.1459PubMed CentralView ArticlePubMedGoogle Scholar
 Alkan C, Kidd J, MarquesBonet T, Aksay G, Antonacci F, Hormozdiari F, Kitzman J, Baker C, Malig M, Mutlu O, Sahinalp S, Gibbs R, Eichler E: Personalized CopyNumber and Segmental Duplication Maps using NextGeneration Sequencing. Nat Genet 2009, 41: 1061–1067. 10.1038/ng.437PubMed CentralView ArticlePubMedGoogle Scholar
 Myers E, Manber U: Suffix arrays: A new method for online string searches. SIAM J Comput 1993, 22: 935–948. 10.1137/0222058View ArticleGoogle Scholar
 Abouelhoda M, Ohlebusch E: A Local Chaining Algorithm and its Applications in Comparitive Genomics. Lecture Notes in Comput Sci 2812, 2003: 1–16.Google Scholar
 Eppstein D, Galil Z, Giancarlo R, Italiano G: Sparse Dynamic Programming I: Linear cost functions. J Assoc Comput Machinery 1992, 39: 519–545. 10.1145/146637.146650View ArticleGoogle Scholar
Copyright
This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.