ó
Ž™xTc           @   s}   d  d l  m Z d  d l m Z m Z d  d l m Z d  d l Z d  d l	 Z	 d  d l
 Z
 d „  Z e d k ry e ƒ  n  d S(   iÿÿÿÿ(   t   division(   t   contains_linest   Exception_expected(   t   SorryNc          C   s/  t  j j d d d t j j ƒ }  |  d  k r6 d GHd  Sd d l m } t	 j
 ƒ  } | |  g d | ƒt | j ƒ  d ƒ s€ t ‚ t	 j
 ƒ  } | |  d	 g d | ƒt | j ƒ  d
 ƒ s½ t ‚ | |  d d g d | ƒd d l m } | j d d d ƒj } | j j ƒ  } | j ƒ  } | j d ƒ | j d ƒ k oBd k n sMt ‚ t	 j
 ƒ  } | |  d d g d | ƒ| j d d d ƒj } t | j ƒ  d ƒ s¥t ‚ | j j ƒ  } | j ƒ  d k sÌt ‚ | j ƒ  } | j d ƒ d k r| j d ƒ d k st ‚ y | |  d g d | ƒWn+ t k
 rO} t | ƒ d k sVt ‚ n Xt ‚ y | |  d g d | ƒWn+ t k
 r�} t | ƒ d k s¤t ‚ n Xt ‚ t  j j d d  d t j j ƒ }  y | |  g d | ƒWn+ t k
 r	} t | ƒ d! k st ‚ n Xt ‚ | |  d" g d | ƒd# GHd  S($   Nt   relative_paths   phenix_regression/pdb/1ywf.pdbt   tests/   phenix_regression not available, skipping test.iÿÿÿÿ(   t   runt   outs   Modified model: 4254 atomss,   atom_selection="chain A and not resname HOH"s   Modified model: 3990 atomss   new_occ=0.4s   atom_selection="resseq 1:275"(   t   file_readers   1ywf_split.pdbt
   force_typet   pdbg333333ã?gš™™™™™Ù?iB  s	   n_confs=3s   new_occ=0.25sl   WARNING: zero-occupancy atom:
HETATM 1941  O  AHOH A 354      -0.009  56.525  -3.872  0.25 29.17           Oií  g      à?iN  g      Ð?iž  s   atom_selection="chain G"s   Empty selection.s	   new_occ=2s!   new_occ must be between 0 and 1.0s   phenix_regression/pdb/1akg.pdbs�   Atom group included in selection already has one or more alternate conformers:
ATOM     22  OG ASER     4      -1.752   0.849   3.272  0.50 11.67           Os   atom_selection="not name OG"t   OK(   t   libtbxt   envt   find_in_repositoriest   ost   patht   isfilet   Nonet(   iotbx.command_line.pdb_add_conformationsR   t	   cStringIOt   StringIOR   t   getvaluet   AssertionErrort   iotbxR   t   any_filet   file_objectt   inputt   atomst   extract_occt   countt   sizeR   t   strR   (   t   pdb_fileR   R   R   t   pdb_inR   t   occt   e(    (    sT   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/regression/tst_add_conformations.pyt   exercise	   sb    40	t   __main__(   t
   __future__R    t   libtbx.test_utilsR   R   t   libtbx.utilsR   t   libtbx.load_envR   R   R   R%   t   __name__(    (    (    sT   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/regression/tst_add_conformations.pyt   <module>   s   	: