Find a middle edge in the global alignment graph in linear space.

Assignment

Write a function middle_edge that takes the location of a FASTA file containing two amino acid sequences $$v$$ and $$w$$. The function must return a middle edge in the global alignment graph of $$v$$ and $$w$$, where the optimal path is defined by the BLOSUM62 scoring matrix and a linear indel penalty equal to 5. The middle edge must be returned as a tuple $$((i, j), (k, l))$$, where $$(i, j)$$ connects to $$(k, l)$$. If there exist multiple middle edges, the function may return any one.

Example

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

>>> middle_edge('data01.faa')
((4, 2), (5, 3))

Resources