01 ‘GATCCAGATCCCCATAC‘, 计算这串数列中两个出现最高的频率。
t = ‘GATCCAGATCCCCATAC‘ L = [ ] for i in range(len(t)-1): L.append(t[i:i+2]) x = reduce(lambda x,y: x if L.count(x)>L.count(y) else y, L) # reduce(function, iterable[, initializer]) print x, ‘appeared‘, L.count(x), ‘times! It is the most frequent 2-mer.‘
时间: 2024-11-06 11:49:02