Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Needleman–Wunsch algorithm
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Filling in the table=== Start with a zero in the first row, first column (not including the cells containing nucleotides). Move through the cells row by row, calculating the score for each cell. The score is calculated by comparing the scores of the cells neighboring to the left, top or top-left (diagonal) of the cell and adding the appropriate score for match, mismatch or indel. Take the maximum of the candidate scores for each of the three possibilities: * The path from the top or left cell represents an indel pairing, so take the scores of the left and the top cell, and add the score for indel to each of them. * The diagonal path represents a match/mismatch, so take the score of the top-left diagonal cell and add the score for match if the corresponding bases (letters) in the row and column are matching or the score for mismatch if they do not. The resulting score for the cell is the highest of the three candidate scores. Given there is no 'top' or 'top-left' cells for the first row only the existing cell to the left can be used to calculate the score of each cell. Hence −1 is added for each shift to the right as this represents an indel from the previous score. This results in the first row being 0, −1, −2, −3, −4, −5, −6, −7. The same applies to the first column as only the existing score above each cell can be used. Thus the resulting table is: {| class="wikitable" |- !| || || G || C || A || T || G || C || G |- ! scope="row" | | 0 || −1 || −2 || −3 || −4 || −5 || −6 || −7 |- ! scope="row" | G | −1 || || || || || || || |- ! scope="row" | A | −2 || || || || || || || |- ! scope="row" | T | −3 || || || || || || || |- ! scope="row" | T | −4 || || || || || || || |- ! scope="row" | A | −5 || || || || || || || |- ! scope="row" | C | −6 || || || || || || || |- ! scope="row" | A | −7 || || || || || || || |} The first case with existing scores in all 3 directions is the intersection of our first letters (in this case G and G). The surrounding cells are below: {| class="wikitable" |- !| || || G |- ! scope="row" | | 0 || −1 |- ! scope="row" | G | −1 || '''X''' |} This cell has three possible candidate sums: * The diagonal top-left neighbor has score 0. The pairing of G and G is a match, so add the score for match: 0+1 = 1 * The top neighbor has score −1 and moving from there represents an indel, so add the score for indel: (−1) + (−1) = (−2) * The left neighbor also has score −1, represents an indel and also produces (−2). The highest candidate is 1 and is entered into the cell: {| class="wikitable" |- !| || || G |- ! scope="row" | | 0 || −1 |- ! scope="row" | G | −1 || '''1''' |} The cell which gave the highest candidate score must also be recorded. In the completed diagram in figure 1 above, this is represented as an arrow from the cell in row and column 2 to the cell in row and column 1. In the next example, the diagonal step for both X and Y represents a mismatch: {| class="wikitable" |- !| || || G || C |- ! scope="row" | | 0 || −1 || −2 |- ! scope="row" | G | −1 || 1 || '''X''' |- ! scope="row" | A | −2 || '''Y''' || |} X: * Top: (−2)+(−1) = (−3) * Left: (+1)+(−1) = (0) * Top-Left: (−1)+(−1) = (−2) Y: * Top: (1)+(−1) = (0) * Left: (−2)+(−1) = (−3) * Top-Left: (−1)+(−1) = (−2) For both X and Y, the highest score is zero: {| class="wikitable" |- !| || || G || C |- ! scope="row" | | 0 || −1 || −2 |- ! scope="row" | G | −1 || 1 || '''0''' |- ! scope="row" | A | −2 || '''0''' || |} The highest candidate score may be reached by two of the neighboring cells: {| class="wikitable" |- !| || T || G |- ! scope="row" | T | 1 || 1 |- ! scope="row" | A | 0 || '''X''' |} * Top: (1)+(−1) = (0) * Top-Left: (1)+(−1) = (0) * Left: (0)+(−1) = (−1) In this case, all directions reaching the highest candidate score must be noted as possible origin cells in the finished diagram in figure 1, e.g. in the cell in row and column 6. Filling in the table in this manner gives the scores of all possible alignment candidates, the score in the cell on the bottom right represents the alignment score for the best alignment.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)