o
    Rŀg
                     @   sJ   d Z ddlmZ ddlmZ ddlmZ G dd dZG dd deZd	S )
z4Abstract base classes for the SearchIO object model.    )Tuple)Union)getattr_strc                   @   s2   e Zd ZU dZdZeeee f ed< dd Z	dS )_BaseSearchObjectz$Abstract class for SearchIO objects. _NON_STICKY_ATTRSc                 C   s,   | j D ]}|| jvrt||| j |  qdS )ae  Transfer instance attributes to the given object (PRIVATE).

        This method is used to transfer attributes set externally (for example
        using ``setattr``) to a new object created from this one (for example
        from slicing).

        The reason this method is necessary is because different parsers will
        set different attributes for each QueryResult, Hit, HSP, or HSPFragment
        objects, depending on the attributes they found in the search output
        file. Ideally, we want these attributes to 'stick' with any new instance
        object created from the original one.

        N)__dict__r   setattr)selfobjattrr   r   M/var/www/html/myenv/lib/python3.10/site-packages/Bio/SearchIO/_model/_base.py_transfer_attrs   s
   

z!_BaseSearchObject._transfer_attrsN)
__name__
__module____qualname____doc__r   r   r   str__annotations__r   r   r   r   r   r      s   
 r   c                   @   s   e Zd ZdZdd ZdS )_BaseHSPz$Abstract base class for HSP objects.c           
   	   C   s&  g }d| j  d| j }t|dkr|dd d n|}d| j d| j }t|dkr4|dd d n|}|| || t| d}t| d	}t| d
}t| d}z| j}| j}	W n t	yo   | j
d }| jd }	Y nw |d| d| d|d |d| d| d|	d d|S )z*Print the alignment header info (PRIVATE).z      Query:  P   NM   z...z        Hit: query_start	query_end	hit_starthit_endr   zQuery range: [:z] ()z  Hit range: [
)query_idquery_descriptionlenhit_idhit_descriptionappendr   query_strand
hit_strand
ValueErrorquery_strand_allhit_strand_alljoin)
r
   linesqid_linehid_liner   r   r   r   qstrandhstrandr   r   r   _str_hsp_header*   s*     








z_BaseHSP._str_hsp_headerN)r   r   r   r   r1   r   r   r   r   r   '   s    r   N)r   typingr   r   Bio.SearchIO._utilsr   r   r   r   r   r   r   <module>   s   