<p>Your alignment is </p>

<p><code>
SDRVIKAAIFDPIQPDF---G-----PVYFGLGHVH
RDLVERLFILDMI-PGLIKAGDSFPIPVALMINHIF
</code></p>

<p>For each position in the alignment you calculate the score for that alignment. For position 1 we'd look up S vs R in the matrix and find a score of -1. You continue doing this until you hit the first -, which is not in the matrix. The first - is a gapopening, each consequent - in a series of -'s counts as a gap extension, instead of an opening.</p>

<p><code>---G--
IKAGDS
</code>
gives
<code>-12 -2 -2 6 -12 -2</code></p>

CC BY-SA 4.0
2019-11-11T10:53:48.190Z
The problem with the example is a gap penalty of 12 and 2 means the position of G is critical to the output, regardless of its location as a biological homologue. If G is at the beginning or end of the indel the score drops considerably, ie only a single gap opening penalty.
M__
CC BY-SA 4.0
2019-11-11T11:05:57.233Z
That is a matter of alignment score maximisation, the author's question regards calculating the score of the given alignment with the given BLOSUM matrix, and how to incorporate the gap penalties into this.
Pallie
CC BY-SA 4.0
2020-12-05T21:14:45.243Z
SDRVIKAAIFDPIQPDF---G-----PVY------FGLGHVH
RDLVERLFILDMI-PGLIKAGDSFPIPVALMINHIF------ has one uguagliance more
RosLuP
CC BY-SA 4.0
2019-11-11T08:44:32.010Z
2019-11-11T08:44:32.010Z
Pallie
<p>I have a bioinformatics exam coming up. I can understand the difference between the global algorithm and the local algorithm, but I have a problem with gap opening penalty and gap extension penalty. What is the difference between gap opening penalty and gap extension? </p>

<p>Can anybody help me in working out how to use the gap opening penalty and gap extension penalty for blosum62?</p>

<p>There are a lot of questions like the one below:</p>

<p><em>Compute the score of the following sequence alignment given the BLOSUM62 matrix below and gap opening penalty (GOP) = 12, and gap extension penalty (GEP) = 2.</em></p>

<pre><code>SDRVIKAAIFDPIQPDF---G-----PVYFGLGHVH
RDLVERLFILDMI-PGLIKAGDSFPIPVALMINHIF

   A  R  N  D  C  Q  E  G  H  I  L  K  M  F  P  S  T  W  Y  V
A  4 -1 -2 -2  0 -1 -1  0 -2 -1 -1 -1 -1 -2 -1  1  0 -3 -2  0
R -1  5  0 -2 -3  1  0 -2  0 -3 -2  2 -1 -3 -2 -1 -1 -3 -2 -3
N -2  0  6  1 -3  0  0  0  1 -3 -3  0 -2 -3 -2  1  0 -4 -2 -3
D -2 -2  1  6 -3  0  2 -1 -1 -3 -4 -1 -3 -3 -1  0 -1 -4 -3 -3
C  0 -3 -3 -3  9 -3 -4 -3 -3 -1 -1 -3 -1 -2 -3 -1 -1 -2 -2 -1
Q -1  1  0  0 -3  5  2 -2  0 -3 -2  1  0 -3 -1  0 -1 -2 -1 -2
E -1  0  0  2 -4  2  5 -2  0 -3 -3  1 -2 -3 -1  0 -1 -3 -2 -2
G  0 -2  0 -1 -3 -2 -2  6 -2 -4 -4 -2 -3 -3 -2  0 -2 -2 -3 -3
H -2  0  1 -1 -3  0  0 -2  8 -3 -3 -1 -2 -1 -2 -1 -2 -2  2 -3
I -1 -3 -3 -3 -1 -3 -3 -4 -3  4  2 -3  1  0 -3 -2 -1 -3 -1  3
L -1 -2 -3 -4 -1 -2 -3 -4 -3  2  4 -2  2  0 -3 -2 -1 -2 -1  1
K -1  2  0 -1 -3  1  1 -2 -1 -3 -2  5 -1 -3 -1  0 -1 -3 -2 -2
M -1 -1 -2 -3 -1  0 -2 -3 -2  1  2 -1  5  0 -2 -1 -1 -1 -1  1
F -2 -3 -3 -3 -2 -3 -3 -3 -1  0  0 -3  0  6 -4 -2 -2  1  3 -1
P -1 -2 -2 -1 -3 -1 -1 -2 -2 -3 -3 -1 -2 -4  7 -1 -1 -4 -3 -2
S  1 -1  1  0 -1  0  0  0 -1 -2 -2  0 -1 -2 -1  4  1 -3 -2 -2
T  0 -1  0 -1 -1 -1 -1 -2 -2 -1 -1 -1 -1 -2 -1  1  5 -2 -2  0
W -3 -3 -4 -4 -2 -2 -3 -2 -2 -3 -2 -3 -1  1 -4 -3 -2 11  2 -3
Y -2 -2 -2 -3 -2 -1 -2 -3  2 -1 -1 -2 -1  3 -3 -2 -2  2  7 -1
V  0 -3 -3 -3 -1 -2 -2 -3 -3  3  1 -2  1 -1 -2 -2  0 -3 -1  4
</code></pre>

CC BY-SA 4.0
2019-11-08T21:49:32.137Z
so could you help me please about solution?
Imren Bayil
CC BY-SA 4.0
2019-11-09T03:02:45.790Z
The lower matrix is the blosom62. The two sequences are the pairwise alignment... easy. The gap penalties are described by here... https://en.m.wikipedia.org/wiki/Gap_penalty ... I don't have code for this and I'm not a fan of optical analysis, so I'm not going to add up the numbers
M__
CC BY-SA 4.0
2020-12-05T21:18:39.187Z
my function align not using matrix... i have implemented one algo that can fail...possible it is better one good eye too
RosLuP
<phylogenetics><homework>
how to calculate Pairwise Alignment Scores for blosum62
# how to calculate Pairwise Alignment Scores for blosum62

(Asked by: username_0 on 2019-11-08)

I have a bioinformatics exam coming up. I can understand the difference between the global algorithm and the local algorithm, but I have a problem with gap opening penalty and gap extension penalty. What is the difference between gap opening penalty and gap extension? 
Can anybody help me in working out how to use the gap opening penalty and gap extension penalty for blosum62?
There are a lot of questions like the one below:
Compute the score of the following sequence alignment given the BLOSUM62 matrix below and gap opening penalty (GOP) = 12, and gap extension penalty (GEP) = 2.
SDRVIKAAIFDPIQPDF---G-----PVYFGLGHVH
RDLVERLFILDMI-PGLIKAGDSFPIPVALMINHIF

   A  R  N  D  C  Q  E  G  H  I  L  K  M  F  P  S  T  W  Y  V
A  4 -1 -2 -2  0 -1 -1  0 -2 -1 -1 -1 -1 -2 -1  1  0 -3 -2  0
R -1  5  0 -2 -3  1  0 -2  0 -3 -2  2 -1 -3 -2 -1 -1 -3 -2 -3
N -2  0  6  1 -3  0  0  0  1 -3 -3  0 -2 -3 -2  1  0 -4 -2 -3
D -2 -2  1  6 -3  0  2 -1 -1 -3 -4 -1 -3 -3 -1  0 -1 -4 -3 -3
C  0 -3 -3 -3  9 -3 -4 -3 -3 -1 -1 -3 -1 -2 -3 -1 -1 -2 -2 -1
Q -1  1  0  0 -3  5  2 -2  0 -3 -2  1  0 -3 -1  0 -1 -2 -1 -2
E -1  0  0  2 -4  2  5 -2  0 -3 -3  1 -2 -3 -1  0 -1 -3 -2 -2
G  0 -2  0 -1 -3 -2 -2  6 -2 -4 -4 -2 -3 -3 -2  0 -2 -2 -3 -3
H -2  0  1 -1 -3  0  0 -2  8 -3 -3 -1 -2 -1 -2 -1 -2 -2  2 -3
I -1 -3 -3 -3 -1 -3 -3 -4 -3  4  2 -3  1  0 -3 -2 -1 -3 -1  3
L -1 -2 -3 -4 -1 -2 -3 -4 -3  2  4 -2  2  0 -3 -2 -1 -2 -1  1
K -1  2  0 -1 -3  1  1 -2 -1 -3 -2  5 -1 -3 -1  0 -1 -3 -2 -2
M -1 -1 -2 -3 -1  0 -2 -3 -2  1  2 -1  5  0 -2 -1 -1 -1 -1  1
F -2 -3 -3 -3 -2 -3 -3 -3 -1  0  0 -3  0  6 -4 -2 -2  1  3 -1
P -1 -2 -2 -1 -3 -1 -1 -2 -2 -3 -3 -1 -2 -4  7 -1 -1 -4 -3 -2
S  1 -1  1  0 -1  0  0  0 -1 -2 -2  0 -1 -2 -1  4  1 -3 -2 -2
T  0 -1  0 -1 -1 -1 -1 -2 -2 -1 -1 -1 -1 -2 -1  1  5 -2 -2  0
W -3 -3 -4 -4 -2 -2 -3 -2 -2 -3 -2 -3 -1  1 -4 -3 -2 11  2 -3
Y -2 -2 -2 -3 -2 -1 -2 -3  2 -1 -1 -2 -1  3 -3 -2 -2  2  7 -1
V  0 -3 -3 -3 -1 -2 -2 -3 -3  3  1 -2  1 -1 -2 -2  0 -3 -1  4

**Tags:** phylogenetics, homework
> **Comments:**
> **username_0**: so could you help me please about solution?  
> **username_1**: The lower matrix is the blosom62. The two sequences are the pairwise alignment... easy. The gap penalties are described by here... https://en.m.wikipedia.org/wiki/Gap_penalty ... I don't have code for this and I'm not a fan of optical analysis, so I'm not going to add up the numbers  
> **username_2**: my function align not using matrix... i have implemented one algo that can fail...possible it is better one good eye too  

---

## 1 answers

### Answer by username_3 on 2019-11-11. Score: 1

Your alignment is

`SDRVIKAAIFDPIQPDF---G-----PVYFGLGHVH
RDLVERLFILDMI-PGLIKAGDSFPIPVALMINHIF`

For each position in the alignment you calculate the score for that alignment. For position 1 we'd look up S vs R in the matrix and find a score of -1. You continue doing this until you hit the first -, which is not in the matrix. The first - is a gapopening, each consequent - in a series of -'s counts as a gap extension, instead of an opening.

`---G--
IKAGDS`
gives
`-12 -2 -2 6 -12 -2`

> **Comments:**
> **username_1**: The problem with the example is a gap penalty of 12 and 2 means the position of G is critical to the output, regardless of its location as a biological homologue. If G is at the beginning or end of the indel the score drops considerably, ie only a single gap opening penalty.  
> **username_3**: That is a matter of alignment score maximisation, the author's question regards calculating the score of the given alignment with the given BLOSUM matrix, and how to incorporate the gap penalties into this.  
> **username_2**: SDRVIKAAIFDPIQPDF---G-----PVY------FGLGHVH RDLVERLFILDMI-PGLIKAGDSFPIPVALMINHIF------ has one uguagliance more  

---

