Back to index

python-biopython  1.60
Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes
Bio.Data.CodonTable.AmbiguousCodonTable Class Reference
Inheritance diagram for Bio.Data.CodonTable.AmbiguousCodonTable:
Inheritance graph
[legend]
Collaboration diagram for Bio.Data.CodonTable.AmbiguousCodonTable:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __getattr__
def __str__

Public Attributes

 forward_table
 back_table
 start_codons
 stop_codons

Static Public Attributes

 nucleotide_alphabet = Alphabet.generic_nucleotide
 protein_alphabet = Alphabet.generic_protein
dictionary forward_table = {}
dictionary back_table = {}
list start_codons = []
list stop_codons = []

Private Attributes

 _codon_table

Detailed Description

Definition at line 152 of file CodonTable.py.


Constructor & Destructor Documentation

def Bio.Data.CodonTable.AmbiguousCodonTable.__init__ (   self,
  codon_table,
  ambiguous_nucleotide_alphabet,
  ambiguous_nucleotide_values,
  ambiguous_protein_alphabet,
  ambiguous_protein_values 
)

Definition at line 157 of file CodonTable.py.

00157 
00158                  ambiguous_protein_values):
00159         CodonTable.__init__(self,
00160                             ambiguous_nucleotide_alphabet,
00161                             ambiguous_protein_alphabet,
00162                             AmbiguousForwardTable(codon_table.forward_table,
00163                                                   ambiguous_nucleotide_values,
00164                                                   ambiguous_protein_values),
00165                             codon_table.back_table,
00166 
00167                             # These two are WRONG!  I need to get the
00168                             # list of ambiguous codons which code for
00169                             # the stop codons  XXX
00170                             list_ambiguous_codons(codon_table.start_codons, ambiguous_nucleotide_values),
00171                             list_ambiguous_codons(codon_table.stop_codons, ambiguous_nucleotide_values)
00172                             )
00173         self._codon_table = codon_table

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

Definition at line 177 of file CodonTable.py.

00177 
00178     def __getattr__(self, name):
00179         return getattr(self._codon_table, name)

def Bio.Data.CodonTable.CodonTable.__str__ (   self) [inherited]
Returns a simple text representation of the codon table

e.g.
>>> import Bio.Data.CodonTable
>>> print Bio.Data.CodonTable.standard_dna_table
>>> print Bio.Data.CodonTable.generic_by_id[1]

Definition at line 61 of file CodonTable.py.

00061 
00062     def __str__(self):
00063         """Returns a simple text representation of the codon table
00064 
00065         e.g.
00066         >>> import Bio.Data.CodonTable
00067         >>> print Bio.Data.CodonTable.standard_dna_table
00068         >>> print Bio.Data.CodonTable.generic_by_id[1]
00069         """
00070 
00071         if self.id:
00072             answer = "Table %i" % self.id
00073         else:
00074             answer = "Table ID unknown"
00075         if self.names:
00076             answer += " " + ", ".join(filter(None, self.names))
00077 
00078         #Use the main four letters (and the conventional ordering)
00079         #even for ambiguous tables
00080         letters = self.nucleotide_alphabet.letters
00081         if isinstance(self.nucleotide_alphabet, Alphabet.DNAAlphabet) \
00082         or (letters is not None and "T" in letters):
00083             letters = "TCAG"
00084         else:
00085             #Should be either RNA or generic nucleotides,
00086             #e.g. Bio.Data.CodonTable.generic_by_id[1]
00087             letters = "UCAG"
00088 
00089         #Build the table...
00090         answer=answer + "\n\n  |" + "|".join( \
00091             ["  %s      " % c2 for c2 in letters] \
00092             ) + "|"
00093         answer=answer + "\n--+" \
00094                + "+".join(["---------" for c2 in letters]) + "+--"
00095         for c1 in letters:
00096             for c3 in letters:
00097                 line = c1 + " |"
00098                 for c2 in letters:
00099                     codon = c1+c2+c3
00100                     line = line + " %s" % codon
00101                     if codon in self.stop_codons:
00102                         line = line + " Stop|"
00103                     else:
00104                         try:
00105                             amino = self.forward_table[codon]
00106                         except KeyError:
00107                             amino = "?"
00108                         except TranslationError:
00109                             amino = "?"
00110                         if codon in self.start_codons:
00111                             line = line + " %s(s)|" % amino
00112                         else:
00113                             line = line + " %s   |" % amino
00114                 line = line + " " + c3
00115                 answer = answer + "\n"+ line 
00116             answer=answer + "\n--+" \
00117                   + "+".join(["---------" for c2 in letters]) + "+--"
00118         return answer
            

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 172 of file CodonTable.py.

dictionary Bio.Data.CodonTable.CodonTable.back_table = {} [static, inherited]

Reimplemented in Bio.Data.CodonTable.NCBICodonTable.

Definition at line 46 of file CodonTable.py.

Reimplemented in Bio.Data.CodonTable.NCBICodonTable.

Definition at line 57 of file CodonTable.py.

dictionary Bio.Data.CodonTable.CodonTable.forward_table = {} [static, inherited]

Reimplemented in Bio.Data.CodonTable.NCBICodonTable.

Definition at line 45 of file CodonTable.py.

Reimplemented in Bio.Data.CodonTable.NCBICodonTable.

Definition at line 56 of file CodonTable.py.

Reimplemented in Bio.Data.CodonTable.NCBICodonTable.

Definition at line 43 of file CodonTable.py.

list Bio.Data.CodonTable.CodonTable.start_codons = [] [static, inherited]

Reimplemented in Bio.Data.CodonTable.NCBICodonTable.

Definition at line 47 of file CodonTable.py.

Reimplemented in Bio.Data.CodonTable.NCBICodonTable.

Definition at line 58 of file CodonTable.py.

list Bio.Data.CodonTable.CodonTable.stop_codons = [] [static, inherited]

Reimplemented in Bio.Data.CodonTable.NCBICodonTable.

Definition at line 48 of file CodonTable.py.

Reimplemented in Bio.Data.CodonTable.NCBICodonTable.

Definition at line 59 of file CodonTable.py.


The documentation for this class was generated from the following file: