Bayesian Integral Log-odds”) substitution scores from prior distributions describing columns of related letters. This approach has been used previously only to define scores for aligning individual sequences to sequence profiles, but it has much broader applicability. We describe how to calculate BILD scores efficiently, and illustrate their uses in Gibbs sampling optimization procedures, gapped alignment, and the construction of hidden Markov model profiles. BILD scores enable automated selection of optimal motif and domain model widths, and can inform the decision of whether to include a sequence in a multiple alignment, and the selection of insertion and deletion locations. Other applications include the classification of related sequences into subfamilies, and the definition of profile-profile alignment scores. Although a fully realized multiple alignment program must rely upon more than substitution scores, many existing multiple alignment programs can be modified to employ BILD scores. We illustrate how simple BILD score based strategies can enhance the recognition of DNA binding domains, including the Api-AP2 domain in Toxoplasma gondii and Plasmodium falciparum.Most pairwise and multiple sequence alignment programs seek alignments with optimal scores. Central to defining such scores is selecting a set of substitution scores for aligned amino acids or nucleotides. For local pairwise alignment, substitution scores are implicitly of log-odds form. We now extend the log-odds formalism to multiple alignments, using Bayesian methods to construct “BILD”  sequences. In this paper, we describe a natural generalization to multiple alignment of the accepted measure of pairwise similarity. A large variety of methods that are used to compare and analyze DNA or protein molecules, or to model protein domain families, could be rendered more sensitive and precise by adopting this similarity measure. We illustrate how our measure can enhance the recognition of important DNA binding domains. Protein and DNA sequence alignment is a fundamental tool of computational molecular biology. It is used for functional prediction, genome annotation, the discovery of functional elements and motifs, homology-based structure prediction and modeling, phylogenetic reconstruction, and in numerous other applications. The effectiveness of alignment programs depends crucially upon the scoring systems they employ to evaluate possible alignments. For pairwise alignments, scores typically are defined as the sum of “substitution scores” for aligning pairs of letters (amino acids or nucleotides), and “gap scores” for aligning letters in one sequence with null characters between letters in the other. Substitution and gap scores may be generalized to multiple alignments, i.e. those involving three or more sequences.Most useful local pairwise alignment algorithms allow gaps and explicitly assign them scores Tree scores. An evolutionary tree can be defined relating the sequences in question, with each sequence residing at one leaf of the tree. By reconstructing letters at the internal nodes of the tree, the score for an aligned column of letters is defined as the sum of pairwise substitution scores for all edges of the tree Star scores. As a special case of tree-scores, a single “consensus” letter can be defined for an alignment column. The column score is defined as the sum of pairwise scores for the consensus letter to each letter in the column. The tree in question reduces to a star, with the consensus at the central node. C) Sum-of-the-Pairs or SP scores. A column score can be constructed as the sum of substitution scores for all pairs of letters in the column Entropy scores. Scores can be based on the entropy of the letter frequencies observed in a column Many pairwise substitution scores have been developed for protein Bayesian Integral Log-odds” or BILD scores. Although these scores are implicit in earlier work, their full generality and utility has not been recognized. They may be calculated efficiently, and may be generalized to allow for the differential weighting of sequences in a multiple alignment. We also consider an alternative approach that allows log-odds column scores to be derived from any pairwise substitution matrix.All reasonable substitution scores for pairwise local alignment are implicitly log-odds scores Given their form, multiple alignment log-odds scores can be used directly to define the proper extent of multiple alignment blocks, and to derive natural scores for profile-profile comparison. We show that they also arise from the perspective of the Minimum Description Length Principle Toxoplasma gondii and Plasmodium falciparum.Efficient methods for calculating BILD scores allow them to be incorporated into Gibbs sampling algorithms for ungapped local multiple alignment. Most practical protein applications, however, require provisions for gaps. We describe two methods for extending an ungapped local multiple alignment produced by the Gibbs sampling strategy to a gapped alignment, the first using asymmetric affine gap costs, and the second hidden Markov models. In the latter, column BILD scores inform the construction of position-specific gap costs, and yield gapped alignments in greater conformity with considerations of protein structure. We illustrate the applications of the programs by using them to uncover previously undescribed Api-AP2 domains of Multiple sequence alignment comprises a diverse set of problems and approaches. Many sophisticated statistical inference techniques have been applied to the multiple alignment problem and to the related problem of phylogenetic reconstruction, e.g. Log-odds pairwise substitution scores can be written To generalize log-odds scores to multiple alignments, we first develop some notation. We consider the alphabet For alignments of more than two sequences, there are of course other possibilities than for all or none of the sequences to be related. However, as we will describe below, scores of the form of equation (1) can be applied to the comparison of sequences where only a subset are related, by adding indicator variables to include or exclude sequences.Log-odds scores For multiple alignments, perhaps the best approach to defining and calculating Although the data We call scores defined in this way Bayesian Integral Log-odds or BILD scores. They can be understood simply as the sum of log-odds scores for the individual letters observed in a column, with the “target frequency” for each letter BILD scores have some conceptual connections to star- and entropy-based multiple alignment scoring systems. The simplest generalization of star scores imposes a prior probability distribution on the consensus letter, but still assumes a probabilistic pairwise substitution model. As we describe in Given observed and background letter distributions Although the definition of BILD scores is valid for any prior distribution We review here the essentials of Dirichlet distributions. A multinomial distribution on Dirichlet distributions have two convenient properties. First, the expected frequency of letter To illustrate how to calculate BILD scores using these properties, consider the case of DNA comparison , with uniform background probabilities The essence of a Dirichlet distribution is perhaps best understood through the alternative parametrization  may be applied to http://compbio.soe.ucsc.edu/dirichlets/index.html. We list five of these in Only the research team that first proposed Dirichlet mixtures for protein sequence comparison has derived, from analyses of large protein alignment collections, sets of Dirichlet mixture prior parameters Proteins diverged by different degrees of evolutionary change are best studied using pairwise substitution matrices with different relative entropies As well as ies  see . For  toto  bits . That  hStandard pairwise substitution matrices are constructed from sets of proteins with certain background amino acid frequencies Single Dirichlet priors may be appropriate for DNA sequence comparison. The uniform density, arising when all A direct application of multiple alignment log-odds scores is to determining local alignment width. As formulated by Smith and Waterman ad hoc principles frequently required for other scoring systems Equation (1) explicitly generalizes pairwise log-odds scores to the multiple alignment case. They are positive for some alignment columns, negative for others, and must have negative expected value. Therefore it is appropriate to define an optimal ungapped multiple alignment as one with maximal aggregate log-odds score. This immediately allows one to define the proper width or extent of an ungapped multiple DNA or protein alignment, without resorting to the ad hoc optimization. They may also be used to determine dynamically whether or not a sequence should participate in the multiple alignment at all, for which purpose it is useful first to consider log-odds scores from the perspective of the Minimum Description Length Principle.The ungapped local multiple alignment problem may be formulated as seeking segments of common width The Minimum Description Length (MDL) Principle provides a criterion for choosing among alternative theories for describing a set of data From information theory For local multiple alignment, the theory a priori equally likely; if necessary, for To allow one or more sequences to be excluded from the multiple alignment, we consider not 2, but The change in the log-odds score with the addition of a segment from the Although our central concern is to define a new type of multiple alignment substitution score, many important applications require the construction of gapped multiple alignments, and these generally entail scores for insertions and deletions. Multiple alignment gap scores should be defined in a manner consistent with the substitution scores used Just as the log-odds perspective places pairwise substitution scores in a probabilistic framework For simplicity, suppose we have a “canonical” multiple alignment There is an essential asymmetry in gap scores for aligning Just as incremental BILD substitution scores change as more sequences are added to a multiple alignment, so it is possible to let insertion and deletion scores change as well, and vary by position. In the context of Hidden Markov Models Formula (3) permits BILD substitution scores to be used for progressive multiple alignment. However, as described above, gaps scores pose a particular problem, because to define insertions and deletions one needs to construct a canonical alignment, and this is difficult for a small number of sequences. For example, when just two proteins are aligned, it is quite possible that gaps in both sequences would ultimately be seen as insertions with respect to a model describing the whole protein family, but there is no obvious way to determine this in advance.  Retain the alignment if the score exceeds a calculated threshold. Multiple non-overlapping segments within For each input sequence Collect all the aligned segments from step b) into a new, gapped multiple alignment, and return to step b). Iterate until the objective score function stops increasing.Adjust the width of the original pattern to optimize the alignment score. Alternatively, this step may be inserted between iterations.The initial search for ungapped segments in the Gibbs sampling step can delineate a common core pattern width, and provisional amino acid frequencies for each column, shared by a set of sequences, even when most segments are at first partially misaligned. For sequences containing repeated or multiple distinct patterns, it may be useful to restrict the width of the pattern sought. The MDL Principle can be used to provisionally exclude some sequences from the alignment at this stage, which may then be included later. Adopting this core pattern generally minimizes the average number of gaps that subsequently need to be introduced when aligning to members of the family. Using Erickson-Sellers semi-global alignment conserves the pattern width The evaluation of the performance of a multiple alignment program requires a collection of sequence sets for each of which the correct alignment is known First, we evaluated the ability of Program 1 to identify properly the left and right motif boundaries within the Most multiple alignment programs do not explicitly identify in their output conserved motifs as distinct from randomly aligned sequence. However, the output of program DIALIGN-TX The IRM database has been used previously to evaluate the performance of multiple alignment programs by computing how accurately they align the letters that are, by construction, “homologous” As mentioned above, real protein domains are subject, on average, to much longer insertions than deletions, and this implies the utility of asymmetric affine gap costs for Program 1. The particular costs that are best will depend upon the statistical properties of gaps, and a possible refinement of Program 1 would be to adjust gap costs dynamically. From the analysis of a variety of protein families, we have found empirically that reasonable gap scores to use in conjunction with Protein structure implies more than an asymmetry between the frequency and length statistics of insertions and deletions. Reflecting the evolution of secondary structure elements and loops, certain motif positions are much less likely to be deleted than others and, similarly, insertions are much less likely to occur between certain pairs of motif positions than others. We describe below an extension of Program 1 to an HMM-based Program 2 that relies only upon column BILD scores to calculate position-specific gap score parameters. We then apply Programs 1 and 2 to the detection of Api-AP2 domains.Protein families or domains are often described by HMMs When translated into the HMM formalism, specifying the asymmetric affine gap cost parameters of Program 1, two for insertions and two for deletions, is equivalent to specifying average frequencies and lengths for insertions and deletions First, we observe that a high BILD score for a column Second, we recognize that insertions are relatively unlikely to occur within regions of a protein that show a close clustering of more conserved positions. Let the normalized score This simple approach to HMM parameter construction can of course be refined. Nevertheless, it captures central features of the location of insertions and deletions within proteins, without relying upon a preconstructed alignment, or on the relatively small sample of gaps present in a particular data set. Program 2 proceeds identically to Program 1, except that in place of the Erickson-Sellers algorithm with asymmetric affine gap costs, it uses the Viterbi algorithm to find an optimal path through the constructed HMM.Plasmodium and Cryptosporidium parasites were initially discovered using PSI-BLAST searches by Balaji et al. To illustrate how our methods may be applied to typical problems, we consider the sequence-specific DNA recognition domains from the Api-AP2 transcription factor family of apicomplexan parasites. Multiple paralogous Api-AP2 domains in the translated proteomes of The Api-AP2 family presents a weakly-clustered pattern of amino acid conservation at variable spacing within the typically 50–60 amino acid domain. This profile is present one to approximately six times within otherwise extremely variable protein sequences of typically more than 1000 amino acids. The proteins show little significant homology outside the Api-AP2 regions: there are many low-complexity segments and occasional recognizable domains of other types, but the latter do not show any consistent relationship to the Api-AP2 regions. On the order of 20 to 80 Api-AP2 domains are encoded in each apicomplexan genome. Although relatively small, this domain has typical globular protein structure with a 3-strand beta-sheet packed against an alpha-helix, with several classes of beta-turn, and a longer loop. The more conserved positions occur mainly within the sheet, the helix and beta-turn structural elements. Consequently, multiple alignment profiles tend to show a loosely-patterned clustering of column scores, as is typical of globular domains.Toxoplasma gondii (53 proteins) and Plasmodium falciparum  random sequences constructed by shuffling input sequences, or (b) real sequences lacking annotated conserved patterns, or (c) sequences that shared a conserved domain unrelated to Api-AP2. Spikes of types (a) and (b) comprising half of the total input sequences did not affect the final Api-AP2 models: the random and unrelated patterns in the spike sequences were all rejected  during oPlasmodium and Toxoplasma  for Plasmodium  recognizes that, with respect to the core pattern, long deletions generally are much more deleterious than long insertions. The placement of gaps can be refined using position-specific gap costs derived from column BILD scores (Program 2). Fourth, greedy alignment allows multiple instances of a pattern to be found within a single sequence. In conjunction with length-dependent gap costs, it discourages alignments spanning more than one instance of a pattern, but can still uncover long insertions. Fifth, iteration permits the core model to be refined, improving the discrimination of true relationships from chance similarities. This strategy, informed by considerations of protein structure, has proved a rapid and effective method for delineating protein families. Although our programs were developed only for research purposes, with the limited goal of testing the impact of BILD scores, their code is available upon request.We have sought here primarily to describe the construction and potential uses of log-odds scores in the multiple alignment context. However, many avenues for further research, involving the development and benchmarking of complete multiple alignment programs, remain. To what extent can BILD scores improve the accuracy of profile-profile comparison programs? How does Erickson-Sellers semi-global alignment Text S1MELD Scores(0.05 MB PDF)Click here for additional data file.Text S2The Mean Relative Entropy of Dirichlet Mixtures(0.05 MB PDF)Click here for additional data file.Text S3The MDL Principle and Local Alignment Statistics(0.04 MB PDF)Click here for additional data file.Text S4The MDL Principle and the Clustering of Multiple Alignments(0.05 MB PDF)Click here for additional data file.Text S5Gibbs Sampling Algorithms and HTH Proteins(0.05 MB PDF)Click here for additional data file.Table S1Helix-turn-helix proteins.(0.02 MB PDF)Click here for additional data file.Table S2M sequences listed in W. Both BILD and Wadsworth samplers optimize contiguous motifs of widths W, 17, 21 and 25. The number of sequences misaligned by the Wadsworth sampler are given in the table without parentheses; the number misaligned by the BILD sampler within parentheses.Number of sequences misaligned by Gibbs sampling programs. Sequence sets supplied to the BILD and Wadsworth samplers consist of the first (0.02 MB PDF)Click here for additional data file.Table S3Toxoplasma gondii . Programs 1 and 2 were run with the Dirichlet mixture prior and default parameters described in the T. gondii and 29 from P. falciparum, based on inspection of low-threshold PSI-BLAST and HMMsearch searches of the parasite genomic translation databases of ToxoDB [Gajria et al. (2008) Nucleic Acids Res 36: D553–556] and PlasmoDB [Aurrecoechea et al. (2009) Nucleic Acids Res 37: D539–543] (http://eupathdb.org/eupathdb/). These database searches were seeded with earlier alignments produced  and ‘Pf-core’ (with 53 columns) respectively. These patterns exclude any insertions in individual sequences: the number of inserted residues is shown in a separate column. All of these domains have positive bit scores with Programs 1 and 2, except for the special case of domain 1.7, T. gondii alignment. This domain is notable because of its occurrence within a multi-Api-AP2 protein and its strong match to the canonical 53-column pattern; however, it also has an unusually long insertion of 66 amino acids , the cost of which results in an overall negative score. The Tg-core (excluding domain 1.7) and the Pf-core alignments shown in http://hmmer.janelia.org). HMMbuild and HMMcalibrate were used with default parameters to construct HMMs and calibrate their E-value distributions, and HMMsearch was used with a permissive E-value threshold of 100 to search the parasite genomic translation databases against these HMMs. These searches gave positive bit scores for the domains used for HMM construction , 10 from T. gondii and 4 from P. falciparum, were not reported by the Pfam00847 HMMsearch above the E-value 100 threshold, and others (9 and 3 respectively) were given negative scores . These low scores reflect misalignments (e.g. missed long insertions) in some cases. In other cases, limited deviations from the canonical conserved patterns occur, commonly in the first beta-strand. However, such deviant residues appear to be structurally compatible with the domain, with beta-strand-favoring propensities in most cases, suggesting that these examples may be authentic but non-canonical Api-AP2 domains. HMMER methodology is capable of identifying and aligning such domains if they are included in the seed alignment, as shown by the bit scores given by the Tg-core and Pf-core seeded searches. Indeed, the T. gondii domain 62.1 (TGME49_062420), which is the example with a 45/46 amino acid insertion shown in et al. [(2007) BMC Bioinformatics 8: 357]. Overall, the HMMsearch results shown in these Tables, compared with the Programs 1 and 2 output, show many more similarities than differences: the two approaches can achieve very similar results with appropriate inputs. Our examples also illustrate how the relatively simple BILD score based approaches, by reducing the strict dependence on seed alignments, might facilitate more automated processes for the discovery and reporting of protein domain families and more flexible updating strategies.a gondii  and Plaslciparum . Also sh(0.05 MB XLS)Click here for additional data file.Table S4Plasmodium falciparum. For more details please see caption to Api-AP2 domains and bit scores reported by Programs 1 and 2 for (0.03 MB XLS)Click here for additional data file.


Hidden Markov models (HMMs) have been extensively used in biological sequence analysis. In this paper, we give a tutorial review of HMMs and their applications in a variety of problems in molecular biology. We especially focus on three types of HMMs: the profile-HMMs, pair-HMMs, and context-sensitive HMMs. We show how these HMMs can be used to solve various sequence analysis problems, such as pairwise and multiple sequence alignments, gene annotation, classification, similarity search, and many others. The sequenced genomes contain a wealth of invaluable information that can help us better understand the underlying mechanisms of various biological functions in cells. However, considering the huge size of the available data, it is virtually impossible to analyze them without the help of computational methods. In order to extract meaningful information from the data, we need computational techniques that can efficiently analyze the data according to sound mathematical principles. Given the expanding list of newly sequenced genomes and the increasing demand for genome re-sequencing in various comparative genomics projects, the importance of computational tools in biological sequence analysis is expected to grow only further.Until now, various signal processing models and algorithms have been used in biological sequence analysis, among which the hidden Markov models (HMMs) have been especially popular. HMMs are well-known for their effectiveness in modeling the correlations between adjacent symbols, domains, or events, and they have been extensively used in various fields, especially in speech recognition  and digiIn this paper, we give a tutorial review of HMMs and their applications in biological sequence analysis. The organization of the paper is as follows. In Sec. 2, we begin with a brief review of HMMs and the basic problems that must be addressed to use HMMs in practical applications. Algorithms for solving these problems are also introduced. After reviewing the basic concept of HMMs, we introduce three types of HMM variants, namely, profile-HMMs, pair-HMMs, and context-sensitive HMMs, that have been useful in various sequence analysis problems. Section 3 provides an overview of profile hidden Markov models and their applications. We also introduce publicly available profile-HMM software packages and libraries of pre-built profile-HMMs for known sequence families. In Sec. 4, we focus on pair-HMMs and their applications in pairwise alignment, multiple sequence alignment, and gene prediction. Section 5 reviews context-sensitive HMMs (csHMMs) and profile context-sensitive HMMs (profile-csHMMs), which are especially useful for representing RNA families. We show how these models and other types of HMMs can be employed in RNA sequence analysis.2.hidden Markov model (HMM) is a statistical model that can be used to describe the evolution of observable events that depend on internal factors, which are not directly observable. We call the observed event a `symbol' and the invisible factor underlying the observation a `state'. An HMM consists of two stochastic processes, namely, an invisible process of hidden states and a visible process of observable symbols. The hidden states form a Markov chain, and the probability distribution of the observed symbol depends on the underlying state. For this reason, an HMM is also called a doubly-embedded stochastic process [A  process .Modeling observations in these two layers, one visible and the other invisible, is very useful, since many real world problems deal with classifying raw observations into a number of categories, or class labels, that are more meaningful to us. For example, let us consider the speech recognition problem, for which HMMs have been extensively used for several decades . In speeThis approach is also useful in modeling biological sequences, such as proteins and DNA sequences. Typically, a biological sequence consists of smaller substructures with different functions, and different functional regions often display distinct statistical properties. For example, it is well-known that proteins generally consist of multiple domains. Given a new protein, it would be interesting to predict the constituting domains (corresponding to one or more states in an HMM) and their locations in the amino acid sequence (observations). Furthermore, we may also want to find the protein family to which this new protein sequence belongs. In fact, HMMs have been shown to be very effective in representing biological sequences , as they2.1.x = x1x2 ... xL and the underlying state sequence as y = y1y2 ... yL, where ny. is the underlying state of the n th observation nx. Each symbol nx takes on a finite number of possible values from the set of observations O =  {O1O2,...,ON} and each state ny takes one of the values from the set of states S = {1,2,...,M}, where N and M denote the number of distinct observations and the number of distinct states in the model, respectively. We assume that the hidden state sequence is a time-homogeneous first-order Markov chain. This implies that the probability of entering state j in the next time point depends only on the current state i, and that this probability does not change over time. Therefore, we haveLet us now formally define an HMM. We denote the observed symbol sequence as               i, j ∈ S and for all n ≥ 1. The fixed probability for making a transition from state i to state j is called the transition probability, and we denote it by t. For the initial state y1, we denote the initial state probability as π(i)= P {y1 = i} for all i ∈ S. The probability that the n th observation will be xn = x depends only on the underlying state ny, hencefor all states             x ∈ O, all state i ∈ S, and all n ≥ 1. This is called the emission probability of x at state i, and we denote it by e(x | i). The three probability measures t, π(i), and e(x | i) completely specify an HMM. For convenience, we denote the set of these parameters as Θ.for all possible observations x = x1 x2 ... Lx with the underlying state sequence y = y1 y2 ... Ly. This joint probability P {x,y | Θ} can be computed byBased on these parameters, we can now compute the probability that the HMM will generate the observation sequence                 where                                As we can see, computing the observation probability is straightforward when we know the underlying state sequence.2.2.1) shows a toy HMM for modeling eukaryotic genes. The given HMM tries to capture the statistical differences in exons and introns. The HMM has four states, where E1, E2, and E3 are used to model the base statistics in exons. Each Ek uses a different set of emission probabilities to reflect the symbol statistics at the k th position of a codon. The state I is used to model the base statistics in introns. Note that this HMM can represent genes with multiple exons, where the respective exons can have variable number of codons, and the introns can also have variable lengths. This example shows that if we know the structure and the important characteristics of the biological sequences of interest, building the corresponding HMM is relatively simple and it can be done in an intuitive manner.As we mentioned earlier, HMMs can be effectively used for representing biological sequences. As a simple example, let us consider an HMM that models protein-coding genes in eukaryotes. It is well known that many protein-coding regions display codon bias. The nonuniform usage of codons results in different symbol statistics for different codon positions , and it x = x1 ... x19 = ATGCGACTGCATAGCACTT How can we find out whether this DNA sequence is a coding gene or not? Or, if we assume that x is a protein-coding gene, how can we predict the locations of the exons and introns in the given sequence? We can answer the first question by computing the observation probability of x based on the given HMM that models coding genes. If this probability is high, it implies that this DNA sequence is likely to be a coding gene. Otherwise, we may conclude that x is unlikely to be a coding gene, since it does not contain the statistical properties that are typically observed in protein-coding genes. The second question is about predicting the internal structure of the sequence, as it cannot be directly observed. To answer this question, we may first predict the state sequence y in the HMM that best describes x. Once we have inferred the best y, it is straightforward to predict the locations of the exons and introns. For example, assume that the optimal state sequence y is as shown in Fig. (1). This implies that the first nine bases x1 ... x9 belong to the first exon, the following four bases x10 ... x13 belong to an intron, and the last six bases x14 ... x19 belong to another exon. As these examples show, HMMs provide a formal probabilistic framework for analyzing biological sequences.The constructed HMM can now be used to analyze new observation sequences. For example, let us assume that we have a new DNA sequence 2.3.x = x1x2 ...Lx. How can we compute the observation probability P{x | Θ} based on a given HMM? This problem is sometimes called the scoring problem, since computing the probability P{x | Θ} is a natural way of `scoring' a new observation sequence x based on the model at hand. Note that for a given x, its underlying state sequence is not directly observable and there can be many state sequences that yield x. Therefore, one way to compute the observation probability is to consider all possible state sequences y for the given x and sum up the probabilities as followsThere are three basic problems that have to be addressed in order to use HMMs in practical applications. Suppose we have a new symbol sequence                 LM possible state sequences. For this reason, we definitely need a more efficient method for computing P{x | Θ}. There exist a dynamic programming algorithm, called the forward algorithm, that can compute P{x | Θ} in an efficient manner [forward variableHowever, this is computationally very expensive, since there are t manner . Instead                This variable can be recursively computed using the following formula                n = 2,...,L. At the end of the recursions, we can compute Px|Θ=∑kαL,k. This algorithm computes the observation probability of x with only O(LM2) computations. Therefore, the amount of time required for computing the probability increases only linearly with the sequence length L , instead of increasing exponentially.for x, Among all possible state sequences y, we want to find the state sequence that best explains the observed symbol sequence. This can be viewed as finding the best alignment between the symbol sequence and the HMM, hence it is sometimes called the optimal alignment problem. Formally, we want to find the optimal path y* that satisfies the followingAnother practically important problem is to find the optimal state sequence, or the optimal path, in the HMM that maximizes the observation probability of the given symbol sequence                 P{x,y | Θ} , since we haveNote that this is identical to finding the state sequence that maximizes                 *y by comparing all LM possible state sequences is computationally infeasible. However, we can use another dynamic programming algorithm, well-known as the Viterbi algorithm, to find the optimal path *y efficiently [Finding the optimal state sequence iciently , 15. The                and computes it recursively using the following formula                At the end, we can obtain the maximum observation probability as follows                *y can be easily found by tracing back the recursions that led to the maximum probability P∗=Px,y∗|Θ. Like the forward algorithm, the Viterbi algorithm finds the optimal state sequence in O(LM2) time.The optimal path entire symbol sequence. In some cases, it may be more useful to find the optimal states individually for each symbol position. In this case, we can find the optimal state ny that is most likely to be the underlying state of nx as followsAs we have seen, the Viterbi algorithm finds the optimal path that maximizes the observation probability of the                 x and Θ. The posterior probability P{ny = i | x, Θ} can be computed frombased on the given                 βis defined aswhere                 backward variable β can be recursively computed using the backward algorithm as followsThis                 n = L – 1, L – 2,…,1. The advantage of predicting the optimal states individually is that this approach will maximize the expected number of correctly predicted states. However, the overall state sequence yˆ=y1ˆy2ˆ...yLˆ  will be generally suboptimal, hence Px,yˆ|Θ≤Px,y∗|Θ. In some cases, the predicted path yˆmay not be even a legitimate path in the given HMM, in which case we will have Px,yˆ|Θ=0. For this reason, the Viterbi algorithm is often preferred when we are interested in inferring the optimal state sequence for the entire observation x, while the posterior-decoding approach in (14) is preferred when our interest is mainly in predicting the optimal state at a specific position. The posterior probability in (15) can also be useful for estimating the reliability of a state prediction. For example, we may first predict the optimal path y∗=y1∗...yL∗ as in (9) using the Viterbi algorithm, and then estimate the reliability of the individual state prediction yn∗ by computing the posterior probability Pyn=yn∗|x,Θ as in (15).for x based on the given HMM. However, the solutions to these problems are meaningful only if the HMM can properly represent the sequences of our interest. Let us assume that we have a set of related observation sequences X = {x1,x2,...,xT} that we want to represent by an HMM. For example, they may be different speech recordings of the same word or protein sequences that belong to the same functional family. Now, the important question is how we can reasonably choose the HMM parameters based on these observations. This is typically called the training problem. Although there is no optimal way of estimating the parameters from a limited number of finite observation sequences, there are ways to find the HMM parameters that locally maximize the observation probability [Baum-Welch algorithm [forward-backward procedure [Monte Carlo EM (MCEM) algorithm, which adopts the Monte Carlo approach to approximate the so-called E-step (expectation step) in the EM algorithm [The scoring problem and the alignment problem are concerned about analyzing a new observation sequence bability -18. For lgorithm  to trainrocedure . Since trocedure , 18. It rocedure , 19. Thelgorithm , 21. Curlgorithm , 23 for 2.4.There exist a large number of HMM variants that modify and extend the basic model to meet the needs of various applications. For example, we can add silent states  to the model in order to represent the absence of certain symbols that are expected to be present at specific locations , 25. We 3.profile hidden Markov model (profile-HMM) [kmatch states M, kinsert states I, and kdelete states D, to describe position-specific symbol frequencies, symbol insertions, and symbol deletions, respectively.Let us assume that we have a multiple sequence alignment of proteins or DNA sequences that belong to the same functional family. How can we build an HMM that can effectively represent the common patterns, motifs, and other statistical properties in the given alignment? One model that is especially useful for representing the profile of a multiple sequence alignment is the ile-HMM) , 25. Pro3.1.2a).To see how profile-HMMs work, let us consider the following example. Suppose we want to construct a profile-HMM based on the multiple alignment shown in Fig.  at the k th match state kM reflects the observed symbol frequencies in the k th consensus column. By interconnecting the match states M1,M2,...,M5, we obtain an ungapped HMM as shown in Fig. (2b). This ungapped HMM can represent DNA sequences that match the consensus sequence of the alignment without any gap, and it serves as the backbone of the final profile-HMM that is to be constructed.As we can see, the given alignment has five columns, where the base frequencies in the respective columns are different from each other. The kI and delete states kD to the model so that we can account for insertions and deletions in new observation sequences. Let us first consider the case when the observed DNA sequence is longer than the consensus sequence of the original alignment. In this case, if we align these sequences, there will be one or more bases in the observed DNA sequence that are not present in the consensus sequence. These additional symbols are modeled by the insert states. The insert state kI is used to handle the symbols that are inserted between the k th and the (k + 1)th positions in the consensus sequence. Now, let us consider the case when the new observed sequence is shorter than the consensus sequence. In this case, there will be one or more bases in the consensus sequence that are not present in the observed DNA sequence. The k th delete state kD is used to handle the deletion of the k th symbol in the original consensus sequence. As delete states represent symbols that are missing, kD is a non-emitting state, or a silent state, which is simply used as a place-holder that interconnects the neighboring states. After adding the insert states and the delete states to the ungapped HMM in Fig. (2b), we obtain the final profile-HMM that is shown in Fig. (2c).Once we have constructed the ungapped HMM, we add insert states kM (for the symbols in the given column) and a delete state kD (for the gaps in the same column). On the contrary, if we have more gaps than symbols, it would make more sense to view the symbols as insertions, hence we use an insert state kI to represent the column. Once we have decided which columns should be represented by match states and which ones should be represented by insert states, we know the underlying state sequence for each symbol sequence in the alignment. Therefore, we can estimate the transition probabilities and the emission probabilities of the profile-HMM by counting the number of each state transition or symbol emission and computing their relative frequencies. To allow small probability for state transitions or symbol emissions that are not observed in the original alignment, we can add the so-called pseudocounts to the actual counts [Estimating the parameters of a profile-HMM based on a given multiple sequence alignment is relatively simple. We first have to decide which columns should be represented by match states and which columns should be modeled by insert states. Suppose we have a column that contains one or more gaps. Should we regard the symbols in the column as `insertions', or should we rather view the gaps in the column as `deletions'? One simple rule would be to compare the number of symbols and the number of gaps. If the column has more symbols than gaps, we treat the gaps as symbol deletions. Therefore, we model the column using a match state l counts .We can also use more sophisticated methods for parameterizing the profile-HMMs. In fact, there have been considerable research efforts for optimal construction and parameterization of profile-HMMs to improve their overall performance. More discussions on this topic can be found in , 28-32.3.2.Due to the convenience and effectiveness in representing sequence profiles, profile-HMMs have been widely used for modeling and analyzing biological sequences. When profile-HMMs were first proposed, they were quickly adopted for modeling the characteristics of a number of protein families, such as globins, immunoglobulins, and kinases . They haIt would be also very convenient to have a library of ready-made profile-HMMs for known sequence families. Currently, we have two such libraries that have compiled a large number of profile-HMMs for various protein families: the PROSITE database , 37 and Sometimes, we may want to compare two multiple sequence alignments or sequence profiles, instead of comparing a single sequence against a multiple alignment or a profile. Comparing sequence profiles can be beneficial for detecting remote homologues, and profile-HMMs have also been used for this purpose -42. For et al. [feature-based profile-HMM that was proposed to improve the performance of remote protein homology detection [Although profile-HMMs have been widely used for representing sequence profiles, their application is by no means limited to modeling amino acid or nucleotide sequences. For example, Di Francesco et al. , 44 usedetection . Insteadetection  and usinjumping profile-HMM (jpHMM) [jumping-alignment approach. The jumping-alignment approach is a strategy for comparing a sequence with a multiple alignment, where the sequence is not aligned to the alignment as a whole, but it can `jump' between the sequences that constitute the alignment. In this way, different parts of the sequence can be aligned to different sequences in the given alignment. A jpHMM uses multiple match states for each column to represent different sequence subtypes. The HMM is allowed to jump between these match states based on the local similarity of the sequence and the different sequence subtypes in the model. This approach has been shown to be especially useful for detecting recombination breakpoints [There are also variants of the basic profile-HMM, where the  (jpHMM)  is one sakpoints .4.In biological sequence analysis, it is often important to compare two sequences to find out whether these sequences are functionally related. Sequence similarity is often a good indicator of their functional relevance, and for this reason, methods for quantitatively measuring the similarity of two proteins or DNA sequences have been of interest to many researchers. A typical approach for comparing two biological sequences is to align them based on their similarity, compute their alignment score, and evaluate the statistical significance of the predicted alignment. To find the best alignment between the sequences, we first have to define a reasonable scoring scheme for ranking different alignments. Based on this scoring scheme, we can choose the alignment that maximizes the alignment score.4.1.pair hidden Markov model (pair-HMM) [3).The air-HMM)  is a varxI, zI, and A , to simultaneously generate two aligned DNA sequences x=x1...xLx(sequence 1) and z=z1...zLz (sequence 2). The state xI emits a single unaligned symbol ix in the first sequence x. Similarly, the state zI emits an unaligned symbol jz only in the second sequence z. Finally, the state A generates an aligned pair of two symbols ix and jz, where ix is inserted in x and jz is inserted in z. For example, let us consider the alignment between x = x1 x2x3x4x5 = TTCCG and z = z1 z2z3z4z5 = CCGTT illustrated in Fig. (3). We assume that the underlying state sequence is y = IxIxAAAIzIz as shown in the figure. As we can see x1  and x2 are individually emitted at xI, hence they are not aligned to any bases in z . The pairs , , and  are jointly emitted at A , and therefore the bases in the respective pairs are aligned to each other. Finally, z4 and z5 are individually emitted at zI as unaligned bases.This simple pair-HMM traverses between the states y and the alignment between the two observed sequences x and z . Therefore, based on the pair-HMM framework, the problem of finding the best alignment between x and z reduces to the problem of finding the following optimal state sequenceAs we can see from this example, there is a one-to-one relationship between the hidden state sequence                 P{x,z,y | Θ}, since we haveNote that this is identical to finding the optimal path that maximizes                 * can be found using dynamic programming, by a simple modification of the Viterbi algorithm [O(xLzL), where xL and zL are the lengths of x and z, respectively.The optimal state sequence ylgorithm . The comP{x,z | Θ} of sequences x and z can be computed by summing over all possible state sequencesAn important advantage of the pair-HMM based approach over traditional alignment algorithms is that we can use the pair-HMM to compute the alignment probability of a sequence pair. When the given sequences do not display strong similarities, it is difficult to find the correct alignment that is biologically meaningful. In such cases, it would be more useful to compute the probability that the sequences are related, instead of focusing only on their best alignment. The joint observation probability                 P{x,z | Θ} in an efficient manner [ix will be aligned to jz is P, where ky denotes the underlying state for the aligned pair . This probability can be computed as followsInstead of enumerating all possible state sequences, we can modify the original forward algorithm to compute t manner . It is a                using a modified forward-backward algorithm .4.2.As pair-HMMs provide a full probabilistic framework for handling pairwise alignments, they have been extensively used for finding pairwise alignment of proteins and DNA sequences . For exaprogressive alignment approach, where sequences are assembled into one large multiple alignment through consecutive pairwise alignment steps according to a guide tree [probabilistic consistency transformation of the posterior probabilities, when finding the alignments. It was demonstrated that this probabilistic consistency based approach can achieve significant improvement over traditional progressive alignment algorithms [Many multiple sequence alignment (MSA) algorithms also make use of pair-HMMs -52. The ide tree , 54. Theide tree -52 combiide tree  uses a pide tree  also usegorithms .de novo gene prediction algorithm [generalized pair hidden Markov model (GPHMM) [Pair-HMMs have also been used for gene prediction , 55-58. lgorithm . In thislgorithm , 58. The (GPHMM)  provides (GPHMM)  are impllinear symbol sequences, we can use it for aligning more complex structures, such as trees. For example, the PHMMTSs (pair hidden Markov models on tree structures) extend the pair-HMMs so that we can use them for aligning trees [structural alignment of RNAs, where an RNA with an unknown structure is aligned to an RNA with a known secondary structure. This structural alignment is distinct from a sequence-based alignment, in the sense that we consider both the structural similarity and the sequence similarity when finding the optimal alignment between the RNAs. Pair stochastic tree adjoining grammars (PSTAGs) extend the PHMMTSs further, so that we can use them to align TAG (tree adjoining grammar) trees [Although the pair-HMM is originally defined on the pairwise alignment of ng trees . As mostng trees , PHMMTSsr) trees . This ex5.stochastic context-free grammars (SCFGs) have been employed in RNA sequence analysis [context-sensitive HMM (csHMM) is a variant of HMM that can be used for this purpose [Despite their usefulness in various sequence analysis problems, especially, those dealing with proteins and DNA sequences, traditional HMMs have inherent limitations that make them not suitable for handling RNA sequences. Many non-coding RNAs (ncRNAs) conserve base-paired secondary structures that induce pairwise correlations between non-adjacent bases . Howeveranalysis , 63. Alt purpose , 64.5.1.nsingle-emission states S, npairwise-emission states P, and ncontext-sensitive states C. The single-emission states are similar to the regular states in traditional HMMs. They have fixed emission probabilities and do not make use of any contextual information. In addition to the single-emission states, two new types of states, the pairwise-emission states and the context-sensitive states, are introduced in csHMMs. These states cooperate to describe pairwise symbol correlations. Like single-emission states, pairwise-emission states also have fixed emission probabilities. However, the symbols emitted at a pairwise-emission state nP are stored in the memory 1 that is associated with the state nP. These symbols are used later on as the `contextual information' for adjusting the probabilities at the corresponding context-sensitive state nC. When we enter the context-sensitive state nC, we first access the associated memory to retrieve the symbol ix that was previously emitted at the corresponding pairwise-emission state iy = nP. The emission probability at jy = Cn(j > i) is adjusted based on the retrieved symbol ix (the `context'). We can denote this context-sensitive emission probability asThe main difference between a context-sensitive HMM and a traditional HMM is that a csHMM can use part of the past emissions  to adjust the probabilities at certain future states. The use of such contextual information is very useful in describing long-range correlations between symbols, and this context-dependency increases the descriptive capability of the HMM considerably . Unlike                 e(ix| iy) at a pairwise-emission state iy = nP and the emission probability e at the corresponding context-sensitive state jy = nC, we obtain the joint emission probability of ix and jxNote that by combining the emission probability                 ix is independent of iy. This clearly shows that we can describe long-range pairwise symbol correlations by using a pair of nP and nC, and then specifying their emission probabilities. Since a given pairwise-emission state nC and its corresponding context-sensitive state nC work together to describe the symbol correlations, these states always exist in pairs, and a separate memory is allocated to each state pair . As we need the contextual information to adjust the emission probabilities at a context-sensitive state, the transition probabilities in the model are adjusted such that we never enter a context-sensitive state if the associated memory is empty [where we used the fact that is empty .nP and the corresponding context-sensitive states nC accordingly. As a simple example, let us consider a csHMM that generates only symmetric sequences, or palindromes. Such an example is shown in Fig. (4).Using context-sensitive HMMs, we can easily describe any kind pairwise symbol correlations by arranging the pairwise emission states 1P and context-sensitive state 1C, and one single-emission state 1S. In this example, the state pair  uses a stack, and the two states work together to model the symbol correlations that are induced by the symmetry of the sequence. Initially, the csHMM enters the pairwise-emission state 1P and emits one or more symbols. The symbols emitted at 1P are stored in the stack. When we enter 1C, we first retrieve a symbol from the top of the stack. Based on this symbol, the emission probabilities of 1C are adjusted such that it emits an identical symbol with probability 1. Transition probabilities of 1C are adjusted such that it makes a transition to itself until the stack becomes empty. Once the stack becomes empty, the csHMM terminates. In this way, the csHMM shown in Fig. (4) generates only palindromes that take one of the following formsThe model has three states, a pair of pairwise-emission state e = x1x2 ... NxNx ... x2x1 (even length)xo = x1x2 ... NxN+1xNx ... x2x1 (odd length)xxe and xo will beThe underlying state sequences for ye=P1...P1︸N statesC1...C1︸N states and yo=P1...P1︸S1N statesC1...C1︸,N states                            1S is only used to generate the symbol located in the center of a palindrome with odd length, since this symbol is not correlated to any other symbols.respectively. Note that the single-emission state nP and nC based on the positions of the base-pairs, and adjust the emission probabilities at nC such that they emit the bases that are complementary to the bases emitted at the corresponding nP. By adjusting the context-sensitive emission probabilities e, we can model any kind of base-pairs including non-canonical pairs. Considering that the widely used stochastic context-free grammars can model only nested base-pairs, hence no pseudoknots, the increased modeling capability and the ease of representing any kind of base-paired structures are important advantages of context-sensitive HMMs [This example clearly shows how we can represent pairwise correlations using a csHMM. When modeling RNAs with conserved base-pairs, we can arrange ive HMMs , 61.5.2.profile context-sensitive HMM (profile-csHMM) provides a convenient probabilistic framework that can be used for this purpose [Suppose we have a multiple alignment of relevant RNA sequences. How can we build a probabilistic model to represent the RNA profile, or the important features in the given RNA alignment? Due to the conservation of secondary structure, multiple RNA alignments often display column-wise correlations. When modeling an RNA profile, it is important to reflect these correlations in the model, along with the conserved sequence information. The  purpose , 65. Prokmatch states M, kinsert states I, and kdelete states D to model symbol matches, symbol insertions, and symbol deletions, respectively. The main difference between a profile-HMM and a profile-csHMM is that the profile-csHMM can have three different types of match states. As we have seen in Sec. 5.1, context-sensitive HMMs use three different types of states, where the single-emission states nS are used to represent the symbols that are not directly correlated to other symbols, while the pairwise-emission states nP and the context-sensitive states nC are used together to describe pairwise symbol correlations. In a profile-csHMM, each kM can choose from these three types of states. Therefore, we can have single-emission match states, pairwise-emission match states, and context-sensitive match states. Single-emission match states are used to represent the columns that are not involved in base-pairing. The pairwise correlations between columns, induced by conserved base-pairs, can be represented by using pairwise-emission match states and the corresponding context-sensitive match states.Like conventional profile-HMMs, profile-csHMMs also repetitively use 5a). Since the alignment has five columns, we need five match states to represent the sequence profile. There exist two base-pairs in the consensus RNA structure, where the bases in the first column form base-pairs with those in the fourth column, and the bases in the second column form base-pairs with those in the fifth column. In order to describe the correlation between the first and the fourth columns, we use a pairwise-emission state for the first match state 1M and the corresponding context-sensitive state for the fourth match state 4M. Similarly, we use a pairwise-emission state for 2M and the corresponding context-sensitive state for 5M. We use a single-emission state for the third match state 3M, since the third column is not involved in base-pairing. By interconnecting the five match states 1M,2M,...,5M, we obtain an ungapped csHMM for the given alignment, as shown in Fig. (5b). Finally, we add insert states kI and delete states kD to the ungapped model to obtain the final profile-csHMM. Since the inserted bases are not correlated to other bases, we use a single-emission state for each kI. As in profile-HMMs, the delete states kD are non-emitting states, and they are simply used to interconnect the neighboring states.As an example, let us assume that we want to construct a profile-csHMM for the alignment shown in Fig.  cannot be directly used for profile-csHMMs. However, we can generalize these algorithms so that they can be used with profile-csHMMs. For example, the sequential component adjoining (SCA) algorithm [As illustrated in this example, profile-csHMMs provide a convenient tool of modeling RNA profiles. Profile-csHMMs can represent lgorithm , which i5.3.Profile-csHMMs can be used for finding structural alignment of RNAs and performing RNA similarity searches , 66. In Cocke-Younger-Kasami (CYK) algorithm [O(3L), where L is the length of the RNA to be aligned. Considering that the computational complexity of the Viterbi algorithm increases only linearly with the sequence length, this is a significant increase. The complexity of a simultaneous RNA folding (structure prediction) and alignment algorithm [O(3NL) computations for aligning N RNAs of length L . These algorithms do not consider pseudoknots, and if we allow pseudoknots, the complexity will increase further. The high computational cost often limits the utility of many RNA sequence analysis algorithms, especially when the RNA of interest is long.One practical problem that frequently arises in RNA sequence analysis is the high computational complexity. As RNA alignment algorithms have to deal with complicated base-pair correlations, they require significantly more computations compared to sequence-based alignment algorithms. For example, the lgorithm , which ilgorithm  is even covariance models (CMs). Covariance models can be viewed as profile-SCFGs that have a special structure useful for modeling RNA families [To overcome this problem, various heuristics have been developed to expedite RNA alignment and RNA search algorithms. For example, profile-HMM based prescreening filters , 71 havefamilies , 63. In families , 71, we families .pair stochastic context-free grammars (pair-SCFGs) [There also exist a number of methods to improve the speed of simultaneous RNA folding and alignment algorithms , 73. Forr-SCFGs)  also empr-SCFGs) , 73.6.Hidden Markov models have become one of the most widely used tools in biological sequence analysis. In this paper, we reviewed several different types of HMMs and their applications in molecular biology. It has to be noted that this review is by no means exhaustive, and that there still exist many other types of HMMs and an even larger number of sequence analysis problems that have benefited from HMMs. Hidden Markov models provide a sound mathematical framework for modeling and analyzing biological sequences, and we expect that their importance in molecular biology as well as the range of their applications will grow only further.


Sequence alignment programs such as MUMmer have proven essential for analysis of these data, but researchers will need ever faster, high-throughput alignment tools running on inexpensive hardware to keep up with new sequence technologies.The recent availability of new, less expensive high-throughput DNA sequencing technologies has yielded a dramatic increase in the volume of sequence data that must be analyzed. These data are being generated for several purposes, including genotyping, genome resequencing, metagenomics, and This paper describes MUMmerGPU, an open-source high-throughput parallel pairwise local sequence alignment program that runs on commodity Graphics Processing Units (GPUs) in common workstations. MUMmerGPU uses the new Compute Unified Device Architecture (CUDA) from nVidia to align multiple query sequences against a single reference sequence stored as a suffix tree. By processing the queries in parallel on the highly parallel graphics card, MUMmerGPU achieves more than a 10-fold speedup over a serial CPU version of the sequence alignment kernel, and outperforms the exact alignment component of MUMmer on a high end CPU by 3.5-fold in total application time when aligning reads from recent sequencing projects using Solexa/Illumina, 454, and Sanger sequencing technologies.MUMmerGPU is a low cost, ultra-fast sequence alignment program designed to handle the increasing volume of data produced by new, high-throughput sequencing technologies. MUMmerGPU demonstrates that even memory-intensive applications can run significantly faster on the relatively low-cost GPU than on the CPU. The algorithm can then report the occurrences of Q at the positions represented by all leaves in the subtree rooted at v after checking the alignments are maximal by comparing the left flanking base of the query and reference. The algorithm then continues by finding the longest substrings for each of the m - 1 remaining start positions in Q. However, instead of navigating the tree from the root each time, the algorithm resumes aligning with Q[i + 1] after following the suffix link from v to v' and without reprocessing previously aligned characters.All substrings of a query string l and a query Q, suppose there is an exact alignment of length M ≥ l for the substring starting at position i in the query and ending at or along the edge to node N. The length of the alignment (M) is equal to the length of the path-label of the parent of node N plus the length along the edge to N. Starting from N, the algorithm follows successive parent links up the tree, subtracting the edge length of each link from the alignment length, until the alignment length is less than l as shown in Figure R be the node with the smallest string depth greater than l on this path. For each leaf L in the subtree rooted by R, the path-label to the lowest common ancestor of N and L defines a substring starting at i in Q which occurs in both Q and S at the reference position defined by the leaf label of L. For a thorough discussion of suffix trees and their applications, see Gusfield's classic work on sequence analysis [Given a user-specifed minimum length analysis .As the GPU has become increasingly more powerful and ubiquitous, researchers have begun exploring ways to tap its power for non-graphics, or general-purpose (GPGPU) applications . This haarithmetic intensity – the ratio of time spent performing arithmetic to the time spent transferring data to and from memory [et al. implemented the Smith-Waterman local sequence alignment algorithm to run on the nVidia GeForce 6800 GTO and GeForce 7800 GTX, and reported an approximate 16× speedup by computing the alignment score of multiple cells simultaneously [et al. ported an expensive loop from RAxML, an application for phylogenetic tree construction, and achieved a 1.2× speedup on the nVidia GeForce 5700 LE [Most GPGPU successes stem from scientific computing or other areas with a homogeneous numerical computational component ,18. Thesm memory . In genem memory . Some bianeously . Charala 5700 LE .nVidia's new G80 architecture radically departs from the traditional vertex+fragment processor pipeline. It features a set of multiprocessors that each contain a number of stream processors Figure . Graphichost, and a smaller but computationally intensive component called the kernel that runs in parallel on the GPU  are reported by post-processing the raw alignment results on the CPU. The output format and many parameters of MUMmerGPU are identical to those of mummer (with the -maxmatch option), up to the order in which alignments appear in the output for each query, and thus MUMmerGPU can be used as a drop-in replacement for mummer. In particular, all programs in the NUCmer suite of programs that use the output of mummer, including those that extend the exact alignment seeds to larger inexact alignments, can take advantage of the GPU paralellization [The MUMmerGPU algorithm performs parallelized exact string alignment on the GPU Figure . First alization -6.k smaller suffix trees from overlapping segments of the reference. MUMmerGPU computes k at runtime to fill approximately one third of the total GPU device memory with tree data. The trees overlap in the reference sequence by the maximum query length m supported by MUMmerGPU (currently 8192 bp) to guarantee all alignments in the reference are found, but alignments in the overlapping regions are reported only once.The G80 has a relatively small amount of on-board memory, so the data are partitioned into large blocks so that the reference suffix tree, query sequences, and output buffers will fit on the GPU. As of this writing, the amount of on-board memory for a G80 ranges from 256 MB to 768 MB. A suffix tree built from a large reference sequence, such as a human chromosome, will exceed this size, so MUMmerGPU builds kernel, aligns a single query sequence from the multiprocessor's subset to the reference. The kernel aligns the query to the reference by navigating the tree using the suffix-links to avoid reprocessing the same character of the query, as described above. Reverse complement alignments are computed using a second version of the kernel which reverse complements the query sequences on-the-fly while aligning, allowing for computing both forward and reverse alignments without any additional data transfer overhead. The output buffer contains a slot to record the alignment result for each of the m - l + 1 substrings for a query of length m. The fixed size alignment result consists of the node id of the last visited node in the tree and length of the substring that exactly aligns. This information is sufficient to print all positions in the reference that exactly align the substring on the CPU.After building the trees, MUMmerGPU computes the amount of GPU memory available for storing query data and alignment results. The queries are read from disk in blocks that will fill the remaining memory, concatenated into a single large buffer (separated by null characters), and transferred to the GPU. An auxiliary 1D array, also transfered to the GPU, stores the offset of each query in the query buffer. Each multiprocessor on the GPU is assigned a subset of queries to process in parallel, depending on the number of multiprocessors and processors available. The executable code running on each processor, the k > 1), then the output slots for each tree are preserved until the queries in a block have been aligned against each tree. This way all of the alignments for a given query can be printed in a single block, following the syntax used by mummer.After the kernel is complete for all the queries, the output buffer on the GPU is transfered to host RAM and the alignments are printed by the CPU. Each slot in the output buffer corresponds to a specific substring of a query. If multiple trees were built from the reference  in these two textures. The node texture stores half the information for a node, including the start and end coordinates of the edge sequence in the reference, and the suffix link for the node. The remaining information for a node – the pointers to its A, C, G & T children – is stored in the child texture, addressed in parallel to the node texture. An auxiliary table containing each node's edge length, sequence depth, parent pointer, and suffix number for leaf nodes, is stored in RAM and is used during the output phase.<16), nodes are assigned using a level-order (breadth-first) traversal of the tree creating "wide" blocks of the tree. This ensures that all nodes near the root of the tree are placed in the first 32 × 32 texel blocks, and guarantees the children of a given node will be at (nearly) adjacent cells in the texture. This is useful because at this depth, loading a single 32 × 32 block for one kernel is likely to be reused for the other kernels running in parallel. Further from the root (depth ≥ 16), nodes are arranged in "tall" blocks so that a node, its children, grandchildren, and great-grandchildren are adjacently placed in the same (or adjacent) 32 × 32 block. As multiple queries are aligned against lower parts of the tree, it becomes less likely that their kernels will access many of the same nodes. Thus, the data reordering scheme attempts to increase the cache hit rate for a single thread. The exact specification of the G80's caching scheme is proprietary information, but empirically, this hybrid layout seems to maximize the cache hit rate near the root of the tree, and towards the leaves where the kernel access patterns are radically different.In the CUDA architecture, a program can store read-only data as cached textures. The G80's proprietary caching scheme takes advantage of 2D locality common in texturing operations. Therefore, the algorithm attempts to optimize the 2D locality of the tree structure in these textures by organizing the nodes in 32 × 32 texel blocks as shown in Figure The reference sequence for the tree is transferred to the GPU as a third 2D texture, and is reordered along a simple 2D space-filling curve to maximize the cache hit rate for subsequent accesses along a node's edge. The sequence is reordered so that beginning with the first character, every four characters in the reference become the topmost four characters in the columns of the 2D array. Once the array contains 4 × 65,536 characters, successive four-character chunks become the next four characters in the columns, left-to-right, and so on. We experimented with a variety of other data reordering schemes, including along a Morton curve and other space filling curves, and found this to have the best performance on several reference sequences. Altogether, using cache memory organized with the spacing-filing curves for the suffix tree and reference sequence improved the kernel execution speed by several fold.O(n) time with Ukkonen's algorithm, where n is the length of the reference. The alignment kernel running on the card computes all exact substring alignments for each query in time linear in the length of the query. The kernel is an implementation of existing alignment methods [MUMmerGPU constructs its suffix trees in  methods , but witO(n/k + m) space, where k is the number of overlapping trees specified by the user, and m is the maximum query length supported by MUMmerGPU. Note that for most expected uses of MUMmerGPU n ≫ m. Only a fraction of that total space is actually transferred to the GPU. In the current implementation, 32 out of every 48 bytes per node are transferred. The remaining bytes are stored in the host-only auxiliary table used only for printing results by the CPU. For each query, MUMmerGPU transfers the null terminated query sequence prepended with a special mismatch character, along with two 4-byte entries in auxiliary tables used by the kernel. For a query of length m, and a minimum substring length l, m - l + 1 output slots are reserved to record the query's substring alignments, and each output slot occupies 8 bytes. The total space required on both the CPU and the GPU for each query is 8(m - l + 1) + (m + 10) bytes. On a G80 with 768 MB of on-board RAM, there is sufficient RAM to store a tree for a 5 Mbp reference sequence, and 5 million 25 bp or 500,000 100 bp query sequences.MUMmerGPU uses both GPU memory and main system memory. Suffix trees use an amount of memory linear in the length of the reference from which they are constructed . The sufWe measured the relative performance of MUMmerGPU by comparing the execution time of the GPU and CPU version of the alignment code, and the total application runtime of MUMmerGPU versus the serial application mummer. The test machine has a 3.0 GHz dual-core Intel Xeon 5160 with 2 GB of RAM, and an nVidia GeForce 8800 GTX. The 8800 GTX has 768 MB of on-board RAM and a G80 with 16 multiprocessors, each of which has 8 stream processors. At the time of this writing, the retail price of the 8800 GTX card is $529, and a retail-boxed Intel Xeon 5160 CPU is $882 . Input aWe ported the MUMmerGPU alignment kernel to use the CPU instead of the GPU to isolate the benefit of using graphics hardware over running the same algorithm on the CPU. CUDA allows programmers to write in a variant of C, so porting MUMmerGPU to the CPU required only straightforward syntactic changes, and involved no algorithmic changes. Where the CUDA runtime invokes many instances of the kernel on the GPU simultaneously, the CPU executes each query in the block sequentially.Bacillus anthracis genome (GenBank ID: NC_003997.3). Thus, each read exactly aligns to the genome end-to-end at least once, and possibly more depending on the repeat content of the genome. When aligning each of the five sets of reads, we used l equal to the read size for the set. Each set contained exactly 250,000,000 base pairs of query sequence divided evenly among all the reads in the set.The first test scenario was to align synthetically constructed reads to a bacterial genome. We used synthetic reads in order to explore MUMmerGPU's performance in the absence of errors and over a wider variety of query lengths then are available with genuine reads. The synthetic test reads consisted of 50-, 100-, 200-, 400-, and 800-character substrings (uniformly randomly) sampled from the The time for building the suffix tree, reading queries from disk, and printing alignment output is the same regardless of whether MUMmerGPU ran on the CPU or the GPU, since those parts of MUMmerGPU always run on the CPU. The actual sequence alignment portion of MUMmerGPU ran dramatically faster, over 10× faster, on the GPU, despite the added cost of transferring the tree and query data to the GPU. The speedup of MUMmerGPU (not including the costs mentioned above shared by both variants) running on the GPU over MUMmerGPU on the CPU is shown in Figure For longer reads, the speedup of using the GPU is diminished, because of poor cache performance and thread divergence, both of which are acknowledged as potential performance problems on the G80 . All queStreptococcus suis sequenced with the Solexa/Illumina sequencer [Listeria monocytogenes sequenced using 454 pyrosequencing  and Caenorhabditis briggsae sequenced with standard ABI 3730xl Sanger-type sequencing [L. monocytogenes and S. suis, and against both strands of chromosome III of C. briggsae. Little data from Solexa/Illumina has been made public at the time of this writing, and the public data set available had only a single lane's worth of data. To represent the full set of reads from a full Solexa/Illumina run, we concatenated 10 copies of a publicly-available file containing 2,659,250 36 bp reads to form the S. suis query set. The reference sequence and queries in all three tests did not include ambiguous bases. For these three tasks, Table In addition to the test with synthetic data, we also aligned reads from several recent sequencing projects against the genomes from which the reads were generated. The projects included equencer , multiplquencing . We aligC. briggsae, MUMmerGPU spent most of its time aligning queries on the GPU. Because we aligned all of the reads from the sequence project against chromosome III of the C. briggsae, many of the reads did not align anywhere in the reference. As a result, a relatively short amount of time was spent in writing alignment output to disk. For other alignments, such as for the L. monocytogenes and S. suis test sets, the output phase dominates the running time of MUMmerGPU. For these tasks, printing the output in parallel with aligning a block of queries would provide substantial speedup, as it would hide much of the time spent aligning queries on the card. We plan to adopt this strategy in a future release of MUMmerGPU.For each of the alignment tasks, MUMmerGPU was between 3.47 and 3.79 times faster than mummer. For C. briggsae alignment required the use of a segmented suffix tree and associated data transfer overhead. In general, MUMmerGPU confers significant speedup over mummer on tasks in which many short queries are aligned to a single long reference.Despite the performance hazards experienced for longer simulated reads, MUMmerGPU on the GPU consistently outperforms mummer on real sequencing data by more than a factor of three in wall-clock application running time. Unlike the idealized simulated reads, these reads are variable length and have sequencing error, which will cause further divergence in the kernel executions. Furthermore, the Operations on the suffix tree have extremely low arithmetic intensity – they consist mostly of following a series of pointers. Thus, sequence alignment with a suffix tree might be expected to be a poor candidate for a parallel GPGPU application. However, our results show that a significant speedup, as much as a 10-fold speedup, can be achieved through the use of cached texture memory and data reordering to improve access locality. This speedup is realized only for large sets of short queries, but these read characteristics are beginning to dominate the marketplace for genome sequencing. For example Solexa/Illumina sequencing machines create on the order of 20 million 50 bp reads in a single run. For a single human genotyping application, reads from a few such runs need to be aligned against the entire human reference genome. Thus our application should perform extremely well on workloads commonly found in the near future. The success of our application is in large part the result of the first truly general purpose GPU programming environment, CUDA, which allowed us to directly formulate and implement our algorithm in terms of suffix tree navigation and not geometric or graphics operations. This environment made it possible to efficiently utilize the highly parallel and high speed 8800 GTX. An 8800 GTX is similar in price to a single 3.0 Ghz Xeon core, but offers up to 3.79× speedup in total application runtime. Furthermore, in the near future, a common commodity workstation is likely to contain a CUDA compliant GPU that could be used without any additional cost.Even though MUMmerGPU is a low arithmetic memory intensive program, and the size of the stream processor cache on the G80 is limited, MUMmerGPU achieved a significant speedup, in part, by reordering the nodes to match the access patterns and fully use the cache. We therefore expect with careful analysis of the access pattern, essentially any highly parallel algorithm to perform extremely well on a relatively inexpensive GPU, and anticipate widespread use of GPGPU and other highly parallel multicore technologies in the near future. We hope by making MUMmerGPU available open source, it will act as a roadmap for a wide class of bioinformatics algorithms for multi-processor environments.Project name: MUMmerGPUProject home page: Operating system(s): Linux, UNIXProgramming language: C, C++, CUDAOther requirements: nVidia G80 GPU, CUDA 1.0License: Artistic LicenseRestrictions to use by non-academics: none.MS and CT developed the software and wrote the manuscript together. AD and AV helped to draft and edit the manuscript. All authors read and approved the final manuscript.


We present swps3, a vectorized implementation of the Smith-Waterman local alignment algorithm optimized for both the Cell/BE and ×86 architectures. The paper describes swps3 and compares its performances with several other implementations.Our benchmarking results show that swps3 is currently the fastest implementation of a vectorized Smith-Waterman on the Cell/BE, outperforming the only other known implementation by a factor of at least 4: on a Playstation 3, it achieves up to 8.0 billion cell-updates per second (GCUPS). Using the SSE2 instruction set, a quad-core Intel Pentium can reach 15.7 GCUPS. We also show that swps3 on this CPU is faster than a recent GPU implementation. Finally, we note that under some circumstances, alignments are computed at roughly the same speed as BLAST, a heuristic method.The Cell/BE can be a powerful platform to align biological sequences. Besides, the performance gap between exact and heuristic methods has almost disappeared, especially for long protein sequences. The gold standard of sequence alignment is the optimal local sequence alignment with affine gap costs by Smith and Waterman ,2. Moderet al.  ported tet al. ,3 to theet al.  on generet al. [In this article, we introduce swps3, an implementation of the Smith-Waterman algorithm that extends Farrar's work to the IBM Cell/BE platform. There, the improvement in runtime over results reported by Sachdeva et al.  are at lBy implementing Farrar's algorithm on IBM Cell/BE and exploiting all available processor cores, swps3 achieves higher alignment speed than previous implementations.In the following, we compare swps3 with the following tools: ssearch35 , swsse , and NCBThe queries consist of protein sequences aligned against release 55.1 of the Swiss-Prot  databaseFigure Throughout the benchmark, the Intel Pentium Q6600 was the fastest platform. On that machine, swps3 reaches an average performance of 10.7 GCUPS with a maximum of 15.7 GCUPS. The multi-threaded heuristic methods are the fastest with short query sequences, but for sequences longer than 300 amino acids, WU-BLAST is dominated by swps3. As for NCBI-BLAST, it exhibits roughly similar average performance as swps3. This suggests that to align long protein sequences, the use of heuristics is no longer justified.Our implementation on Cell/BE performs relatively better with long sequence queries, when alignment scores are represented by 16-bit integers or 32-bit floating point values. In fact, it is able to catch up with the Intel Pentium Q6600 when processing (related) queries of 8000 amino acids (result not shown). On the other hand, the performances of the Cell/BE are limited by its sparse vector instruction set. For instance, the lack of support for 8-bit integer vectors restrains performance on short, unrelated sequences with low scores, which constitute the largest portion of the benchmark dataset.swps3 is largely based on previous implementations of the striped Smith-Waterman algorithm by . This seSynergistic Processing Elements (SPE). The SPEs are not able to access main memory directly. Instead, each unit has a local storage of 256 kiB SRAM and a programmable DMA controller which performs bulk transfers between local storage and main memory, without interrupting program execution on the SPE. Large portions of our code are written as C++ templates and we apply intrinsics to access platform specific instructions. In doing so the compiler is responsible for optimizations. To ease this task, we manually unroll the inner loops, which results in a considerable performance gain. On ×86, execution time is reduced by early termination of inner loops, while on Cell/BE, early termination savings are offset by the overhead of evaluating conditional branch instructions. In this case also, static branch prediction fails to improve performance, and thus we moved code checking for conditions of early termination out of the inner loop. Although the memory consumption of the algorithm is linear in the length of the query and of the database sequence, memory is mainly consumed by the profile data. As improvement over Sachdeva et al. [F in Farrar's notation) and maximum scores (H). Then, the next profile segment is fetched from main memory, replacing the old segment, and the alignment is resumed with the stored scores.The architecture of the Cell/BE differs in multiple aspects from other general purpose microprocessors. In addition to the main general-purpose PowerPC core (PPE), it features eight co-processors called In experiments with long amino acid sequences (> 5000 residues), we tried double-buffering the profile  but this resulted in worse performance. Indeed, pre-fetching requires additional local memory on the SPE, and thus decreases the length of the profile segments. Instead of pre-computing the profile on the PPE and transferring it to the SPE, we tried computing the profile directly on the SPE, thus only requiring the transfer of the query sequence and scoring matrix. Unfortunately, this approach resulted in a slightly higher execution time (results not shown). These results suggest that that the data transfers between PPE and SPE, even without double-buffering, only constitute a minor fraction of total execution time. Most biological query sequences are short enough for the entire profile to be loaded at once. The overhead of transmitting database sequences is also insignificant when considering that the Cell/BE is able to transmit 16 bytes every two processor cycles (25.6 GB/s at 3.2 GHz clock frequency).While working on the code for the Cell/BE, we found a few minor aspects of Farrar's implementation that could be improved. By design, only unsigned 8-bit integers are stored in the scoring matrix. For an alignment with 16-bit scores, the profile is created by expanding these to 16-bit values by setting the upper bytes to zero. We were able to reduce the cache footprint caused by the profile by creating an 8-bit profile and using an unpacking operation (_mm_unpacklo_epi8) to extend it to 16-bit in the inner loop of the algorithm. This has shown especially beneficial for long query sequences. Altogether, our SSE2 implementation shows a very good cache efficiency. According to Valgrind , we havelazy F evaluation loop (see [Furthermore we restructured the oop (see ) by tranIn order to exploit the whole potential of the Cell/BE, we designed a multi-threaded alignment algorithm to distribute the workload onto multiple SPEs and the PPE. After creating the profile, we fork one worker thread for each CPU core. It has proved most efficient to have six worker threads initializing a single SPE each and one thread performing an alignment using the Altivec instruction set of the PPE. The parent process handles file I/O and communicates with the worker threads over bidirectional pipes to supply them with database sequences and to collect alignment scores. Every worker thread computes the alignment of the query sequence with a separate database sequence. Note that the ×86 implementation also benefits from the multi-threaded design, as recent chips feature an increasing number of processing cores.In the current version, swps3 is only able to compute scores of local protein sequence alignments with affine gaps. It does not display the resulting alignment. Users can select their own scoring matrix through the command line. Matrix entries are restricted to signed 8-bit integer values (i.e. from -128 to 127), but support for reading and scaling floating point matrices is available in the code. Sequences are limited to a maximal length of 10000 amino acids and scores are bounded by the relevant data type for computations (unsigned 16-bit integer by default).swps3 is a fast and flexible Smith-Waterman implementation for the Cell/BE, for PowerPC, and for ×86/×86_64 architectures. With a performance of up to 15.7 GCUPS on a quad-core Pentium and 8.0 GCUPS on the Sony Playstation 3, it is the fastest implementation we know of on both platforms. In addition, it also outperforms computation on general purpose graphics hardware as reported by Manavski and Valle [project name: SWPS3project website: operating systems: Linux, Unix, Mac OS Xprogramming language: C, C++license: MITThe authors declare that they have no competing interests.CD initiated and coordinated the project. AS, CL, PK contributed to the program code. AS, CD performed the analysis and drafted this manuscript. All authors read and approved the final manuscript.