码迷,mamicode.com
首页 > 其他好文 > 详细

求DNA序列中各个碱基的含量

时间:2017-01-11 14:01:06      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:osal   line   adl   简单   numbers   nbsp   lines   style   blog   

方法很简单,用count就可以了,

with open (rD:\Rosalind\rosalind_dna.txt,r) as f:
    for nucleotide in f.readlines():
        num_A = nucleotide.count("A")
        num_G = nucleotide.count("G")
        num_C = nucleotide.count("C")
        num_T = nucleotide.count("T")
        
print ("The numbers of ‘A‘ ====> " + str(num_A))
print ("The numbers of ‘G‘ ====> " + str(num_G))
print ("The numbers of ‘C‘ ====> " + str(num_C))
print ("The numbers of ‘T‘ ====> " + str(num_T))

 

求DNA序列中各个碱基的含量

标签:osal   line   adl   简单   numbers   nbsp   lines   style   blog   

原文地址:http://www.cnblogs.com/nklzj/p/6273181.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!