WARNING

This implementation of the Needleman-Wunsch sequence alignment algorithm is severely limited. (For example, all calculations are done with integers, which makes gap penalties useless.) It is intended to show how the algorithm works and can be used on short sequences; however it is not useful for serious sequence alignment.

Needleman-Wunsch sequence alignment program

Source

align.c
The alignment functions. This implementation takes two strings, a gap opening penalty (must be an integer), a gap extension penalty factor (also an integer) and aligns them without any substitution matrix (using only integer calculation for gap penalties). It returns the aligned strings.
align.h
Header file to include in any module which uses routines in align.c (such as NWalign.c): specifies interface to sequence alignment implementation.
NWalign.c
A quick interface to the sequence alignment routines: NWalign takes the names of two files containing alphabetic sequences, along with gap opening and extension penalties; it calls the alignment function in align.c to do the alignment; then it prints the alignment to stdout.
Makefile
A makefile for compiling NWalign on UNIX platforms. Replace the value of the CC variable on the first line with the name (and path, if necessary) of your c compiler if it other than cc.

Binaries

NWalign.exe
DOS (16-bit) executable.
NWalign32.exe
Win32 console mode executable: requires Windows 95 or Windows NT. This executable will provide better performance in NT than the DOS version; however it has mysterious problems with certain combinations of gap opening and extension penalties.

Sample Sequences

The following two files contain short sequences with some similarity.