ó
2@¨Hc           @   s   d  Z  d d d „  ƒ  YZ d S(   s7   Useful utilities for helping in parsing GenBank files.
t   FeatureValueCleanerc           B   s5   e  Z d  Z d g Z e d „ Z d „  Z d „  Z RS(   s¬  Provide specialized capabilities for cleaning up values in features.

    This class is designed to provide a mechanism to clean up and process
    values in the key/value pairs of GenBank features. This is useful 
    because in cases like:
        
         /translation="MED
         YDPWNLRFQSKYKSRDA"

    you'll end up with a value with 
s and spaces in it like:
        "MED
 YDPWEL..."

    which you probably don't want. 
    
    This cleaning needs to be done on a case by case basis since it is
    impossible to interpret whether you should be concatenating everything
    (as in translations), or combining things with spaces (as might be
    the case with /notes).
    t   translationc         C   s   | |  _  d S(   s6   Initialize with the keys we should deal with.
        N(   t   _to_process(   t   selft
   to_process(    (    s„   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/GenBank/utils.pyt   __init__   s    c         C   s]   | |  j  k rY y# t |  d | ƒ } | | ƒ } WqY t k
 rU t d | ƒ ‚ qY Xn  | S(   s—   Clean the specified value and return it.

        If the value is not specified to be dealt with, the original value
        will be returned.
        s	   _clean_%ss   No function to clean key: %s(   R   t   getattrt   AttributeErrort   AssertionError(   R   t   key_namet   valuet   cleaner(    (    s„   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/GenBank/utils.pyt   clean_value   s    c         C   s   | j  ƒ  } d j | ƒ S(   sD   Concatenate a translation value to one long protein string.
        t    (   t   splitt   join(   R   R
   t   translation_parts(    (    s„   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/GenBank/utils.pyt   _clean_translation,   s    (   t   __name__t
   __module__t   __doc__t   keys_to_processR   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/GenBank/utils.pyR       s
   		N(    (   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/GenBank/utils.pyt   <module>   s   