计算氨基酸序列的平均
我有此代码用于使用Biopython计算FastA格式的序列。我得到了lenghts。
NP_418305.1
349
np_418306.1
469
np_418308.1
236
但是,现在我想计算整个序列的平均值,就像我可以添加到研究中的相互关系的事实一样。获得一些建议会很棒。
from Bio import SeqIO
record_dict = seqio.to_dict(seqio.parse(“ aminoacids.txt”,“ fasta”))
in Record_dict.items():
print(键) [0],“ \ n”,len(key [1] .seq))
I have this code for calculating the length of sequences in fasta format using BioPython. I got the lenghts.
NP_418305.1
349
NP_418306.1
469
NP_418308.1
236
However, now I'd like to calcule the mean of the whole sequences, just like an intereting fact that I can add to my research. Will be great to get some advices.
from Bio import SeqIO
record_dict = SeqIO.to_dict(SeqIO.parse("aminoacids.txt", "fasta"))
for key in record_dict.items():
print(key[0],"\n ",len(key[1].seq))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我能够通过将每个序列的每个长度求和除以序列的总长度来获得总长度的平均值。
I was able to get the mean of total length by summing each length of every sequence and dividing by the total of sequences.