ó
ª Ic           @   s\   d  Z  d d l m Z d d d „  ƒ  YZ d „  Z d d d „  ƒ  YZ d d d	 „  ƒ  YZ d
 S(   s   Handle the SCOP DOMain file.

The DOM file has been officially deprecated. For more information see
the SCOP"release notes.":http://scop.berkeley.edu/release-notes-1.55.html 
The DOM files for older releases can be found 
"elsewhere at SCOP.":http://scop.mrc-lmb.cam.ac.uk/scop/parse/
iÿÿÿÿ(   t   Residuest   Recordc           B   s,   e  Z d  Z d d „ Z d „  Z d „  Z RS(   sæ   Holds information for one SCOP domain.

    sid -- The SCOP ID of the entry, e.g. d1anu1

    residues -- The domain definition as a Residues object

    hierarchy -- A string specifying where this domain is in the hierarchy.
    c         C   s5   d |  _  g  |  _ d |  _ | r1 |  j | ƒ n  d  S(   Nt    (   t   sidt   residuest	   hierarchyt   _process(   t   selft   line(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/SCOP/Dom.pyt   __init__   s
    			c         C   sw   | j  ƒ  } | j d ƒ } t | ƒ d k r@ t d | ƒ ‚ n  | \ |  _ } } |  _ t | ƒ |  _ | |  j _ d S(   s~   Parses DOM records.
    
        Records consist of 4 tab deliminated fields;
        sid, pdbid, residues, hierarchy
        s   	i   s#   I don't understand the format of %sN(	   t   rstript   splitt   lent
   ValueErrorR   R   R    R   t   pdbid(   R   R   t   columnsR   t   res(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/SCOP/Dom.pyR   %   s    c         C   sY   g  } | j  |  j ƒ | j  t |  j ƒ j d d ƒ ƒ | j  |  j ƒ d j | ƒ d S(   Nt    s   	s   
(   t   appendR   t   strR   t   replaceR   t   join(   R   t   s(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/SCOP/Dom.pyt   __str__;   s
    "N(   t   __name__t
   __module__t   __doc__t   NoneR	   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/SCOP/Dom.pyR      s   	c         c   s    x |  D] } t  | ƒ Vq Wd S(   s‘   Iterates over a DOM file, returning a Dom record for each line
    in the file.

    Arguments:
        
        handle -- file-like object.
    N(   R   (   t   handleR   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/SCOP/Dom.pyt   parseC   s    t   Iteratorc           B   s#   e  Z d  Z d d „ Z d „  Z RS(   s   Iterates over a DOM file.
    c         C   s_   d d l  m } m } t | ƒ | k	 rI t | ƒ | k	 rI t d ƒ ‚ n  | |  _ | |  _ d S(   s/  Create an object that iterates over a DES file.

        handle -- file-like object.

        parser -- an optional Parser object to change the results into
                  another form.  If set to None, then the raw contents
                  of the file will be returned.
                  
        iÿÿÿÿ(   t   FileTypet   InstanceTypes,   I expected a file handle or file-like objectN(   t   typesR   R    t   typeR   t   _handlet   _parser(   R   R   t   parserR   R    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/SCOP/Dom.pyR	   R   s
    
$	c         C   s<   |  j  j ƒ  } | s d  S|  j d  k	 r8 |  j j | ƒ S| S(   N(   R#   t   readlineR   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/SCOP/Dom.pyt   nextb   s    N(   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/SCOP/Dom.pyR   O   s   t   Parserc           B   s   e  Z d  „  Z RS(   c         C   s#   d d l  } | j d ƒ t | ƒ S(   s   Returns a Dom.Record iÿÿÿÿNsº   Bio.SCOP.Dom.Parser is deprecated.
        Instead of

        parser = Dom.Parser()
        record = parser.parse(entry)

        please use

        record = Dom.Record(entry)
        (   t   warningst   warnR   (   R   t   entryR)   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/SCOP/Dom.pyR   k   s    	(   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/SCOP/Dom.pyR(   j   s   N(    (    (    (   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/SCOP/Dom.pyt   <module>   s
   .	