
    Xf	                     ^    d Z  G d d          Z G d d          Z G d d          Zd ZdS )	z;Code to interact with the primersearch program from EMBOSS.c                   $    e Zd ZdZd Zd Z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                     g | _         dS Initialize the class.Nprimer_infoselfs    7lib/python3.11/site-packages/Bio/Emboss/PrimerSearch.py__init__zInputRecord.__init__   s        c                 B    d}| j         D ]\  }}}|| d| d| dz  }|S )z4Summarize the primersearch input record as a string.  
r   )r
   outputnameprimer1primer2s        r   __str__zInputRecord.__str__   sJ    &*&6 	6 	6"D'75555'5555FFr   c                 @    | j                             |||f           dS )z%Add primer information to the record.N)r   append)r
   primer_namefirst_primer_seqsecond_primer_seqs       r   add_primer_setzInputRecord.add_primer_set   s(    .>@Q RSSSSSr   N)__name__
__module____qualname____doc__r   r   r    r   r   r   r      sP             T T T T Tr   r   c                       e Zd ZdZ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                     i | _         dS r   )
amplifiersr	   s    r   r   zOutputRecord.__init__)   s    r   Nr   r   r   r    r   r!   r   r   r#   r#   "   s-             r   r#   c                       e Zd ZdZd ZdS )	Amplifierz/Represent a single amplification from a primer.c                 "    d| _         d| _        dS )r   r       N)hit_infolengthr	   s    r   r   zAmplifier.__init__1   s    r   Nr&   r!   r   r   r(   r(   .   s)        99    r   r(   c                    t                      }| D ]}|                                s|                    d          r%|                                d         }g |j        |<   R|                    d          r/t                      }|j        |                             |           |                    d          r|                    dd          |_        |                    d          r0|                                d         }t          |          |_
        |xj        |z  c_        |j        D ]0}|j        |         D ] }|j                                        |_        !1|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,   s         r   readr;   7   sj   ^^F ' 'zz|| 	'__]++ 	'::<<#D&(Fd##__Z(( 		'!Id#**95555__^,, 	'!%nb!A!AI__233 	'ZZ\\"%F"6{{I$&! = =*40 	= 	=I!*!3!:!:!<!<I	= Mr   N)r    r   r#   r(   r;   r!   r   r   <module>r<      s    B AT T T T T T T T.	 	 	 	 	 	 	 	           r   