
    Ri                     <    d Z dZdZeez
  Zd Zd ZeefdZefdZy)zCode to work with data from the KEGG database.

References:
Kanehisa, M. and Goto, S.; KEGG: Kyoto Encyclopedia of Genes and Genomes.
Nucleic Acids Res. 28, 29-34 (2000).

URL: http://www.genome.ad.jp/kegg/

   P   c                     | ddgS )zReturn default wrap rule for _wrap_kegg (PRIVATE).

    A wrap rule is a list with the following elements:
    [indent, connect, (splitstr, connect, splitafter, keep), ...]
     ) r           indents    I/home/agent/.friday_env/lib/python3.12/site-packages/Bio/KEGG/__init__.py_default_wrapr      s     B((    c                     | ddgS )z.Return wrap rule for KEGG STRUCTURE (PRIVATE).r   )z  r   r   r   r	   r
   s    r   _struct_wrapr       s    B())r   c                    d}d}d|d   z  }|d   }|dd }	 t        |       |k  r|| z   }||z   }	 |S d}|D ]  }	|}
|	d   s|
t        |	d         z   }
| j                  |	d   d|
      }|dkD  s7|	d   r|	d   r|t        |	d         z   }|| d| z   d	z   }|	d   s|t        |	d         z   }||	d   z   | |d z   } d} n |s|| d| z   d	z   }||z   | |d z   } )
a/  Wrap the input line for KEGG output (PRIVATE).

    Arguments:
     - info - String holding the information we want wrapped
       for KEGG output.
     - max_width - Maximum width of a line.
     - wrap_rule - A wrap rule (see above) for deciding how to split
       strings that must be wrapped.

    r   r   r   r      N   
)lenrfind)line	max_width	wrap_ruleswrapped_liner   connectrules	did_splitruleto	split_idxs               r   
_wrap_keggr#   %   sT    	AL9Q<FlGabME
t9	!'$.LL A( H% I Awc$q'l*B JJtAw26	r>Aw47$-DG$<	#/$q2C#Cd#JL7$-DG$<	!DG+d9:.>>D !I +d1Y.??$F'$yz*::/ r   c                     d}|D ]8  }|j                         }|D ]!  }|| j                  |      |z   dz   z  }| s d} # : |S )zWrite a indented KEGG record item (PRIVATE).

    Arguments:
     - item - The name of the item to be written.
     - info - The (wrapped) information to write.
     - indent - Width of item field.

    r   r   )
splitlinesljust)iteminfor   r   r   partial_linespartials          r   _write_keggr+   P   s_     	A )$ 	GF#g-44A	 Hr   N)__doc__KEGG_ITEM_LENGTHKEGG_LINE_LENGTHKEGG_DATA_LENGTHr   r   r#   r+   r	   r   r   <module>r0      sE      #&66 )*
  0= (V $4 r   