Interactive demo for Needleman-Wunsch algorithm for simple scoring functions

This was adapted from https://github.com/drdrsh/Needleman-Wunsch by Chris Lockhart for GMU course BINF 401. It solves Needleman-Wunsch for simple scoring functions.

See also:

Algorithm:
  1. Create a table, and write one sequence along the column and another along the rows with one extra row or column at the beginning
  2. Initialize the first row or column with increasing gap penalities
  3. Begin scoring. You can score any cell if the cells diagonal, upper, and left of it have values. You evaluate three scores: (i) The diagonal score plus the match/mismatch score, (ii) the upper score plus the gap penalty, and (iii) the left score plus the gap penalty. You take whichever score is greatest, and make a note if that score came from the diagonal, upper, or left cell.
  4. Perform traceback. Start from the bottom right cell, and work your way backward following the indications where the scores came from. A diagonal move indicates that you accept the letter in the two sequences, a vertical move indicates that you insert a gap into the sequence along the columns and take the letter from the sequence along the rows, and a horizontal move indicates that you insert a gap into the sequence along the rows and take the letter from the sequence along the columns.
Demo: