A genome path consists of a sequence of $$k$$-mers $$p_0, \ldots, p_{n}$$ such that the last $$k - 1$$ symbols of $$k$$-mer $$p_i$$ are equal to the first $$k - 1$$ of $$k$$-mer $$p_{i + 1}$$ for $$i$$ from 0 to $$n - 1$$. Such a genome path corresponds to a string $$s$$ of length $$k + n$$ where the $$i$$-th $$k$$-mer in $$s$$ is equal to $$p_i$$ for all $$i$$.

Assignment

Write a function reconstruction that takes two arguments: i) the location of a FASTA file containing a genome path and iii) another file location. The function must write the string that corresponds to the given genome path to the FASTA file whose location is passed as the second argument.

Example

In the following interactive session, we assume the FASTA files data01.fna1 and output01.fna2 to be located in the current directory.

>>> reconstruction('data01.fna', 'output01.fna')
>>> print(open('output01.fna').read().rstrip())
>seq01
ACCGAAGCT