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

def Bio::AlignIO::NexusIO::NexusWriter::_classify_alphabet_for_nexus (   self,
  alphabet 
) [private]

Returns 'protein', 'dna', 'rna' based on the alphabet (PRIVATE).

Raises an exception if this is not possible.

Definition at line 115 of file NexusIO.py.

00115                                                      :
        """Returns 'protein', 'dna', 'rna' based on the alphabet (PRIVATE).

        Raises an exception if this is not possible."""
        #Get the base alphabet (underneath any Gapped or StopCodon encoding)
        a = Alphabet._get_base_alphabet(alphabet)

        if not isinstance(a, Alphabet.Alphabet) :
            raise TypeError("Invalid alphabet")
        elif isinstance(a, Alphabet.ProteinAlphabet) :
            return "protein"
        elif isinstance(a, Alphabet.DNAAlphabet) :
            return "dna"
        elif isinstance(a, Alphabet.RNAAlphabet) :
            return "rna"
        else :
            #Must be something like NucleotideAlphabet or
            #just the generic Alphabet (default for fasta files)
            raise ValueError("Need a DNA, RNA or Protein alphabet")

if __name__ == "__main__" :


Generated by  Doxygen 1.6.0   Back to index