o
    Rŀg                     @   s   d Z G dd dZdd ZdS )a?  Handle the SCOP DEScription file.

The file format is described in the scop
"release notes.":http://scop.berkeley.edu/release-notes-1.55.html
The latest DES file can be found
"elsewhere at SCOP.":http://scop.mrc-lmb.cam.ac.uk/scop/parse/

"Release 1.55":http://scop.berkeley.edu/parse/des.cla.scop.txt_1.55 (July 2001)
c                   @   s*   e Zd ZdZd	ddZdd Zdd ZdS )
Recorda  Holds information for one node in the SCOP hierarchy.

    Attributes:
     - sunid - SCOP unique identifiers
     - nodetype - One of 'cl' (class), 'cf' (fold), 'sf' (superfamily),
       'fa' (family), 'dm' (protein), 'sp' (species), 'px' (domain).
       Additional node types may be added.
     - sccs - SCOP concise classification strings. e.g. b.1.2.1
     - name - The SCOP ID (sid) for domains (e.g. d1anu1), currently empty for other node types
     - description - e.g. "All beta proteins","Fibronectin type III",

    Nc                 C   s4   d| _ d| _d| _d| _d| _|r| | dS dS )zInitialize the class. N)sunidnodetypesccsnamedescription_process)selfline r   @/var/www/html/myenv/lib/python3.10/site-packages/Bio/SCOP/Des.py__init__   s   zRecord.__init__c                 C   s`   |  }|d}t|dkrtd| |\}| _| _| _| _| jdkr)d| _t|| _	dS )zParse DES records (PRIVATE).

        Records consist of 5 tab deliminated fields,
        sunid, node type, sccs, node name, node description.
        	   z!I don't understand the format of -r   N)
rstripsplitlen
ValueErrorr   r   r   r   intr   )r	   r
   columnsr   r   r   r   r   )   s   

zRecord._processc                 C   sf   g }| | j | | j | | j | jr| | j n| d | | j dtt|d S )z@Represent the SCOP description record as a tab-separated string.r   r   
)	appendr   r   r   r   r   joinmapstr)r	   sr   r   r   __str__A   s   
zRecord.__str__)N)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r      s
    

r   c                 c   s&    | D ]}| drqt|V  qdS )zmIterate over a DES file as a Des record for each line.

    Arguments:
     - handle - file-like object

    #N)
startswithr   )handler
   r   r   r   parseO   s   
r%   N)r!   r   r%   r   r   r   r   <module>   s   >