Frequency of each residue type in an alignment.

    Alignment is a MultipleSeqAlignment or iterable of SeqRecords.

def aa_frequencies(aln, weights=None, gap_chars='-.'):
    """Frequency of each residue type in an alignment.

    Alignment is a MultipleSeqAlignment or iterable of SeqRecords.
    """
    counts = aa_counts(aln, weights, gap_chars)
    # Reduce to frequencies
    scale = 1.0 / sum(counts.values())
    return dict((aa, cnt * scale) for aa, cnt in counts.iteritems())