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

def Bio::Align::AlignInfo::SummaryInfo::_get_letter_freqs (   self,
  residue_num,
  all_records,
  letters,
  to_ignore 
) [private]

Determine the frequency of specific letters in the alignment.

Arguments:
o residue_num - The number of the column we are getting frequencies
from.
o all_records - All of the SeqRecords in the alignment.
o letters - The letters we are interested in getting the frequency
for.
o to_ignore - Letters we are specifically supposed to ignore.

This will calculate the frequencies of each of the specified letters
in the alignment at the given frequency, and return this as a
dictionary where the keys are the letters and the values are the
frequencies.

Definition at line 482 of file AlignInfo.py.

00482                                                                              :
        """Determine the frequency of specific letters in the alignment.

        Arguments:
        o residue_num - The number of the column we are getting frequencies
        from.
        o all_records - All of the SeqRecords in the alignment.
        o letters - The letters we are interested in getting the frequency
        for.
        o to_ignore - Letters we are specifically supposed to ignore.

        This will calculate the frequencies of each of the specified letters
        in the alignment at the given frequency, and return this as a
        dictionary where the keys are the letters and the values are the
        frequencies.
        """
        freq_info = self._get_base_letters(letters)

        total_count = 0
        # collect the count info into the dictionary for all the records
        for record in all_records:
            try:
                if record.seq[residue_num] not in to_ignore:
                    freq_info[record.seq[residue_num]] = \
                      freq_info[record.seq[residue_num]] + \
                      record.annotations['weight']

                    total_count = total_count + record.annotations['weight']
            # getting a key error means we've got a problem with the alphabet 
            except KeyError:
                raise ValueError("Residue %s not found in alphabet %s"
                                 % (record.seq[residue_num],
                                    self.alignment._alphabet))

        # now convert the counts into frequencies
        for letter in freq_info.keys():
            freq_info[letter] = freq_info[letter] / total_count

        return freq_info
            
    def _get_column_info_content(self, obs_freq, e_freq_table, log_base,


Generated by  Doxygen 1.6.0   Back to index