You may want to align sequences with Biopython, and after reading its tutorial ( http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc87 ), you will try
>>> from Bio import Align
>>> aligner = Align.PairwiseAligner()
only to encounter
AttributeError: module 'Bio.Align' has no attribute 'PairwiseAligner'
You have to refer to a subsection of the tutorial ( http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc86 ) just before the section above. For example, if you want to emulate blastn command of NCBI BLAST+ with default settings (match: +2, mismatch: -1, gapopen: -5, gapextend: -2, according to Table C2 of BLAST User Manual ( https://www.ncbi.nlm.nih.gov/books/NBK279684/ )),
from Bio import pairwise2
from Bio.pairwise2 import format_alignment
def pairwise_wrapper(seq1, seq2):
return int(pairwise2.align.globalms(seq1, seq2, 2, -1, -5, -2, score_only=True))
this will be the wrapper function which you can call just by giving a pair of sequences. You can remove score_only=True
parameter to get the alignment itself in addition to alignment score.