ó
±™xTc           @   sŠ   d  d l  m Z d  d l m Z d  d l m Z d  d l Z d  d l Z d  d l	 Z	 e j
 d „ Z e d k r† e d e j d ƒ n  d S(	   iÿÿÿÿ(   t   division(   t   fab_elbow_angle(   t   SorryNc   	   	   C   sË  t  |  ƒ d k s: t  |  ƒ d k rs |  d j ƒ  d k rs | d d IJ| t j IJ| d d IJt j d ƒ nTt j j |  d ƒ sª | d	 |  d IJt	 d
 ƒ ‚ nt
 j j d |  d ƒ j ƒ  } t ƒ  } t d d d d d d d d ƒ } x© |  d D]� } | j d ƒ } | d j ƒ  d k r‚t  | ƒ d k r‚y t | d ƒ } Wn t k
 rl| d } n X| | | | d <qþ t	 d j | d ƒ ƒ ‚ qþ Wt d | | � j } | d j | ƒ IJd S(   sa  
  Calculating Fragment Antigen-Binding (Fab) elbow angle

  Each FAB is made of two chains, Heavy (H) and Light (L), and two domains,
  Variable (V) and Constant (C or C1, The heavy domain has three parts).
  The angle between the variable and constant domains is the elbow angle.
  It is the angle between rotation axes, the pseudo-dyad axes,
  defined by aligning the light portion of each domain, on-to the heavy one.

  command line options:
  light        chain ID of light domain, by default set to L
  heavy        chain ID of heavy domain, by default set to H
  limit_l      the number of the residue separating between variable
               and constant domains in the light chain, by default 107
  limit_H      the number of the residue separating between variable
               and constant domains in the heavy chain, by default 113
  h            help

  usage:
  >>>phenix.fab_elbow_angle fab_name.pdb [light=L] [heavy=H] [limit_l=107] [limit_h=113]

  examples:
  >>>phenix.fab_elbow_angle 7fab.pdb light=L heavy=H limit_l=104 limit_h=117
  >>>123.00
  >>>phenix.fab_elbow_angle 1bbd.pdb
  >>>126.34
  i    i   s   -hs   --hs   -helps   --helpt   -iO   s,   There is no file %s in the current directorys   File name errort	   file_namet   lightt   chain_id_lightt   heavyt   chain_id_heavyt   limit_lt   limit_lightt   limit_ht   limit_heavyt   =i   s   Option {} does not existt   pdb_hierarchys   fab elbow angle (deg): {0:.2f}N(   s   -hs   --hs   -helps   --help(   R   R   R	   R   (   t   lent   lowert   runt   __doc__t   syst   exitt   ost   patht   isfileR   t   iotbxt   pdbt   inputt   construct_hierarchyt   dictt   splitt   intt
   ValueErrort   formatR   (	   t   argst   logt   pht
   inp_paramst   param_manest   xt   kvt   valt   elbow_angle(    (    sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/fab_elbow_angle.pyR   	   s8    $		(t   __main__R!   i   (   t
   __future__R    t   mmtbx.utils.fab_elbow_angleR   t   libtbx.utilsR   t	   iotbx.pdbR   R   R   t   stdoutR   t   __name__t   argv(    (    (    sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/fab_elbow_angle.pyt   <module>   s   =