Optimal sequence alignment using affine gap costs


When comparing two biological sequences, it is often desirable for a gap to be assigned a cost not directly proportional to its length. If affine gap costs are employed, in other words if opening a gap costsv and each null in the gap costsu, the algorithm of Gotoh (1982,J. molec. Biol. 162, 705) finds the minimum cost of aligning two sequences in orderMN steps. Gotoh's algorithm attempts to find only one from among possibly many optimal (minimum-cost) alignments, but does not always succeed. This paper provides an example for which this part of Gotoh's algorithm fails and describes an algorithm that finds all and only the optimal alignments. This modification of Gotoh's algorithm still requires orderMN steps. A more precise form of path graph than previously used is needed to represent accurately all optimal alignments for affine gap costs.

This is a preview of subscription content, log in to check access.


  1. Altschul, S. F. and B. W. Erickson. 1986. “A Nonlinear Measure of Subalignment Similarity and its Significance Levels.”Bull. math. Biol. 48, 617–632.

    MATH  MathSciNet  Article  Google Scholar 

  2. Erickson, B. W. and P. H. Sellers. 1983. “Recognition of Patterns in Genetic Sequences.” InTime Warps, String Edits, and Macromolecules: The Theory and Practice of Sequence Comparison, D. Sankoff and J. B. Kruskal (Eds), pp. 55–91. Reading, MA: Addison-Wesley.

    Google Scholar 

  3. Fitch, W. M. and T. F. Smith. 1983. “Optimal Sequence Alignments.”Proc. natn. Acad. Sci. U.S.A. 80, 1382–1386.

    Article  Google Scholar 

  4. Gotoh, O. 1982. “An Improved Algorithm for Matching Biological Sequences.”J. molec. Biol. 162, 705–708.

    Article  Google Scholar 

  5. Needleman, S. B. and C. D. Wunsch. 1970. “A General Method Applicable to the Search for Similarities in the Amino Acid Sequences of Two Proteins.”J. molec. Biol. 48, 443–453.

    Article  Google Scholar 

  6. Schwartz, R. M. and M. O. Dayhoff. 1978. “Matrices for Detecting Distant Relationships.” InAtlas of Protein Sequence and Structure, Vol. 5, Suppl. 3, M. O. Dayhoff (Ed.), pp. 345–358. Washington, DC: National Biomedical Research Foundation.

    Google Scholar 

  7. Sellers, P. H. 1974. “On the Theory and Computation of Evolutionary Distances.”SIAM J. appl. Math. 26, 787–793.

    MATH  MathSciNet  Article  Google Scholar 

  8. Smith, T. F., M. S. Waterman and W. M. Fitch. 1981. “Comparative Biosequence Metrics.”J. molec. Evol. 18, 38–46.

    Article  Google Scholar 

  9. Taniguchi, T. H. Matsui, T. Fujita, C. Takaoka, N. Kashima, R. Yoshimoto and J. Hamuro. 1983. “Structure and Expression of a Cloned cDNA for Human Interleukin-2.”Nature 302, 305–310.

    Article  Google Scholar 

  10. Taylor, P. 1984. “A Fast Homology Program for Aligning Biological Sequences.”Nucl. Acids Res. 12, 447–455.

    Google Scholar 

  11. Waterman, M. S. 1984. “Efficient Sequence Alignment Algorithms.”J. theor. Biol. 108, 333–337.

    MathSciNet  Google Scholar 

  12. —, T. F. Smith and W. A. Beyer. 1976. “Some Biological Sequence Metrics.”Adv. Math. 20, 367–387.

    MATH  MathSciNet  Article  Google Scholar 

  13. Ukkonen, E. 1983. “On Approximate String Matching.”Proc. Int. Conference on the Foundations of Computer Theory, Lecture Notes in Computer Science, Vol. 158, pp. 487–496. Berlin: Springer-Verlag.

    Google Scholar 

  14. Yokota, T., N. Arai, F. Lee, D. Rennick, T. Mosmann and K. Arai. 1985. “Use of a cDNA Expression Vector for Isolation of Mouse Interleukin 2 cDNA Clones: Expression of T-Cell Growth Factor Activity After Transfection of Monkey Cells.”Proc. natn. Acad. Sci. U.S.A. 82, 68–72.

    Article  Google Scholar 

Download references

Author information



Rights and permissions

Reprints and Permissions

About this article

Cite this article

Altschul, S.F., Erickson, B.W. Optimal sequence alignment using affine gap costs. Bltn Mathcal Biology 48, 603–616 (1986). https://doi.org/10.1007/BF02462326

Download citation


  • Optimal Path
  • Vertical Edge
  • Optimal Alignment
  • Horizontal Edge
  • Cost Assignment