o
    Rŀg	                     @   s:   d Z G dd dZG dd dZG dd dZdd Zd	S )
z;Code to interact with the primersearch program from EMBOSS.c                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	InputRecordzRepresent the input file into the primersearch program.

    This makes it easy to add primer information and write it out to the
    simple primer file format.
    c                 C   s
   g | _ dS Initialize the class.Nprimer_infoself r   K/var/www/html/myenv/lib/python3.10/site-packages/Bio/Emboss/PrimerSearch.py__init__      
zInputRecord.__init__c                 C   s4   d}| j D ]\}}}|| d| d| d7 }q|S )z4Summarize the primersearch input record as a string.  
r   )r   outputnameprimer1primer2r   r   r	   __str__   s   zInputRecord.__str__c                 C   s   | j |||f dS )z%Add primer information to the record.N)r   append)r   primer_namefirst_primer_seqsecond_primer_seqr   r   r	   add_primer_set   s   zInputRecord.add_primer_setN)__name__
__module____qualname____doc__r
   r   r   r   r   r   r	   r      s
    r   c                   @      e Zd ZdZdd ZdS )OutputRecordzRepresent the information from a primersearch job.

    amplifiers is a dictionary where the keys are the primer names and
    the values are a list of PrimerSearchAmplifier objects.
    c                 C   s
   i | _ dS r   )
amplifiersr   r   r   r	   r
   )   r   zOutputRecord.__init__Nr   r   r   r   r
   r   r   r   r	   r   "   s    r   c                   @   r   )	Amplifierz/Represent a single amplification from a primer.c                 C   s   d| _ d| _dS )r   r       N)hit_infolengthr   r   r   r	   r
   1   s   
zAmplifier.__init__Nr    r   r   r   r	   r!   .   s    r!   c                 C   s   t  }| D ]N}| sq|dr| d }g |j|< q|dr.t }|j| | q|dr;|dd|_q|drL| d }t	||_
q| j|7  _q|jD ]}|j| D ]}|j |_q^qW|S )z=Get output from primersearch into a PrimerSearchOutputRecord.zPrimer nameAmplimerz	Sequence: r   z	Amplimer length: )r   strip
startswithsplitr   r!   r   replacer#   intr$   rstrip)handlerecordliner   	amplifierr$   r   r   r	   read7   s*   




r2   N)r   r   r   r!   r2   r   r   r   r	   <module>   s
   	