I'm writing a Python program and I have to do a pairwise alignment on several thousand DNA sequences. I looked at Biopython but I couldn't fine a function to do a pairwise alignment, this may be my mistake. The function should have gap penalty, gap open, gap extension and Smith Waterman or Needleman Wunsch. Can anyone tell me where I can find a good Python package for doing this kind of alignment?
You can use the Bio.Emboss python package for Needleman Wunsch alignment (It is essentially a wrapper around the program).
Here is a short example copied from my code base:
from Bio.Emboss.Applications import NeedleCommandline
from Bio import AlignIO
needle_cli = NeedleCommandline(asequence=seq_fname1, \
"""This generates the needle file"""
"""That parses the needle file, aln and aln contain the aligned
first and second sequence in the usual format (e.g. - for a gap)"""
aln = AlignIO.read(needle_file, "emboss")
https://pypi.python.org/pypi/alignment/1.0.9 may be of some help