ó
´’Ic           @   só  d  Z  d d l m Z m Z d d l m Z d d d „  ƒ  YZ i  Z x- e j j ƒ  D] \ Z	 Z
 e e
 ƒ e e	 <qU Wi  Z x- e j j ƒ  D] \ Z	 Z
 e e
 ƒ e e	 <q‹ Wi  Z x- e j j ƒ  D] \ Z	 Z
 e e
 ƒ e e	 <qÁ Wi  Z x- e j j ƒ  D] \ Z	 Z
 e e
 ƒ e e	 <q÷ Wi  Z x- e j j ƒ  D] \ Z	 Z
 e e
 ƒ e e	 <q-Wi  Z x- e j j ƒ  D] \ Z	 Z
 e e
 ƒ e e	 <qcWi  Z x- e j j ƒ  D] \ Z	 Z
 e e
 ƒ e e	 <q™Wi  Z x- e j j ƒ  D] \ Z	 Z
 e e
 ƒ e e	 <qÏWd S(   s¨  Code to translate DNA or RNA into proteins (OBSOLETE).

Instead of Bio.Translate, for translation you are now encouraged to use the
Seq object's translate method, or the translate function in the Bio.Seq
module.  Translate-to-stop functionality is via an optional argument.

Bio.Seq does not offer any back-translation function like the one here. It
was concluded that a since a simple back-translation giving a Seq or python
string could only capture some of the possible back translations, there were
no practical uses for such a method/function.

This module is now considered to be obsolete, and is likely to be deprecated
in a future release of Biopython, and later removed.
iÿÿÿÿ(   t   Alphabett   Seq(   t
   CodonTablet
   Translatorc           B   sA   e  Z d  „  Z d „  Z d d „ Z d „  Z d „  Z d „  Z RS(   c         C   s   | |  _  i  |  _ d  S(   N(   t   tablet   _encoded(   t   selfR   (    (    s€   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Translate.pyt   __init__   s    	c         C   s   d t  |  j ƒ S(   Ns   Translator object
(   t   strR   (   R   (    (    s€   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Translate.pyt   __str__   s    t   *c         C   s  | j  j |  j j j k s: t d | j  |  j j f ƒ ‚ | j } g  } | j } |  j } | j j } t	 | ƒ } x@ t
 d | | d d ƒ D]$ }	 | | | |	 |	 d !| ƒ ƒ qŽ Wy |  j | }
 Wn3 t k
 rü t j | j | ƒ }
 |
 |  j | <n Xt j d j | ƒ |
 ƒ S(   Ns7   cannot translate from given alphabet (have %s, need %s)i    i   t    (   t   alphabett	   __class__R   t   nucleotide_alphabett   AssertionErrort   datat   appendt   forward_tablet   gett   lent   rangeR   t   KeyErrorR    t   HasStopCodont   protein_alphabetR   t   join(   R   t   seqt   stop_symbolt   st   lettersR   R   R   t   nt   iR   (    (    s€   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Translate.pyt	   translate   s&    				!"	c         C   sß   | j  j |  j j j k s: t d | j  |  j j f ƒ ‚ | j } g  } | j } |  j j } t | ƒ } yB x; t	 d | | d d ƒ D] } | | | | | d !ƒ qˆ WWn t
 k
 r¿ n Xt j d j | ƒ |  j j ƒ S(   Ns7   cannot translate from given alphabet (have %s, need %s)i    i   R   (   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (   R   R   R   R   R   R   R   R   (    (    s€   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Translate.pyt   translate_to_stop3   s    			!!c         C   sÞ   t  | j t j ƒ s" |  j | ƒ S| j j |  j j k sP t d | j j ƒ ‚ | j } | j j	 } g  } | j
 } |  j j } x< | j D]1 } | | k r­ | | d  ƒ qŠ | | | ƒ qŠ Wt j d j | ƒ |  j j ƒ S(   Ns2   cannot back translate from the given alphabet (%s)R   (   t
   isinstanceR   R    R   t   _back_translate_no_stopR   R   R   R   R   R   t
   back_tablet   NoneR   R   R   (   R   R   R   t   letterR   R   R   t   c(    (    s€   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Translate.pyt   back_translateH   s     		c         C   s   | j  |  j j k s( t d | j  ƒ ‚ | j } g  } | j } |  j j } x | j D] } | | | ƒ qV Wt j d j | ƒ |  j j	 ƒ S(   Ns2   cannot back translate from the given alphabet (%s)R   (
   R   R   R   R   R   R   R$   R   R   R   (   R   R   R   R   R   R   R'   (    (    s€   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Translate.pyR#   \   s    		(   t   __name__t
   __module__R   R	   R    R!   R(   R#   (    (    (    s€   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Translate.pyR      s   				N(    (   t   __doc__t   BioR    R   t   Bio.DataR   R   t   unambiguous_dna_by_namet   itemst   keyt   valuet   unambiguous_dna_by_idt   unambiguous_rna_by_namet   unambiguous_rna_by_idt   ambiguous_dna_by_namet   ambiguous_dna_by_idt   ambiguous_rna_by_namet   ambiguous_rna_by_id(    (    (    s€   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Translate.pyt   <module>   s6   X