php-app开发接口加密的示例分析
274
2022-08-31
【Python小试】统计一条核酸序列中频数非0或为2的双核苷酸
概念
双核苷酸由任意2个碱基组成
测试1
dna = "AATGATGAACGAC"#一一列举dinucleotides = ['AA','AT','AG','AC', 'TA','TT','TG','TC', 'GA','GT','GG','GC', 'CA','CT','CG','CT']all_counts = {}for dinucleotide in dinucleotides: count = dna.count(dinucleotide) if count > 0: all_counts[dinucleotide] = countprint(all_counts)for dinucleotide in all_counts.keys(): if all_counts.get(dinucleotide, 0) == 2: print(dinucleotide)
测试2
dna = "AATGATGAACGAC"bases = ['A','T','G','C']all_counts = {}#循环生成for base1 in bases: for base2 in bases: dinucleotide = base1 + base2 count = dna.count(dinucleotide) if count > 0: all_counts[dinucleotide] = countprint(all_counts)for dinucleotide in all_counts.keys(): if all_counts.get(dinucleotide, 0) == 2: print(dinucleotide)
结果
AA AT AC TG
作者:Bioinfarmer
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~