ó
¤™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	 m
 Z
 m Z d  d l m Z m Z d  d l m Z d  d l Z d  d l m Z d  d l j Z d „  Z d	 „  Z e d
 k re j j d d ƒ sà d GHqe ƒ  e j j d d ƒ sd GHn e ƒ  d GHn  d S(   iÿÿÿÿ(   t   division(   t
   molprobityN(   t   loadst   dumpst   dump(   t	   show_difft   approx_equal(   t   null_out(   t   StringIOc          C   su  t  j j d d d t j ƒ }  t  j j d d d t j ƒ } |  d  k rQ d GHd  S|  d d d d	 g } t j d
 | d t ƒ  ƒ j	 } t
 ƒ  } | j d | ƒ t t | ƒ ƒ } t
 ƒ  } | j d | ƒ | j j d k sà t ‚ d | j ƒ  k sø t ‚ | j ƒ  | j ƒ  k st ‚ t d | ƒ | j ƒ  } | j d  k sDt ‚ | j ƒ  } t
 ƒ  } | j d | d t ƒ d | j ƒ  k s‡t ‚ t | j ƒ  d ƒ s¢t ‚ t | j ƒ  d ƒ s½t ‚ t | j ƒ  d ƒ sØt ‚ | j ƒ  d  k sðt ‚ t | j ƒ  d ƒ st ‚ t | j ƒ  d ƒ s&t ‚ t | j ƒ  d ƒ sAt ‚ | j  ƒ  d k sYt ‚ t | j ƒ  d d d ƒszt ‚ | j! ƒ  }	 t" |	 j# ƒ  ƒ }
 t$ |
 ƒ d k s°t ‚ t% | j& ƒ  d ƒ d k sÒt ‚ d d  l' } d d l( m) } | j* |  ƒ } | j+ j, } | j	 j j- ƒ  } t. | _/ t. | _0 t. | _1 | j	 j j d  | d! | ƒ } t
 ƒ  } | j d | ƒ t2 | j ƒ  d" ƒ s‰t ‚ | | d# g } t j d
 | d t ƒ  d$ t ƒ \ } } t
 ƒ  } | j d | ƒ | j3 ƒ  } | j4 d% d& d' d( d) d* g ƒ } t | j ƒ  d+ d d, ƒs't ‚ t | j ƒ  d- d d, ƒsHt ‚ t | j ƒ  d. d d ƒsit ‚ t | j ƒ  d/ d. g d d ƒs�t ‚ t | j ƒ  d ƒ s«t ‚ t | j ƒ  d ƒ sÆt ‚ t | j ƒ  d ƒ sát ‚ | j  ƒ  d k sùt ‚ t | j5 ƒ  j6 ƒ  d? ƒ st ‚ t% | j7 ƒ  ƒ d4 k s8t ‚ | j8 ƒ  } t$ | ƒ d k s\t ‚ t | j9 ƒ  d5 d d ƒs}t ‚ t | j: ƒ  d6 ƒ s˜t ‚ t j d7 ƒ s­t ‚ t | j9 ƒ  d8 ƒ sÈt ‚ | j8 ƒ  } | j; ƒ  } | j< ƒ  } | j= j> ƒ  } | j	 j j d  | j? d9 | j= d: | d; | j@ d< t d= t ƒ } | j3 ƒ  } d> g  | D] \ } } | ^ qPk sqt ‚ d  S(@   Nt   relative_paths   phenix_regression/pdb/3ifk.pdbt   tests+   phenix_regression/reflection_files/3ifk.mtzs*   phenix_regression not available, skipping.s   outliers_only=Trues   output.prefix=tst_molprobitys   --pickles   flags.xtriage=Truet   argst   outi   s   RNA validations   tst_molprobity.pklt   show_percentiless2     Clashscore            =  49.96 (percentile: 0.2)g¼t“VÎ?g�—nƒÀÒ?g=
×£p= @gÕ	h"lxš?g,Öp‘{ú@gÇô„%X@i
   g{®Gáú
@t   epsg-Cëâ6?i   i   s    A   5  THR  rota,cb,clashiÿÿÿÿ(   t   file_readert   pdb_hierarchyt   flagssi     Ramachandran outliers =   1.76 %
                favored =  96.47 %
  Rotamer outliers      =  18.67 %
s   --mapst   return_input_objectst   r_workt   r_freet   adp_mean_allt
   angle_rmsdt	   bond_rmsdt
   clashscoreg§èH.ÿ!Í?gü©ñÒMbP?gÁÊ¡E¶óÑ?g®¶bÙ= @g–C‹lçEA@g®Gáz¤K@g°rh‘ílM@g�Âõ(\ÇP@iZ   s
   P 21 21 21g~Œ¹k	ù¸?g àbE?@s   tst_molprobity_maps.mtzgÌh?­ýø¸?t   fmodelt   fmodel_neutront   geometry_restraints_managert   nucleart   keep_hydrogenss   R-work (neutron)(   g®Gáz¤K@g°rh‘ílM@g�Âõ(\ÇP@iZ   iZ   iZ   (A   t   libtbxt   envt   find_in_repositoriest   opt   isfilet   NoneR   t   runR   t
   validationR   t   showR   R   t	   nqh_flipst
   n_outlierst   AssertionErrort   getvalueR   t   as_multi_criterion_viewt   neutron_statst   molprobity_scoret   show_summaryt   TrueR   R   R   t   d_mint	   d_max_mint	   rms_bondst
   rms_anglest   rama_favoredt   cbeta_outlierst	   summarizet   listt   iter_molprobity_gui_fieldst   lent   strt   datat   mmtbx.validation.molprobityt   iotbxR   t   any_filet   file_objectt	   hierarchyt   molprobity_flagst   FalseR   t   model_statst   cbetadevR   t   get_statistics_for_phenix_guit   get_polygon_statisticst	   unit_cellt
   parameterst   space_group_infot   fmodel_statistics_by_resolutiont   atoms_to_observations_ratiot
   b_iso_meant   fmodel_statistics_graph_datat   format_loggraphR   t	   deep_copyR   t   geometry(   t   pdb_filet   hkl_filet   args1t   resultt   out1t   out2t   mct   mpscoret   out4t   summaryt
   gui_fieldst   mmtbxR   t   pdb_inR@   R   t   out3t   args2t   cmdlineR   t   statst   binst   bin_plott   lgR   t   result2t   labelt   stat(    (    sZ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/validation/regression/tst_molprobity_2.pyt   exercise_protein   sÆ    				!"							!!!'				c          C   sç   t  j j d d d t j ƒ }  |  d  k r3 d GHd  St j d |  g d t ƒ  ƒ j	 } | j
 d  k	 si t ‚ t ƒ  } | j d | ƒ d | j ƒ  k sš t ‚ t t | ƒ ƒ } t ƒ  } | j d | ƒ | j ƒ  | j ƒ  k sã t ‚ d  S(   NR	   s,   phenix_regression/pdb/pdb2goz_refmac_tls.entR
   sP   Skipping exercise_regression(): input pdb (pdb2goz_refmac_tls.ent) not availableR   R   s   2/58 pucker outliers present(   R   R   R    R!   R"   R#   R   R$   R   R%   t   rnaR)   R   R&   R*   R   R   (   t   regression_pdbRT   R   RV   (    (    sZ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/validation/regression/tst_molprobity_2.pyt   exercise_rna€   s    !		t   __main__t   namet   probes$   Skipping tests: probe not configuredt	   suitenames*   Skipping RNA test: suitename not availablet   OK(   t
   __future__R    t   mmtbx.command_lineR   R<   R\   t   iotbx.pdb.hierarchyR=   t   libtbx.easy_pickleR   R   R   t   libtbx.test_utilsR   R   t   libtbx.utilsR   t   libtbx.load_envR   t	   cStringIOR   t   os.patht   pathR!   Rh   Rk   t   __name__R   t
   has_module(    (    (    sZ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/validation/regression/tst_molprobity_2.pyt   <module>   s&   	r	