Substitution matrices are key parameters for the alignment of two protein sequences, and consequently for most comparative genomics studies. The composition of biological sequences can vary importantly between species and groups of species, and classical matrices such as those in the BLOSUM series fail to accurately estimate alignment scores and statistical significance with sequences sharing marked compositional biases.We present a general and simple methodology to build matrices that are especially fitted to the compositional bias of proteins. Our approach is inspired from the one used to build the BLOSUM matrices and is based on learning substitution and amino acid frequencies on real sequences with the corresponding compositional bias. We applied it to the large scale comparison of Mollicute AT-rich genomes. The new matrix, MOLLI60, was used to predict pairwise orthology relationships, as well as homolog families among 24 Mollicute genomes. We show that this new matrix enables to better discriminate between true and false orthologs and improves the clustering of homologous proteins, with respect to the use of the classical matrix BLOSUM62.We show in this paper that well-fitted matrices can improve the predictions of orthologous and homologous relationships among proteins with a similar compositional bias. With the ever-increasing number of sequenced genomes, our approach could prove valuable in numerous comparative studies focusing on atypical genomes. A fundamental task in evolutionary biology and comparative genomics is to quantify the similarity between biological sequences and then assess their evolutionary relationships. The challenge is in particular to distinguish between homologous  and unrelated sequences. DNA and protein sequences similarities are usually assessed through an alignment of sequences. The scoring function is crucial in the alignment process: not only it enables to choose the best pairing between the sequences among all possible, but also it is often at the heart of the evaluation of the alignment significance. Indeed, a p-value or e-value is usually derived from the score of the alignment to assess if it is statistically different from one that can arise by chance . Substitution matrices are therefore key parameters in the alignment process since they assign an elementary score to each match and mismatch between any two letters of the alphabet. This is particularly relevant in the case of protein alignment. As the protein alphabet contains 20 amino acids with different frequencies in biological sequences and different biochemical properties that may impact the protein structure, matches and mismatches between amino acids are not equipropable. It is thus crucial to take into account these differences in order to estimate accurately the similarity between sequences.The most widely used matrices are the BLOSUM  and PAM These matrices are typically expressed in log-odds scores: the score of the pairing of two amino acids is the logarithm of the ratio of the likelihoods of this pairing under two hypotheses: homology versus chance. It reflects thus how likely two aligned residues are descendants of a common ancestral residue with respect to random pairing: if the pairing of two residues is more likely to arise by chance than by homology the score will be negative, in the opposite situation it will be positive. Consequently, two probabilities need to be computed: the one of observing the two residues aligned in an alignment of homologous sequences and the probability of observing the two residues aligned in unrelated sequences. The latter can be easily computed when assuming independence between the sequences, that is the probability of drawing at random these two residues among all residues present in the sequences, it is thus the product of their frequencies in the sequences, also called the background frequencies. The first probability, also called the target frequency, is inferred by counting the amount of each kind of substitutions in homologous sequence alignments.Plasmodium falciparum, with a 80%- A+T genome [For both approaches, the reference set of homologous sequences used to estimate the substitution frequencies is therefore essential and the resulting matrices will reflect both the composition and the evolutionary characteristics of these sequences. For both matrix series, this reference set was composed of "classical" sequences and together with the large size of the datasets, this gave matrices with an "average" amino acid composition. However, sequence compositions can vary drastically, and one can find groups of sequences with atypical compositions: certain types of proteins have a composition directly correlated to their function, such as transmembrane proteins which include tracts of hydrophobic residues. Additionally, at the scale of the whole genome, some species show extreme nucleotide compositions that affect their amino acid composition, one of the most extreme example being the malaria agent, T genome .et al. [et al. and further implemented in the well-known (and used) program BLAST [et al. deviced a similar method for low complexity sequences and showed an improvement over classical masking strategies [Plasmodium genus [et al. also used this approach to build asymetric matrices enabling to compare proteins with an atypical amino acid composition (again Plasmodium proteins) against "classical" proteins  [Keeping the rationale of log-odds scores in mind, we can easily figure out that the classical matrices will not perfectly fit sequences with biased amino acid composition. Basically, the likelihood of each match and mismatch under the null hypothesis of unrelated sequences will vary according to the differences in the background frequencies. For instance, for amino acids which are rare in classical sequences but much more abundant in the sequences of interest, the probability of observing their pairing just by chance would be greatly underestimated in the classical matrices and therefore their log-odds score will not reflect a "true" likelyhood ratio. As a consequence of these discrepancies the resulting alignment can be wrong (not pairing together homologous residues) and also mis-evaluated, both leading possibly to mis-interpretation of the similarity. This issue has already been pointed out from a theoretical point of view by Yu et al.  and seveet al. -7. Theseam BLAST ,8. Laterrategies . The maium genus ,7. Bastihaliana) . These pMycoplasma genitalium species. Mollicutes share several atypical features such as a small cell size, the absence of a cell wall, a dramatically reduced genome with simplified metabolic pathways, and of particular interest here, a nucleotide composition biased toward A and T . They exhibit a wide variety of phenotypes with diverse host environments ranging from plants, arthropods to vertebrates, and also with various pathogenic or non-pathogenic impacts [http://cbib1.cbib.u-bordeaux2.fr/molligen3b/), some of which diverged up to 470 million years ago [In this paper, we address the problem of designing new substitution matrices fitted to the compositional bias of Mollicute proteins. Mollicutes are a particular class of bacteria derived from Gram-positive bacteria, including for instance the well-known  impacts . With thears ago . This coMycoplasma pneumoniae appears as an exception among the Mollicutes, with a G+C content almost "normal" of 40%, wheras all the other sequenced Mollicutes have their G+C content less than 32%. As a consequence, the composition of their protein sequences is also biased towards certain amino acids. Strong differences between frequencies can be observed in Figure The nucleotide composition of Mollicute genomes is strongly biased towards A and T, with a G+C content that varies from 21.4 to 40.0% with a median value of 27.1%. The main result of this paper is the generation of a new substitution matrix, called MOLLI60, which is better fitted to the compositional bias of Mollicute protein sequences. We generated this matrix with an approach similar to the one used to generate the well-known BLOSUM matrices . This coGlobal features of the matrix were then investigated, such as the entropy and expected values. These are commonly computed for substitution matrices and reflect the level of stringency of the matrix. Typically, a matrix with a lower entropy and a greater expected value will reflect more diverged sequences. We reported also, in table However, when looking more closely at each individual element, we can see in Figure The robustness of MOLLI60 with respect to the learning set composition was evaluated, using a re-sampling approach (see Methods). If we removed randomly 10% of the initial mutliple alignments, the resulting matrix was slightly modified with 3 to 8% of the positions with different values and when removing half of the data only 15% of the matrix positions were changed. Noteworthy, these changes are minor compared to the differences with BLOSUM62.Since the initial alignments used to infer the substitutions were obtained using BLOSUM62 (not fitted to the bias), the impact of this first step was evaluated by iterating the matrix construction with MOLLI60. Actually, this recursive step appeared not necessary since the resulting matrix was very similar to the first one, showing only 10 elements over 210 with a -1 or +1 difference (less than 5% of the elements). The amount of differences is thus similar to the one obtained when removing 10% of the data.We used the matrix MOLLI60 to align Mollicute protein sequences and to predict homology and orthology relationships based on these alignments.The standard method of bi-directional best hit (BDBH) was used to predict orthologous genes between two genomes and proteic sequence alignments were obtained using the program SSEARCH, using either MOLLI60 or the standard BLOSUM62 as substitution matrix (see Methods).Mycoplasma genitalium, Mycoplasma hominis and Ureaplasma parvum. This reference set contains 871 pairwise relationships which were manually curated by biologists (see Methods). It enables to evaluate orthology predictions and to compare the influences of different substitution matrices, by classifying the predictions as true positive, false positive or false negative.We focused on 3 mycoplasma genomes for which we dispose of a reference set of orthologous relationships: 11 in favor of the alignments obtained with MOLLI60: half of the common alignments have e-values obtained with BLOSUM62 more than 1011 larger than the ones obtained with MOLLI60. However, having better e-values does not necessarily mean that the alignments are better and enable to infer better biological information. What is important is to get scores or e-values that improve the discrimination between biologically meaningfull similarity and random similarity. If we consider now all the alignments obtained between all proteins , meaning that this set contains surely a large portion of non-homologous relationships (or poor similarity), we still get better e-values with the MOLLI60 alignments than the ones with BLOSUM62. However, the difference is significantly smaller than previously with a median ratio of only 5 (instead of 1011). Thus this suggests that the observed differences in e-values between the two matrices are not systematic and depends on the significance of the alignments.When comparing orthologous predictions obtained using the standard BLOSUM62 matrix versus our matrix MOLLI60, we first noticed that alignments obtained with MOLLI60 have overall smaller e-values than the ones obtained with BLOSUM62: the median e-value of BDBH proteins obtained with BLOSUM62 is 5.9e-22 against 1.1e-31 for MOLLI60. If we consider only common pairwise relationships between the two sets, the median pairwise ratio of e-values is of 10-38 against 10-25) and it is the contrary for false positive alignments (0.026 against 0.00125). Overall the mean ratio of e-values between false and true positives is of 1045 for MOLLI60 against 1025 for BLOSUM62, thus the discrimination between true and false positive e-values is significantly improved when using MOLLI60 .To evaluate the discriminative power of the e-values, we plotted in Figure For both matrices, we computed also their sensitivity and specificity (see Methods). As the two matrices give different e-values even for the same alignment, it is not pertinent to compare their sensitivity and specificity when using a fixed e-value cut-off to predict orthologs. Therefore we represented them using the Receiver Operating Characteristic (ROC) curves . This tyMycoplasma genitalium, Mycoplasma hominis and Ureaplasma parvum) and re-did these analyses. We obtained a very similar matrix and same results of comparison with BLOSUM62 on BDBH relationships (data not shown).Importantly, we verified that these results were not due to the fact that the training dataset used to build the matrix had common sequences with the test dataset. To do so, we built a second matrix without using any sequence of the genomes of the test dataset , since we can not rely anymore on the best hit criterion. Instead, we have to use a cut-off to decide if two proteins are homologous and a clustering approach to build groups where each member is assumed to be homologous to any other member of the group. The construction of homologous clusters was performed using a naive approach based on an e-value cut-off: any two proteins with their alignment e-value lower than the cut-off are grouped in the same cluster . This implies that two proteins can belong to the same cluster even if they do not share enough similarity, for instance they only need to be both related to a third protein. This transitivity property is justified by the definition of homology of a common ancestor, which implies that if a and b are homologous and so are a and c, then b and c are also homologous.Considering such process, and as the best hit criterion is no more usefull, we guess that the impact of the substitution matrix on these predictions may be more significant than for BDBH predictions. However in the absence of a reference dataset, the estimation of sensitivity and specificity scores is not applicable. Instead, we can compare the number of clusters, their size and their phylogenetic profile (presence/absence of species). We call the pan genome the number of distinct clusters  among the set of genomes, and the core genome the number of distinct clusters containing at least one member of each species. Assuming that each cluster represents a distinct funtion, the pan genome may be seen as the set of functions one can find in the community of genomes and the core genome the set of functions shared by all genomes. The number and size of clusters depend naturally on the e-value threshold: the more stringent is the threshold the more numerous and the smaller the clusters are, in other words the larger both the pan and the core genomes are. We can expect that a good clustering would give the fewest singletons (that is single proteins without any homolog), and consequently the smallest pan genome. On the other hand, a clustering with too many large clusters may group together several distinct families and thus reduce the core genome. Therefore when comparing several clustering we should prefer the one with the largest core genome and the smallest pan genome.Since the core and pan genomes depend on the e-value threshold, and we have seen previously that e-values are not directly comparable between the two matrices, we built several clustering for each matrix by varying the e-value cut-off and computed for each their core and pan genomes. The results are presented in Figure intra - discrepancy as the number of families with more than one domain architecture weighted by the number of different architectures, and inter - discrepancy as the number of pairs of families sharing at least one domain architecture. We compared these metrics for the clusterings obtained with MOLLI60 versus BLOSUM62 giving the largest core genomes . For both metrics the clustering obtained with MOLLI60 showed a better agreement with domain predictions: its intra - discrepancy value being of 129 versus 139 for BLOSUM62, and 1302 for inter - discrepancy versus 1465. This result holds also for other evalue thresholds . For a given clustering, we computed two metrics of domain homogeneity: Based on these results, the matrix MOLLI60 was applied for the generation of comparative data in the reference database Molligen (predictions of orthologous and homologous relationships) and it is proposed as an optional parameter for the alignment tools provided to query the database.We want to emphasize that, although our results are focused on a specific group of species, the Mollicutes, the method for building the matrix and the analyses of its impacts can be easily generalized to any group of species with an atypical composition.Plasmodium falciparum, our method differs mainly with respect to the learning sets of proteins. The sets of Bastien et al and Paila et al, included few sequences from genomes with the bias and more sequences with no bias, in particular to build non-symetrical matrices [et al the learning set was not composed of sequences from the genomes of interest but by selecting blocks from the BLOSUM database showing a similar compositional bias. Having at our disposal a large set of genomes sharing the same compositional bias, we could stick to the BLOSUM strategy and take full advantage of it.To build this new matrix, we followed the approach initially proposed by Henikoff and Henikoff to build the BLOSUM series . The maimatrices ,9, and iAs for the global approach, we chose to follow the BLOSUM strategy rather than the PAM one mainly because it has been shown to perform better in homology search context . FurtherActually, the major hurdle of our strategy is its reliance on a reference set of orthologous proteins, as opposed to methods that only adjust the standard matrices to the bias with theoritical formulas ,5. One nAs concerns this learning dataset, we also verified that the final matrix was not too dependant on some individual parts of this set, by a re-sampling approach. This suggested that our learning set was homogeneous enough to estimate correct substitution rates. We also noticed that a recursive step where multiple alignments would be obtained with the new matrix instead of the standard BLOSUM62 had few impacts on the resulting matrix. This suggests that substitution matrices may be less important in multiple alignment than pairwise alignment and especially for well conserved proteins. Indeed, the signal of conservation, if it exists, is easier to detect when we deal not only with two sequences but with a large set of sequences. Moreover, we used a multiple aligner, T-Coffee, which is based on consistency scores rather than substitution scores and may thus be less sensitive to differences in substitution matrices. Additionally, in multiple alignments, we align sequences already known as homologous and we do not need nor use the scoring of the alignment. In the context of pairwise alignment for homology search, substitution matrices may have more impact on the evaluation of the alignment rather than on the alignment itself .Finally, the last but non negligible step of the method is the optimisation of the gap parameters to the new matrix. In gapped alignments, gap penalties have a strong impact on the alignments and especially their length. Indeed, the score of a gap has to be fixed relatively to the scores of matches and mismatches. The task of adjusting the gap penalties to the matrix is not trivial and there exists no theoretical formula to relate them to some features of the matrix . We thusPairwise alignments and similarity searches in databases are the basis of numerous comparative genomics analyses. What is important in this step is to be able to discriminate between biologically meaningfull similarities and random ones. We showed in this paper that this can be improved by using well fitted substitution matrices. We demonstrated that MOLLI60 enabled to better evaluate pairwise alignments with raw-score, as well as e-values. The difference with BLOSUM62 was particularly significant for the raw score Figure , enhanciO (n2)), its implementation in SSEARCH as multi-threaded and vectorized greatly improves the runtime, which is no longer a limiting factor. Secondly, they differ in the way they evaluate alignments. BLAST computes e-values using a formula with pre-computed statistical parameters [In this paper, we also compared two alignment programs: SSEARCH  and BLASrameters , whereasrameters -24).The evaluation of the performances and impacts of the substitution matrices in homology search is a difficult task especially due to the lack of benchmarks or reference datasets, that is the knowledge of the true homologous relationships. Whereas such datasets may exist for model organisms, they lack crucially for many specific groups of species, such as Mollicutes. We first used a personal manually curated dataset of one-to-one orthologs. As the human expertise can not infer with certainty all evolutionary relationships between proteins of distant species, this set may contain errors and missing orthologs. These errors could bias our estimators of performance such as sensitivities and specificities. However, we can assume that these errors are independent of the compositional bias and will impact the results of both matrices the same way. Moreover, the initial set of orthologs which was further curated was obtained with classical predictions using BLOSUM62. Therefore, potential errors in the reference dataset will tend to favor the BLOSUM62 matrix rather than MOLLI60, and we may only underestimate the benefits of our new matrix. Indeed, if MOLLI60 did improve the ortholog predictions, the benefits were slight. This is due in part to the small size of the benchmark and also to the nature of the predictions: one-to-one orthologs are the easiest homology relationships to predict and the criterion of best hit reciprocity is very strong. The additionable value of MOLLI60 can only be shown for a small subset of the results and its impact is consequently minimized with respect to the large number of obvious one-to-one orthologs.Concerning the homologous families analysis, to cope with the lack of "true" relationships, we used the phylogenetic profiles of the clusters as an evaluation criterion. We thus took full advantage of the large number of genomes at our disposal and their wide distribution in the evolutionary tree of Mollicutes. The computation of the core and pan genomes enables to have a first glance at the clustering properties in terms of biological considerations. The evaluation of the clustering is however based on two assumptions: that the orphan genes (genes without homolog) are rare and must be minimized and that the number of distinct clusters shared by all genomes must be maximized. These assumptions are guided by the parsimony principle. Indeed, in the last common ancestor of the considered species the core and pan genomes were equal and they diverged by gene gains and losses: the pan genome increased by gene gain and the core genome decreased by gene loss. Therefore a clustering resulting in a smaller pan genome and a larger core genome may invoke less gain and loss and be more parsimonious. It is however important to note that this hypothesis is strong and may not reflect the reality of Mollicute gene set evolution, that is the real evolutionary scenario may not be the most parsimonious. This is the reason why we performed a second evaluation based on the domain composition in and between families. This relies also on an hypothesis, that domain architectures are conserved inside the families and are specific to families.Moreover, it concerns only a small portion of the genes, those for which the function is the best known and represented in studied organisms and this may bias the results towards more conserved genes. As the two evaluation methods relied on different assumptions and may have different biases, we argue that they complement each other and the fact that they gave the same trends strengthen our conclusion.In conclusion, we showed in this paper that we can improve orthology and homology predictions of Mollicute proteins by using a well-fitted substitution matrix, rather than the standard BLOSUM62. We argue that this result can be generalized to other groups of species with a marked compositional bias. The methodology we propose to construct such well-fitted matrices is very simple to carry out and could be useful in an increasing number of studies especially in the current context of massive growth of genomic data: the new sequencing technologies enable from now on to study specific groups of genomes with their specific and atypical nucleotide or amino acid compositions, notably for sequences coming from metagenomic studies.To generate new matrices, we followed an approach similar to the one used for the well-known BLOSUM matrices . This coThese families were obtained by combining pairwise orthologous predictions (by BDBH) with high significance alignments, then selecting protein sets having at most one member per species. These families were further manually curated according to the protein annotations .ftp://ftp.ncbi.nih.gov/repository/blocks/unix/blosum/) on the whole set of blocks. This program clusters very similar sequences inside the blocks and counts all pairwise substitutions. The score of aligning the amino acid ai with aj is obtained with the following formula:For each family, a multiple alignment was obtained using the program T-Coffee . Then, uf is the observed frequency of pairwise alignment of the two amino acids ai and aj, and f(ai) (resp. f(aj)) is the observed frequency of the amino acid ai. The level of clustering is determined with the parameter c which was set to 60. This means that sequences in a block with at least 60% identity are clustered together and will be considered as one sequence in the counting process. Then the matrix elements were normalized with the factor λ = 2 and rounded to the closest integer to obtain half-bit scores such as in the BLOSUM62 matrix.where For each matrix, relative entropy and expected values were obtained from the following formula:The whole pipeline to build new matrices was implemented in perl scripts, which are provided in Additional file http://cbib1.cbib.u-bordeaux2.fr/molligen3b/). A complete list of genomes used in this paper is provided in Additional file All sequences and annotations of Mollicute proteins were retrieved from the Molligen database   or the raw score of the pairwise alignment. BDBH relationships can be further filtered according to their alignment features  to discard less significant pairs.BDBH between pairs of genomes were obtained by aligning each protein sequence of one genome against all the protein sequences of the other genome and vice versa. A pair of proteins, The substitution matrix is not the only parameter used to score gapped alignments. For each new matrix, it is thus important to optimise gap penalties. Indeed, the score of a gap has to be fixed relatively to the scores of matches and mismatches. Our approach to determine well-adapted gap penalties was empirical: we tried several combinations of gap open and gap extend penalties, and we evaluated them with respect to the performances in predicting orthologous relationships with the BDBH approach. We chose the gap penalties that gave the best compromise between sensitivity and specificity of ortholog predictions, using the ROC curves. We performed the same analysis for the BLOSUM62 matrix. For both matrices, we chose the following penalties: 10 for the opening of a gap and 1 for each extension of a gap. We verified that both matrices along with their gap penalties gave alignments of similar length.To evaluate if the obtained matrix is robust with respect to the set of protein families given as input, we used a Jacknife sampling approach. We generated 10 other matrices with the same procedure but with a smaller set of protein families sampled randomly from the original one. We generated two sets of samples: keeping either 90% or 50% of the initial protein families.mycoplasma genomes: Mycoplasma genitalium, Mycoplasma hominis and Ureaplasma parvum. Each prediction was manually curated by biologists according to alignment features, functional annotations of the proteins and synteny analyses [The reference set of one-to-one orthologous relationships was obtained with standard BDBH predictions between 3 well annotated analyses . It contThis set enables to evaluate several methods of orthology predictions, by classifying the predictions as true positive, false positive (predictions absent from the reference set) and false negative (relationships of the reference set not predicted as orthologous); we denote by TP, FP and FN the amount of predictions in each category respectively. Then we can compute sensitivity and specificity values for each method, such as age pROC .The variability of alignment evalues was analyzed with respect to the matrix and the status of the prediction (either TP or FP), using an Analysis of Variance. To test the effect of each factor and in particular if the discrimmination between TP and FP evalues is different according to the matrix used (interaction factor), we used the following model:MOLLI60 and TP being boolean variables indicating respectively whether the prediction has been obtained with MOLLI60 and whether it is a true positive. e is the error and is assumed to be normally distributed. The estimation of the parameters of the fitted model were the following:with We built homologous protein families between 24 Mollicute genomes with a simple clustering method: first we runned all-vs-all protein alignments with SSEARCH using one of the two matrices. Then, we grouped together in a same cluster any two proteins with a significant alignment, that is with an e-value less than a given threshold and covering at least 50 percent of the longest protein. In other words, we built a similarity graph with each node being a protein and each edge connecting two proteins with a significant alignment. The clusters were then the connected components of this graph, that is any two custers are completely disjoint in this graph .Domain architectures were attributed to clusters containing at least one sequence with at least one predicted domain. We considered the domains predicted by running InterProScan on each proteic sequence against the Pfam-A database of domains . The domCL implemented the method and performed the analyses. CL, AB, PT and PSP designed and conceived the method and experiments. AB and PSP built and manually curated the reference datasets. CL and PT wrote the manuscript. PSP, CT, FTa and FTh wrote the grant application upon which this project was built. All authors read and approved the final manuscript.The MOLLI60 matrix.Click here for fileperl scripts for building new matrices.Click here for fileSupplementary figures.Click here for fileList of genomes used in these analyses.Click here for file


High quality alignments are difficult to build and protein alignment remains one of the largest open problems in computational biology. Misalignments can lead to inferential errors about protein structure, folding, function, phylogeny, and residue importance. Identifying alignment errors is difficult because alignments are built and validated on the same primary criteria: sequence conservation. Local covariation identifies systematic misalignments and is independent of conservation. We demonstrate an alignment curation tool, LoCo, that integrates local covariation scores with the Jalview alignment editor. Using LoCo, we illustrate how local covariation is capable of identifying alignment errors due to the reduction of positional independence in the region of misalignment. We highlight three alignments from the benchmark database, BAliBASE 3, that contain regions of high local covariation, and investigate the causes to illustrate these types of scenarios. Two alignments contain sequential and structural shifts that cause elevated local covariation. Realignment of these misaligned segments reduces local covariation; these alternative alignments are supported with structural evidence. We also show that local covariation identifies active site residues in a validated alignment of paralogous structures. Loco is available at  Multiple sequence alignments are critical for generating and testing hypotheses based on protein structure, function, and phylogeny. Protein alignments are built based on the assumption that each position (column) in the alignment is homologous Structure alignments are used to validate sequence alignments because they provide evidence independent of sequence; thus, benchmark datasets like BAliBASE include structural support Multiple sequence alignment methods are typically benchmarked against high-quality datasets such as BAliBASE Another resource for hand-curated structure-based sequence alignments is the Conserved Domain Database (CDD) Alignments are also susceptible to errors for reasons independent of the circular logic of sequence alignment. Without careful manual curation, structure alignment algorithms are susceptible to shift error Progressive multiple sequence alignment strategies can also be prone to systematic propagation of errors as sequences are progressively added to a growing alignment. Iterative sequence alignment methods attempt to resolve this issue by employing a refinement step after the initial alignment is built. However, at present there is no method that reliably identifies shift errors. A disagreement between two theoretically valid alignment predictions is therefore very difficult to resolve; the current solution is to trust a benchmark dataset if available.Covariation analysis is a statistical method used to understand coevolution in proteins Covariation statistics are used to indicate whether two residues are potentially coevolving We previously demonstrated that with systematic sequence shifts , alignments show patterns of increased sequence-local covariation in the shifted segment Zp  analyzed in the CDD database (REF), 2189 had at least one peak at or above 2.0 . We alsoIn the BAliBASE 3 dataset, there were 37 alignments that contain contiguous blocks of high local covariation (filled dots). Of these, 30 had three or more contiguous high local covariation peaks, representing an extended range of high local covariation. We have chosen 3 alignments BB11003, BB30002, and BB40047 from 3 different categories of BAliBASE that demonstrate the characteristics of alignments with high local covariation. We illustrate how LoCo can be used to characterize the source of the high local covariation.We identified a contiguous segment of high local covariation in the BB40047 alignment of BAliBASE 3. BB40047 is built upon the alignment of two structures containing a disulphide bond shown in Although there is no structural information for the highlighted sequences, we can infer that the adjacent cysteine should be aligned to the disulphide bonded position because the existing alignment would place the cysteine in a conformation unable to form a disulphide bond. Thangudu et al. noted that imperfect conservation of disulphide bonds in alignments is frequently caused by structure or sequence alignment errors Some structure alignments generated by unsupervised algorithms suffer from shift error Local covariation analysis of BAliBASE 3 identified a region of interest in the alignment BB30002 . BB30002In The BB30 category of alignments are designed to test the ability to properly align multiple subfamilies into a single subalignment. Aligning paralogous sequences is particularly challenging because of increased sequence divergence and different functional constraints. Functional divergence can result in increased substitution rates (type I divergence) Not all regions of high local covariation in BAliBASE are explained by potential misalignments; in fact, some segments with high local covariation are structurally valid. It is thus crucial to examine regions of high local covariation to determine the root cause. As outlined in this section, local covariation can identify segments of interest that covary because of another mechanism. In our analysis of BAliBASE 3, we identified BB11003 as an alignment with a region of high local covariation. Two strariation  is suppoariation . Thus, wAs noted in the previous section, protein families undergo functional divergence after gene duplication leading to paralogous alignments have specific characteristics. Functional divergence that occurs at a only a clustered subset of positions will cause an increase in local covariation. Thus, the presence of paralogues that have undergone type II divergence Structure 1AD3 included the coenzyme NAD, which is critical for enzyme function. The human homologues for positions E333 and F335, E399 and F401 respectively, have been found to be important for function. The human E399 binds the NAD ribose; mutations to the position significantly affect the catalytic rate Protein family misalignments can cause errors in downstream analyses — unimportant positions may be falsely identified as conserved or coevolving and critical conserved positions can be overlooked. Systematic misalignments can reduce the bootstrap values of phylogenetic trees or reinforce incorrect trees Selecting which alignment is most likely correct can be a source of debate because there is no high-throughput biochemical method to prove the validity of an alignment. Some investigators prefer to believe the internally consistent output of an established alignment algorithm over an alternative alignment with some biological justification. Here we provide a tool to identify regions in an alignment that should be investigated. Automating alignment using local covariation as a parameter is difficult because increased local covariation is not tautologically equivalent to misalignment, as shown by the example of correctly aligned paralogs in We provide strong structural evidence of the validity of our alternative alignments over the BAliBASE alignments in the form of cysteine conservation at a disulphide bond  and signLarge datasets are known to have many systematic misalignments caused by incorrect sequential or structural inference because of the limitations of current alignment methods It is interesting to contrast this assessment of BAliBASE 3 with a previous analysis of BAliBASE by Edgar The exploration of the BAliBASE BB30 subfamilies dataset, as in Identifying functional residues is an important open problem. The degree of conservation of a position is typically used to indicate its potential importance in such analyses. However, when paralogous families are included and conservation is lost, local covariation could also be used to search for non-conserved, functionally important residues. We provide an example of local covariation in a functional region in our analysis of the alignment BB11003. Investigating the region of local covariation revealed two important functional residues in an alignment of 4 sequences. Residues E333 and F335 both make important contacts to NAD in the coenzyme binding site .Local covariation previously identified an interesting structural region in phosphoglycerate kinase An interesting illustration of the importance of manual alignment curation is provided by Kawrykow et al. through their work on the sequence alignment game Phylo Increased local covariation should not be confused with patch covariation, where two short contiguous segments of sequence coevolve with one another We have made the tool used in this manuscript, LoCo, available online. LoCo can be used effectively on large datasets. Performance can become a concern when analyzing alignments with many ungapped positions because of the covariation calculations. However, because the covariation algorithms are implemented in C and optimized, we have successfully analyzed very large concatenated protein datasets with thousands of sequences. We have run LoCo successfully on concatenated alignments over 2500 ungapped positions long, though at this size the covariation module requires approximately 1 gigabyte of memory and 1 minute of CPU time to update the local covariation score. Alignments this size can be analyzed because of the extensive optimizations made to the covariation calculation software. LoCo and its antecedents have been an important part of building high quality protein alignments for several recent manuscripts Analyses of alignments which contain errors are inherently unreliable. LoCo provides an intuitive and rapid platform to identify and correct alignment errors. We recommend that new alignments be analyzed with local covariation and visually inspected before any conclusions are drawn from them.We created a 7-position synthetic alignment to demonstrate the effectiveness of local covariation for finding misalignments . Each coZpThe synthetic alignments were inserted at the N-terminus of a structure-guided and manually-curated alignment of methionine aminopeptidase. We subsequently analyzed the synthetic alignment using the covariation statistic Zp/MIp statistic Zp is optimized for memory use and speed. Zp is based on mutual information, a statistic that is calculated based on the relative counts and pairwise counts of each individual alignment position.LoCo calculates the average covariation between positions in a protein alignment using the MIp is defined as:MIp is normalized and referred to as Zp:MIp and MIp as Zp was introduced in Because there are 20 amino acids, there are 20 potential entries in the count matrix; each pairwise count represents two positions so there are 400 potential entries for each pairwise count. However, because the majority of positions demonstrate some degree of conservation, most entries in the count and pairwise count matrices will be zero. This fact is exploited by the LoCo algorithm — a reusable linear array is used to initialize a dynamically allocated linked list which stores the pairwise count for each pair of positions for significant memory savings.Zp score between all pairs of positions over a window of six; this is done in a Perl script upon completion of the C program.Local covariation is calculated by taking the average The programs used to calculate covariation statistics can be used independently of the Jalview GUI. These programs are accessed using the Perl script MIp.pl; they take a fasta-formatted alignment and, optionally, a pdb-formatted structure as input and return a summary file of covariation statistics (and inter-residue distances if the pdb file is provided). The MIp software can be automated to screen large alignment datasets.The alignment editing software is a modified version of Jalview We have developed a simple procedure to correct potential systematic misalignments using LoCo: 1) Identify potential misalignments , 2) clusPotentially misaligned regions can be identified by examining the “Local Covariation” bar at the bottom of the alignment window. In Clustering is done by highlighting the potentially misaligned positions and selecting “Neighbour Joining Using % Identity” from the Calculate menu. Regions of systematic misalignment will cluster separately from correctly aligned sequences. Sequences can be placed in the same order as the tree by using the Sort command in the Calculate menu.Finally, alternate alignments can be tested by highlighting the region of misalignment and dragging the misaligned sequence into position by holding control while left-clicking and dragging the mouse. The local covariation score will change as you edit the alignment.We collected alignments from the Conserved Domain Database ftp://ftp.ncbi.nih.gov/pub/mmdb/cdd/We collected all sequences from the ftp distribution of BAliBASE 3 ftp://ftp-igbmc.u-strasbg.fr/pub/BAliBASE3/The BAliBASE alignments were converted to fasta format by readseq Structures were collected from the RCSB Protein Data Bank


We present a novel method called DendroBLAST for reconstructing phylogenetic dendrograms/trees from protein sequences using BLAST. This method differs from other methods by incorporating a simple model of sequence evolution to test the effect of introducing sequence changes on the reliability of the bipartitions in the inferred tree. Using realistic simulated sequence data we demonstrate that this method produces phylogenetic trees that are more accurate than other commonly-used distance based methods though not as accurate as maximum likelihood methods from good quality multiple sequence alignments. In addition to tests on simulated data, we use DendroBLAST to generate input trees for a supertree reconstruction of the phylogeny of the Archaea. This independent analysis produces an approximate phylogeny of the Archaea that has both high precision and recall when compared to previously published analysis of the same dataset using conventional methods. Taken together these results demonstrate that approximate phylogenetic trees can be produced in the absence of multiple sequence alignments, and we propose that these trees will provide a platform for improving and informing downstream bioinformatic analysis. A web implementation of the DendroBLAST method is freely available for use at  Inferring phylogenetic relationships between biological sequences is fundamental to nearly all aspects of contemporary biological research. In addition to the pivotal role these inferences play in progressing our understanding of the evolution and diversity of life, they also provide a platform on which algorithms that predict sequence structure and function can be developed. The majority of methods for inferring relationships between biological sequences are dependent on the construction of a multiple sequence alignment. The improvement of multiple sequence alignment methods over more than 20 years has resulted in the production of many different multiple sequence alignment methods whose performances on diverse data types can vary considerably Given a multiple sequence alignment there are several methods for inferring phylogenies which vary in speed, accuracy and complexity. These methods range from those with fewer parameters ones such as neighbour-joining  as the BLAST bit score for sequence B produced using sequence A as a query. In the case where no BLAST score was observed between two sequences the following rule was used to replace s so that all sequences have non zero score valuesmin(A)s is the minimum non-zero BLAST bit score value observed for sequence A when searching the entire dataset. BLAST bit scores will have different scales depending on the sequence and length of the query sequence. To account for this we compute a normalised bit scoremax(A)s is the maximum BLAST bit score observed for sequence A when searching the entire dataset. To take into account the dis-similarity in the pattern of BLAST hits produced using any two sequences we weight the normalised BLAST bit scores by the overlap in the number of sequences producing non-zero BLAST bit scores using each sequence as a queryAn is the number of sequences producing non-zero BLAST bit scores identified in the dataset using sequence A as a query. A,Bn is the number of sequences producing non-zero BLAST bit scores that are identified using both sequence A and B as queries, i.e. the overlap between the search results. Here sequences which produce more similar patterns of BLAST hits have higher weights so that two sequences which produce the highest BLAST bit score and have perfect overlap in the distribution of their BLAST hits will have a similarity score of 1. However, if there is no overlap between sequences producing BLAST hits then the inference procedure cannot be completed. As BLAST bit scores between any two sequences can be non-symmetric due to the properties of the query sequence we evaluate the similarity score between any two sequences as the mean of the weighted normalised BLAST bit scoresS = S and S is in the range .d is the symmetric BLAST distance score  = d) between sequence A and B. This similarity-to-distance score transform is similar to the BLAST bit score transform used by Lake et al.To begin a BLAST database of a set of protein sequences is created and a matrix of all possible pairwise BLAST bit scores is computed using the blastp algorithm i→Aj | Ai)Pf is the BLOSUM62 substitution value for replacing amino acid i with amino acid j and max(i)B is the maximum observed substitution value for amino acid i. For example, the BLOSUM62 score for substituting A with R is −1. The best scoring substitution for A is A itself which has a score of 4. When transformed so that the highest scoring substitution for A is assigned a value of 0 (and hence the most likely to be selected from the Gamma distribution) the value for substituting A with R becomes 5. However, in total 8 amino acids  have the same score for replacing A. In these cases where a group of substitutions have the same score according to this normalised matrix the amino acid to be substituted was selected at random from this group. Therefore, the probability of replacing amino acid A with R in any given sequence can be evaluated as:P(A→R | A) is the probability of substituting amino acid A with amino acid R given amino acid A. A Perl implementation of the DendroBLAST method is provided as To identify and remove poorly supported bipartitions, the tree inference procedure is repeated several times, each time introducing a small set of amino acid changes based on a probability distribution and the BLOSUM62 amino acid substitution rates (described below). A majority-rule consensus tree is then constructed from these replicate trees to eliminate the weakly supported bipartitions. To introduce these sequence changes the entire set of sequences is modified according to the following rule. The probability of replacement of each amino acid in each sequence is specified by a Gamma distribution distributed over an amino acid substitution matrix:The optimal value for the scale of the Gamma distribution was determined using a randomly selected subset of 50 simulated protein sequence alignments from a previous analysis comprising 308 simulated multiple sequence alignments To determine the optimal value for the scale of the Gamma distribution the inference procedure was repeated for a range of Gamma scale values between 0.2 and 5. 100 replicates were run without the amino acid replacement strategy and this value is shown at 0 and can be considered equivalent to BLAST clustering previously used In order to compare DendroBLAST to existing tree inference methods the performance was evaluated on the entire set of 308 simulated protein sequence alignments obtained from As the simulated multiple sequence alignments do not contain alignment induced error, an additional test was performed to introduce realistic alignment errors encountered in real multiple sequence alignments. Each of the 308 simulated alignments were parsed to remove all gap characters and realigned using two different methods. 1) MAFFT FFT-NS-1 Due negative effects which can be incurred by the inclusion of gap characters and mis-aligned data on phylogenetic inference a common approach is to discarded “gappy” information. Popular methods such as GBLOCKS To demonstrate the utility of DendroBLAST for tackling real-world datasets, we took an existing dataset of 3537 discrete orthologue groups found in the Archaea We developed a novel method for constructing consensus phylogenetic trees from protein sequences in the absence of multiple sequence alignments. In brief, the method uses minimum evolution clustering of transformed BLAST similarity scores to infer a hierarchical tree of un-aligned protein sequences. A simple model of sequence evolution is then employed to improve the accuracy of the inferred trees by identifying and removing weakly supported bipartitions from the tree. The work flow of the tree inference method is described in To determine the accuracy of DendroBLAST phylogenetic trees were inferred for each of the 308 simulated protein sequence families present in In the above test DendroBLAST generally compares well to other commonly used methods of tree inference . DendroBAs DendroBLAST produces a distance matrix which is converted to a phylogenetic tree using the minimum evolution principle implemented by FastMe In the case of the above tests, DendroBLAST was compared to other inference methods each of which used the simulated multiple sequence alignments. The simulated multiple sequence alignments on which these methods were tested do not contain any alignment induced error. In real world situations, the true multiple sequence alignment is not known and hence an additional test of the above inference methods was performed on re-aligned data to introduce realistic errors which occur by the production of a multiple sequence alignment. This presents a more realistic comparison of the performance of DendroBLAST to that of other inference methods. To do this each of the 308 simulated alignments were parsed to remove all gap characters and realigned using two different methods. 1) MAFFT FFT-NS-1 As expected, the introduction of alignment error increased the number of false positive and false negative errors of all alignment-based inference methods . As befoIn the case of the above experiment, DendroBLAST was compared to other inference methods using simulated multiple sequence alignments with addition of alignment induced error. It is common in phylogenetic analysis for alignments to be subject to trimming before use. Trimming removes positions which are suspected to contain mis-aligned sequence and hence could lead to phylogenetic error. However, trimming also reduces the amount of data available to make the inference and hence can negatively affect phylogenetic inference through data reduction. Here a commonly used package for alignment trimming GBLOCKS To provide an independent test of the DendroBLAST method and demonstrate its utility for analysis of real-world sequence data, we selected a large dataset which has been shown by multiple inference methods  to support the same tree topology We present a novel BLAST-based tree inference algorithm that achieves good levels of precision in the absence of multiple sequence alignments. In all tests performed on realistic simulated sequence data, DendroBLAST outperformed all of the commonly used distance based methods achieving levels of precision comparable to that of maximum likelihood methods. However, DendroBLAST recall rate is comparatively poor rendering it less accurate in comparison to tree inference using maximum likelihood methods from good quality multiple sequence alignments. We therefore do not propose DendroBLAST as a replacement for high quality phylogenetic inference methods but rather as a platform for improving and informing multiple aspects of bioinformatic analysis.http://www.dendroblast.com/.One such application of this method may be in constructing guide trees for informing multiple sequence alignment. As DendroBLAST bypasses a multiple sequence alignment step and produces good quality approximate phylogenetic trees, use of DendroBLAST may prevent propagation of multiple sequence alignment error incurred from poor quality guide trees. This would be particularly suitable for difficult to align sequence families and in situations where the accuracy of the multiple sequence alignment is in question. Improvement in the accuracy of the guide tree in these scenarios is likely to lead to improvements in the accuracy of the subsequent alignment and tree inference. A strictly bifurcating guide tree is also produced by DendroBLAST and available using the online implementation at While the bipartitions that are recovered by DendroBLAST are likely to be correct, DendroBLAST does have a low recall rate in comparison to other maximum likelihood methods meaning than many bipartitions are missed. One use for high-precision low-recall phylogenetic trees is in construction of supertrees. We demonstrate the utility of DendroBLAST for this task by reconstructing a supertree of the Archaea. This supertree reconstruction closely matched previous Bayesian and maximum likelihood analyses with a precision and recall of 0.89 . Hence, we propose that this method may be useful for production of phylogenetic trees for use in supertree reconstruction or in providing approximate start trees for subsequent optimisation.File S1Perl implementation of DendroBLAST method.(PL)Click here for additional data file.Figure S1Optimising the scale of the Gamma distribution. A) Plot of the effect of varying the Gamma distribution scale factor on the false positive partitions, false negative partitions and Robinson-Foulds distance. Value at 0 is estimated from 100 replicates with no amino acid replacement. Black line indicates the fitted polynomial model, the local optimum for Gamma scale value is 1.9644. Error bars indicate 1 standard error of the mean (n = 50). B) The frequency of the amino acid changes for a 100 replicate DendroBLAST inference using the optimal Gamma scale parameter. For example, a value of 0 indicates that the amino acid was not changed. A value of 1 indicates that the amino acid was changed to an amino acid which has a score of 1 less than the score for not changing in the BLOSUM62 substitution matrix. C) The distribution of score values in the remapped BLOSUM62 substitution matrix. D) Comparison of pairwise distances computed by DendroBLAST and by PhyML using 4 gamma rate categories.(PDF)Click here for additional data file.


Pairwise sequence alignment methods are widely used in biological research. The increasing number of sequences is perceived as one of the upcoming challenges for sequence alignment methods in the nearest future. To overcome this challenge several GPU (Graphics Processing Unit) computing approaches have been proposed lately. These solutions show a great potential of a GPU platform but in most cases address the problem of sequence database scanning and computing only the alignment score whereas the alignment itself is omitted. Thus, the need arose to implement the global and semiglobal Needleman-Wunsch, and Smith-Waterman algorithms with a backtracking procedure which is needed to construct the alignment.In this paper we present the solution that performs the alignment of every given sequence pair, which is a required step for progressive multiple sequence alignment methods, as well as for DNA recognition at the DNA assembly stage. Performed tests show that the implementation, with performance up to 6.3 GCUPS on a single GPU for affine gap penalties, is very efficient in comparison to other CPU and GPU-based solutions. Moreover, multiple GPUs support with load balancing makes the application very scalable.The article shows that the backtracking procedure of the sequence alignment algorithms may be designed to fit in with the GPU architecture. Therefore, our algorithm, apart from scores, is able to compute pairwise alignments. This opens a wide range of new possibilities, allowing other methods from the area of molecular biology to take advantage of the new computational architecture. Performed tests show that the efficiency of the implementation is excellent. Moreover, the speed of our GPU-based algorithms can be almost linearly increased when using more than one graphics card. The most important and the most frequently used algorithms in computational biology are probably the Needleman-Wunsch  and the Recently, modern graphics processing units (GPUs) have been widely exploited for solving many bioinformatic problems. An example may be the problem of scanning databases for sequences similar to a given query sequence. A few efficient implementations addressing this problem have been developed see -16). How. How16])The main goal of this work derives from the discussion above. It is a construction of GPU-based dynamic programing algorithms for pairwise alignment. One difference between our approach and the previous ones is that we have optimized the algorithm for aligning every sequence with each other from a given input set. The second difference is that our method, unlike others, performs the backtracking procedure in linear time. Although special data structures are used here, no redundant computations are needed. In contrast to the Myers-Miller algorithm, it was designed for the GPU architecture. Moreover, the three basic pairwise alignment algorithms, i.e. local, global and semiglobal, differ only in details, so all of them have been implemented. As a result we got a valuable tool for multi-sequence pairwise alignments which is fast and can be run on a common personal computer equipped with NVIDIA GPU . Extensive computational tests show its advantage over CPU-based solutions like the Emboss package or the highly optimized Farrar's implementation. Moreover, our task manager is able to use more than one GPU. Performed tests show that the multi-GPU support influences the execution time considerably.There are a few substantial differences between CPU and GPU architectures that make a GPU a more powerful tool for some applications. The same differences cause some difficulties in programming of graphics cards. Firstly, GPUs have many more cores, which are the main computational units, e.g. NVIDIA GeForce 280 has 240 cores. Secondly, there is much less cache memory available on the GPU. Moreover, the cache memory on the graphics card is not managed automatically, but by a programmer.Such an architecture gives opportunities to utilize the hardware more efficiently. On the other hand, writing parallel algorithms on GPU is more time-consuming, because it requires in-depth knowledge and understanding of the hardware. As a result the algorithm can be much faster than its CPU version. Although there are a few GPGPU  technologies like ATI Stream  or OpenCTo understand the essentials of CUDA, one has to be aware of different types of available memory. The main differences between these memory types have been shown in Table Another significant property of CUDA-enabled graphics cards is that the GPU consists of many multiprocessors and each multiprocessor has a number of cores working as one or more SIMT (single instruction multiple thread) units. One such unit is able to execute one and only one instruction at the same time, but in many threads and on various parts of data. As a result, during the process of designing an algorithm, one must take this into consideration.Being conscious of the architecture described briefly above, one can design and implement alignment algorithms efficiently.There are three basic algorithms for performing pairwise sequence alignment: Needleman-Wunsch  for compLet us define:A - a set of characters of nucleic acids or proteins,• i s- the i-th sequence,• is(k) ∈ A - k-th character of the i-th sequence,• SM - substitution matrix,• SM - substitution score for i cand j cpair,• open G- penalty for opening a gap,• ext G- penalty for extending a gap,• H - a matrix with partial alignment scores,• E - a matrix with partial alignment scores indicating vertical gap continuation,• F - a matrix with partial alignment scores indicating horizontal gap continuation,• H according to the similarity function. The similarity function determines a score of substitution between two residues. This relation is given in a substitution matrix, like one from BLOSUM [H also takes gap penalties into account, described by open Gand extG. The size of the matrix H is (n + 1) × (m + 1), where n is the number of residues in the first sequence s1 and m - in the second sequence s2.To compute the alignment of two sequences, the algorithm  has to fill the matrix m BLOSUM  or PAM [m BLOSUM  familiesH is filled using the following formulae:The matrix i = 1...n and j = 1...m.where The first row and the first column are filled according to the following formulae:E and F matrices are initialized by putting -∞ value into the first row and column. The result for this part of the algorithm is the value of similarity, so called score. Let us denote the coordinates of the cell with the similarity score by . In case of the NW algorithm, this value can be found in the H cell of the matrix H.Moreover, the i*, j*) cell in the matrix H until it reaches the  cell. Every time when the algorithm moves to the upper cell, a gap character is inserted into the sequence s1 in the final alignment. If the algorithm moves left, a gap is added analogically to the sequence s2, and finally the diagonal move means that the corresponding residues are aligned. The backtracking procedure is deeply analyzed in Section "The idea of backtracking procedure and GPU limitations".The goal of the second stage - backtracking, is to retrieve the final alignment of two sequences. The idea of backtracking is that the algorithm performs backward moves starting from the  and (5) should be replaced respectively by:A semiglobal version of dynamic programming for pairwise alignment differs from the previous one in three points. The first one is the way how the matrix H. For semiglobal alignment this cell is the one with the highest value from the last row or column of the matrix H.The second difference concerns the coordinates of the cell where the similarity score can be found in the matrix k, 0) or  is reached, where k = 0, ..., n and l = 0, ..., m.The last difference involves the stop criterion for the backtracking procedure. In this case backtracking is finished when the cell  also differs from the Needleman-Wunsch algorithm in three points. The first one is again the way of initializing the matrix H. The formula (1) should be replaced by the following one:The second difference concerns the formulae describing the process of filling the matrix i = 1...n and j = 1...m.where i*, j*) cell is the one with the highest value within the entire matrix H.The next difference covers the coordinates of the cell with the final score for the local alignment. In this case the  × (m + 1). The purpose of these matrices is to indicate the proper direction of backward moves for the algorithm being at a certain position during the process of backtracking. Although their memory usage is quadratic, the advantage is that they enable to perform the backtracking procedure in a linear time, in contrast to the Mayers and Miller's idea.To obtain the alignment efficiently four boolean matrices have been defined in our approach, each of size , as compared to the formula (11), prevents the algorithm from an ambiguous situation, when both directions, up and left, are equally good. In this case, to avoid non-deterministic behavior, the algorithm should prefer only one, predefined direction.The additional condition of up Cand left Cmatrices are filled according to formulae (9) and (10), respectively. However, the up Band left Bmatrices are filled using the following formulae:For the local alignment algorithm, the H any cell value can be computed only if the values of the left, above and diagonal cells are known. It means that only these cells that are on the same anti-diagonal can be processed simultaneously. As a result, there is not much to parallelize  in a single run of NW or SW algorithm. However, progressive multiple sequence alignment algorithms require aligning of many sequences (every sequence with each other). Our idea was to design an algorithm for efficient execution of many pairwise alignment instances running concurrently. To utilize the GPU resources properly one has to load it with a sufficient amount of work. To fulfill this requirement at least 80 × 80 NW/SW instances should be computed concurrently . The problem to overcome was that the amount of available RAM on graphics cards was, for this purpose, relatively small . In fact, the H, E and F matrices do not have to be kept entirely in RAM . However, the backtracking tables  must be kept in the global memory. Hence, they would take a lot of memory space if they were held in normal C/C++ boolean arrays, e.g. for sequences with lengths of 500 residues one would need 80 × 80 × 5002 × 4 bytes i.e. 6103.5 MB only for backtracking arrays. Thus, a special emphasis has been put to make this figure smaller, so that the algorithm can be run on any CUDA-capable device.An important issue, one should take into consideration, is that during the process of filling the matrix open Gand ext Gvalues, a file in fasta format with sequences to be aligned, etc. When the algorithm is launched, it performs an alignment of every given sequence with each other. The result of the algorithm consists of the score and the alignment for each pair of sequences.All the algorithms in our implementation, namely the NW algorithm, its semiglobal version and the SW algorithm, have a few input parameters such as a substitution matrix, S be the set of input sequences. The total number N of sequences' pairs to be aligned is given by the following formula:Let windows  is represented by one bit. Hence, in one 32-bit memory word, a total of 32 values can be stored. These enhancements, i.e. windowing and backtracking matrices with their binary representations, enable the algorithm to run on any CUDA-capable device.Because the problem of aligning many sequences simultaneously is a memory-consuming task, it has been split into subproblems. The whole matrix of tasks, where a single task is a pairwise alignment, was divided into smaller matrices, called window can be considered as a grid consisting of constant-sized blocks, as shown in Figure window is executed entirely on one GPU. Many windows, though, can be executed on many different GPUs. The block size is set to 16, because of our low-level optimizations of the algorithm. It means that in one block there are 16 · 16 = 256 threads. Each thread is responsible for aligning one pair of sequences. Although the window size value must be divisible by the block size, the algorithm ensures that all input sequences will be aligned, despite of their number. Execution of a block is over if its last thread finishes. Hence, to fully utilize the hardware resources, the lengths of all of the sequences within a block should be similar. The same applies to any window and its blocks. Therefore, the input sequences are sorted from the longest to the shortest one in the preprocessing step. This enhancement improves the algorithm performance significantly.One kernels. The first kernel computes the alignment score and fills the backtracking matrices, the second one performs the backtracking stage. In the first kernel every thread fills its H, E and F matrices as well as its backtracking arrays upC, leftC, upB, left Bhorizontally. In each iteration a total of eight cells are computed, as shown in Figure H and E matrices, and eight elements of backtracking arrays, are written back). A pair of H and E elements are stored together as one 32-bit word.All alignment algorithms are divided into two main procedures, called F do not have to be transferred from/to the global memory, because they can be stored in the fast, shared memory. Although utilization of the shared memory greatly speeds up the algorithm, not all the solutions, e.g. Manavski et al. [kernel has been shown in Figure Also the elements of backtracking arrays are stored in a 32-bit word - eight elements in each of four matrices give totally 32 bits. Moreover, one can notice that the elements of the matrix i et al. , leveragkernel is similar to the one proposed by Liu Y. et al. in CUDASW++ [The idea of processing the dynamic programming matrix in vectors of eight elements in the first CUDASW++ . HoweverCUDASW++  by usingkernel. Also in this case, one thread is responsible for processing of only one alignment. The kernel starts from the  cell, computed in the first stage, and performs the up, left or diagonal moves, depending on the backtracking matrices, until the stop condition is fulfilled. When the algorithm moves up, the elements of upC, leftC, up Band left Bmatrices do not have to be read from the global memory, because in most cases, they are already in registers - one 32-bit word contains the information about eight elements of backtracking arrays. However, when the algorithm moves left or diagonal, one word is read from the global memory. This kernel, launched in grids of blocks, produces the final alignments of every sequence with each other. Its pseudocode has been shown in Figure The second stage of the algorithm - backtracking, is executed by the second window size parameter. E.g. to utilize the resources of the GeForce GTX 280 with 1 GB of RAM properly, it is sufficient to set window size parameter to 80. It means that the input sequences, regardless of their number, can be as long as about 547 residues each. Processing of longer sequences is also possible, but the window size parameter should be decreased, e.g. the proper window size value for sequences with the length of 900 residues is 48. Although this change will have an influence on the overall performance of the algorithm, its speed may be still satisfactory. Taking this into consideration, we can conclude that the algorithm can process sequences with reasonable length. On the other hand, while aligning short sequences, one can try to increase the value of window size. This may improve the algorithm's performance.The advantage of using the backtracking arrays is that the backtracking stage can be performed very quickly in a linear time leading to very good solutions for short and medium-length sequences. However, its main drawback is quadratic memory complexity, discussed in Section "The idea of backtracking procedure and GPU limitations". Thus, the question is: what is the length of the longest sequences that can be processed by our program? Table windows) in descending order of their estimated complexity. Then, the tasks are assigned consecutively to any GPU that becomes idle. This type of scheduling, i.e. largest processing time first (LPT), although not optimal, ensures that the upper bound of execution time is equal to opt tis the optimal execution time and m - number of processing units [Bearing in mind, that nowadays many computer systems are equipped with more than one graphics card, we have designed and implemented a multi-GPU support. To ensure that all graphics cards used are equally loaded with work, regarding to their individual speeds, we have also implemented a task manager. Its role is to balance work among available GPUs. First, it sorts the tasks  should be well understood. The measure represents the average time needed to compute one cell in the matrix H, including the time of all side operations like computation of the values in the E and F matrices or performing the backtracking procedure. In practice, the number of computed cells in the matrix H is divided by the overall runtime of the algorithm. In our case it is:The main goal of this section is to compare the performance of the algorithm to other state-of-the-art approaches. However, before proceeding to the actual tests, the measure of n is the number of input sequences, i lengthis the length of the i-th sequence, t represents the time in seconds and the result is given in giga (109) CUPS.where H does not change, the time needed by backtracking is added.It should be stressed, however, that this measure underestimates the performance of the algorithms with a backtracking routine, because while the number of cells in the matrix The first implementation of the SW algorithm taking advantage of CUDA-capable GPUs has been developed by Manavski S. et al. . The SW-n - 1 times, where n is the number of input sequences, each time with decreased size of the database. Obviously, a good parallelism with a small database cannot be obtained for these algorithms. Hence, it would be unfair to include such tests in the paper. Instead, we decided to make use of a well-established algorithm of Farrar M. [In search for an application to which our algorithm could be compared, we have come across the Khajeh-Saeed A. et al. solution . This aparrar M.  which isIn this test our algorithm is compared to the Farrar's implementation of the Smith-Waterman algorithm . Farrar'Ensembl Databases - Release 55 [For testing purposes we used the lease 55 , which copen G= 10, ext G= 2) were fixed the same for all tests.In order to see if the performance of the algorithms depends on the length of the sequences, the input data was divided into six groups with different average lengths: 51, 154, 257, 459, 608 and 1103 amino acids. Moreover, for each group three sets with different number of sequences are considered to see if their number has any significant impact on the performance. The substitution matrix (BLOSUM50) as well as gap penalties . Additionally, our algorithm has been tested in one and four GPU configurations, respectively.Each algorithm was launched with each input data ten times. Table window size parameter needs to be reduced. This corresponds directly to the number of tasks running in parallel. Hence the slowdown.The performance of the Farrar's algorithm grows significantly with increasing sequence length, reaching around 3.15 GCUPS for the sets with the longest sequences. In contrast, our algorithm with the performance of about 2.8 GCUPS seems to be insensitive to the sequence length. Its speed slightly decreases only for the groups with long sequences (608 and 1103). The reason behind this is that longer sequences require more global memory and thus the value of the Farrar's solution, that has been used in this test, uses only one CPU core, but obviously we can expect a speedup close to linear if all CPU cores were used. However, our approach is also scalable - the execution times drop by a factor of nearly four when all four GPUs are used and the algorithm reaches up to 11.5 GCUPS. The number of input sequences does not affect the performance of Farrar's approach and it was high enough to have no influence on the performance of our algorithm. We can conclude that for sequences of average length (459) both implementations run comparably fast, but the GPU-based algorithm tends to be much faster when short sequences are processed. Moreover, it is worth noting that our algorithm additionally performs the backtracking step and computes the actual alignments of the sequences.The speedup is much higher if the algorithm is compared to the one presented by Khajeh-Saeed A. et al. in . Up to oEmboss [Ensembl Databases - Release 55 (see Section "Comparison to the Farrar's implementation"). We tested ten sets of sequences, each containing 2800 entries with lengths between 100 and 420 amino acids. The execution times of our NW and SW algorithms' implementations were compared with needle and water programs, which are available in the Emboss package. The needle program performs semiglobal alignments using the NW algorithm, the water program computes local alignments using the SW algorithm. These programs have been designed for aligning one sequence with a set of sequences. Instead of changing the source code, a special shell script was prepared that allows to align every sequence with each other. As a side effect, the programs from the Emboss package had to be launched 2800 times. In order to make the comparison reasonably fair their execution times have been reduced appropriately. We prepared a set of 2800 sequences with lengths equal to 1. Then, we measured the execution times of the programs from the Emboss package for this special set. The times were subtracted from the execution times of the test cases containing real sequences. It is worth noting that needle and water programs work using one CPU thread. Obviously, the NW and SW algorithms are deterministic - they always find the optimal solution. Therefore, there is no need to compare the quality of the results.Apart from comparison to the state-of-the-art solutions, we decided to compare the algorithm to the implementation available in a popular package with bioinformatics tools - the Emboss . The inpThe tests were run on the following hardware:• CPU: Intel Core 2 Quad Q8200, 2.33 GHz,• GPU: NVIDIA GeForce GTX 280 with 1 GB of RAM,• RAM: 8 GB,• OS: 64-bit Linux.σ have been omitted, because they do not give any significant information .Each algorithm was run ten times (once for each input set). Figure needle and water programs were 6157 and 10957 seconds respectively (about 102 and 182 minutes), whereas the times for our implementation were as follows: 89.7 seconds for the NW and 100.8 seconds for the SW algorithm. Thus, the GPU implementation of the semiglobal version of NW was about 68 times faster than the CPU-based needle. In case of the SW algorithm the difference was even higher: the GPU version was about 108 times faster. To show this relationship properly, the scale of the time axis in Figure The average times of computation for the The multi-GPU test was performed to see how the time of the computations depends on the number of graphics cards used. The sets of input sequences were the same as in the case of the test from Section "Comparison to the Farrar's implementation".The tests were run on the following hardware:• CPU: 2 × Intel Xeon E5405, 2.0 GHz,• GPU: NVIDIA Tesla S1070 with 16 GB of RAM,• RAM: 16 GB,• OS: 64-bit Linux.The Smith-Waterman algorithm was launched using one, two, three and four GPUs in turn. The algorithm was run ten times for each input set and the mean values of the computational times are shown in Table Ensembl Databases - Release 55 and the set of sequences contained 4000 entries with lengths between 100 and 420 amino acids.To see if the same applies to the NW algorithm and its semiglobal version, we prepared a simple test. The input sequences were taken from the All three algorithms, namely global and semiglobal versions of the NW, and the SW algorithm, were launched using again one, two, three and four GPUs, respectively. Each algorithm was run ten times and the mean values of the computational times as well as the speedups are shown in Table Ensembl Databases - Release 55 (see Section "Comparison to the Farrar's implementation"). Each subsequent instance contained additional 16 sequences, the largest instance had 1024 sequences. The lengths of the sequences varied between 100 and 420 amino acids. The adopted measure was the average time needed to compute a single alignment of two sequences. To be more precise, the time needed to perform all alignments for a given problem instance was measured and then divided by the total number of computed alignments. The goal was to determine the minimal number of input sequences that could guarantee good performance.According to Gustafson's law , to gainThe tests were run on the following hardware:• CPU: Intel Core 2 Quad Q8200, 2.33 GHz,• GPU: NVIDIA GeForce GTX 280 with 1 GB of RAM,• RAM: 8 GB,• OS: 64-bit Linux.Figure The reasonable times of 0.1, 0.1 and 0.12 ms, respectively, have been achieved for an instance with 80 sequences. The chart is limited to the maximum instance size of 256 sequences, because the curve almost reaches its asymptote. For an instance of this size the times were 0.04, 0.04 and 0.05 ms, respectively. All three algorithms needed only around 0.03 ms if 512 sequences were processed. Although further incrementing of the problem size resulted in some decreases in time, the benefits were not considerable. It means that even for relatively small instances the algorithms were able to gain a good speedup.The algorithm was designed during the time when only the G80 and the GT200 GPU architectures were available on the market. However, recently a new architecture, called Fermi , has comThe sets of input sequences were the same as in the case of the test from Section "Comparison to the Farrar's implementation". Only the longest sequences were excluded, because of more limited memory on the graphics cards.The tests were run on the following hardware:• CPU: Intel Core i7 950, 3.06 GHz,• GPU: 2× NVIDIA GeForce GTX 480 with 1.5 GB of RAM,• RAM: 8 GB,• OS: 64-bit Linux.σ were insignificant (less than 1% of measurement) and hence omitted. Additionally, the table includes the performance of the previous generation architecture - GT200, represented here by one GPU from the Tesla S1070 (see Section "Comparison to the Farrar's implementation").Each method, i.e. the SW algorithm as well as the NW algorithm and its semiglobal version, was launched ten times for each input data. Table The test shows that with the Fermi architecture the performance of the algorithms increases by a factor of nearly two, especially for short sequences. In case of longer sequences this dominance is slightly reduced, because only 1.5 GB of RAM was available on our Fermi graphics card whereas one Tesla has 4 GB. Obviously, Fermi GPU with 3 or 6 GB of memory may solve this performance issue. However, one should remember that the solution aims to process mainly short and medium-length sequences.kernel responsible for the actual backtracking is very quick and as stated before comprises less than 1 percent of total runtime of the algorithm. It, however, requires the backtracking arrays to be filled by the kernel 1. Since these arrays are not used for any other purpose, we excluded them from computations.Although the algorithm has been designed especially to deal well with backtracking routine, we also carried out a special test to investigate its performance when the backtracking is not performed, i.e. for score-only version. In other words we set out to check the overhead needed by the backtracking procedure. The Tests were conducted on workstation already described in Section "Test on the Fermi architecture". This time, though, only one GPU was used. The sets of input sequences were also the same. The results are presented in Table The performance of the score-only algorithm increases considerably reaching up to 9.39 GCUPS. The results are not as good as e.g. in CUDASW++2.0, but one should be aware of the fact that our algorithm was optimized to work well together with the backtracking routine. Moreover, our method has a few assumptions (described earlier) that distinguish it from other implementations but at the same time make it more elaborate.BT share values were computed in the following way: the computational times of the algorithm with the backtracking routine were divided by the runtimes of corresponding score-only versions of the algorithm. As we can see the overhead of the backtracking is mainly caused by the necessity of filling the upC, leftC, up Band left Bmatrices. However, the additional 45% - 65% is still low in comparison to the method proposed by Myers et al. [The s et al. . Their aAlthough a few GPU-based implementations of the SW algorithm are already known -16 most The NW and SW algorithms with a backtracking routine may have a lot of applications. They can be used as a robust method for multi-pairwise sequence comparisons performed during the first step in all of the multiple sequence alignment methods based on the progressive approach. Another area of interest can be the usage of a GPU-based semiglobal alignment procedure as a part of the algorithm for the DNA assembly problem, being one of the most challenging problem in current biological studies. It has already been shown that in this case a parallel solution can be successfully applied . Using G• Project name: gpu-pairAlignhttp://gpualign.cs.put.poznan.pl• Project home page: • Operating system: Linux• Programming language: C/C++• Other requirements: CUDA 2.0 or higher, CUDA compliant GPU, make, g++• License: GNU GPLv3• Any restrictions to use by non-academics: noneNW: the Needleman-Wunsch algorithm; SW: the Smith-Waterman algorithm; CPU: central processing unit; GPU: graphics processing unit; GPGPU: general-purpose computing on graphics processing units; CUDA: Compute Unified Device Architecture; RAM: random access memory; OS: operating system.WF, MK and PW conceived of the study and participated in its design. WF proposed the idea of backtracking arrays. WF and MK contributed equally to algorithm design and implementation. MK carried out computational tests. JB and EP participated in the coordination of the project. All authors were involved in writing the manuscript and all of them read and approved its final version.