ó
gbc           @   s‚   d  d l  m Z d  d l  m Z d  d l  m Z d  d l m Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d	 „  Z d
 „  Z	 d S(   iÿÿÿÿ(   t   OBOTerm(   t   OBOEntry(   t   stanzaIterator(   t   debugt   GOEntryc           B   s   e  Z d  Z RS(   s¸   
       An entry of a GeneOntology .obo file. It can be a header (without a stanza name) or
       a stanza (with a stanza name between brackets). It inherits from the class dict.
    (   t   __name__t
   __module__t   __doc__(    (    (    s5   lib/python2.7/site-packages/obitools/obo/go/parser.pyR      s   t   GOTermc           B   s   e  Z d  Z d „  Z RS(   sG   
       A stanza named 'Term'. It inherits from the class OBOTerm.
    c         C   sB   t  j |  | ƒ d |  k r2 t |  d ƒ d k s> t d ƒ ‚ d  S(   Nt	   namespacei   sg   An OBOTerm must belong to one of the cell_component, molecular_function or biological_process namespace(   R    t   __init__t   lent   AssertionError(   t   selft   stanza(    (    s5   lib/python2.7/site-packages/obitools/obo/go/parser.pyR
      s    (   R   R   R   R
   (    (    (    s5   lib/python2.7/site-packages/obitools/obo/go/parser.pyR      s   c         C   s3   t  j |  ƒ } | d k r% t |  ƒ St  |  ƒ Sd S(   s  
    Dispatcher of stanza.
    
    @param stanza: a stanza composed of several lines.
    @type stanza: text
    
    @return: an C{OBOTerm} | C{OBOEntry} instance
    
    @note: The dispatcher treats differently the stanza which are OBO "Term"
    and the others.
    t   TermN(   R   t   parseStanzaNameR   (   R   t
   stanzaType(    (    s5   lib/python2.7/site-packages/obitools/obo/go/parser.pyt   GOEntryFactory   s    
c         c   s6   t  |  ƒ } x# | D] } t | ƒ t | ƒ Vq Wd  S(   N(   R   R   R   (   t   filet   entriest   e(    (    s5   lib/python2.7/site-packages/obitools/obo/go/parser.pyt   GOEntryIterator0   s    
N(
   t   obitools.obo.parserR    R   R   t   loggingR   R   R   R   R   (    (    (    s5   lib/python2.7/site-packages/obitools/obo/go/parser.pyt   <module>   s   	