Back to index

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

List of all members.

Public Member Functions

def __init__
def __str__

Public Attributes

 id
 names
 forward_table
 back_table
 start_codons
 stop_codons

Static Public Attributes

 nucleotide_alphabet = Alphabet.generic_nucleotide
 protein_alphabet = IUPAC.protein

Detailed Description

Definition at line 130 of file CodonTable.py.


Constructor & Destructor Documentation

def Bio.Data.CodonTable.NCBICodonTable.__init__ (   self,
  id,
  names,
  table,
  start_codons,
  stop_codons 
)

Definition at line 134 of file CodonTable.py.

00134 
00135     def __init__(self, id, names, table, start_codons, stop_codons):
00136         self.id = id
00137         self.names = names
00138         self.forward_table = table
00139         self.back_table = make_back_table(table, stop_codons[0])
00140         self.start_codons = start_codons
00141         self.stop_codons = stop_codons
00142 

Here is the caller graph for this function:


Member Function Documentation

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

Reimplemented from Bio.Data.CodonTable.CodonTable.

Definition at line 138 of file CodonTable.py.

Reimplemented from Bio.Data.CodonTable.CodonTable.

Definition at line 137 of file CodonTable.py.

Definition at line 135 of file CodonTable.py.

Definition at line 136 of file CodonTable.py.

Reimplemented from Bio.Data.CodonTable.CodonTable.

Definition at line 132 of file CodonTable.py.

Reimplemented from Bio.Data.CodonTable.CodonTable.

Definition at line 139 of file CodonTable.py.

Reimplemented from Bio.Data.CodonTable.CodonTable.

Definition at line 140 of file CodonTable.py.


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