Apparently, the program has some instructions forcing it to limit the number of gaps and their position in the sequence. That instruction is called the "gap penalty". Each time the program introduces a gap, it triggers a penalty score, which may decrease or increase the total score of the alignment. Gaps are introduced only if they substantially increase the total score of the alignment. By this simple rule, we can limit the number of gaps and increase their significance. The gap penalty is a parameter that can be changed each time an alignment is run. By increasing or reducing the value of the gap penalties, the total number of gaps, their length, and their position in the sequence alignment may be controlled.
The expression for calculating the alignment score can be modified accordingly to include gap penalties:(score) S= Σ of costs (identities, replacements) - Σ of penalties (number of gaps x gap penalties)
The numbers required for the left-hand side of the equation, where we count the score generated by identities and similarities, are presented as a 20 x 20 matrix. This matrix is called a substitution matrix
. The details are discussed on the next page