首页 > 其他 > 详细

002 生信基础题

时间:2017-07-28 13:07:53      阅读:154      评论:0      收藏:0      [点我收藏+]

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.‘

  

002 生信基础题

原文:http://www.cnblogs.com/think-and-do/p/7249648.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!