bioin.frequent_words

bioin.frequent_words(text, k)[source]

Find all the most frequent k-mers in text. Depend on function frequency_map.

Parameters:
  • text (str) – text.
  • k (int) – length of the substring (i.e. kmers).
Returns:

List, a list that contains all the most frequent k-mers in text.

Examples

Compare the frequency map of all the k-mers (given string (i.e. text) and integer (i.e. k)), then return a list of the most frequent k-mers.

>>> text = "ACGTTGCATGTCGCATGATGCATGAGAGCT"
>>> k = 4
>>> kmers_list = frequency_map(text, k)
>>> kmers_list
    ["CATG", "GCAT"]