# 读取fasta
# 解析每条序列的长度
chr_len = {‘chr1‘:10,‘chr2‘:20,‘chr3‘:30,‘chr4‘:40,‘chr5‘:15}
# 求和
total_len = sum(chr_len.values())
# 求最长染色体编号
max_chr =‘‘
max_len = 0
for [chr,len] in chr_len.items():
if len > max_len:
print(‘current chr > max chr‘)
max_chr = chr
max_len = len
elif len == max_len:
print(‘current chr == max chr‘)
else:
print(‘current chr < max chr‘)
# 输出结果
print(total_len)
print(max_len)
print(max_chr)
原文地址:https://www.cnblogs.com/caicai2019/p/10784047.html
时间: 2024-10-15 13:18:40