Chinaunix首页 | 论坛 | 博客
  • 博客访问: 367025
  • 博文数量: 97
  • 博客积分: 2846
  • 博客等级: 少校
  • 技术积分: 1000
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-19 20:00
文章分类

全部博文(97)

文章存档

2017年(1)

2013年(2)

2012年(6)

2011年(17)

2010年(12)

2009年(41)

2007年(18)

我的朋友

分类: Python/Ruby

2009-04-05 20:05:45

import string

def Compute_GC (seq):
    GC = 0
    total =0
    for i in range(0, len(seq)):
        if string.upper(seq[i]) in ['A','T','G','C']:
            total = total +1
        if string.upper(seq[i]) in ['G', 'C']:
            GC = GC+1
    return float(GC)/total*100

seq = 'atcgAATTTCCGGGGTTAATCAGNNNtgGT'
print 'GC percent of %s %2.2f%%' % (seq,Compute_GC(seq))

阅读(4657) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~