How to find amino acid composition using Biopython?
How to find amino acid composition using Biopython?
Bio.SeqUtils.ProtParam contains a method, count_amino_acids to do this for you.
However, it does it by iterating over a dictionary, exactly as Chris said: source code.
Since this is so elementary you won't need biopython for this. Create a dictionary which holds the 20 aminoacids as keys and iterate over each position in your sequence collection while raising the counter (the value of the specific aminoacid) by one when seeing the specific aa. Finally, divide each number by the aa total to get relative frequencies. Very easy.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
As it seems to be a homework, what did you try so far ?