We say that pattern $$p$$ is a most frequent $$k$$-mer in string $$s$$ if it maximizes PatternCount($$s$$, $$p$$) among all $$k$$-mers. For example, ACTAT is a most frequent 5-mer in ACAACTATGCATCACTATCGGGAACTATCCT, and ATA is a most frequent 3-mer of CGATATATCCATAG.

Assignment

Write a function most_frequent_kmers that takes a DNA string $$s$$ and an integer $$k$$. The function must return the set of all most frequent $$k$$-mers in $$s$$.

Example

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

>>> most_frequent_kmers('ACAACTATGCATCACTATCGGGAACTATCCT', 5)
{'ACTAT'}
>>> most_frequent_kmers('CGATATATCCATAG', 3)
{'ATA'}

>>> from Bio import SeqIO
>>> most_frequent_kmers(*SeqIO.parse('data.fna', 'fasta'), 4)
{'CATG', 'GCAT'}