
    Ri                     $    d Z  G d de      Zd Zy)aZ  Code to parse the keywlist.txt file from SwissProt/UniProt.

See:
 - https://www.uniprot.org/docs/keywlist.txt

Classes:
 - Record            Stores the information about one keyword or one category
   in the keywlist.txt file.

Functions:
 - parse             Parses the keywlist.txt file and returns an iterator to
   the records it contains.

c                       e Zd ZdZd Zy)Recorda  Store information of one keyword or category from the keywords list.

    This record stores the information of one keyword or category in the
    keywlist.txt as a Python dictionary. The keys in this dictionary are
    the line codes that can appear in the keywlist.txt file::

        ---------  ---------------------------     ----------------------
        Line code  Content                         Occurrence in an entry
        ---------  ---------------------------     ----------------------
        ID         Identifier (keyword)            Once; starts a keyword entry
        IC         Identifier (category)           Once; starts a category entry
        AC         Accession (KW-xxxx)             Once
        DE         Definition                      Once or more
        SY         Synonyms                        Optional; once or more
        GO         Gene ontology (GO) mapping      Optional; once or more
        HI         Hierarchy                       Optional; once or more
        WW         Relevant WWW site               Optional; once or more
        CA         Category                        Once per keyword entry; absent
                                                   in category entries

    c                 F    t         j                  |        dD ]  }g | |<   	 y)zInitialize the class.DESYGOHIWWN)dict__init__)selfkeywords     N/home/agent/.friday_env/lib/python3.12/site-packages/Bio/SwissProt/KeyWList.pyr   zRecord.__init__-   s&    d5 	GDM	    N)__name__
__module____qualname____doc__r    r   r   r   r      s    ,r   r   c              #   X  K   t               }| D ]T  }|j                  d      r|dd j                         |d<    n+|j                  d      s>|dd j                         |d<    n | D ]  }|j                  d      r n|dd }|d	k(  r=d
j                  |d         |d<   d
j                  |d         |d<   | t               }]|dd dk(  sf|dd j                         }|dv r|||<   |dv r||   j	                  |       t        d|j                          d       | D ]  } yw)zParse the keyword list from file handle.

    Returns a generator object which yields keyword entries as
    Bio.SwissProt.KeyWList.Record() object.
    zID      NIDzIC   ICz%-------------------------------------   z// r   r   z   )r   r   ACCAr   zCannot parse line '')r   
startswithstripjoinappend
ValueError)handlerecordlinekeyvalues        r   parser)   4   sQ     XF ??7#8>>+F4L??7#8>>+F4L  H??BC2Ah$;88F4L1F4L88F4L1F4LLXF!AY%HNN$E..#s66s""5) #6tzz|nA!FGG#H&  s   A
D*B D*AD*N)r   r   r   r)   r   r   r   <module>r*      s    T <&r   