
Hc           @   s=  d  Z  d d l Z d d l Z y
 e Z Wn! e k
 rK d d l m Z n Xd d l m Z m	 Z	 d d l
 m Z d d l m Z m Z m Z d d l Td d l m Z d d	 l m Z i d
 d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d  d! 6d" d# 6d$ d% 6d& d' 6Z e Z d( e f d)     YZ d* e f d+     YZ d, e f d-     YZ d. e f d/     YZ d0 e f d1     YZ d2 e f d3     YZ  d4 e f d5     YZ! d6 e f d7     YZ" d8 e f d9     YZ# d: e f d;     YZ$ d< e f d=     YZ% d> e f d?     YZ& d@ e f dA     YZ' dB e f dC     YZ( dD e f dE     YZ) dF e f dG     YZ* dH e f dI     YZ+ dJ e f dK     YZ, dL e f dM     YZ- dN e f dO     YZ. dP e. e f dQ     YZ/ e.   Z0 e.   Z1 x e j2   D] \ Z3 \ Z4 Z5 e6 g  e4 D] Z7 e8 e7  ^ q9 Z4 e j9 e d* e4 i   Z: xM e5 D]E Z; e: e; e4 e e;  Z< e< j=   re0 j> e<  n e1 j> e<  qsWqWe0 e1 BZ? g  e? D] Z7 e@ e7  ^ qZA eB   jC eD eE eF eA e?    d( dP dN dR dS dT g eA ZG [; [7 [5 [3 [4 [A d S(U   s,   Notes about the diverses class of the restriction enzyme implementation.

        RestrictionType is the type of all restriction enzymes.
    ----------------------------------------------------------------------------
        AbstractCut implements some methods that are common to all enzymes.
    ----------------------------------------------------------------------------
        NoCut, OneCut,TwoCuts   represent the number of double strand cuts
                                produced by the enzyme.
                                they correspond to the 4th field of the rebase
                                record emboss_e.NNN.
                0->NoCut    : the enzyme is not characterised.
                2->OneCut   : the enzyme produce one double strand cut.
                4->TwoCuts  : two double strand cuts.
    ----------------------------------------------------------------------------
        Meth_Dep, Meth_Undep    represent the methylation susceptibility to
                                the enzyme.
                                Not implemented yet.
    ----------------------------------------------------------------------------
        Palindromic,            if the site is palindromic or not.
        NotPalindromic          allow some optimisations of the code.
                                No need to check the reverse strand
                                with palindromic sites.
    ----------------------------------------------------------------------------                                    
        Unknown, Blunt,         represent the overhang.
        Ov5, Ov3                Unknown is here for symetry reasons and
                                correspond to enzymes that are not characterised
                                in rebase.
    ----------------------------------------------------------------------------
        Defined, Ambiguous,     represent the sequence of the overhang.
        NotDefined             
                                NotDefined is for enzymes not characterised in
                                rebase.
                                
                                Defined correspond to enzymes that display a
                                constant overhang whatever the sequence.
                                ex : EcoRI. G^AATTC -> overhang :AATT
                                            CTTAA^G

                                Ambiguous : the overhang varies with the
                                sequence restricted.
                                Typically enzymes which cut outside their
                                restriction site or (but not always)
                                inside an ambiguous site.
                                ex :
                                AcuI CTGAAG(22/20)  -> overhang : NN
                                AasI GACNNN^NNNGTC  -> overhang : NN
                                     CTGN^NNNNNCAG

            note : these 3 classes refers to the overhang not the site.
               So the enzyme ApoI (RAATTY) is defined even if its restriction
               site is ambiguous.
                                
                    ApoI R^AATTY -> overhang : AATT -> Defined
                         YTTAA^R
               Accordingly, blunt enzymes are always Defined even
               when they cut outside their restriction site.
    ----------------------------------------------------------------------------
        Not_available,          as found in rebase file emboss_r.NNN files.
        Commercially_available
                                allow the selection of the enzymes according to
                                their suppliers to reduce the quantity
                                of results.
                                Also will allow the implementation of buffer
                                compatibility tables. Not implemented yet.

                                the list of suppliers is extracted from
                                emboss_s.NNN
    ----------------------------------------------------------------------------
        iN(   t   Set(   t   Seqt
   MutableSeq(   t   IUPAC(   t	   rest_dictt   typedictt	   suppliers(   t   *(   t   PrintFormat(   t   check_basest   ARWMHVDNt   At   CYSMHBVNt   Ct   GRSKBVDNt   Gt   TYWKHBDNt   Tt   ABDGHKMNSRWVt   Rt   CBDHKMNSTWVYt   Yt   ABDHKMNRTWVYt   Wt   CBDGHKMNSRVYt   St   ACBDHMNSRWVYt   Mt   BDGHKNSRTWVYt   Kt   ACBDHKMNSRTWVYt   Ht   CBDGHKMNSRTWVYt   Bt   ACBDGHKMNSRWVYt   Vt   ABDGHKMNSRTWVYt   Dt   ACBDGHKMNSRTWVYt   Nt   FormattedSeqc           B   st   e  Z d  Z e d  Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z d   Z RS(   s  FormattedSeq(seq, [linear=True])-> new FormattedSeq.

    Translate a Bio.Seq into a formatted sequence to be used with Restriction.

    Roughly :
        remove anything which is not IUPAC alphabet and then add a space
        in front of the sequence to get a biological index instead of a
        python index (i.e. index of the first base is 1 not 0).

        Retains information about the shape of the molecule linear (default)
        or circular. Restriction sites are search over the edges of circular
        sequence.c         C   s   t  | t  s t  | t  rl | j   } | j   |  _ t |  |  _ | |  _ | j	 |  _
 | j |  _ nd t  | t  r | j |  _ | j |  _ | j |  _ | j |  _ | j
 |  _
 n t d t |    d S(   s   FormattedSeq(seq, [linear=True])-> new FormattedSeq.

        seq is either a Bio.Seq, Bio.MutableSeq or a FormattedSeq.
        if seq is a FormattedSeq, linear will have no effect on the
        shape of the sequence.s"   expected Seq or MutableSeq, got %sN(   t
   isinstanceR   R   t   tostringt   islowert   lowerR	   t   datat   lineart	   __class__t   klasst   alphabetR(   t	   TypeErrort   type(   t   selft   seqR.   t   stringy(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __init__|   s    	c         C   s   t  |  j  d S(   Ni   (   t   lenR-   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __len__   s    c         C   s!   d t  |  d  t  |  j  f S(   Ns   FormattedSeq(%s, linear=%s)i   (   t   reprR.   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __repr__   s    c         C   s6   t  | t  r2 t |   t |  k r+ t St Sn  t S(   N(   R)   R(   R:   t   Truet   False(   R4   t   other(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __eq__   s
    c         C   s   t  |  _ d S(   s"   FS.circularise() -> circularise FSN(   R=   R.   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   circularise   s    	c         C   s   t  |  _ d S(   s   FS.linearise() -> linearise FSN(   R<   R.   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt	   linearise   s    	c         C   s   |  j  |   } t | _ | S(   s(   FS.to_linear() -> new linear FS instance(   R/   R<   R.   (   R4   t   new(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt	   to_linear   s    	c         C   s   |  j  |   } t | _ | S(   s,   FS.to_circular() -> new circular FS instance(   R/   R=   R.   (   R4   RB   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   to_circular   s    	c         C   s   |  j  S(   sY   FS.is_linear() -> bool.

        True if the sequence will analysed as a linear sequence.(   R.   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt	   is_linear   s    c         C   se   |  j    r |  j } n |  j |  j d | d !} g  t j | |  D] } | j   | j f ^ qF S(   s~  FS.finditer(pattern, size) -> list.

        return a list of pattern into the sequence.
        the list is made of tuple (location, pattern.group).
        the latter is used with non palindromic sites.
        pattern is the regular expression pattern corresponding to the
        enzyme restriction site.
        size is the size of the restriction enzyme recognition-site size.i   (   RE   R-   t   ret   finditert   startt   group(   R4   t   patternt   sizeR-   t   i(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyRG      s    	c         C   sC   |  j  r) |  j |  j | j    |  j  S|  j |  j | |  j  S(   N(   R,   R0   R-   R1   (   R4   RL   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __getitem__   s    	 (   t   __name__t
   __module__t   __doc__R<   R7   R9   R;   R?   R@   RA   RC   RD   RE   RG   RM   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR(   n   s   									t   RestrictionTypec           B   s   e  Z d  Z d d i  d  Z d   Z d   Z d   Z d   Z d   Z d   Z	 d	   Z
 d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sa   RestrictionType. Type from which derives all enzyme classes.

    Implement the operator methods.t    c         C   s8   t  t |   j |  | | |  t j |  j  |  _ d S(   s   RE(name, bases, dct) -> RestrictionType instance.

        Not intended to be used in normal operation. The enzymes are
        instantiated when importing the module.
        
        see below.N(   t   superRQ   R7   RF   t   compilet   compsite(   t   clst   namet   basest   dct(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR7      s    c         C   sE   t  | t  r t |  | g  St  | t  r; | j |   St  d S(   s   RE.__add__(other) -> RestrictionBatch().

        if other is an enzyme returns a batch of the two enzymes.
        if other is already a RestrictionBatch add enzyme to it.N(   R)   RQ   t   RestrictionBatcht   add_nocheckR2   (   RV   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __add__   s
    c         C   s   |  j  |  S(   sN   RE.__div__(other) -> list.

        RE/other
        returns RE.search(other).(   t   search(   RV   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __div__   s    c         C   s   |  j  |  S(   sO   RE.__rdiv__(other) -> list.

        other/RE
        returns RE.search(other).(   R]   (   RV   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __rdiv__   s    c         C   s   |  j  |  S(   sR   RE.__truediv__(other) -> list.

        RE/other
        returns RE.search(other).(   R]   (   RV   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __truediv__   s    c         C   s   |  j  |  S(   sS   RE.__rtruediv__(other) -> list.

        other/RE
        returns RE.search(other).(   R]   (   RV   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __rtruediv__  s    c         C   s   |  j  |  S(   sV   RE.__floordiv__(other) -> list.

        RE//other
        returns RE.catalyse(other).(   t   catalyse(   RV   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __floordiv__  s    c         C   s   |  j  |  S(   sW   RE.__rfloordiv__(other) -> list.

        other//RE
        returns RE.catalyse(other).(   Rb   (   RV   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __rfloordiv__  s    c         C   s   |  j  S(   s<   RE.__str__() -> str.

        return the name of the enzyme.(   RN   (   RV   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __str__  s    c         C   s   d |  j  S(   sR   RE.__repr__() -> str.

        used with eval or exec will instantiate the enzyme.s   %s(   RN   (   RV   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR;     s    c         C   s   |  j  S(   s=   RE.__len__() -> int.

        length of the recognition site.(   RK   (   RV   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR9   "  s    c         C   s
   | |  k S(   sF   RE == other -> bool

        True if RE and other are the same enzyme.(    (   RV   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR?   (  s    c         C   s1   t  | t  s t S|  j | j k r) t St Sd S(   s   RE != other -> bool.
        isoschizomer strict, same recognition site, same restriction -> False
        all the other-> TrueN(   R)   RQ   R<   t   characR=   (   RV   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __ne__.  s
    c         C   sC   t  | t  s t S|  j | j k r; |  j | j k r; t St Sd S(   s   RE >> other -> bool.
        
        neoschizomer : same recognition site, different restriction. -> True
        all the others :                                             -> FalseN(   R)   RQ   R=   t   siteRf   R<   (   RV   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt
   __rshift__9  s
    $c         C   s5   t  | t  s( t d t |    n  |  j |  S(   sx   a % b -> bool.

        Test compatibility of the overhang of a and b.
        True if a and b have compatible overhang.s(   expected RestrictionType, got %s instead(   R)   RQ   R2   R3   t   _mod1(   RV   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __mod__E  s    c         C   sg   t  | t  s t  n  t |   t |  k r4 t S|  j t |  k r_ |  j | j k r_ t St Sd S(   s   a >= b -> bool.

        a is greater or equal than b if the a site is longer than b site.
        if their site have the same length sort by alphabetical order of their
        names.N(   R)   RQ   t   NotImplementedErrorR8   R<   RK   RN   R=   (   RV   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __ge__O  s    	'c         C   sg   t  | t  s t  n  t |   t |  k r4 t S|  j t |  k r_ |  j | j k r_ t St Sd S(   s   a > b -> bool.

        sorting order :
                    1. size of the recognition site.
                    2. if equal size, alphabetical order of the names.N(   R)   RQ   Rl   R8   R<   RK   RN   R=   (   RV   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __gt__^  s    	'c         C   sj   t  | t  s t  nN t |   t |  k  r4 t St |   t |  k rb |  j | j k rb t St Sd S(   s   a <= b -> bool.

        sorting order :
                    1. size of the recognition site.
                    2. if equal size, alphabetical order of the names.N(   R)   RQ   Rl   R8   R<   RN   R=   (   RV   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __le__m  s    	*c         C   sj   t  | t  s t  nN t |   t |  k  r4 t St |   t |  k rb |  j | j k  rb t St Sd S(   s   a < b -> bool.

        sorting order :
                    1. size of the recognition site.
                    2. if equal size, alphabetical order of the names.N(   R)   RQ   Rl   R8   R<   RN   R=   (   RV   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __lt__|  s    	*(    (   RN   RO   RP   R7   R\   R^   R_   R`   Ra   Rc   Rd   Re   R;   R9   R?   Rg   Ri   Rk   Rm   Rn   Ro   Rp   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyRQ      s(   
														
			t   AbstractCutc           B   s   e  Z d  Z e d  Z e e  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z	 e e	  Z	 d
 d  Z e e  Z d
 d  Z e e  Z d
 d  Z e e  Z d	   Z e e  Z RS(   s   Implement the methods that are common to all restriction enzymes.

    All the methods are classmethod.

    For internal use only. Not meant to be instantiate.c         C   sB   t  | t  r" | |  _ |  j   St | |  |  _ |  j   Sd S(   s  RE.search(dna, linear=True) -> list.

        return a list of all the site of RE in dna. Compensate for circular
        sequences and so on.

        dna must be a Bio.Seq.Seq instance or a Bio.Seq.MutableSeq instance.
        
        if linear is False, the restriction sites than span over the boundaries
        will be included.

        The positions are the first base of the 3' fragment,
        i.e. the first base after the position the enzyme will cut. N(   R)   R(   t   dnat   _search(   RV   Rr   R.   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR]     s
    	
c         C   s?   g  t  j   D] } | d ^ q } | j   d j |  GHd S(   s0   RE.all_suppliers -> print all the suppliers of Ri    s   ,
N(   t   suppliers_dictt
   itervaluest   sortt   join(   R4   t   xt   supply(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   all_suppliers  s    #
c         C   s   |  | k S(   s   RE.is_equischizomers(other) -> bool.

        True if other is an isoschizomer of RE.
        False else.

        equischizomer <=> same site, same position of restriction.(    (   R4   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   is_equischizomer  s    c         C   s   |  | ?S(   s   RE.is_neoschizomers(other) -> bool.

        True if other is an isoschizomer of RE.
        False else.

        neoschizomer <=> same site, different position of restriction.(    (   R4   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   is_neoschizomer  s    c         C   s   |  | k p |  | ?S(   s   RE.is_isoschizomers(other) -> bool.

        True if other is an isoschizomer of RE.
        False else.

        isoschizomer <=> same site.(    (   R4   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   is_isoschizomer  s    c         C   sX   | s t  } n  g  | D] } |  | k s | ^ q } | j |   } | | =| j   | S(   s   RE.equischizomers([batch]) -> list.

        return a tuple of all the isoschizomers of RE.
        if batch is supplied it is used instead of the default AllEnzymes.

        equischizomer <=> same site, same position of restriction.(   t
   AllEnzymest   indexRv   (   R4   t   batchRx   t   rRL   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   equischizomers  s     	%
c         C   s@   | s t  } n  g  | D] } |  | ?r | ^ q } | j   | S(   s   RE.neoschizomers([batch]) -> list.

        return a tuple of all the neoschizomers of RE.
        if batch is supplied it is used instead of the default AllEnzymes.

        neoschizomer <=> same site, different position of restriction.(   R~   Rv   (   R4   R   Rx   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   neoschizomers  s
     	#
c         C   sc   | s t  } n  g  | D]# } |  | ?s3 |  | k r | ^ q } | j |   } | | =| j   | S(   s   RE.isoschizomers([batch]) -> list.

        return a tuple of all the equischizomers and neoschizomers of RE.
        if batch is supplied it is used instead of the default AllEnzymes.(   R~   R   Rv   (   R4   R   Rx   R   RL   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   isoschizomers  s     	0
c         C   s   |  j  S(   s6   RE.frequency() -> int.

        frequency of the site.(   t   freq(   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt	   frequency  s    N(   RN   RO   RP   R<   R]   t   classmethodRz   R{   R|   R}   t   NoneR   R   R   R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyRq     s&   					t   NoCutc           B   sw   e  Z d  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z RS(   s`  Implement the methods specific to the enzymes that do not cut.

    These enzymes are generally enzymes that have been only partially
    characterised and the way they cut the DNA is unknow or enzymes for
    which the pattern of cut is to complex to be recorded in Rebase
    (ncuts values of 0 in emboss_e.###).

    When using search() with these enzymes the values returned are at the start of
    the restriction site.

    Their catalyse() method returns a TypeError.

    Unknown and NotDefined are also part of the base classes of these enzymes.

    Internal use only. Not meant to be instantiated.c         C   s   t  S(   s\   RE.cut_once() -> bool.

        True if the enzyme cut the sequence one time on each strand.(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   cut_once  s    c         C   s   t  S(   sZ   RE.cut_twice() -> bool.

        True if the enzyme cut the sequence twice on each strand.(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt	   cut_twice  s    c         c   s	   | Vd S(   s  RE._modify(location) -> int.

        for internal use only.
        
        location is an integer corresponding to the location of the match for
        the enzyme pattern in the sequence.
        _modify returns the real place where the enzyme will cut.

        example :
            EcoRI pattern : GAATTC
            EcoRI will cut after the G.
            so in the sequence :
                     ______
            GAATACACGGAATTCGA
                     |
                     10
            dna.finditer(GAATTC, 6) will return 10 as G is the 10th base
            EcoRI cut after the G so :
            EcoRI._modify(10) -> 11.

        if the enzyme cut twice _modify will returns two integer corresponding
        to each cutting site.
        N(    (   R4   t   location(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   _modify%  s    c         c   s	   | Vd S(   s   RE._rev_modify(location) -> generator of int.

        for internal use only.
        
        as _modify for site situated on the antiparallel strand when the
        enzyme is not palindromic
        N(    (   R4   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   _rev_modify@  s    c         C   s   d d d d |  j f S(   sg  RE.characteristic() -> tuple.

        the tuple contains the attributes :
            fst5 -> first 5' cut ((current strand) or None
            fst3 -> first 3' cut (complementary strand) or None
            scd5 -> second 5' cut (current strand) or None
            scd5 -> second 3' cut (complementary strand) or None
            site -> recognition site.N(   R   Rh   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   characteristicK  s    	(	   RN   RO   RP   R   R   R   R   R   R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s   						
t   OneCutc           B   sw   e  Z d  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z RS(   s   Implement the methods specific to the enzymes that cut the DNA only once

    Correspond to ncuts values of 2 in emboss_e.###

    Internal use only. Not meant to be instantiated.c         C   s   t  S(   s\   RE.cut_once() -> bool.

        True if the enzyme cut the sequence one time on each strand.(   R<   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   ^  s    c         C   s   t  S(   sZ   RE.cut_twice() -> bool.

        True if the enzyme cut the sequence twice on each strand.(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   e  s    c         c   s   | |  j  Vd S(   s  RE._modify(location) -> int.

        for internal use only.
        
        location is an integer corresponding to the location of the match for
        the enzyme pattern in the sequence.
        _modify returns the real place where the enzyme will cut.

        example :
            EcoRI pattern : GAATTC
            EcoRI will cut after the G.
            so in the sequence :
                     ______
            GAATACACGGAATTCGA
                     |
                     10
            dna.finditer(GAATTC, 6) will return 10 as G is the 10th base
            EcoRI cut after the G so :
            EcoRI._modify(10) -> 11.

        if the enzyme cut twice _modify will returns two integer corresponding
        to each cutting site.
        N(   t   fst5(   R4   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   l  s    c         c   s   | |  j  Vd S(   s   RE._rev_modify(location) -> generator of int.

        for internal use only.
        
        as _modify for site situated on the antiparallel strand when the
        enzyme is not palindromic
        N(   t   fst3(   R4   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    c         C   s   |  j  |  j d d |  j f S(   sg  RE.characteristic() -> tuple.

        the tuple contains the attributes :
            fst5 -> first 5' cut ((current strand) or None
            fst3 -> first 3' cut (complementary strand) or None
            scd5 -> second 5' cut (current strand) or None
            scd5 -> second 3' cut (complementary strand) or None
            site -> recognition site.N(   R   R   R   Rh   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    	(	   RN   RO   RP   R   R   R   R   R   R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   W  s   						
t   TwoCutsc           B   sw   e  Z d  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z RS(   s   Implement the methods specific to the enzymes that cut the DNA twice

    Correspond to ncuts values of 4 in emboss_e.###

    Internal use only. Not meant to be instantiated.c         C   s   t  S(   s\   RE.cut_once() -> bool.

        True if the enzyme cut the sequence one time on each strand.(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    c         C   s   t  S(   sZ   RE.cut_twice() -> bool.

        True if the enzyme cut the sequence twice on each strand.(   R<   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    c         c   s   | |  j  V| |  j Vd S(   s  RE._modify(location) -> int.

        for internal use only.
        
        location is an integer corresponding to the location of the match for
        the enzyme pattern in the sequence.
        _modify returns the real place where the enzyme will cut.

        example :
            EcoRI pattern : GAATTC
            EcoRI will cut after the G.
            so in the sequence :
                     ______
            GAATACACGGAATTCGA
                     |
                     10
            dna.finditer(GAATTC, 6) will return 10 as G is the 10th base
            EcoRI cut after the G so :
            EcoRI._modify(10) -> 11.

        if the enzyme cut twice _modify will returns two integer corresponding
        to each cutting site.
        N(   R   t   scd5(   R4   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    c         c   s   | |  j  V| |  j Vd S(   s   RE._rev_modify(location) -> generator of int.

        for internal use only.
        
        as _modify for site situated on the antiparallel strand when the
        enzyme is not palindromic
        N(   R   t   scd3(   R4   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    c         C   s"   |  j  |  j |  j |  j |  j f S(   sg  RE.characteristic() -> tuple.

        the tuple contains the attributes :
            fst5 -> first 5' cut ((current strand) or None
            fst3 -> first 3' cut (complementary strand) or None
            scd5 -> second 5' cut (current strand) or None
            scd5 -> second 3' cut (complementary strand) or None
            site -> recognition site.(   R   R   R   R   Rh   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    	(	   RN   RO   RP   R   R   R   R   R   R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s   				
	
t   Meth_Depc           B   s#   e  Z d  Z d   Z e e  Z RS(   sk   Implement the information about methylation.

    Enzymes of this class possess a site which is methylable.c         C   s   t  S(   sR   RE.is_methylable() -> bool.

        True if the recognition site is a methylable.(   R<   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   is_methylable  s    (   RN   RO   RP   R   R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s   	t
   Meth_Undepc           B   s#   e  Z d  Z d   Z e e  Z RS(   ss   Implement informations about methylation sensitibility.

    Enzymes of this class are not sensible to methylation.c         C   s   t  S(   sR   RE.is_methylable() -> bool.

        True if the recognition site is a methylable.(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    (   RN   RO   RP   R   R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s   	t   Palindromicc           B   s8   e  Z d  Z d   Z e e  Z d   Z e e  Z RS(   s  Implement the methods specific to the enzymes which are palindromic

    palindromic means : the recognition site and its reverse complement are
                        identical.
    Remarks     : an enzyme with a site CGNNCG is palindromic even if some
                  of the sites that it will recognise are not.
                  for example here : CGAACG

    Internal use only. Not meant to be instantiated.c         C   sp   |  j  j |  j |  j  } g  | D]( \ } } |  j |  D] } | ^ q; q" |  _ |  j ri |  j   n  |  j S(   s   RE._search() -> list.

        for internal use only.

        implement the search method for palindromic and non palindromic enzyme.
        (   Rr   RG   RU   RK   R   t   resultst   _drop(   R4   t   siteloct   st   gR   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyRs     s
    8	 c         C   s   t  S(   sR   RE.is_palindromic() -> bool.

        True if the recognition site is a palindrom.(   R<   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   is_palindromic  s    (   RN   RO   RP   Rs   R   R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s
   			t   NonPalindromicc           B   s8   e  Z d  Z d   Z e e  Z d   Z e e  Z RS(   s   Implement the methods specific to the enzymes which are not palindromic

    palindromic means : the recognition site and its reverse complement are
                        identical.

    Internal use only. Not meant to be instantiated.c         C   s   |  j  j |  j |  j  } g  |  _ |  j } |  j } t |   } g  |  _ xs | D]k \ } } | |  r |  j g  | |  D] } | ^ q~ 7_ qR |  j g  | |  D] } | ^ q 7_ qR W|  j |  j 7_ |  j r |  j j	   |  j
   n  |  j S(   s   RE._search() -> list.

        for internal use only.

        implement the search method for palindromic and non palindromic enzyme.
        (   Rr   RG   RU   RK   R   R   R   t   strt   on_minusRv   R   (   R4   t   iteratort   modift   revmodifR   RH   RI   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyRs   )  s    				+,	c         C   s   t  S(   sR   RE.is_palindromic() -> bool.

        True if the recognition site is a palindrom.(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   B  s    (   RN   RO   RP   Rs   R   R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   !  s
   		t   Unknownc           B   s   e  Z d  Z e d  Z e e  Z Z d   Z e e  Z d   Z e e  Z d   Z	 e e	  Z	 d   Z
 e e
  Z
 d   Z e e  Z d   Z e e  Z RS(   s   Implement the methods specific to the enzymes for which the overhang
    is unknown.

    These enzymes are also NotDefined and NoCut.

    Internal use only. Not meant to be instantiated.c         C   s   t  d |  j   d S(   s  RE.catalyse(dna, linear=True) -> tuple of DNA.
        RE.catalyze(dna, linear=True) -> tuple of DNA.

        return a tuple of dna as will be produced by using RE to restrict the
        dna.
        
        dna must be a Bio.Seq.Seq instance or a Bio.Seq.MutableSeq instance.
        
        if linear is False, the sequence is considered to be circular and the
        output will be modified accordingly.s   %s restriction is unknown.N(   Rl   RN   (   R4   Rr   R.   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyRb   Q  s    c         C   s   t  S(   s   RE.is_blunt() -> bool.

        True if the enzyme produces blunt end.

        see also :
            RE.is_3overhang()
            RE.is_5overhang()
            RE.is_unknown()(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   is_blunt`  s    	c         C   s   t  S(   s   RE.is_5overhang() -> bool.

        True if the enzyme produces 5' overhang sticky end.

        see also :
            RE.is_3overhang()
            RE.is_blunt()
            RE.is_unknown()(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   is_5overhangl  s    	c         C   s   t  S(   s   RE.is_3overhang() -> bool.

        True if the enzyme produces 3' overhang sticky end.

        see also :
            RE.is_5overhang()
            RE.is_blunt()
            RE.is_unknown()(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   is_3overhangx  s    	c         C   s   d S(   sz   RE.overhang() -> str. type of overhang of the enzyme.,

        can be "3' overhang", "5' overhang", "blunt", "unknown"   t   unknown(    (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   overhang  s    c         C   s   g  S(   s`   RE.compatible_end() -> list.

        list of all the enzymes that share compatible end with RE.(    (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   compatible_end  s    c         C   s   t  S(   s   RE._mod1(other) -> bool.

        for internal use only
        
        test for the compatibility of restriction ending of RE and other.(   R=   (   R4   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyRj     s    (   RN   RO   RP   R<   Rb   R   t   catalyzeR   R   R   R   R   Rj   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   I  s   	
	
	
			t   Bluntc           B   s   e  Z d  Z e d  Z e e  Z Z d   Z e e  Z d   Z e e  Z d   Z	 e e	  Z	 d   Z
 e e
  Z
 d d  Z e e  Z d   Z e e  Z RS(	   s   Implement the methods specific to the enzymes for which the overhang
    is blunt.

    The enzyme cuts the + strand and the - strand of the DNA at the same
    place.
    
    Internal use only. Not meant to be instantiated.c         C   s1  |  j  | |  } |  j } | s, | d f Sg  } t |  d } | j   r | j | d | d ! | r | g  t |  D] } | | | | | d !^ q| 7} n  | j | | d  nj | j | | d | d | d ! | s t |  S| g  t |  D] } | | | | | d !^ q7} t |  S(   s  RE.catalyse(dna, linear=True) -> tuple of DNA.
        RE.catalyze(dna, linear=True) -> tuple of DNA.

        return a tuple of dna as will be produced by using RE to restrict the
        dna.
        
        dna must be a Bio.Seq.Seq instance or a Bio.Seq.MutableSeq instance.
        
        if linear is False, the sequence is considered to be circular and the
        output will be modified accordingly.i   i    i(   R]   Rr   R8   RE   t   appendt   xranget   tuple(   R4   Rr   R.   R   t   dt	   fragmentst   lengthRx   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyRb     s     	 9$
6c         C   s   t  S(   s   RE.is_blunt() -> bool.

        True if the enzyme produces blunt end.

        see also :
            RE.is_3overhang()
            RE.is_5overhang()
            RE.is_unknown()(   R<   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    	c         C   s   t  S(   s   RE.is_5overhang() -> bool.

        True if the enzyme produces 5' overhang sticky end.

        see also :
            RE.is_3overhang()
            RE.is_blunt()
            RE.is_unknown()(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    	c         C   s   t  S(   s   RE.is_3overhang() -> bool.

        True if the enzyme produces 3' overhang sticky end.

        see also :
            RE.is_5overhang()
            RE.is_blunt()
            RE.is_unknown()(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    	c         C   s   d S(   sz   RE.overhang() -> str. type of overhang of the enzyme.,

        can be "3' overhang", "5' overhang", "blunt", "unknown"   t   blunt(    (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    c         C   sH   | s t  } n  g  t t   D] } | j   r | ^ q } | j   | S(   s`   RE.compatible_end() -> list.

        list of all the enzymes that share compatible end with RE.(   R~   t   iterR   Rv   (   R4   R   Rx   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s
     	+
c         C   s   t  |  t  r t St Sd S(   s   RE._mod1(other) -> bool.

        for internal use only
        
        test for the compatibility of restriction ending of RE and other.N(   t
   issubclassR   R<   R=   (   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyRj     s     N(   RN   RO   RP   R<   Rb   R   R   R   R   R   R   R   R   Rj   t   staticmethod(    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s   -	
	
	
		t   Ov5c           B   s   e  Z d  Z e d  Z e e  Z Z d   Z e e  Z d   Z e e  Z d   Z	 e e	  Z	 d   Z
 e e
  Z
 d d  Z e e  Z d   Z e e  Z RS(	   s   Implement the methods specific to the enzymes for which the overhang
    is recessed in 3'.

    The enzyme cuts the + strand after the - strand of the DNA.
    
    Internal use only. Not meant to be instantiated.c         C   s1  |  j  | |  } |  j } | s, | d f St |  d } g  } | j   r | j | d | d ! | r | g  t |  D] } | | | | | d !^ q| 7} n  | j | | d  nj | j | | d | d | d ! | s t |  S| g  t |  D] } | | | | | d !^ q7} t |  S(   s  RE.catalyse(dna, linear=True) -> tuple of DNA.
        RE.catalyze(dna, linear=True) -> tuple of DNA.

        return a tuple of dna as will be produced by using RE to restrict the
        dna.
        
        dna must be a Bio.Seq.Seq instance or a Bio.Seq.MutableSeq instance.
        
        if linear is False, the sequence is considered to be circular and the
        output will be modified accordingly.i   i    i(   R]   Rr   R8   RE   R   R   R   (   R4   Rr   R.   R   R   R   R   Rx   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyRb     s     	 9$
6c         C   s   t  S(   s   RE.is_blunt() -> bool.

        True if the enzyme produces blunt end.

        see also :
            RE.is_3overhang()
            RE.is_5overhang()
            RE.is_unknown()(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   I  s    	c         C   s   t  S(   s   RE.is_5overhang() -> bool.

        True if the enzyme produces 5' overhang sticky end.

        see also :
            RE.is_3overhang()
            RE.is_blunt()
            RE.is_unknown()(   R<   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   U  s    	c         C   s   t  S(   s   RE.is_3overhang() -> bool.

        True if the enzyme produces 3' overhang sticky end.

        see also :
            RE.is_5overhang()
            RE.is_blunt()
            RE.is_unknown()(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   a  s    	c         C   s   d S(   sz   RE.overhang() -> str. type of overhang of the enzyme.,

        can be "3' overhang", "5' overhang", "blunt", "unknown"   s   5' overhang(    (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   m  s    c         C   sR   | s t  } n  g  t t   D]" } | j   r | |  r | ^ q } | j   | S(   s`   RE.compatible_end() -> list.

        list of all the enzymes that share compatible end with RE.(   R~   R   R   Rv   (   R4   R   Rx   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   t  s
     	5
c         C   s$   t  | t  r |  j |  St Sd S(   s   RE._mod1(other) -> bool.

        for internal use only
        
        test for the compatibility of restriction ending of RE and other.N(   R   R   t   _mod2R=   (   R4   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyRj   ~  s     N(   RN   RO   RP   R<   Rb   R   R   R   R   R   R   R   R   Rj   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s   -	
	
	
		t   Ov3c           B   s   e  Z d  Z e d  Z e e  Z Z d   Z e e  Z d   Z e e  Z d   Z	 e e	  Z	 d   Z
 e e
  Z
 d d  Z e e  Z d   Z e e  Z RS(	   s   Implement the methods specific to the enzymes for which the overhang
    is recessed in 5'.

    The enzyme cuts the - strand after the + strand of the DNA.
    
    Internal use only. Not meant to be instantiated.c         C   s1  |  j  | |  } |  j } | s, | d f Sg  } t |  d } | j   r | j | d | d ! | r | g  t |  D] } | | | | | d !^ q| 7} n  | j | | d  nj | j | | d | d | d ! | s t |  S| g  t |  D] } | | | | | d !^ q7} t |  S(   s  RE.catalyse(dna, linear=True) -> tuple of DNA.
        RE.catalyze(dna, linear=True) -> tuple of DNA.

        return a tuple of dna as will be produced by using RE to restrict the
        dna.
        
        dna must be a Bio.Seq.Seq instance or a Bio.Seq.MutableSeq instance.
        
        if linear is False, the sequence is considered to be circular and the
        output will be modified accordingly.i   i    i(   R]   Rr   R8   RE   R   R   R   (   R4   Rr   R.   R   R   R   R   Rx   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyRb     s     	 9$
6c         C   s   t  S(   s   RE.is_blunt() -> bool.

        True if the enzyme produces blunt end.

        see also :
            RE.is_3overhang()
            RE.is_5overhang()
            RE.is_unknown()(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    	c         C   s   t  S(   s   RE.is_5overhang() -> bool.

        True if the enzyme produces 5' overhang sticky end.

        see also :
            RE.is_3overhang()
            RE.is_blunt()
            RE.is_unknown()(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    	c         C   s   t  S(   s   RE.is_3overhang() -> bool.

        True if the enzyme produces 3' overhang sticky end.

        see also :
            RE.is_5overhang()
            RE.is_blunt()
            RE.is_unknown()(   R<   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    	c         C   s   d S(   sz   RE.overhang() -> str. type of overhang of the enzyme.,

        can be "3' overhang", "5' overhang", "blunt", "unknown"   s   3' overhang(    (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    c         C   sR   | s t  } n  g  t t   D]" } | j   r | |  r | ^ q } | j   | S(   s`   RE.compatible_end() -> list.

        list of all the enzymes that share compatible end with RE.(   R~   R   R   Rv   (   R4   R   Rx   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s
     	5
c         C   s$   t  | t  r |  j |  St Sd S(   s   RE._mod1(other) -> bool.

        for internal use only
        
        test for the compatibility of restriction ending of RE and other.N(   R   R   R   R=   (   R4   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyRj     s    	 N(   RN   RO   RP   R<   Rb   R   R   R   R   R   R   R   R   Rj   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s   -	
	
	
		t   Definedc           B   s   e  Z d  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z	 e e	  Z	 RS(   s  Implement the methods specific to the enzymes for which the overhang
    and the cut are not variable.

    Typical example : EcoRI -> G^AATT_C
                      The overhang will always be AATT
    Notes :
        Blunt enzymes are always defined. even if there site is GGATCCNNN^_N
        There overhang is always the same : blunt!
    
    Internal use only. Not meant to be instantiated.c            s+  t  |  j    t j } t j } |  j j   r g  | d   |  j  D] } | ^ qF |  _ g  |   f d   |  j  D] } | ^ qw |  _ n x@ t |  j  D]/ \ } } | d k  r |  j | c   7<q Pq WxR t |  j d d d   D]4 \ } } |   k r"|  j | d c   8<q Pq Wd S(   s   RE._drop() -> list.

        for internal use only.

        drop the site that are situated outside the sequence in linear sequence.
        modify the index for site in circular sequences.c         S   s
   |  d k  S(   Ni   (    (   Rx   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   <lambda>"  s    c            s
   |    k  S(   N(    (   Rx   (   R   (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   #  s    i   Ni(   R8   Rr   t	   itertoolst	   dropwhilet	   takewhileRE   R   t	   enumerate(   R4   t   dropt   takeRx   R   R   (    (   R   s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    		+4)c         C   s   t  S(   s  RE.is_defined() -> bool.

        True if the sequence recognised and cut is constant,
        i.e. the recognition site is not degenerated AND the enzyme cut inside
        the site.

        see also :
            RE.is_ambiguous()
            RE.is_unknown()(   R<   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt
   is_defined2  s    
c         C   s   t  S(   s  RE.is_ambiguous() -> bool.

        True if the sequence recognised and cut is ambiguous,
        i.e. the recognition site is degenerated AND/OR the enzyme cut outside
        the site.

        see also :
            RE.is_defined()
            RE.is_unknown()(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   is_ambiguous?  s    
c         C   s   t  S(   s   RE.is_unknown() -> bool.

        True if the sequence is unknown,
        i.e. the recognition site has not been characterised yet.

        see also :
            RE.is_defined()
            RE.is_ambiguous()(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt
   is_unknownL  s    	c         C   s8  |  j  } |  j } |  j } |  j   r0 d } n|  j   r | | k oS d k n rl d |  j d } q4| d k r | |  d | | d } q4| |  d | | | !d | | } nw |  j   r | |  d | | } nR | | k o d k n rd | d	 } n% | |  d | | | !d | | } | S(
   s  RE.elucidate() -> str

        return a representation of the site with the cut on the (+) strand
        represented as '^' and the cut on the (-) strand as '_'.
        ie :
        >>> EcoRI.elucidate()   # 5' overhang
        'G^AATT_C'
        >>> KpnI.elucidate()    # 3' overhang
        'G_GTAC^C'
        >>> EcoRV.elucidate()   # blunt
        'GAT^_ATC'
        >>> SnaI.elucidate()     # NotDefined, cut profile unknown.
        '? GTATAC ?'
        >>>
        s%   cut twice, not yet implemented sorry.i    s   N^t   _Nt   ^t   _s   ^_t   N_s   ^N(   R   R   Rh   R   R   R   (   R4   t   f5t   f3Rh   RF   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt	   elucidateX  s"    			 	  ( %c         C   s:   | j  |  j  k r t St | t  r2 | j |   St Sd S(   s   RE._mod2(other) -> bool.

        for internal use only
        
        test for the compatibility of restriction ending of RE and other.N(   t   ovhgseqR<   R   t	   AmbiguousR   R=   (   R4   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   x  s
    	(
   RN   RO   RP   R   R   R   R   R   R   R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s   
	!			
		R   c           B   s   e  Z d  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z	 e e	  Z	 RS(   s  Implement the methods specific to the enzymes for which the overhang
    is variable.

    Typical example : BstXI -> CCAN_NNNN^NTGG
                      The overhang can be any sequence of 4 bases.
    Notes :
        Blunt enzymes are always defined. even if there site is GGATCCNNN^_N
        There overhang is always the same : blunt!
    
    Internal use only. Not meant to be instantiated.c            s+  t  |  j    t j } t j } |  j j   r g  | d   |  j  D] } | ^ qF |  _ g  |   f d   |  j  D] } | ^ qw |  _ n x@ t |  j  D]/ \ } } | d k  r |  j | c   7<q Pq WxR t |  j d d d   D]4 \ } } |   k r"|  j | d c   8<q Pq Wd S(   s   RE._drop() -> list.

        for internal use only.

        drop the site that are situated outside the sequence in linear sequence.
        modify the index for site in circular sequences.c         S   s
   |  d k  S(   Ni   (    (   Rx   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    c            s
   |    k  S(   N(    (   Rx   (   R   (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    i   Ni(   R8   Rr   R   R   R   RE   R   R   (   R4   R   R   Rx   R   R   (    (   R   s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    		+4)c         C   s   t  S(   s  RE.is_defined() -> bool.

        True if the sequence recognised and cut is constant,
        i.e. the recognition site is not degenerated AND the enzyme cut inside
        the site.

        see also :
            RE.is_ambiguous()
            RE.is_unknown()(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    
c         C   s   t  S(   s  RE.is_ambiguous() -> bool.

        True if the sequence recognised and cut is ambiguous,
        i.e. the recognition site is degenerated AND/OR the enzyme cut outside
        the site.

        
        see also :
            RE.is_defined()
            RE.is_unknown()(   R<   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    c         C   s   t  S(   s   RE.is_unknown() -> bool.

        True if the sequence is unknown,
        i.e. the recognition site has not been characterised yet.

        see also :
            RE.is_defined()
            RE.is_ambiguous()(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    	c         C   s   t  |  j  t  | j  k r" t S|  j } x} | D]u } | d k rG n  | d k rn d j | j d   } n  | d k r2 d t | d } | j | j |   } q2 q2 Wt j | | j  r t St Sd S(   s   RE._mod2(other) -> bool.

        for internal use only
        
        test for the compatibility of restriction ending of RE and other.t   ATCGR'   t   .t
   RYWMSKHDBVt   [t   ]N(	   R8   R   R=   Rw   t   splitt   matchingRF   t   matchR<   (   R4   R>   t   set   baset   expand(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    		c         C   sX  |  j  } |  j } t |   } |  j } |  j   r< d } n|  j   r| | k o_ d k n ru d | d } qTd | k o | k n r d | | k o | k n r | |  d | | | !d | | } qTd | k o | k n r| |  d | | | d d } qTd | | k o5| k n red t |  d | |  d | | } qT| | d k  rd t |  d d t | |  d | } qT| | k r| | | d d | | | d d } qTd t |  d | | d d } nN|  j   rz| d k  r9d t |  d | } qT| | k r^| | | d d	 } qTt d
 |  j	 | f   n| d k r| d k rd | d } qT| d | | d d } nd | | k  o| k n r$d | k o| k n r$| |  d | | | !d | | } n0d | | k  o?| k n rm| |  d | | | | d d } n d | k o| k n rd d | | | |  d | | } n | d k r| | d d | | | d d } nm | d k  r(d t | | |  d d t |  d | } n, d t | |  d | | | d d } | S(   s  RE.elucidate() -> str

        return a representation of the site with the cut on the (+) strand
        represented as '^' and the cut on the (-) strand as '_'.
        ie :
        >>> EcoRI.elucidate()   # 5' overhang
        'G^AATT_C'
        >>> KpnI.elucidate()    # 3' overhang
        'G_GTAC^C'
        >>> EcoRV.elucidate()   # blunt
        'GAT^_ATC'
        >>> SnaI.elucidate()     # NotDefined, cut profile unknown.
        '? GTATAC ?'
        >>>
        s%   cut twice, not yet implemented sorry.i    s   N^R   R   R   R'   s   N^_s   ^_Ns   %s.easyrepr() : error f5=%iR   s   ^N(
   R   R   R8   Rh   R   R   t   absR   t
   ValueErrorRW   (   R4   R   R   R   Rh   RF   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     sV    			 	<(% +1-' <( )))5,(
   RN   RO   RP   R   R   R   R   R   R   R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s   
				
		=t
   NotDefinedc           B   s   e  Z d  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z	 e e	  Z	 RS(   s   Implement the methods specific to the enzymes for which the overhang
    is not characterised.

    Correspond to NoCut and Unknown.
    
    Internal use only. Not meant to be instantiated.c         C   s   |  j  j   r d St |  j   } x@ t |  j  D]/ \ } } | d k  r` |  j | c | 7<q2 Pq2 WxI t |  j d   D]4 \ } } | | k r |  j | d c | 8<qy Pqy Wd S(   s   RE._drop() -> list.

        for internal use only.

        drop the site that are situated outside the sequence in linear sequence.
        modify the index for site in circular sequences.Ni   i(   Rr   RE   R8   R   R   (   R4   R   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   ;  s     c         C   s   t  S(   s  RE.is_defined() -> bool.

        True if the sequence recognised and cut is constant,
        i.e. the recognition site is not degenerated AND the enzyme cut inside
        the site.

        see also :
            RE.is_ambiguous()
            RE.is_unknown()(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   S  s    
c         C   s   t  S(   s  RE.is_ambiguous() -> bool.

        True if the sequence recognised and cut is ambiguous,
        i.e. the recognition site is degenerated AND/OR the enzyme cut outside
        the site.

        
        see also :
            RE.is_defined()
            RE.is_unknown()(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   `  s    c         C   s   t  S(   s   RE.is_unknown() -> bool.

        True if the sequence is unknown,
        i.e. the recognition site has not been characterised yet.

        see also :
            RE.is_defined()
            RE.is_ambiguous()(   R<   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   n  s    	c         C   s/   t  d t |   t |  t |   f   d S(   s   RE._mod2(other) -> bool.

        for internal use only
        
        test for the compatibility of restriction ending of RE and other.s0   %s.mod2(%s), %s : NotDefined. pas glop pas glop!N(   R   R   (   R4   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   z  s    c         C   s   d |  j  S(   s  RE.elucidate() -> str

        return a representation of the site with the cut on the (+) strand
        represented as '^' and the cut on the (-) strand as '_'.
        ie :
        >>> EcoRI.elucidate()   # 5' overhang
        'G^AATT_C'
        >>> KpnI.elucidate()    # 3' overhang
        'G_GTAC^C'
        >>> EcoRV.elucidate()   # blunt
        'GAT^_ATC'
        >>> SnaI.elucidate()     # NotDefined, cut profile unknown.
        '? GTATAC ?'
        >>>
        s   ? %s ?(   Rh   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    (
   RN   RO   RP   R   R   R   R   R   R   R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   3  s   				
		t   Commercially_availablec           B   sb   e  Z d  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z RS(   s   Implement the methods specific to the enzymes which are commercially
    available.
    
    Internal use only. Not meant to be instantiated.c         C   sF   t  j   } x3 | D]+ \ } } | |  j k r | d d GHq q Wd S(   s,   RE.suppliers() -> print the suppliers of RE.i    t   ,N(   Rt   t   itemst   suppl(   R4   Ry   t   kt   v(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s
    c         C   s6   g  t  j   D]% \ } } | |  j k r | d ^ q S(   sG   RE.supplier_list() -> list.

        list of the supplier names for RE.i    (   Rt   R   R   (   R4   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   supplier_list  s    c         C   s   d S(   s=   RE.buffers(supplier) -> string.

        not implemented yet.N(    (   R4   t   supplier(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   buffers  s    c         C   s   t  S(   s7   RE.iscomm() -> bool.

        True if RE has suppliers.(   R<   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   is_comm  s    (   RN   RO   RP   R   R   R   R   R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s   				t   Not_availablec           B   sb   e  Z d  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z RS(   s   Implement the methods specific to the enzymes which are not commercially
    available.
    
    Internal use only. Not meant to be instantiated.c           C   s   d S(   s,   RE.suppliers() -> print the suppliers of RE.N(   R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    c         C   s   g  S(   sG   RE.supplier_list() -> list.

        list of the supplier names for RE.(    (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    c         C   s   t  d   d S(   s=   RE.buffers(supplier) -> string.

        not implemented yet.s"   Enzyme not commercially available.N(   R2   (   R4   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    c         C   s   t  S(   s7   RE.iscomm() -> bool.

        True if RE has suppliers.(   R=   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    (	   RN   RO   RP   R   R   R   R   R   R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s   				RZ   c           B   s   e  Z g  g  d   Z d   Z d   Z d   Z d   Z d   Z e d  Z	 d   Z
 d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z e e  Z d   Z e e  Z e d  Z RS(   c         C   s   g  | D] } |  j  |  ^ q } | g  | D]' } t | d D] } t |  ^ q> q, 7} t j |  |  t j |   |  _ t d  |  _	 d S(   s5   RestrictionBatch([sequence]) -> new RestrictionBatch.i   RR   N(
   t   formatRt   t   evalt   setR7   t   dictt   fromkeyst   mappingt   DNAt   already_mapped(   R4   t   firstR   Rx   t   n(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR7     s
    "8c         C   sb   t  |   d k  r% d j |  j    Sd j d j |  j   d   d j |  j   d  f  Sd  S(   Ni   t   +s   ...i   i(   R8   Rw   t   elements(   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyRe     s    c         C   s   d |  j    S(   Ns   RestrictionBatch(%s)(   R   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR;      s    c         C   s8   y |  j  |  } Wn t k
 r' t SXt j |  |  S(   N(   R   R   R=   R   t   __contains__(   R4   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s
    c         C   s   |  j  |  S(   N(   R]   (   R4   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR^   
  s    c         C   s   |  j  |  S(   N(   R]   (   R4   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR_     s    c         C   sM   |  j  |  } | |  k r | S| r6 |  j |  | St d | j   d S(   s  B.get(enzyme[, add]) -> enzyme class.

        if add is True and enzyme is not in B add enzyme to B.
        if add is False (which is the default) only return enzyme.
        if enzyme is not a RestrictionType or can not be evaluated to
        a RestrictionType, raise a ValueError.s$   enzyme %s is not in RestrictionBatchN(   R   t   addR   RN   (   R4   t   enzymeR   t   e(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   get  s    c         C   sZ   g  t  j | |   D] } | ^ q } t   } t t d | t g t |    | _ | S(   s   B.lambdasplit(func) -> RestrictionBatch .

        the new batch will contains only the enzymes for which
        func return True.N(	   R   t   ifilterRZ   R   t   mapR   R<   R8   t   _data(   R4   t   funcRx   R   RB   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   lambdasplit!  s    %	(c         C   sF   t  | } |  j j |  x% | d D] } |  j t |   q% Wd S(   s   B.add_supplier(letter) -> add a new set of enzyme to B.

        letter represents the suppliers as defined in the dictionary
        RestrictionDictionary.suppliers
        return None.
        raise a KeyError if letter is not a supplier code.i   N(   Rt   R   R   R[   R   (   R4   t   letterR   Rx   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   add_supplier+  s
    
c         C   s2   g  |  j  D] } t | d ^ q
 } | j   | S(   s   B.current_suppliers() -> add a new set of enzyme to B.

        return a sorted list of the suppliers which have been used to
        create the batch.i    (   R   Rt   Rv   (   R4   Rx   t
   suppl_list(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   current_suppliers8  s    $
c         C   s   |  j  |  |  S(   s7    b += other -> add other to b, check the type of other.(   R   (   R4   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   __iadd__A  s    c         C   s    |  j  |   } | j |  | S(   s#    b + other -> new RestrictionBatch.(   R/   R   (   R4   R>   RB   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR\   F  s    c         C   s   t  j |  |  j |   S(   s=  B.remove(other) -> remove other from B if other is a RestrictionType.

        Safe set.remove method. Verify that other is a RestrictionType or can be
        evaluated to a RestrictionType.
        raise a ValueError if other can not be evaluated to a RestrictionType.
        raise a KeyError if other is not in B.(   R   t   removeR   (   R4   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR  L  s    c         C   s   t  j |  |  j |   S(   s  B.add(other) -> add other to B if other is a RestrictionType.

        Safe set.add method. Verify that other is a RestrictionType or can be
        evaluated to a RestrictionType.
        raise a ValueError if other can not be evaluated to a RestrictionType.
        (   R   R   R   (   R4   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   U  s    c         C   s   t  j |  |  S(   sK   B.add_nocheck(other) -> add other to B. don't check type of other.
        (   R   R   (   R4   R>   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR[   ^  s    c         C   sm   y< t  | t  r | St  t t |   t  r; t |  SWn t t f k
 rU n Xt d | j   d S(   s   B.format(y) -> RestrictionType or raise ValueError.

        if y is a RestrictionType return y
        if y can be evaluated to a RestrictionType return eval(y)
        raise a Value Error in all other case.s   %s is not a RestrictionTypeN(   R)   RQ   R   R   t	   NameErrort   SyntaxErrorR   R/   (   R4   t   y(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   c  s    
c         C   s(   t  | t  p' t  t t |   t  S(   sP   B.is_restriction(y) -> bool.

        True is y or eval(y) is a RestrictionType.(   R)   RQ   R   R   (   R4   R  (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   is_restrictionv  s    c            sl      f d   } g  t  j | |   D] } | ^ q% } t   } t t d | t g t |    | _ | S(   s   B.split(class, [class.__name__ = True]) -> new RestrictionBatch.

        it works but it is slow, so it has really an interest when splitting
        over multiple conditions.c            sY   xR  D]J }   j  | j t  } t |  |  rD | r= q qQ t Sq | r t Sq q Wt S(   N(   R   RN   R<   R   R=   (   t   elementR0   t   b(   t   boolt   classes(    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt	   splittest  s    N(	   R   R   RZ   R   R   R   R<   R8   R   (   R4   R  R  R  R   R   RB   (    (   R  R  s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   }  s
    %	(c         C   s-   g  |  D] } t  |  ^ q } | j   | S(   s]   B.elements() -> tuple.

        give all the names of the enzymes in B sorted alphabetically.(   R   Rv   (   R4   R   t   l(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR     s    
c         C   s   g  |  D] } t  |  ^ q S(   sO   B.as_string() -> list.

        return a list of the name of the elements of B.(   R   (   R4   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt	   as_string  s    c         C   s9   t  g  t j   D] \ } } | | d f ^ q  } | S(   s>   B.suppl_codes() -> dict

        letter code for the suppliersi    (   R   Rt   t	   iteritems(   R4   R   R   Ry   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   suppl_codes  s    5c         C   s@   g  |  j    j   D] } d j |  ^ q } d j |  GHd S(   s0   B.show_codes() -> letter codes for the supplierss    = s   
N(   R  R  Rw   (   R4   RL   Ry   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt
   show_codes  s    .c         C   s  t  | t  r | | f |  j k r+ |  j S| | f |  _ t | |  } t g  |  D] } | | j |  f ^ qS  |  _ |  j Sn{ t  | t  r | | j f |  j k r |  j S| | j f |  _ t g  |  D] } | | j |  f ^ q  |  _ |  j Sn  t d t	 |    d S(   s   B.search(dna) -> dict.s3   Expected Seq or MutableSeq instance, got %s insteadN(
   R)   R   R   R   R(   R   R]   R.   R2   R3   (   R4   Rr   R.   t   fseqRx   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR]     s    1
1
(   RN   RO   R7   Re   R;   R   R^   R_   R=   R   R   R   R  R  R\   R  R   R[   R   R  R   R   R  R  R   R  R<   R]   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyRZ     s2   						
																	t   Analysisc           B   s7  e  Z e   e d   e d  Z d   Z d   Z d   Z d   Z	 d   Z
 d d  d  d  Z d   Z e d	  Z d d
  Z d d  Z d d  Z d d  Z d d  Z d d  Z d d  Z d d  Z d d  Z d d  Z d d  Z d d  Z d d  Z d d  Z d d  Z d d  Z RS(   RR   c         C   sQ   t  j |  |  | |  _ | |  _ | |  _ |  j rM |  j |  j |  j  n  d S(   sk  Analysis([restrictionbatch [, sequence] linear=True]) -> New Analysis class.

        For most of the method of this class if a dictionary is given it will
        be used as the base to calculate the results. 
        If no dictionary is given a new analysis using the Restriction Batch
        which has been given when the Analysis class has been instantiated.N(   RZ   R7   t   rbt   sequenceR.   R]   (   R4   t   restrictionbatchR  R.   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR7     s    				c         C   s&   d t  |  j  t  |  j  |  j f S(   Ns   Analysis(%s,%s,%s)(   R:   R  R  R.   (   R4   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR;     s    c         C   s>   t  g  |  j j   D]$ \ } } | | k r | | f ^ q  S(   s   A._sub_set(other_set) -> dict.

        Internal use only.
        
        screen the results through wanted set.
        Keep only the results for which the enzymes is in wanted set.
        (   R   R   R  (   R4   t   wantedR   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   _sub_set  s    c         C   s   t  | t  s( t d t |    n  t  | t  sP t d t |    n  | d k  rr | t |  j  7} n  | d k  r | t |  j  7} n  | | k  r n | | | k | f | d k  r | d k n  | | k  r | | |  j f S| | |  j f Sd S(   s   A._boundaries(start, end) -> tuple.

        Format the boundaries for use with the methods that limit the
        search to only part of the sequence given to analyse.
        s   expected int, got %s insteadi   N(   R)   t   intR2   R3   R8   R  t   _test_normalt   _test_reverse(   R4   RH   t   end(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   _boundaries  s     c         C   s   | | k o | k  SS(   s   A._test_normal(start, end, site) -> bool.

        Internal use only
        Test if site is in between start and end.
        (    (   R4   RH   R  Rh   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR    s    c         C   s=   | | k o  t  |  j  k n p< d | k o: | k  SS(   s   A._test_reverse(start, end, site) -> bool.

        Internal use only
        Test if site is in between end and start (for circular sequences).
        i   (   R8   R  (   R4   RH   R  Rh   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR    s    c         C   s)   | s |  j  } n  Ht j |  | | |  S(   s   A.print_that([dct[, title[, s1]]]) -> print the results from dct.

        If dct is not given the full dictionary is used.
        (   R   R   t
   print_that(   R4   RY   t   titlet   s1(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR    s    c         K   sH  xA| j    D]3\ } } | d k r^ t |  | |  |  j |  j |  _ |  j |  j |  _ q | d k r t |  d |  |  j |  j |  j  q | d k r t	 j
 |  | |  j |  j  }  q | d k r t |  d |  |  j |  j |  q | d k rt |  | |  q | d k r0t d
 t   q t d t   q Wd S(   s  A.change(**attribute_name) -> Change attribute of Analysis.

        It is possible to change the width of the shell by setting
        self.ConsoleWidth to what you want.
        self.NameWidth refer to the maximal length of the enzyme name.

        Changing one of these parameters here might not give the results
        you expect. In which case, you can settle back to a 80 columns shell
        or try to change self.Cmodulo and self.PrefWidth in PrintFormat until
        you get it right.t	   NameWidtht   ConsoleWidthR  R  R.   t   Indentt   Maxsizet   Cmodulot	   PrefWidths2   To change %s, change NameWidth and/or ConsoleWidths   Analysis has no attribute %sN(   R"  R#  (   R$  R%  (   R&  R'  (   R  t   setattrR#  R"  R&  R'  R]   R  R.   R  R7   t   AttributeErrorRW   (   R4   t   whatR   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   change!  s,    !c         C   s   |  j  S(   sH   A.full() -> dict.
        
        Full Restriction Map of the sequence.(   R   (   R4   R.   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   fullD  s    c         C   sM   | s |  j  } n  t g  | j   D]$ \ } } | j   r" | | f ^ q"  S(   sc   A.blunt([dct]) -> dict.
        
        Only the enzymes which have a 3'overhang restriction site.(   R   R   R  R   (   R4   RY   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR   J  s    c         C   sM   | s |  j  } n  t g  | j   D]$ \ } } | j   r" | | f ^ q"  S(   sh   A.overhang5([dct]) -> dict.
        
        Only the enzymes which have a 5' overhang restriction site.(   R   R   R  R   (   R4   RY   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt	   overhang5R  s    c         C   sM   | s |  j  } n  t g  | j   D]$ \ } } | j   r" | | f ^ q"  S(   sg   A.Overhang3([dct]) -> dict.
        
        Only the enzymes which have a 3'overhang restriction site.(   R   R   R  R   (   R4   RY   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt	   overhang3[  s    c         C   sM   | s |  j  } n  t g  | j   D]$ \ } } | j   r" | | f ^ q"  S(   sk   A.defined([dct]) -> dict.
        
        Only the enzymes that have a defined restriction site in Rebase.(   R   R   R  R   (   R4   RY   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   definedd  s    c         C   sG   | s |  j  } n  t g  | j   D] \ } } | r" | | f ^ q"  S(   sc   A.with_sites([dct]) -> dict.
        
        Enzymes which have at least one site in the sequence.(   R   R   R  (   R4   RY   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt
   with_sitesl  s    c         C   sG   | s |  j  } n  t g  | j   D] \ } } | s" | | f ^ q"  S(   s[   A.without_site([dct]) -> dict.
        
        Enzymes which have no site in the sequence.(   R   R   R  (   R4   RY   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   without_sitet  s    c         C   sS   | s |  j  } n  t g  | j   D]* \ } } t |  | k r" | | f ^ q"  S(   s[   A.With_N_Sites(N [, dct]) -> dict.
        
        Enzymes which cut N times the sequence.(   R   R   R  R8   (   R4   R'   RY   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   with_N_sites|  s    c         C   sS   | s |  j  } n  t g  | j   D]* \ } } t |  | k r" | | f ^ q"  S(   N(   R   R   R  R8   (   R4   t   listRY   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   with_number_list  s    c         C   s   x? t  |  D]1 \ } } | t k r d Gt t  GH| | =q q W| s^ t |  j |  j  St g  | D]" } | | k rh | | | f ^ qh  S(   so   A.with_name(list_of_names [, dct]) ->
        
         Limit the search to the enzymes named in list_of_names.s   no datas for the enzyme:(   R   R~   R   RW   RZ   R]   R  R   (   R4   t   namesRY   RL   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt	   with_name  s    c         C   s   g  |  D] } | j  | k r | ^ q } | sD t |  j |  j  St g  | j   D]$ \ } } | | k rT | | f ^ qT  S(   s{   A.with_site_size(site_size [, dct]) ->
        
         Limit the search to the enzymes whose site is of size <site_size>.(   RK   RZ   R]   R  R   R  (   R4   t	   site_sizeRY   RW   t   sitesR   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   with_site_size  s    (c   	      C   s   |  j  | |  \ } } } | s- |  j } n  t |  } x^ | j   D]P \ } } | se | | =qF n  x. | D]& } | | | |  r ql ql | | =Pql WqF W| S(   sp   A.only_between(start, end[, dct]) -> dict.

        Enzymes that cut the sequence only in between start and end.(   R  R   R   R  (	   R4   RH   R  RY   t   testR   t   keyR8  Rh   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   only_between  s    	c   	      C   s   |  j  | |  \ } } } i  } | s3 |  j } n  xN | j   D]@ \ } } x1 | D]) } | | | |  rS | | | <PqS qS qS Wq@ W| S(   s   A.between(start, end [, dct]) -> dict.

        Enzymes that cut the sequence at least in between start and end.
        They may cut outside as well.(   R  R   R  (	   R4   RH   R  RY   R:  R   R;  R8  Rh   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   between  s    
c         C   s   g  } | | k rr g  |  j  | | |  D]A } t g  | D]( } | | k oU | k n r8 | ^ q8 f ^ q( } nY g  |  j  | | |  D]= } t g  | D]$ } | | k s | | k r | ^ q f ^ q } t |  S(   s   A.show_only_between(start, end [, dct]) -> dict.

        Enzymes that cut the sequence outside of the region
        in between start and end but do not cut inside.(   R=  R   R   (   R4   RH   R  RY   R   R   t   vv(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   show_only_between  s    ]Vc   	      C   s   |  j  | |  \ } } } | s- |  j } n  t |  } x^ | j   D]P \ } } | se | | =qF n  x. | D]& } | | | |  rl | | =Pql ql ql WqF W| S(   s   A.only_outside(start, end [, dct]) -> dict.

        Enzymes that cut the sequence outside of the region
        in between start and end but do not cut inside.(   R  R   R   R  (	   R4   RH   R  RY   R:  R   R;  R8  Rh   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   only_outside  s     c   	      C   s   |  j  | |  \ } } } | s- |  j } n  i  } xN | j   D]@ \ } } x1 | D]) } | | | |  rq qS qS | | | <PqS Wq@ W| S(   s   A.outside((start, end [, dct]) -> dict.

        Enzymes that cut outside the region in between start and end.
        No test is made to know if they cut or not inside this region.(   R  R   R  (	   R4   RH   R  RY   R:  R   R;  R8  Rh   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   outside  s    
	c         C   s>   | s |  j  } n  |  j   } | j |  j | | |   | S(   so   A.do_not_cut(start, end [, dct]) -> dict.

        Enzymes that do not cut the region in between start and end.(   R   R1  t   updateR@  (   R4   RH   R  RY   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt
   do_not_cut  s
    N(   RN   RO   RZ   R   R<   R7   R;   R  R  R  R  R   R  R+  R,  R   R-  R.  R/  R0  R1  R2  R4  R6  R9  R<  R=  R?  R@  RA  RC  (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyR    s4   		
			
	#			R~   t   CommOnlyt   NonComm(H   RP   RF   R   R   R  t   setsR    t   Bio.SeqR   R   t   Bio.AlphabetR   t&   Bio.Restriction.Restriction_DictionaryR   t
   enzymedictR   R   Rt   t   Bio.Restriction.RanaConfigt   Bio.Restriction.PrintFormatR   t   Bio.Restriction.DNAUtilsR	   R   R   t   objectR(   R3   RQ   Rq   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   RZ   R  RD  RE  R  t   TYPERX   t   enzymesR   Rx   R   t   __new__R   R   t   newenzR   R[   R~   R   R5  t   localsRB  R   R   R   t   __all__(    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction.pyt   <module>O   sp   

czQHJ (Rwwzk)( J		% 
"