
    {Ti	                     J    d Z  G d d      Z G d d      Z G d d      Zd Zy)	z;Code to interact with the primersearch program from EMBOSS.c                   "    e Zd ZdZd Zd Zd Zy)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 | _         yInitialize the class.Nprimer_infoselfs    J/home/agent/.local/lib/python3.12/site-packages/Bio/Emboss/PrimerSearch.py__init__zInputRecord.__init__   s
        c                 P    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__   sE    &*&6&6 	6"D'7ay'"55F	6r   c                 @    | j                   j                  |||f       y)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Sr   N)__name__
__module____qualname____doc__r   r   r    r   r   r   r      s    Tr   r   c                       e Zd ZdZd Zy)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 | _         y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y)	Amplifierz/Represent a single amplification from a primer.c                      d| _         d| _        y)r   r       N)hit_infolengthr	   s    r   r   zAmplifier.__init__1   s    r   Nr&   r!   r   r   r(   r(   .   s
    9r   r(   c                    t               }| D ]  }|j                         s|j                  d      r#|j                         d   }g |j                  |<   H|j                  d      r)t               }|j                     j                  |       |j                  d      r|j                  dd      _        |j                  d      r$|j                         d   }t        |      _
        xj                  |z  c_         |j                  D ]5  }|j                  |   D ]!  }|j                  j                         |_        # 7 |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   s$   ^F 'zz|__]+::<#D&(Fd#__Z(!Id#**95__^,!%nb!AI__23ZZ\"%F"6{I$&'" !! =**40 	=I!*!3!3!:!:!<I	== Mr   N)r    r   r#   r(   r;   r!   r   r   <module>r<      s0    BT T.	 	 r   