求DNA序列中各个碱基的含量
Posted Bio-Liu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了求DNA序列中各个碱基的含量相关的知识,希望对你有一定的参考价值。
方法很简单,用count就可以了,
with open (r‘D:\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序列中各个碱基的含量的主要内容,如果未能解决你的问题,请参考以下文章