def col_frequencies ( col , weights = None , gap_chars = '-.' ) : counts = col_counts ( col , weights , gap_chars ) # Reduce to frequencies scale = 1.0 / sum ( counts . values ( ) ) return dict ( ( aa , cnt * scale ) for aa , cnt in counts . iteritems ( ) )
get frequencies for column in python
Frequencies of each residue type ( totaling 1 . 0 ) in a single column .
def col_frequencies(col, weights=None, gap_chars='-.'):
    """Frequencies of each residue type (totaling 1.0) in a single column."""
    counts = col_counts(col, weights, gap_chars)
    # Reduce to frequencies
    scale = 1.0 / sum(counts.values())
    return dict((aa, cnt * scale) for aa, cnt in counts.iteritems())