Logo Search packages:      
Sourcecode: python-biopython version File versions

def Bio::Align::AlignInfo::SummaryInfo::_get_column_info_content (   self,
  obs_freq,
  e_freq_table,
  log_base,
  random_expected 
) [private]

Calculate the information content for a column.

Arguments:
o obs_freq - The frequencies observed for each letter in the column.
o e_freq_table - An optional argument specifying the expected
frequencies for each letter. This is a SubsMat.FreqTable instance.
o log_base - The base of the logathrim to use in calculating the
info content.

Definition at line 522 of file AlignInfo.py.

                                                 :
        """Calculate the information content for a column.

        Arguments:
        o obs_freq - The frequencies observed for each letter in the column.
        o e_freq_table - An optional argument specifying the expected
        frequencies for each letter. This is a SubsMat.FreqTable instance.
        o log_base - The base of the logathrim to use in calculating the
        info content.
        """
        if e_freq_table:
            # check the expected freq information to make sure it is good
            for key in obs_freq.keys():
                if (key != self.alignment._alphabet.gap_char and
                    key not in e_freq_table):
                    raise ValueError("Expected frequency letters %s" +
                                     " do not match observed %s"
                           % (e_freq_table.keys(), obs_freq.keys() -
                              [self.alignment._alphabet.gap_char]))
        
        total_info = 0

        for letter in obs_freq.keys():
            inner_log = 0.
            # if we have expected frequencies, modify the log value by them
            # gap characters do not have expected frequencies, so they
            # should just be the observed frequency.
            if letter != self.alignment._alphabet.gap_char:
                if e_freq_table:
                    inner_log = obs_freq[letter] / e_freq_table[letter]
                else:
                    inner_log = obs_freq[letter] / random_expected
            # if the observed frequency is zero, we don't add any info to the
            # total information content
            if inner_log > 0:
                letter_info = (obs_freq[letter] * 
                               math.log(inner_log) / math.log(log_base))
                total_info = total_info + letter_info
        return total_info 

    def get_column(self,col):


Generated by  Doxygen 1.6.0   Back to index