ó
ª Ic           @   sL   d  Z  d d	 d „  ƒ  YZ d „  Z d d
 d „  ƒ  YZ d d d „  ƒ  YZ d S(   sC   Handle the SCOP DEScription file.

The file format is described in the scop
"release notes.":http://scop.berkeley.edu/release-notes-1.55.html 
The latest DES file can be found
"elsewhere at SCOP.":http://scop.mrc-lmb.cam.ac.uk/scop/parse/
  
"Release 1.55":http://scop.berkeley.edu/parse/des.cla.scop.txt_1.55 (July 2001)
t   Recordc           B   s,   e  Z d  Z d d „ Z d „  Z d „  Z RS(   sC  Holds information for one node in the SCOP hierarchy.

    sunid       -- SCOP unique identifiers

    nodetype    -- One of 'cl' (class), 'cf' (fold), 'sf' (superfamily),
                   'fa' (family), 'dm' (protein), 'sp' (species),
                   'px' (domain). Additional node types may be added.

    sccs        -- SCOP concise classification strings. e.g. b.1.2.1

    name        -- The SCOP ID (sid) for domains (e.g. d1anu1),
                   currently empty for other node types

    description --  e.g. "All beta proteins","Fibronectin type III", 
    
    c         C   sG   d |  _  d |  _ d |  _ d |  _ d |  _ | rC |  j | ƒ n  d  S(   Nt    (   t   sunidt   nodetypet   sccst   namet   descriptiont   _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/Des.pyt   __init__#   s    					c         C   s   | j  ƒ  } | j d ƒ } t | ƒ d k r@ t d | ƒ ‚ n  | \ } |  _ |  _ |  _ |  _ |  j d k r| d |  _ n  t | ƒ |  _	 d S(   s“   Parses DES records.
    
        Records consist of 5 tab deliminated fields,
        sunid, node type, sccs, node name, node description.
        s   	i   s#   I don't understand the format of %st   -R   N(
   t   rstript   splitt   lent
   ValueErrorR   R   R   R   t   intR   (   R   R	   t   columnsR   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/SCOP/Des.pyR   ,   s    ! c         C   s‰   g  } | j  |  j ƒ | j  |  j ƒ | j  |  j ƒ |  j rR | j  |  j ƒ n | j  d ƒ | j  |  j ƒ d j t t | ƒ ƒ d S(   NR   s   	s   
(	   t   appendR   R   R   R   R   t   joint   mapt   str(   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/Des.pyt   __str__D   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/Des.pyR       s   		c         c   s    x |  D] } t  | ƒ Vq Wd S(   s‡   Iterates over a DES file, returning a Des 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/Des.pyt   parseQ   s    t   Iteratorc           B   s,   e  Z d  Z d d „ Z d „  Z d „  Z RS(   s   Iterates over a DES file.
    c         C   s{   d d l  } | j d t ƒ d d l m } m } t | ƒ | k	 re t | ƒ | k	 re 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 chang the results into
                  another form.  If set to None, then the raw contents
                  of the file will be returned.
                  
        iÿÿÿÿNsM   Bio.SCOP.Des.Iterator is deprecated. Please use Bio.SCOP.Des.parse() instead.(   t   FileTypet   InstanceTypes,   I expected a file handle or file-like object(
   t   warningst   warnt   DeprecationWarningt   typesR   R    t   typet	   TypeErrort   _handlet   _parser(   R   R   t   parserR!   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/Des.pyR
   _   s    
$	c         C   sW   x1 |  j  j ƒ  } | s d S| d d k r Pq q W|  j d k	 rS |  j j | ƒ S| S(   s   Retrieve the next DES record.i    t   #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/Des.pyt   nextq   s      c         C   s   t  |  j d  ƒ S(   N(   t   iterR,   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/Des.pyt   __iter__{   s    N(   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/SCOP/Des.pyR   \   s   	
t   Parserc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s    d d  l  } | j d t ƒ d  S(   Niÿÿÿÿsº   Bio.SCOP.Des.Parser is deprecated.
        Instead of

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

        please use

        record = Des.Record(entry)
        (   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/Des.pyR
   €   s    	c         C   s
   t  | ƒ S(   s   Returns a Des Record (   R    (   R   t   entry(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/SCOP/Des.pyR      s    (   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/Des.pyR/      s   	N(    (    (    (   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/Des.pyt   <module>   s   ?	#