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

def Bio::Align::AlignInfo::SummaryInfo::_guess_consensus_alphabet (   self  )  [private]

Pick an alphabet for a consesus sequence of an alignment.

This just looks at the sequences we have, checks their type, and
returns as appropriate type which seems to make sense with the
sequences we've got.

Definition at line 169 of file AlignInfo.py.

00169                                        :
        """Pick an alphabet for a consesus sequence of an alignment.

        This just looks at the sequences we have, checks their type, and
        returns as appropriate type which seems to make sense with the
        sequences we've got.
        """
        # check to be sure our alphabet is a gapped alphabet, otherwise
        # we have a weird bunch of sequences -- this would make it harder
        # to find an alphabet (since we'd have to check non-gapped types
        # as well).
        # Right now we'll raise an error for non-gapped alphabets, and
        # if anyone complains, we can figure out what the use is for
        # non-gapped alphabets.

        if not(isinstance(self.alignment._records[0].seq.alphabet,
                          Alphabet.Gapped)):
            raise ValueError \
                  ("Non-gapped alphabet found in alignment object.")

        # now check the types, and get an ambiguous alphabet based on the
        # type of alphabet found.
        if isinstance(self.alignment._records[0].seq.alphabet.alphabet,
                      Alphabet.ProteinAlphabet):
            alpha = IUPAC.protein
        elif isinstance(self.alignment._records[0].seq.alphabet.alphabet,
                        Alphabet.DNAAlphabet):
            alpha = IUPAC.ambiguous_dna
        elif isinstance(self.alignment._records[0].seq.alphabet.alphabet,
                        Alphabet.RNAAlphabet):
            alpha = IUPAC.ambiguous_rna
        else:
            raise ValueError("Could not determine the type of alphabet.")

        return alpha

    def replacement_dictionary(self, skip_chars = []):


Generated by  Doxygen 1.6.0   Back to index