B
    ‰°b£	  ã               @   s*   d Z ddlmZ G dd„ dƒZdd„ ZdS )a  Handle the SCOP DOMain file.

The DOM file has been officially deprecated. For more information see
the SCOP"release notes.":http://scop.berkeley.edu/release-notes-1.55.html
The DOM files for older releases can be found
"elsewhere at SCOP.":http://scop.mrc-lmb.cam.ac.uk/scop/parse/
é   )ÚResiduesc               @   s*   e Zd ZdZd	dd„Zdd„ Zdd„ ZdS )
ÚRecordzúHolds information for one SCOP domain.

    Attribues:
     - sid - The SCOP ID of the entry, e.g. d1anu1
     - residues - The domain definition as a Residues object
     - hierarchy - A string specifying where this domain is in the hierarchy.

    Nc             C   s$   d| _ g | _d| _|r |  |¡ dS )zInitialize the class.Ú N)ÚsidÚresiduesÚ	hierarchyÚ_process)ÚselfÚline© r   ú+lib/python3.7/site-packages/Bio/SCOP/Dom.pyÚ__init__   s
    zRecord.__init__c             C   sP   |  ¡ }| d¡}t|ƒdkr*td| ƒ‚|\| _}}| _t|ƒ| _|| j_dS )zƒParse DOM records (PRIVATE).

        Records consist of 4 tab deliminated fields;
        sid, pdbid, residues, hierarchy
        ú	é   z#I don't understand the format of %sN)	ÚrstripÚsplitÚlenÚ
ValueErrorr   r   r   r   Úpdbid)r	   r
   Úcolumnsr   Zresr   r   r   r   $   s    

zRecord._processc             C   sB   g }|  | j¡ |  t| jƒ dd¡¡ |  | j¡ d |¡d S )z;Represent the SCOP domain record as a tab-separated string.ú r   Ú
)Úappendr   Ústrr   Úreplacer   Újoin)r	   Úsr   r   r   Ú__str__9   s
    zRecord.__str__)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r      s   
r   c             c   s(   x"| D ]}|  d¡rqt|ƒV  qW dS )zoIterate over a DOM file as a Dom record for each line.

    Arguments:
     - handle -- file-like object.

    ú#N)Ú
startswithr   )Zhandler
   r   r   r   ÚparseB   s    

r$   N)r!   r   r   r$   r   r   r   r   Ú<module>   s   0