o
    RÅ€gÞ  ã                   @   sB   d Z dZdZee Zdd„ Zdd„ Zeefdd„Zefd	d
„ZdS )zÐCode 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                 C   ó
   | ddgS )z±Return default wrap rule for _wrap_kegg (PRIVATE).

    A wrap rule is a list with the following elements:
    [indent, connect, (splitstr, connect, splitafter, keep), ...]
    Ú )ú r   é   é    © ©Úindentr   r   úE/var/www/html/myenv/lib/python3.10/site-packages/Bio/KEGG/__init__.pyÚ_default_wrap   s   
r   c                 C   r   )z.Return wrap rule for KEGG STRUCTURE (PRIVATE).r   )z  r   r   r   r   r	   r   r   r   Ú_struct_wrap    s   
r   c                 C   s*  d}d}d|d  }|d }|dd… }	 t | ƒ|kr&||  }|| }	 |S d}|D ]S}	|}
|	d s:|
t |	d ƒ }
|  |	d d|
¡}|dkr}|	d rW|	d	 rW|t |	d ƒ }|| d|…  d
 }|	d	 sm|t |	d ƒ }||	d  | |d…  } d} nq*|s”|| d|…  d
 }|| | |d…  } q)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   é   NTéÿÿÿÿé   Ú
)ÚlenÚrfind)ÚlineÚ	max_widthÚ	wrap_ruleÚsÚwrapped_liner
   ÚconnectÚrulesÚ	did_splitÚruleÚtoÚ	split_idxr   r   r   Ú
_wrap_kegg%   s>   îø	ér   c                 C   sB   d}|D ]}|  ¡ }|D ]}||  |¡| d 7 }| rd} qq|S )zËWrite 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Úpartialr   r   r   Ú_write_keggP   s   	€ýr&   N)Ú__doc__ÚKEGG_ITEM_LENGTHÚKEGG_LINE_LENGTHÚKEGG_DATA_LENGTHr   r   r   r&   r   r   r   r   Ú<module>   s   
	+