ó
gbc           @   sA   d  d l  m Z d „  Z d „  Z d „  Z d „  Z d „  Z d S(   iÿÿÿÿ(   t   debugc            s"   ‡  ‡ f d †  } | | j  _ d  S(   Nc            sg   t  d ˆ ƒ t ˆ  d ƒ rF ˆ  j d  k	 rF i ˆ  j d 6|  d 6} n i |  d 6} t ˆ | |  ƒ d S(   Ns
   begin = %st   taxonomyt   sequencei   (   R    t   hasattrR   t   Nonet   eval(   t   seqt   environ(   t   optionst   value(    s<   lib/python2.7/site-packages/obitools/options/bioseqcutter.pyt   beginCutPosition   s
    (   t   valuesR
   (   R   t   optR	   t   parserR
   (    (   R   R	   s<   lib/python2.7/site-packages/obitools/options/bioseqcutter.pyt   _beginOptionCallback   s    	c            s"   ‡  ‡ f d †  } | | j  _ d  S(   Nc            sU   t  ˆ  d ƒ r8 ˆ  j d  k	 r8 i ˆ  j d 6|  d 6} n i |  d 6} t ˆ | |  ƒ S(   NR   R   (   R   R   R   R   (   R   R   (   R   R	   (    s<   lib/python2.7/site-packages/obitools/options/bioseqcutter.pyt   endCutPosition   s    (   R   R   (   R   R   R	   R   R   (    (   R   R	   s<   lib/python2.7/site-packages/obitools/options/bioseqcutter.pyt   _endOptionCallback   s    c         C   so   |  j  d ƒ } | j d d d d d t d d d d	 d
 d ƒ| j d d d d d t d d d d	 d
 d ƒd  S(   Ns   Cutting optionss   -bs   --begint   actiont   callbackt   metavars   <PYTHON_EXPRESSION>t   typet   stringt   helpsÇ   python expression to be evaluated in the sequence context. The attribute name can be used in the expression as variable name. An extra variable named 'sequence' refers to the sequence object itself. s   -es   --endsÆ   python expression to be evaluated in the sequence context. The attribute name can be used in the expression as variable name .An extra variable named 'sequence' refersto the sequence object itself. (   t   add_option_groupt
   add_optionR   R   (   t   optionManagert   group(    (    s<   lib/python2.7/site-packages/obitools/options/bioseqcutter.pyt   addSequenceCuttingOptions   s    c            s   ‡  f d †  } | S(   Nc            sª   t  |  ƒ } t ˆ  d ƒ r3 t ˆ  j |  ƒ ƒ } n d } t ˆ  d ƒ r` t ˆ  j |  ƒ ƒ } n | } | d k s~ | | k  r¦ |  | | !}  d | d | f |  d <n  |  S(   NR
   i    R   s   %d..%di   t   subsequence(   t   lenR   t   intR
   R   (   R   t   lseqt   begint   end(   R   (    s<   lib/python2.7/site-packages/obitools/options/bioseqcutter.pyt   sequenceCutter8   s    (    (   R   R"   (    (   R   s<   lib/python2.7/site-packages/obitools/options/bioseqcutter.pyt   cutterGenerator6   s    c            s   t  |  ƒ ‰  ‡  f d †  } | S(   Nc         3   s    x |  D] } ˆ  | ƒ Vq Wd  S(   N(    (   t   seqIteratorR   (   t   _cutter(    s<   lib/python2.7/site-packages/obitools/options/bioseqcutter.pyt   sequenceCutterIteratorQ   s    (   R#   (   R   R&   (    (   R%   s<   lib/python2.7/site-packages/obitools/options/bioseqcutter.pyt   cutterIteratorGeneratorN   s    N(   t   loggingR    R   R   R   R#   R'   (    (    (    s<   lib/python2.7/site-packages/obitools/options/bioseqcutter.pyt   <module>   s
   				