ó
œ™xTc           @   sµ   d  d l  m Z d  d l m Z d  d l Z d  d l Z d  d l m Z d  d l Z	 d  d l
 m Z d  d l Z d  d l Z d „  Z d „  Z e d k r± e d	 e j d
 ƒ n  d S(   iÿÿÿÿ(   t   division(   t   monomer_libraryN(   t   approx_equal(   t   StringIOc      	   C   só  t  j j d d | d t j j ƒ } | d  k r> d | GHd  St ƒ  } t j	 j
 d |  d | d | d | ƒ } | j ƒ  } | j j ƒ  }	 | j d	 |	 ƒ }
 | j d
 |
 ƒ } | j d	 |	 ƒ j j ƒ  | j d	 |	 ƒ j j ƒ  f } | j j ƒ  | j j ƒ  f } t | | ƒ st ‚ t | | ƒ s+t ‚ i  } x | j D] } | | | j <q;Wt | ƒ | d k snt ‚ t | j j j ƒ  ƒ } xf | j D][ } | j | j ƒ s�d | j d } | d k rë| | j d j d k sèt ‚ qëq�q�Wd  S(   Nt   relative_paths   phenix_regression/tardy_action/t   testsF   Skipping exercise_geo_reduce_for_tardy("%s"): input file not availablet   mon_lib_srvt   ener_libt	   file_namet   logt
   sites_cartt
   tardy_treei   g      à?i
   i    t   PRO(   t   libtbxt   envt   find_in_repositoriest   ost   patht   isfilet   NoneR   R   t   pdb_interpretationt   processt   geometry_restraints_managert   all_chain_proxiest   sites_cart_exactt   construct_tardy_treet   reduce_for_tardyt   pair_proxiest   bond_proxiest   n_totalt   dihedral_proxiest   sizeR   t   AssertionErrort   i_seqst   lent   listt   pdb_hierarchyt   atoms_with_labelst   has_keyt   weightt   resname(   R   R   R   t   expected_bond_countst   expected_dihedral_countst	   file_pathR	   t   processed_pdb_filet   geoR
   R   t   reduced_geot   bond_countst   dihedral_countst   proxy_i_seqs_redt   proxyt   awlt   sigma(    (    s\   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/monomer_library/tst_geo_reduce_for_tardy.pyt   exercise_geo_reduce_for_tardy
   sB    
		c         C   sº   t  |  ƒ d k s t ‚ t j j ƒ  } t j j ƒ  } xx d d d f d d d f d
 d d f d d d  f d d! d" f g D]4 \ } } } t d | d | d | d | d | ƒ qy Wd GHd  S(#   Ni    s   gly_gly_box.pdbi   i   i   s   lys_pro_trp_box.pdbi!   i   i   s   pro_lys_trp_box.pdbs   1yjp_box.pdbi;   i   i   s   disulfides_box.pdbiÆ   i   i   R   R   R   R)   R*   t   OK(   i   i    (   i   i   (   i!   i    (   i   i   (   i!   i    (   i   i   (   i;   i    (   i   i   (   iÆ   i   (   i;   i   (   R"   R    R   t   serverR   R5   (   t   argsR   R   R   R)   R*   (    (    s\   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/monomer_library/tst_geo_reduce_for_tardy.pyt   run5   s     t   __main__R8   i   (   t
   __future__R    t   mmtbxR   t   mmtbx.monomer_library.servert(   mmtbx.monomer_library.pdb_interpretationt   libtbx.test_utilsR   t   libtbx.load_envR   t	   cStringIOR   t   sysR   R5   R9   t   __name__t   argv(    (    (    s\   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/monomer_library/tst_geo_reduce_for_tardy.pyt   <module>   s   	+	