
    Ri                     0    d Z d Zd Z G d de      Zd Zy)a+  Parse the enzyme.dat file from Enzyme at ExPASy.

See https://www.expasy.org/enzyme/

Tested with the release of 03-Mar-2009.

Functions:
 - read       Reads a file containing one ENZYME entry
 - parse      Reads a file containing multiple ENZYME entries

Classes:
 - Record     Holds ENZYME data.

c              #   2   K   	 t        |       }|sy| w)zParse ENZYME records.

    This function is for parsing ENZYME files containing multiple
    records.

    Arguments:
     - handle   - handle to the file.

    N)__read)handlerecords     I/home/agent/.friday_env/lib/python3.12/site-packages/Bio/ExPASy/Enzyme.pyparser      s$      	 s   c                 V    t        |       }| j                         }|rt        d      |S )zRead one ENZYME record.

    This function is for parsing ENZYME files containing
    exactly one record.

    Arguments:
     - handle   - handle to the file.

    z!More than one ENZYME record found)r   read
ValueError)r   r   	remainders      r   r	   r	   (   s,     F^FI<==M    c                   "    e Zd ZdZd Zd Zd Zy)Recorda  Holds information from an ExPASy ENZYME record as a Python dictionary.

    Each record contains the following keys:

    - ID: EC number
    - DE: Recommended name
    - AN: Alternative names (if any)
    - CA: Catalytic activity
    - CF: Cofactors (if any)
    - PR: Pointers to any Prosite documentation entries that correspond to the
      enzyme
    - DR: Pointers to any Swiss-Prot protein sequence entries that correspond
      to the enzyme
    - CC: Comments

    c                 ~    t         j                  |        d| d<   d| d<   g | d<   d| d<   d| d<   g | d<   g | d<   g | d	<   y
)zInitialize the class. IDDEANCACFCCPRDRN)dict__init__selfs    r   r   zRecord.__init__L   sV    dT
T
T
T
T
T
T
T
r   c                     | d   rI| d   r%| j                   j                   d| d    d| d    dS | j                   j                   d| d    dS | j                   j                   dS )z@Return the canonical string representation of the Record object.r   r   z (z, )z ( ))	__class____name__r   s    r   __repr__zRecord.__repr__X   sv    :Dz..112"T$ZL4:,aPP..112"T$ZLBBnn--.d33r   c                     d| d   z   d| d   z   dt        | d         z   d| d   z   d	z   d
| d   z   dt        | d         z   dt        | d         z   dt        | d         z  g}dj                  |      S )z=Return a readable string representation of the Record object.zID: r   zDE: r   zAN: r   zCA: 'r   'zCF: r   zCC: r   zPR: r   zDR: %d Recordsr   
)reprlenjoin)r   outputs     r   __str__zRecord.__str__b   s     T$ZT$ZT$t*%%d4j 3&T$ZT$t*%%T$t*%%s4:.	
 yy  r   N)r    
__module____qualname____doc__r   r!   r)    r   r   r   r   :   s    "
4!r   r   c                    d }| D ]  }|d d |dd  j                         }}|dk(  rt               }||d<   1|dk(  r|dxx   |z  cc<   D|dk(  rE|d   r+|d   d   j                  d      s|d   dxx   d|z   z  cc<   y|d   j                  |       |d	k(  r|d	xx   |z  cc<   |d
k(  rq|j                  d      j	                  d      }|D ]J  }|j	                  d      \  }}|j                         |j                         g}	|d
   j                  |	       L |dk(  r|d   r|dxx   d|z   z  cc<   3||d<   :|dk(  r=|j                  d      sJ |dd  j                  d      }|d   j                  |       ||dk(  rY|j                  d      r|d   j                  |dd         |j                  d      s|d   s|d   dxx   |dd  z  cc<   |dk(  s|r|c S  |rt        d      y )N      r   r   r   . r   r   ;,r   r   z	PROSITE; 	   r   z-!-    z       z//zUnexpected end of stream)rstripr   endswithappendsplitstrip
startswithr
   )
r   r   linekeyvalue	pair_datapairt1t2rows
             r   r   r   t   s   F '"1XtABx0U$;XF F4LD[4LE!LD[d|F4L$4$=$=c$BtR C%K/ t##E*D[4LE!LD[S)//4I! )CBxxz288:.t##C() D[d|te+$tD[##K000!"I$$S)E4L&D['t##E!"I.!!&)fTltR E!"I- D[O'P 344 r   N)r,   r   r	   r   r   r   r-   r   r   <module>rG      s&    "$4!T 4!t+5r   