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

def Bio::Align::AlignInfo::SummaryInfo::_pair_replacement (   self,
  seq1,
  seq2,
  weight1,
  weight2,
  start_dict,
  ignore_chars 
) [private]

Compare two sequences and generate info on the replacements seen.

Arguments:
o seq1, seq2 - The two sequences to compare.
o weight1, weight2 - The relative weights of seq1 and seq2.
o start_dict - The dictionary containing the starting replacement
info that we will modify.
o ignore_chars - A list of characters to ignore when calculating
replacements (ie. '-').

Returns:
o A replacment dictionary which is modified from initial_dict with
the information from the sequence comparison.

Definition at line 256 of file AlignInfo.py.

                                                   :
        """Compare two sequences and generate info on the replacements seen.

        Arguments:
        o seq1, seq2 - The two sequences to compare.
        o weight1, weight2 - The relative weights of seq1 and seq2.
        o start_dict - The dictionary containing the starting replacement
        info that we will modify.
        o ignore_chars - A list of characters to ignore when calculating
        replacements (ie. '-').

        Returns:
        o A replacment dictionary which is modified from initial_dict with
        the information from the sequence comparison.
        """
        # loop through each residue in the sequences
        for residue_num in range(len(seq1)):
            residue1 = seq1[residue_num]
            try:
                residue2 = seq2[residue_num]
            # if seq2 is shorter, then we just stop looking at replacements
            # and return the information
            except IndexError:
                return start_dict

            # if the two residues are characters we want to count
            if (residue1 not in ignore_chars) and (residue2 not in ignore_chars):
                try:
                    # add info about the replacement to the dictionary,
                    # modified by the sequence weights
                    start_dict[(residue1, residue2)] = \
                                         start_dict[(residue1, residue2)] + \
                                         weight1 * weight2
                                         
                # if we get a key error, then we've got a problem with alphabets
                except KeyError:
                    raise ValueError("Residues %s, %s not found in alphabet %s"
                                     % (residue1, residue2,
                                        self.alignment._alphabet))

        return start_dict


    def _get_base_replacements(self, skip_items = []):


Generated by  Doxygen 1.6.0   Back to index