def faster_frequent_words(text, k): frequent_patterns = set() frequency_array = computing_frequencies(text, k) max_count = max(frequency_array) for pattern, count in frequency_array.iteritems(): if count == max_count: frequent_patterns.add(pattern)
def faster_frequent_words(text, k): frequent_patterns = [] frequency_array = cf.computing_frequencies(text,k) max_count = max(frequency_array) for i in range(0,4**k): if frequency_array[i] == max_count: pattern = cf.number_to_pattern(i,k) if pattern not in frequent_patterns: frequent_patterns.append(pattern) return frequent_patterns
def clump_finding(genome, k, t, L): frequent_patterns = [] clump = [0] * (4**k) for i in range(0,len(genome)-L+1): text = genome[i:i+L] frequency_array = cf.computing_frequencies(text,k) for index in range(0,4**k): if frequency_array[index] >= t: clump[index] = 1 for i in range(0,4**k): if clump[i] == 1: pattern = number_to_pattern(i, k) frequent_patterns.append(pattern) return frequent_patterns