ó
"˜ÎIc           @   s@   d  d l  m Z d  d l m Z d Z d e f d „  ƒ  YZ d S(   iÿÿÿÿ(   t   IntType(   t   Entitys'   Chain class, used in Structure objects.t   Chainc           B   sY   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(	   c         C   s   d |  _  t j |  | ƒ d  S(   Nt   C(   t   levelR   t   __init__(   t   selft   id(    (    s€   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Chain.pyR      s    	c   	      C   sk   | j  \ } } } | j  \ } } } | | k rE t | d | d ƒ S| | k r^ t | | ƒ St | | ƒ S(   sÃ  Sort function for residues in a chain

        Residues are first sorted according to their hetatm records.
        Protein and nucleic acid residues first, hetatm residues next, 
        and waters last. Within each group, the residues are sorted according
        to their resseq's (sequence identifiers). Finally, residues with the
        same resseq's are sorted according to icode.

        Arguments:
        o r1, r2 - Residue objects
        i    (   R   t   cmp(	   R   t   r1t   r2t   hetflag1t   resseq1t   icode1t   hetflag2t   resseq2t   icode2(    (    s€   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Chain.pyt   _sort   s    c         C   s(   t  | ƒ t k r$ d | d f } n  | S(   sÑ  
        A residue id is normally a tuple (hetero flag, sequence identifier, 
        insertion code). Since for most residues the hetero flag and the 
        insertion code are blank (i.e. " "), you can just use the sequence 
        identifier to index a residue in a chain. The _translate_id method
        translates the sequence identifier to the (" ", sequence identifier,
        " ") tuple. 

        Arguments:
        o id - int, residue resseq 
        t    (   t   typeR    (   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/PDB/Chain.pyt   _translate_id*   s    c         C   s   |  j  | ƒ } t j |  | ƒ S(   s!  Return the residue with given id.

        The id of a residue is (hetero flag, sequence identifier, insertion code). 
        If id is an int, it is translated to (" ", id, " ") by the _translate_id
        method. 

        Arguments:
        o id - (string, int, string) or int
        (   R   R   t   __getitem__(   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/PDB/Chain.pyR   <   s    
c         C   s   |  j  | ƒ } t j |  | ƒ S(   sH   
        Arguments:
        o id - (string, int, string) or int
        (   R   R   t   __delitem__(   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/PDB/Chain.pyR   I   s    c         C   s   d |  j  ƒ  S(   Ns   <Chain id=%s>(   t   get_id(   R   (    (    s€   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Chain.pyt   __repr__Q   s    c         C   sg   g  } xZ |  j  ƒ  D]L } | j ƒ  d k rR x1 | j ƒ  D] } | j | ƒ q8 Wq | j | ƒ q W| S(   sè   Return a list of undisordered residues.

        Some Residue objects hide several disordered residues
        (DisorderedResidue objects). This method unpacks them, 
        ie. it returns a list of simple Residue objects.
        i   (   t   get_listt   is_disorderedt   disordered_get_listt   append(   R   t   unpacked_listt   residuet   dresidue(    (    s€   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Chain.pyt   get_unpacked_listV   s    c         C   s   |  j  | ƒ } t j |  | ƒ S(   s5  Return 1 if a residue with given id is present.

        The id of a residue is (hetero flag, sequence identifier, insertion code).
                If id is an int, it is translated to (" ", id, " ") by the _translate_id
        method.

        Arguments:
        o id - (string, int, string) or int
        (   R   R   t   has_id(   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/PDB/Chain.pyR!   f   s    
c         c   s+   x$ |  D] } x | D] } | Vq Wq Wd  S(   N(    (   R   t   rt   a(    (    s€   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Chain.pyt	   get_atomsv   s    (   t   __name__t
   __module__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/PDB/Chain.pyR      s   								N(   t   typesR    R   t   __doc__R   (    (    (    s€   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Chain.pyt   <module>   s   