 Research article
 Open access
 Published:
Improvement in accuracy of multiple sequence alignment using novel grouptogroup sequence alignment algorithm with piecewise linear gap cost
BMC Bioinformatics volume 7, Article number: 524 (2006)
Abstract
Background
Multiple sequence alignment (MSA) is a useful tool in bioinformatics. Although many MSA algorithms have been developed, there is still room for improvement in accuracy and speed. In the alignment of a family of protein sequences, global MSA algorithms perform better than local ones in many cases, while local ones perform better than global ones when some sequences have long insertions or deletions (indels) relative to others. Many recent leading MSA algorithms have incorporated pairwise alignment information obtained from a mixture of sources into their scoring system to improve accuracy of alignment containing long indels.
Results
We propose a novel grouptogroup sequence alignment algorithm that uses a piecewise linear gap cost. We developed a program called PRIME, which employs our proposed algorithm to optimize the welldefined sumofpairs score. PRIME stands for Profilebased Randomized Iteration MEthod. We evaluated PRIME and some recent MSA programs using BAliBASE version 3.0 and PREFAB version 4.0 benchmarks. The results of benchmark tests showed that PRIME can construct accurate alignments comparable to the most accurate programs currently available, including LINSi of MAFFT, ProbCons, and TCoffee.
Conclusion
PRIME enables users to construct accurate alignments without having to employ pairwise alignment information. PRIME is available at http://prime.cbrc.jp/.
Background
Multiple sequence alignment (MSA) is a useful tool for elucidating the relationships among function, evolution, sequence, and structure of biological macromolecules such as genes and proteins [1–3]. Although we can calculate the optimal alignment of a set of sequences by ndimensional dynamic programming (DP), the DP method is applicable to only a small number of sequences. In fact, even when a sumofpairs (SP) score with the simplest gap cost is used as an objective function, computation of optimal MSA is an NPhard problem [4]. Hence, many heuristic methods have been developed. Almost all practical methods presently available adopt either a progressive [5–7] or an iterative [8–10] heuristic strategy.
The grouptogroup sequence alignment algorithm is a straightforward extension of the pairwise sequence alignment algorithm, and is the core of progressive and iterative methods. The essential difference of grouptogroup sequence alignment from pairwise sequence alignment is the existence of gaps within each group of prealigned sequences. The gap opening penalty used in an affine gap cost disrupts the independence between adjacent columns, and hence calculating the optimal alignment between two groups with respect to the SP score was shown to be NPcomplete [11]. Gotoh was the first to devise a grouptogroup sequence alignment algorithm that optimizes the SP score by using a candidate list paradigm [12]. An algorithm with a candidate list paradigm, similar to the branchandbound method, prunes the candidates that are dispensable for arrival at an optimal solution. Kececioglu and Starrett proposed another candidatepruning method [11]. Although these algorithms can calculate the optimal alignment between two groups, they require relatively extensive computational resources. Several papers have reported faster algorithms that use the heuristic estimation of gap opening penalties [8, 10].
Several studies have discussed the tendency that global alignment methods perform better than local ones [13, 14]. However, the opposite is also true when some sequences to be aligned have long insertions or deletions (indels). One reason for this tendency is that almost all grouptogroup sequence alignment algorithms use an affinelike gap cost that overpenalizes long indels. To alleviate this problem, several methods have combined pairwise global and local alignments, or incorporated consistency information among pairwise alignments [6, 15, 16]. Another strategy to prevent overpenalizing long indels is to use a concave function as the gap cost. It is relatively easy to choose a concave gap cost that does not overpenalize long indels, and several pairwise sequence alignment algorithms using this gap cost have been developed [17, 18]. However, there have been few attempts to incorporate this gap cost into a grouptogroup sequence alignment algorithm to develop an MSA program.
In this paper, we propose a novel grouptogroup sequence alignment algorithm with a piecewise linear gap cost [18], which is the key to a progressive or an iterative refinement method. The piecewise linear gap cost [18] is one of the concave functions and consists of L linear functions. Depending on the gap length, this gap cost varies its inclination, which corresponds to the gap extension penalty. However, in the case of grouptogroup sequence alignment algorithm, it is difficult to calculate the proper gap extension penalty with only the data structures used in the previous algorithm that were designed to detect the opening of new gaps [12, 19]. Accordingly, we newly introduce two additional data structures: 'insertion length profile' and 'dynamic gap information'. An insertion length profile vector is associated with each column of a group of sequences, while dynamic gap information keeps track of information about gaps inserted into a group during the DP process. Together with those used in the previous algorithm, gap extension penalty can be calculated efficiently. Using the proposed algorithm, we developed a program called PRIME.
PRIME stands for Profilebased Randomized Iteration MEthod. As a result of benchmark tests, the accuracy of our method is shown to be comparable to the most accurate methods available today, all of which incorporate pairwise alignment information obtained from allbyall pairwise alignment. This implies that the piecewise linear gap cost is as effective as pairwise alignment information in improving the alignment accuracy of sequences, some of which have long indels.
Algorithms
In this section, we first review the previous grouptogroup sequence alignment algorithm with an affine gap cost [12, 19], and then describe a novel one with a piecewise linear gap cost. The final subsection outlines a doubly nested randomized iterative strategy with which our proposed algorithm is integrated.
The definitions of symbols are as follows. Let Σ be the residue set and Σ, the number of elements in Σ. Σ* denotes the set containing a null and each element in Σ. A null means that a residue of one sequence does not aligned with that of another sequence when aligning sequences, and is denoted by the symbol ''. A and B denote prealigned groups of sequences. A includes m rows, and B, n rows. The respective lengths of A and B are I and J. A_{ p }, a_{ i }, and a_{p,i}denote the pth row of A, the ith column of A and the ith residue of A_{ p }, respectively. B_{ q }, b_{ j }, and b_{q,j}are defined similarly. Both a_{p,i}and b_{q,j}belong to Σ*. Note that any column of a group must not be a null column, which consists of nulls only. If all nulls are removed from a group, each row is an usual sequence. A run of consecutive nulls in a row is called a gap. A gap length is the number of nulls constituting the gap. A segment of A that consists of consecutive columns a_{ s }to a_{ t }is denoted by A(s, t); A is also expressed as A(1, I). s(a, b) is a substitution score between residues a and b. By g(x), we mean a gap cost function of gap length x. The pair weight between the pth sequence in A and the qth sequence in B is w_{p,q}. If the threeway method [20] is used to calculate the pair weights, w_{p,q}can be factorized as {w}_{{A}_{p}}·{w}_{{B}_{q}}, where {w}_{{A}_{p}} and {w}_{{B}_{q}} are the weights for the pth sequence in A and the qth one in B, respectively.
Review of previous grouptogroup sequence alignment algorithm with affine gap cost
The previous grouptogroup sequence alignment algorithm that optimizes SP or weighted SP score with an affine gap cost is based on a twodimensional DP method [12]. The key point of this algorithm is to exactly evaluate the gap opening penalties during the DP process. To explicitly consider gaps already present in each group, this algorithm introduces a gap state that denotes the number of consecutive nulls up to the current position.
Another important feature of this algorithm is the candidate list paradigm, which is a variant of branchandbound methods. Because the calculation of gap opening penalties depends on a previous partial DP path, simple extension of pairwise sequence alignment algorithm may not yield globally optimal alignment between two groups [12]. For rigorous calculation, not only locally optimal partial paths but also those that possibly contribute to globally optimal alignment have to be stored at each node of a DP matrix [11, 12]. In the worst case, the number of candidates to be stored grows exponentially with the total number of sequences in the two groups [11]. As discussed in some papers [8, 10, 12], the grouptogroup sequence alignment algorithm without the candidate list paradigm may suffice for good alignment. Moreover, because the novel grouptogroup sequence alignment algorithm described below requires roughly twice as much computation time as the previous one at each DP process, we adopted a simpler algorithm without the candidate list paradigm.
Basic algorithm
Let an affine gap cost function be g(x) = (ux + v), where u(> 0) and v(> 0) are constants called gap extension penalty and gap opening penalty, respectively. The grouptogroup sequence alignment algorithm with the affine gap cost employs essentially the same recurrent relations as the pairwise sequence alignment algorithm [21], with exact evaluation of gap opening and extension penalties. Like the pairwise sequence alignment algorithm, we calculate four variables at each node, (i, j), of the DP matrix: {H}_{i,j}^{0}, {H}_{i,j}^{1}, {H}_{i,j}^{2}, and {H}_{i,j}^{3}. {H}_{i,j}^{0} holds the best score among {H}_{i,j}^{1}, {H}_{i,j}^{2}, and {H}_{i,j}^{3} at (i, j). {H}_{i,j}^{1} is a score of a partial alignment where a_{ i }and b_{ j }are aligned. {H}_{i,j}^{2} and {H}_{i,j}^{3} mean partial alignment scores where a_{ i }and b_{ j }are aligned with null columns, respectively. The recurrent equations are:
where '' denotes a null column, and {P}_{i1,j1}^{0} is a partial DP path. A partial DP path is one from (0, 0) to the node of the DP matrix in question, representing a partial alignment; for example, {P}_{i,j}^{0} represents a partial alignment with the best score {H}_{i,j}^{0} between A(1, i) and B(1, j)·S(a_{ i }, b_{ j }) is responsible for the calculation of substitution scores and gap extension penalties:
If either a or b is a null, s(a, b) = u, and if both a and b are null, s(a, b) = 0. G(a_{ i }, b_{ j }; {P}_{i1,j1}^{0}) is the gap opening penalty when a_{ i }is aligned with b_{ j }:
and {y}_{q,j1}^{0} are the gap states for the pth and qth rows in A(1, i  1) and B(1, j  1) on {P}_{i1,j1}^{0}, respectively. As mentioned above, the gap state is the length of the gap up to the current position. γ(a, b, x, y) represents whether a gap opens with respect to a pair of rows. Specifically, if a is a residue, x ≥ y, and b is a null; or if a is a null, x ≤ y, and b is a residue; then γ(a, b, x, y) = 1. Otherwise, γ(a, b, x, y) = 0. In order to evaluate exact gap openings for calculation of each {H}_{i,j}^{k}, the gap states must be updated. If a_{p,i}is a null, {x}_{p,i}^{0}={x}_{p,i1}^{d}+1 where d = arg max_{1≤k≤3}{{H}_{i,j}^{k}}. Otherwise, {x}_{p,i}^{0} = 0. The other gap states are calculated in a similar way.
Use of generalized profile
Although equations 5 and 6 require O(mn) computational steps, these steps can be reduced by using a generalized profile [19] and the threeway weighting method [20]. The idea of using the generalized profile is that the same residue types or gap states on a column are treated together. The generalized profile consists of four vectors calculated from each column of a group: frequency, residue profile, and two kinds of static gap profile vectors. These vectors can be obtained in advance of the DP process. The frequency and residue profile vectors are used to calculate S(a_{ i }, b_{ j }), while the static gap profile vectors are necessary to calculate G(a_{ i }, b_{ j }; {P}_{i1,j1}^{0}).
With the frequency and residue profile vectors, S(a_{ i }, b_{ j }) is calculated by
where residue frequency {f}_{{a}_{i},r} is the weighted frequency of occurrence of residue type r (including null) on column a_{ i }, and residue profile {p}_{{b}_{j},r}={\displaystyle {\sum}_{t\in \Sigma *}{f}_{{b}_{j},r}}\cdot s(r,t). Both {p}_{{a}_{i},r} and {f}_{{b}_{j},r} are defined in the same way. The right hand side of equation 7 requires O(Σ*), because each frequency and residue profile vector consists of Σ* values. When m × n is sufficiently large, the computation time can be considerably reduced. Although S(a_{ i }, b_{ j }) is easy to calculate, the profilebased calculation of G(a_{ i }, b_{ j }; {P}_{i1,j1}^{0}) is somewhat complicated, because, in addition to static gaps, dynamic gaps must be considered explicitly. A static gap consists of consecutive static nulls that already exist in each group, while a dynamic gap denotes a run of dynamic nulls that are inserted into each group during the DP process. Note that we distinguish static and dynamic gaps for convenience of the description of our algorithm, while they contribute to the total alignment score in the same way. Let us consider an example of the gap opening penalty calculation when a_{8} is aligned with b_{12} (Figure 1). To keep the discussion simple, we consider A_{1} and B_{2} only. From simple observation, we find that a gap between A_{1} and B_{2} has already opened before a_{8} is aligned with b_{12}. However, if the gap opening penalty were calculated using the static gap states only, a gap opening would be detected wrongly, because a_{1,8} is a null, b_{2,12} is a residue, and x_{1,7} = 0 ≤ y_{2,11} = 0 where x_{1,7} and y_{2,11} are the static gap states of a_{1,7} and b_{2,11}, respectively. For correct detection of gap opening, we need 'running gap states', each of which represents the sum of the numbers of consecutive static and dynamic nulls up to the current position. For the example shown in Figure 1, the running gap state for A_{2} at column position a_{7} is 11, which is composed of 7 static nulls and 4 dynamic nulls.
Static gap states are compactly represented as a static gap profile. A static gap profile is obtained by gathering static gap states with the same values at a column. More specifically, the static gap profile at a column c_{ k }consists of two vectors {E}_{{c}_{k}} and {S}_{{c}_{k}}. Each element of both vectors has the same form: {(g, f)} where g is the gap state of previous column c_{k1}and f is the weighted frequency of the occurrence of rows whose element on c_{ k }is either a residue or null depending on {E}_{{c}_{k}} or {S}_{{c}_{k}}, respectively. Although {E}_{{c}_{k}} itself may be used to calculate gap opening penalties, its accumulated form, {E}_{{c}_{k}}^{+}, is more convenient to reduce the computation time. If an element in {E}_{{c}_{k}}^{+} is (g, f^{+}), f^{+} represents the weighted frequency of the occurrence of rows whose gap states are not less than g. For the example shown in Figure 1, {E}_{{a}_{8}}, {E}_{{a}_{8}}^{+}, and {S}_{{a}_{8}} are {(0, {w}_{{A}_{4}}), (2, {w}_{{A}_{3}}), (7, {w}_{{A}_{2}})}, {(0, {w}_{{A}_{4}} + {w}_{{A}_{3}} + {w}_{{A}_{2}}), (2, {w}_{{A}_{3}} + {w}_{{A}_{2}}), (7, {w}_{{A}_{2}})}, and {(0, {w}_{{A}_{1}})}, respectively. Since all gap states are different in the worst case, the total number of elements of {E}_{{c}_{k}}^{+} and {S}_{{c}_{k}} is at most the number of sequences in the group.
Like a static gap profile, a running gap profile can represent running gap states compactly. In order to obtain a running gap profile, another data structure called a gap mediation profile is required. A gap mediation profile is defined for each path in the DP process, and records the total number of dynamic nulls inserted into static gaps that are currently open. Each element of the gap mediation profile is expressed as (s, d), where s is the length of a static gap and d is the summed length of dynamic gaps inserted within or after the static gap. Let {M}_{i,j}^{0}(A) be the gap mediation profile of group A at the DP node (i, j)·{M}_{i,j}^{0}(A) follows a recurrent relation, the initial condition of which is {M}_{i,j}^{0}(A) = {(0, 0)}. We first consider the case where a_{ i }and b_{ j }are aligned. For each (g, f) in {S}_{{a}_{i}}, if there exists element (s, d) in {M}_{i1,j1}^{0}(A) such that g = s, then (s + 1, d) ∈ {M}_{i,j}^{0}(A). In the case where b_{ j }is aligned with a null column, then (s, d + 1) ∈ {M}_{i,j}^{0}(A) where (s, d) is an element in {M}_{i,j1}^{0}(A) or {M}_{i,j1}^{3}(A) depending on the maximum operation of equation 4. If a_{ i }is aligned with a null column, {M}_{i,j}^{0}(A) equals {M}_{i1,j}^{0}(A) or {M}_{i1,j}^{2}(A). In the case of Figure 1, {M}_{7,11}^{0}(A) = {(0, 1), (2, 1), (7, 4)} is derived from {M}_{7,10}^{0}(A) = {(0, 0), (2, 0), (7, 3)}. The other gap mediation profile vectors are constructed in a similar way.
Running gap profile vectors {\widehat{E}}_{{a}_{i}}^{+} and {\widehat{S}}_{{a}_{i}} are obtained by combining gap mediation profile {M}_{i1,j1}^{0}(A), and static gap profiles {E}_{{a}_{i}}^{+} and {S}_{{a}_{i}}, respectively. For each (g, f^{+}) in {E}_{{a}_{i}}^{+}, (s, d) is chosen from {M}_{i1,j1}^{0}(A) such that g = s, and then (s + d, f^{+}) ∈ {\widehat{E}}_{{a}_{i}}^{+}. Similarly, {\widehat{S}}_{{a}_{i}} is obtained from {M}_{i1,j1}^{0}(A) and {S}_{{a}_{i}}. For example, {\widehat{E}}_{{a}_{8}}^{+} and {\widehat{S}}_{{a}_{8}} at the node (8, 12) of Figure 1 are {(1, {w}_{{A}_{2}} + {w}_{{A}_{3}} + {w}_{{A}_{4}}), (3, {w}_{{A}_{2}} + {w}_{{A}_{3}}), (11, {w}_{{A}_{2}})} and {(1, {w}_{{A}_{1}})}, respectively.
Using running gap profile vectors {\widehat{E}}_{{a}_{i}}^{+}, {\widehat{S}}_{{a}_{i}}, {\widehat{E}}_{{b}_{j}}^{+}, and {\widehat{S}}_{{b}_{j}}, Equation 6 can be rewritten as:
S • E^{+} is expressed as
where s_{ p }and {e}_{q}^{+} are the pth and qth elements in S and E^{+}, respectively, and f(e) is the weighted frequency of element e. q is chosen such that the gap state of {e}_{q}^{+} is the smallest among the elements in E^{+} whose gap states are not less than that of s_{ k }. Calculation of S • E^{+} requires O(S) + E^{+}), and hence G(a_{ i }, b_{ j }; {P}_{i1,j1}^{0}) at most O(m + n). Using equation 8 instead of equation 6 can reduce computation from O(mn) to O(m + n) even in the worst case where gap states on a column are mutually different.
Novel grouptogroup sequence alignment algorithm with piecewise linear gap cost
In this section, we describe a novel grouptogroup sequence alignment algorithm with a piecewise linear gap cost. Although this algorithm uses recurrent equations 1 to 4, the algorithms calculating S(a_{ i }, b_{ j }) and G(a_{ i }, b_{ j }; {P}_{i1,j1}^{0}) must be changed. Roughly speaking, the term for calculating gap extension penalties is transferred from S(a_{ i }, b_{ j }) to G(a_{ i }, b_{ j }; {P}_{i1,j1}^{0}). After explanation of the piecewise linear gap cost, we describe these algorithms in detail.
Piecewise linear gap cost
The piecewise linear gap cost consists of several linear functions [18]:
where u_{ l }> u_{l+1}(≥ 0) and v_{l+1}> v_{ l }(> 0). When L = 1, this cost is the same as the affine gap cost. This cost could alleviate overpenalizing long indels, because the inclination of g(x), which corresponds to a gap extension penalty, u_{ l }, becomes small as gap length increases. In other words, this cost calculates gap extension penalties based on gap length. For the sake of simplicity, we restricted our attention to the case of L = 2. Then, g(x) = (u_{1}x + v_{1}) if x ≤ x_{ c }or g(x) = (u_{2}x + v_{2}), otherwise, x_{ c }= ⌊(v_{2}  v_{1})/(u_{1}  u_{2})⌋ is called the critical gap length.
Calculation of substitution score
As mentioned above, the calculation of gap extension penalties must be separated from the calculation of the substitution score S(a_{ i }, b_{ j }) in order to use the piecewise linear gap cost. Therefore, S(a_{ i }, b_{ j }) is expressed as:
where {p}_{{b}_{j},r}={\displaystyle {\sum}_{t\in \Sigma}{f}_{{b}_{j},r}}\cdot s(r,t). Note that this equation and the definition of residue profile vector sum over not Σ* but Σ.
Calculation of gap extension penalty
In the previous algorithm with an affine gap cost, G(a_{ i }, b_{ j }; {P}_{i1,j1}^{0}) was responsible for the gap opening penalty only; however, it must take care of the gap extension penalty in the case of the piecewise linear gap cost. Therefore, a term for gap extension penalty is added to the right hand side of equation 8. Let us consider an example of gap extension penalty calculation for the null on b_{12} aligned with the residues on a_{8} (the last column of Figure 1). The gap state at b_{1,12} is 8. With omission of nulls that are aligned with other nulls, the lengths of the gap on B_{1} relative to A_{2}, A_{3}, and A_{4} are 1, 4, and 6, respectively. Assuming that the critical gap length x_{ c }= 4, we obtain the respective gap extension penalties for A_{2}, A_{3}, and A_{4} as u_{1}, u_{1}, and u_{2}. Therefore, the gap extension penalty in question is {w}_{{A}_{1}} (F_{1}·u_{1} + F_{2}·u_{2}), where F_{1} = {w}_{{A}_{2}} + {w}_{{A}_{3}} and F_{2} = {w}_{{A}_{4}}.
This example indicates two important points for the exact calculation of gap extension penalty. First, each gap length is obtained by counting the residues on each row of a specific range in A called 'relevant segment', A(3, 8) in this example. Second, the two nulls on B_{1} at columns b_{5} and b_{11} are aligned with two separate dynamic gaps inserted into A. The first observation suggests that F_{1} and F_{2} for any segment may be calculated before the DP process. However, the second observation indicates that the number of null columns of dynamic gaps aligned with static nulls on a target gap must be subtracted from the gap state of the target gap for correct assignment of the relevant segment; without this subtraction, the relevant segment would be assigned as A(1, 8) in the above example.
We initially consider the first point, neglecting the presence of dynamic gaps for a moment. Without loss of generality, we assume that the residues on a_{ i }are aligned with a null of a target gap on b_{ j }whose gap state is g. We define F_{0}(a_{ i }) as the weighted fraction of nulls on a_{ i }: {F}_{0}({a}_{i})\equiv {\displaystyle {\sum}_{p=1}^{m}{w}_{{A}_{p}}}\delta ({a}_{p,i},), where δ(a, b) = 1 if a = b, otherwise, δ(a, b) = 0, and '' denotes a null. F_{0}(a_{ i }) is the same as the null component of the frequency profile at a_{ i }, i.e. F_{0}(a_{ i }) = {f}_{{a}_{i},}. We also define F_{1}(A, i, g) as the sum of weights of sequences {A_{ p }} such that a_{p,i}≠ '' and the number of residues within segment A(i  g + 1, i) aligned with the target gap is less than or equal to x_{ c }: {F}_{1}(A,i,g)={\displaystyle {\sum}_{p=1}^{m}{w}_{{A}_{p}}}(1\delta ({a}_{p,i},))\Delta ({a}_{p},i,g), where Δ(a_{ p }, i, g) = 1 if the number of residues on the pth row of A(i  g + 1, i) is less than or equal to x_{ c }, otherwise, Δ(a_{ p }, i, g) = 0. Specifically, if {\displaystyle {\sum}_{k=i}^{ig+1}(1\delta ({a}_{p,k},))\le {x}_{c}}, then Δ(a_{ p }, i, g) = 1, otherwise, Δ(a_{ p }, i, g) = 0. Likewise, F_{2}(A, i, g) is defined as the sum of weights of sequences {A_{ p }} such that a_{p,i}≠ '' and the number of residues within A(i  g + 1, i) aligned with the target gap is greater than x_{ c }. Obviously,
F_{0}(a_{ i })+ F_{1}(A, i, g) + F_{2}(A, i, g) = 1. (11)
Because there may exist gap states g and g' (0 ≤ g <g' ≤ i) such that F_{1}(A, i, g) = F_{1}(A, i, g'), we need to store only distinct F_{1}(A, i, g) values, the number of which is at most the number of rows of A, m. For actual calculations, we use an 'insertion length profile' associated with each column of a group. An insertion length profile of column a_{ i }, {F}_{{a}_{i}} is expressed as {F}_{{a}_{i}} = {(i  g_{ k }+ 1, F_{1}(A, i, g_{ k }))}, where g_{ k }is a maximum gap state such that F_{1}(A, i, g_{ k }) = F_{1}(A, i, g') for g_{ k }≤ g' <g_{k+1}. Information about F_{2}(A, i, g) does not need to be recorded, because it can be easily derived from F_{0}(a_{ i }) and {F}_{{a}_{i}} through equation 11.
The second point raises the key problem: how to determine the 'tailored gap state' of the target gap, \widehat{g} = g  s, where g is the gap state of the target gap and s is the number of dynamic null columns to be removed for correct assignment of the relevant segment. For example, dynamic null columns aligned with b_{5} and b_{11} in Figure 1 are removed. To keep track of the dynamic gaps to be removed, we newly introduce the 'dynamic gap information' list. Each element of dynamic gap information is represented by (p, l), where p and l indicate the position and the length of a dynamic gap, respectively. For efficiency, the dynamic gap information list {(p_{ k }, l_{ k })} is sorted in order of p_{ k }. The dynamic gap information of group A at (i, j), {D}_{i,j}^{0}(A), is recurrently calculated as follows. When a_{ i }and b_{ j }are aligned, {D}_{i,j}^{0}(A) is simply copied from {D}_{i1,j1}^{0}(A). Similarly, when a_{ i }is aligned with a null column, {D}_{i,j}^{0}(A) is copied from {D}_{i1,j}^{0}(A) or {D}_{i1,j}^{2}(A) depending on the maximum operation of recurrent equation 3. When b_{ j }is aligned with a null column, {D}_{i,j}^{0}(A) is first copied from {D}_{i,j1}^{0}(A) or {D}_{i,j1}^{3}(A), and then a new element is added to it or its last element is modified. Specifically, if the last element of {D}_{i,j}^{0}(A) is (i, l), it is modified to (i, l + 1). Otherwise, a new element (i, 1) is added to {D}_{i,j}^{0}(A). The other dynamic gap information lists are obtained in a similar way.
It is worth mentioning that dynamic gap information {D}_{i,j}^{0}(A) and gap mediation profile {M}_{i,j}^{0}(A) contain information on dynamic gaps from different viewpoints. The information held in dynamic gap information is relevant to the group aligned with a gap in question (group A in the present example), while that maintained in a gap mediation profile is relevant to the group containing the gap (group B in the above example). In addition, each element of {D}_{i,j}^{0}(A) refers to a single dynamic gap, while that of {M}_{i,j}^{0}(A) records the total length of separate dynamic gaps inserted within or after a static gap. In the case of Figure 1, each element of {D}_{8,12}^{0}(A) = {(0, 1), (2, 2), (7, 1)} indicates the dynamic gaps of lengths 1, 2, and 1 inserted before column a_{1}, after a_{2}, and after a_{7}, respectively, while that of {M}_{7,11}^{0}(A) = {(0, 1), (2, 1), (7, 4) } means the total length of dynamic gaps inserted after the last nonnull residue within or before the present column in A_{1} or A_{4}, A_{3}, and A_{2}, respectively.
Given a dynamic gap information list D_{i, j}(A) = {(p_{ k }, l_{ k })} and a gap state g, we can easily derive the tailored gap state \widehat{g} with the following algorithm, in which s denotes the total number of dynamic gap columns to be removed and t_{ k }indicates the distance in the reverse direction from the current position i to the start position of the kth dynamic gap inserted into A(1, i):
Algorithm getTailoredGapState(D_{i,j}(A), g)

1.
s ← 0

2.
for k ← D_{i,j}(A) down to 1

(a)
t_{ k }← s + i  p_{ k }+ l_{ k }

(b)
if t_{ k }≤ g, then s ← s + l_{ k }

(c)
else if t_{ k } l_{ k }<g, then s ← s + g  (t_{ k } l_{ k })

(d)
if t_{ k }≥ g, then return \widehat{g} ← g  s

3.
retrun \widehat{g} ← g  s
The gap extension penalty for the target gap is then obtained by
w_{ B }{u_{1}·F_{1}(A, i, \widehat{g}) + u_{2}·F_{2}(A, i, \widehat{g})}, (12)
where w_{ B }is the weight given to the sequence containing the target gap. Note that step 2c in this algorithm examines whether or not the dynamic gap in question is partially aligned with the target gap. For the example considered in Figure 1, t_{3} = 0 + 8  7 + 1 = 2, and s = l_{3} = 1 are calculated after the first iteration of steps 2 in this algorithm. In the second iteration, we obtain t_{2} = 1 + 8  2 + 2 = 9. Because t_{2} = 9 > g = 8 and t_{2}  l_{2} = 7 <g = 8, we can recognize that the dynamic gap is partially aligned with the target gap, and hence the number of dynamic null columns to be removed 8  7 = 1 is added to s. The gap extension penalty, u, summed over all the nulls on column b_{ j }can easily be calculated with the following algorithm:

1.
u ← 0

2.
for h ← 1 to {\widehat{S}}_{{b}_{j}}

(a)
\widehat{g}(2)
← getTailoredGapState(D_{i,j}(A), g_{ h })

(b)
u ← u + f_{ h }{u_{1}·F_{1}(A, i, \stackrel{\_}{{g}_{h}}) + u_{2}·F_{2}(A, i, \stackrel{\_}{{g}_{h}})}

3.
return u
where (g_{ h }, f_{ h }) is the hth element of {\widehat{S}}_{{b}_{j}}. Because we have already prepared running gap state profile {\widehat{S}}_{{b}_{j}}, the computation is done in O(D_{i,j}(A)·{\widehat{S}}_{{b}_{j}}). To obtain the total gap extension penalty at each DP step, we must also consider the opposite situation where residues on b_{ j }are aligned with gaps on a_{ i }in a similar way.
Doubly nested randomized iterative strategy
The doubly nested randomized iterative strategy involves refinement of alignment, phylogenetic tree, and pair weights until these are mutually consistent [9]. After preparation of an initial alignment with such progressive methods as the oligomer counting based method [8, 10], this strategy refines the initial alignment as follows:

1.
Calculate a distance matrix from the multiple alignment

2.
Construct a phylogenetic tree from the distance matrix

3.
Calculate pair weights from the phylogenetic tree

4.
Iteratively refine the alignment using the phylogenetic tree and the pair weights

(a)
Divide the alignment into two groups based on a randomly chosen branch of the tree

(b)
Align these two groups using a grouptogroup sequence alignment algorithm

(c)
Repeat steps 4a to 4b until no better weighted SP score is obtained

5.
Repeat steps 1 to 4 until the weighted SP score of the alignment does not improve anymore at step 4
Results
PRIME
We developed a program called PRIME (Profilebased Randomized Iteration Method). PRIME is written in ISO standard C++, implementing the doubly nested randomized iterative strategy similar to our previous MSA program, Prrn [9]. However, PRIME employs our proposed algorithm with a piecewise linear gap cost in contrast to Prrn that uses an affine gap cost. Another algorithmic difference between PRIME and Prrn is that the latter uses the candidate list paradigm in the grouptogroup sequence alignment algorithm and the anchoring method, whereas the former adopts a simpler DP method without anchoring heuristics. The parameters of PRIME including selection of substitution matrix and gap cost parameters are optimized using an older BAliBASE, version 2.01 [22]. Because only about 20% of the sequences in BAliBASE version 3.0 [23] used for the test are common to those in BAliBASE version 2.01, we do not think that these parameters are overfitted against BAliBASE version 3.0. Initial MSAs are constructed using a simple progressive method with the proposed grouptogroup sequence alignment algorithm based on a distance matrix calculated from pairwise sequence alignment. The PRIME source code is provided as an additional file [see Additional file 1], and can be downloaded at PRIME website [24]. The future version of PRIME will be available at this site.
Benchmarks
To evaluate the performance of PRIME and other MSA programs shown in Table 1, we execute two benchmarks: BAliBASE version 3.0 [22, 23, 25] and PREFAB version 4.0 [8]. In the case of PREFAB, we also test two global pairwise sequence alignment programs as controls: PSA_{ piecewise }and PSA_{ affine }. PSA_{ piecewise }and PSA_{ affine }use the piecewise linear gap cost and the affine gap cost, respectively.
BAliBASE
BAliBASE is categorized into five references according to the nature of sequences to be aligned (Table 2). Reference 1 is further divided into two subreferences based on sequence identities. Although the previous BAliBASE version 2.01 has been widely used, it had a problem that some sequences were trimmed off nonhomologous regions [26]. Therefore, two test sets are prepared in BAliBASE version 3.0: full length set and homologous region set. Each sequence in the full length set is not trimmed off nonhomologous regions, whereas the homologous region set consists of alignments of trimmed sequences and hence corresponds to the previous BAliBASE. However, reference 4 is excluded from the homologous region set due to its objective.
Alignment evaluation based on BAliBASE
To evaluate alignment accuracy based on BAliBASE, we use sumofpairs and column scores [14]. The sumofpairs score (SPS) is defined as the proportion of correctly aligned residue pairs:
where I and J are the number of columns of test and reference alignments, respectively. S{P}_{i}^{t} is defined as:
If aligned residue pair a_{ mi }and a_{ ni }of the test alignment also exists in the reference alignment, P_{ i }(m, n) = 1. Otherwise, p_{ i }(m, n) = 0. S{P}_{j}^{r} is the total number of aligned pairs on column j of the reference alignment. The column score (CS) represents the proportion of correctly aligned columns:
If the column of the test alignment is identical to the ith column of the reference alignment, c_{ i }= 1.
Otherwise, c_{ i }= 0.
PREFAB
PREFAB is another MSA benchmark. Each alignment of PREFAB is generated automatically, while that of BAliBASE is constructed by human expertise. PREFAB consists of three data sets: main, long gap, and weighting sets. The main set corresponds to the previous PREFAB version 3.0, which is not categorized unlike BAliBASE. Each alignment of the long gap set, a subset of the main set, contains one or more gaps whose lengths are more than 10. The weighting set involves alignments each of which includes more sequences of one subfamily than that of the other subfamilies. Whereas each reference alignment of BAliBASE is provided as an MSA, each reference alignment of PREFAB is provided as a pairwise alignment of a pair of PDB sequences of known structures.
Alignment evaluation based on PREFAB
For alignment evaluation of PREFAB, the quality score is employed, which measures only two PDB sequences within each alignment. The quality score (QS) is the ratio of correctly aligned residue pairs of the reference pairwise alignment: QS=\frac{1}{J}{\displaystyle {\sum}_{i=1}^{J}{p}_{i}}, where J is the number of residue pairs in the reference alignment. If the residue pair of the test alignment is also aligned in the reference alignment, p_{ i }= 1. Otherwise, p_{ i }= 0. Note that if the reference alignment is pairwise alignment, quality score, sumofpairs score, and column score have the same value.
Results of BAliBASE benchmark test
Full length set
The average sumofpairs and column scores of the full length set are shown in Tables 3 and 4, respectively. The last columns of both tables are the rank sum of the Friedman test. The program with the smallest rank sum means that the program consistently constructs the most accurate alignments even if it does not achieve the largest average score. The pvalues of the Friedman test are shown in the additional file [see Additional file 2]. The Friedman test indicates that the tested programs are classified into three groups according to their performances. The most accurate group consists of PRIME_{ piecewise }, PRIME_{ affine }, MAFFT, ProbCons, and TCoffee. The second most accurate one is Prrn and MUSCLE. The accuracies of DIALIGNT, POA, and ClustalW are comparable to each other but are significantly lower than those of Prrn and MUSCLE. Figure 2 shows the performance difference between PRIME_{ piecewise }and PRIME_{ affine }. In this figure, we plot the difference in alignment scores of PRIME_{ piecewise }and PRIME_{ affine }. A positive difference score means that PRIME_{ piecewise }constructs more accurate alignments than PRIME_{ affine }, and vice versa. Although the difference is not statistically significant, PRIME_{ piecewise }shows better performance than PRIME_{ affine }, as expected.
Homologous region set
The average sumofpairs and column scores of the homologous region set are shown in Tables 5 and 6, respectively. The pvalues of the Friedman test are shown in the additional file [see Additional file 3]. Unlike the results of the full length set, little difference in accuracy was detected between PRIME_{ piecewise }and PRIME_{ affine }. Figure 3 shows the performance difference between them. Because the terminal nonhomologous regions trimmed off in the homologous region set are usually long, for the full length set, the piecewise linear gap cost treats the long terminal gaps more effectively than the affine gap cost, and hence PRIME_{ piecewise }shows better performance than PRIME_{ affine }. However, because the difference between these gap costs is relatively small in the homologous region set, PRIME_{ piecewise }and PRIME_{ affine }show similar performance. The relative performance of the nine programs examined is nearly the same as that of the full length set in a statistical sense.
Effects of nonhomologous regions
We examine the effects of nonhomologous regions in more detail. The critical difference between the full length and homologous region sets is the existence of nonhomologous regions at N/C terminals. Therefore, the difference in alignment scores obtained by the same program for the corresponding members in the full length and homologous region sets indicates to what extent the program properly deals with terminal gaps. Figures 4 and 5 show the average difference of sumofpairs and column scores between the full length and homologous region sets. Each difference score is calculated by subtracting the alignment score of the full length set from that of the homologous region set. A positive difference score means that the nonhomologous regions adversely affect alignment accuracy, whereas a negative score indicates improvement in alignment accuracy due to the presence of such regions. If the score difference is close to 0, the program is considered to be robust against the nonhomologous regions. The results indicate that PRIME_{ piecewise }is less affected by such regions than PRIME_{ affine }. This follows the general tendency that terminal gaps reduce more significantly the accuracy of global alignment programs including Prrn, MUSCLE, POA, and ClustalW than that of MAFFT, ProbCons, and TCoffee that incorporate local alignment information in some ways. These observations indicate that PRlME_{ piecewise }deals with terminal gaps better than conventional global MSA programs, although not as well as those incorporating local alignment information.
Results of PREFAB benchmark test
The average quality scores of the three sets of PREFAB are shown in Table 7. The overall tendencies of relative performances and the Friedman tests of the main and long gap sets are nearly the same as those of BAliBASE. However, in the case of the weighting set, all programs except POA are comparable to each other. Because POA does not use sequence weights, 'biased subfamily composition' might adversely affect the performance of POA compared with the other programs.
Computation time
The computation time of each program for executing the benchmarks is compiled in Table 8. The computer we used is Pentium3 933 MHz with 1 GB memory, running on RedHat Linux 7.3. PRIME_{ piecewise }and PRIME_{ affine }are somewhat slower than most programs tested. The computational speed would be significantly improved by incorporating anchoring heuristics and refining source codes.
Discussions and Conclusion
The grouptogroup sequence alignment algorithm is the key to most heuristic MSA algorithms. Although many grouptogroup sequence alignment algorithms focus on positionspecific gap opening penalties [7, 8, 10, 12], they use essentially a constant gap extension penalty similar to that of the affine gap cost. For global MSA algorithms, use of the constant gap extension penalty could lead to deterioration of alignment accuracy when some of the sequences to be aligned have long indels. To our knowledge, POA version 2 [5] is the sole precedent that incorporates lengthdependent gap extension penalties into the grouptogroup sequence alignment algorithm. Examination of POA with various options indicated that lengthdependent gap extension penalties with global alignment strategy are effective to improve alignment accuracy when some of the sequences to be aligned have long indels (data not shown).
In this paper, we proposed a novel grouptogroup sequence alignment algorithm with the piecewise linear gap cost, and developed a program called PRIME. The advantage of using the piecewise linear gap cost is that this gap cost more accurately models the occurrence of long gap in a simple way than other gap cost does. As a result of BAliBASE benchmark test, PRIME achieved alignment accuracies comparable to the most accurate programs available today including LINSi of MAFFT, ProbCons, and TCoffee. Unlike others, PRIME does not rely on pairwise alignment information. This implies that the introduction of lengthdependent gap extension penalties could contribute to improving the alignment accuracy even when pairwise alignment information is not used.
It should be noted that our proposed algorithm has two inherent drawbacks. First, it is considerably slower than many popular algorithms. Second, selecting the parameters of the piecewise linear gap cost is somewhat more complicated than that of the affine gap cost. However, these drawbacks would not be serious enough to reduce the advantages of our proposed algorithm and PRIME. Unlike most popular algorithms, PRIME can circumvent the timeconsuming process for obtaining pairwise alignment information, and hence it is theoretically advantageous for aligning a large number of sequences. Our preliminary examination confirmed the expected dependency of computational time on the number of sequences to be aligned. However, the current version of PRIME is still slower than most of other programs over the examined range of the number of sequences (data not shown). One of the reasons is that the current PRIME does not use any heuristics, such as anchoring or grouping method used in Prrn, for reducing the computation. To improve calculation speed of PRIME without a loss of accuracy, we are attempting to incorporate these heuristics. To further improve alignment accuracy, we will investigate several problems including the conditions under which PRIME_{ affine }constructs more accurate alignment than PRIME_{ piecewise }, the potential of other objective functions, and the effect of incorporating pairwise alignment information.
Availability and Requirements
Project name: PRIME project
Project home page: http://prime.cbrc.jp/
Operating system(s): Platform independent
Programming language: C++
Licence: GNU GPL version 2 or later
Any restrictions to use by nonacademics: None
References
Gotoh O: Multiple sequence alignment: algorithms and applications. Adv Biophys 1999, 36: 159–206.
Notredame C: Recent progress in multiple sequence alignment: a survey. Pharmacogenomics 2002, 3: 131–144.
Gotoh O, Yamada S, Yada T: Multiple sequence alignment. In Handbook of computational molecular biology, Computer and Information Science Series. Edited by: Aluru S. Chapman & Hall/CRC; 2005:3–1–3–36.
Jiang T, Wang L: Algorithmic methods for multiple sequence alignment. In Current topics in computational molecular biology. Edited by: Jiang T, Xu Y, Zhang MQ. Tsinghua University Press; 2002.
Grasso C, Lee C: Combining partial order alignment and progressive multiple sequence alignment increases alignment speed and scalability to very large alignment problems. Bioinformatics 2004, 20: 1546–1556.
Notredame C, Higgins DG, Heringa J: TCoffee: A novel method for fast and accurate multiple sequence alignment. J Mol Biol 2000, 302: 205–217.
Thompson JD, Higgins DG, Gibson TJ: CLUSTAL W: improving the sensitivity of progressive multiple sequence alignment through sequence weighting, positionspecific gap penalties and weight matrix choice. Nucleic Acids Res 1994, 22: 4673–4680.
Edgar RC: MUSCLE: multiple sequence alignment with high accuracy and high throughput. Nucleic Acids Res 2004, 32: 1792–1797.
Gotoh O: Significant improvement in accuracy of multiple protein sequence alignments by iterative refinement as assessed by reference to structural alignments. J Mol Biol 1996, 264: 823–838.
Katoh K, Misawa K, Kuma K, Miyata T: MAFFT: a novel method for rapid multiple sequence alignment based on fast Fourier transform. Nucleic Acids Res 2002, 30: 3059–3066.
Kececioglu J, Starrett D: Aligning alignments exactly. In Proceedings of the Eighth Annual International Conference on Research in Computational Molecular Biology: 27–31 March 2004. Edited by: Bourne PE. San Diego, ACM; 2004:85–96.
Gotoh O: Optimal alignment between groups of sequences and its application to multiple sequence alignment. Comput Appl Biosci 1993, 9: 361–370.
McClure MA, Vasi TK, Fitch WM: Comparative analysis of multiple proteinsequence alignment methods. Mol Biol Evol 1994, 11: 571–592.
Thompson JD, Plewniak F, Poch O: A comprehensive comparison of multiple sequence alignment programs. Nucleic Acids Res 1999, 27: 2682–2690.
Katoh K, Kuma K, Toh H, Miyata T: MAFFT version 5: improvement in accuracy of multiple sequence alignment. Nucleic Acids Res 2005, 33: 511–518.
Do CB, Mahabhashyam MSP, Brudno M, Batzoglou S: ProbCons: Probabilistic consistencybased multiple sequence alignment. Genome Res 2005, 15: 330–340.
Miller W, Myers EW: Sequence comparison with concave weighting functions. Bull Math Biol 1988, 50: 97–120.
Gotoh O: Optimal sequence alignment allowing for long gaps. Bull Math Biol 1990, 52: 359–373.
Gotoh O: Further improvement in methods of grouptogroup sequence alignment with generalized profile operations. Comput Appl Biosci 1994, 10: 379–387.
Gotoh O: A weighting system and algorithm for aligning many phylogenetically related sequences. Comput Appl Biosci 1995, 11: 543–551.
Gotoh O: An improved algorithm for matching biological sequences. J Mol Biol 1982, 162: 705–708.
Bahr A, Thompson JD, Thierry JC, Poch O: BAliBASE (Benchmark Alignment dataBASE): enhancements for repeats, transmembrane sequences and circular permutations. Nucleic Acids Res 2001, 29: 323–326.
Thompson JD, Koehl P, Ripp R, Poch O: BAliBASE 3.0: Latest developments of the multiple sequence alignment benchmark. Proteins 2005, 61: 127–136.
PRIME[http://prime.cbrc.jp/]
Thompson JD, Plewniak F, Poch O: BAliBASE: a benchmark alignment database for the evaluation of multiple alignment programs. Bioinformatics 1999, 15: 87–88.
Karplus K, Hu B: Evaluation of protein multiple alignments by SAMT99 using the BAliBASE multiple alignment test set. Bioinformatics 2001, 17: 713–720.
O'Sullivan O, Suhre K, Abergel C, Higgins DG, Notredame C: 3DCoffee: combining protein sequences and structures within multiple sequence alignments. J Mol Biol 2004, 340: 385–395.
Subramanian AR, WeyerMenkhoff J, Kaufmann M, Morgenstern B: DIALIGNT: an improved algorithm for segmentbased multiple sequence alignment. BMC Bioinformatics 2005, 6: 66.
Acknowledgements
This work was partially supported by a GrantinAid for Scientific Research on Priority Areas (C) "Genome Information Science" from the Ministry of Education, Culture, Sports, Science and Technology of Japan; and by the Institute for Bioinformatics Research and Development (BIRD) of Japan Science and Technology Agency (JST).
Author information
Authors and Affiliations
Corresponding author
Additional information
Authors' contributions
SY devised the proposed algorithms, implemented PRIME, carried out the benchmark test and its evaluation, and drafted the manuscript. OG conceived of the study, devised the proposed algorithms, helped to implement PRIME, and drafted the manuscript. HY participated in the design and coordination of the study, and helped to implement PRIME. All authors read and approved the final manuscript.
Electronic supplementary material
12859_2006_1263_MOESM1_ESM.gz
Additional File 1: PRIME source code. This tar.gz archive includes the source files of PRIME. To compile PRIME, one can check 'INSTALL' and 'Makefile' in the archive. Although 'Makefile' basically assumes GNU make and g+ +, another compiler can be used with a few modification of 'Makefile'. (GZ 48 KB)
12859_2006_1263_MOESM2_ESM.pdf
Additional File 2: p values of the Friedman test of full length set. Each value is pvalue of the Friedman test, indicating the significance of a difference in performance between programs of a row and a column. The upper right and lower left pvalues are calculated using sumofpairs and column scores on all alignments of the whole full length set, respectively. PRIME_{ pcw }denotes PRIME_{ piecewise }, and PRIME_{ afn }, PRIME_{ affine }. The respective signs + and  denote that a program of a row performs significantly better and worse than that of a column. (PDF 32 KB)
12859_2006_1263_MOESM3_ESM.pdf
Additional File 3: p values of the Friedman test of homologous region set. Each value is pvalue of the Friedman test, indicating the significance of a difference in performance between programs of a row and a column. The upper right and lower left pvalues are calculated using sumofpairs and column scores on all alignments of the whole homologous region set, respectively. PRIME_{ pcw }denotes PRIME_{ piecewise }, and PRIME_{ afn }, PRIME_{ affine }. The respective signs + and  denote that a program of a row performs significantly better and worse than that of a column. (PDF 32 KB)
Authors’ original submitted files for images
Below are the links to the authors’ original submitted files for images.
Rights and permissions
This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
About this article
Cite this article
Yamada, S., Gotoh, O. & Yamana, H. Improvement in accuracy of multiple sequence alignment using novel grouptogroup sequence alignment algorithm with piecewise linear gap cost. BMC Bioinformatics 7, 524 (2006). https://doi.org/10.1186/147121057524
Received:
Accepted:
Published:
DOI: https://doi.org/10.1186/147121057524