-2

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))

  • We'd have to understand how to meaningfully add sub-sequences into a larger sequence. Can you explain how you plan to do it? Once you do the calculation of length appears to be simple. – duffymo May 12 '22 at 16:59

1 Answers1

0

I was able to get the mean of total length by summing each length of every sequence and dividing by the total of sequences.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 13 '22 at 06:33