Building upon local alignments

We have thus far worked with local alignments with a linear gap penalty and global alignments with affine gap penalties (see "Local alignment with scoring matrix1" and "Global alignment with scoring matrix and affine gap penalty2").

It is only natural to take the intersection of these two problems and find an optimal local alignment given an affine gap penalty.

Assignment

Example

In the following interactive session, we assume the FASTA file data.faa3 to be located in the current directory.

>>> from Bio import SeqIO

>>> localAlignmentScore('PLEASANTLY', 'MEANLY')
12
>>> localAlignmentScore(*SeqIO.parse('data.faa', 'fasta'))
230

>>> localAlignment('PLEASANTLY', 'MEANLY')
('LEAS', 'MEAN')
>>> localAlignment(*SeqIO.parse('data.faa', 'fasta'))
('IGSWGACF-------IH-SFRNRG---CILY-----HIGY------SAIQCT-----AFFMGP-------YKDSLNN---------GISDTWD-----RMSRQY--TC--PAHKFG-------MF---AQEDG---FSNHG---HLVY----NSKL---QLDHQELT---IYMH-PC-HN---TFRNLNIIV-------ERFALIQNFNI---------KC-QGID-PN-YPHEA', 'IGSWGACSDKNFILQIHASFIRRGNQNCSIWLDYYCHIGYLGSDAASPIQCKWSTTIAFFMGKPQGSNIYYKDSLNECSNMSGILISVCDTWDMRMQSRAARQYYTECLGPAHKHDKAEFPGCMFICCAQEDYDYYFSNHGPIFHLVEYVLNQSKLHKRQLDHQEMSLTQIYMHFPCMHNDTYTFRNLRNVISIHVYDNERFALDLNFNICITINLVHVKCVQGIDHPNIYPHEA')