ó
±™xTc           @   sa   d  d l  m Z d  d l Z d „  Z d „  Z e d k r] d  d l Z e d e j d ƒ n  d S(   iÿÿÿÿ(   t   divisionNc          C   s"   d d  l  }  |  j j d d t ƒS(   Niÿÿÿÿs·  atom_selection = None
  .type = str
  .help = "Limit all analysis of restraints to this selection only."
strict_processing = False
  .type = bool
build_geometry_restraints_manager = True
  .type = bool
build_xray_structure = True
  .type = bool
max_atoms = None
  .type = int

write_geo_files = False
  .type = bool
write_tardy_geo_files = False
  .type = bool

include scope mmtbx.monomer_library.pdb_interpretation.grand_master_phil_str
t   process_includes(   t
   iotbx.philt   philt   parset   True(   t   iotbx(    (    sS   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/pdb_interpretation.pyt   get_master_phil   s    	c            s˜  d d l  m ‰ t ƒ  } d d  l } | j j d |  d | d d& ƒ } | j d | d	 ƒ } | j ƒ  H| j ƒ  } d d  l	 } | j
 j j ƒ  } | j
 j j ƒ  } xW | d D]K }	 d
 ˆ |	 j ƒ GHx0 | | g D]" }
 |
 j d |	 j d |	 j ƒ qÓ Wq® Wd d  l } d d l m } g  } xÿ | d D]ó } | j
 j j d | d | d | j d | j d | j d | j d t d | j d t j ƒ 	} | j rÀ| j j ƒ  } | d  k	 rÀ| | ƒ ‚ qÀn  | j rú| j d | j  j! d | j  j" d | j j# ƒ n  | j$ r| j% ƒ  n  | j& | ƒ q*WH| j' s4| j( r”d d  l) j* } xN| D]C} | j } | j+ j, ƒ  } | j- d ƒ s}t. ‚ | d ‰  | j/ ƒ  ‰ g  | j0 D] } | j1 ƒ  ^ q�‰ ‡  ‡ ‡ ‡ f d †  } | j ƒ  } | j' r!| j2 ˆ  ƒ d } d ˆ | ƒ GH| d d d  | d! | ƒ Hn  | j( rJ| j2 ˆ  ƒ d" } d ˆ | ƒ GH| j3 d# ˆ ƒ } | j4 d$ | ƒ } | d d% d  | d! | ƒ HqJqJWn  | S('   Niÿÿÿÿ(   t   show_stringt   argst   master_philt   input_typest   pdbt   cift   sourcesR   s   Processing CIF file: %st
   cif_objectt	   file_name(   t   Sorryt   mon_lib_srvt   ener_libt   paramst   atom_selection_stringt   strict_conflict_handlingt6   substitute_non_crystallographic_unit_cell_if_necessaryt	   max_atomst   logt   params_editst   params_removet   show_nonbonded_clashscores   file i   c            s‚   t  | d ƒ } | d |  IJ| d ˆ ˆ  ƒ IJd d l m } | d I| ƒ  IJ| J| j d ˆ d ˆ d	 | ƒ | j ƒ  d  S(
   Nt   ws!   # %sgeometry restraints for file:s   #   %siÿÿÿÿ(   t   date_and_timet   #t
   sites_cartt   site_labelst   f(   t   opent   libtbx.utilsR   t   show_sortedt   close(   t   labelt   geot   geo_file_nameR"   R   (   t   pdb_file_nameR   R!   R    (    sS   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/pdb_interpretation.pyt	   write_geoZ   s    	s   .geos   Writing file: %sR'   t    R(   R)   s
   .tardy.geoR    t
   tardy_trees   tardy (   R   R   (5   t   libtbx.str_utilsR   R   t   iotbx.utilst   utilst   process_command_line_inputst   fetcht   showt   extractt   mmtbx.monomer_library.servert   monomer_libraryt   serverR   R   t   process_cif_objectt   file_contentt(   mmtbx.monomer_library.pdb_interpretationR$   R   t   pdb_interpretationt   processt   atom_selectiont   strict_processingR   R   t   syst   stdoutt   all_chain_proxiest   fatal_problems_messaget   Nonet!   build_geometry_restraints_managert   geometry_restraints_managert   geometry_restraintst   editst   removet   nonbonded_clashscoret   build_xray_structuret   xray_structuret   appendt   write_geo_filest   write_tardy_geo_filest   os.patht   patht   pdb_inpt   source_infot
   startswitht   AssertionErrort   sites_cart_exactt	   pdb_atomst   id_strt   basenamet   construct_tardy_treet   reduce_for_tardy(   R	   R
   R   t   input_objectst	   work_philt   work_paramst   mmtbxR   R   t   file_objt   srvR   t   processed_pdb_filest	   input_objt   processed_pdb_filet   msgt   opt   acpt   sourcet   atomR+   R(   R)   R-   t   reduced_geo(    (   R*   R   R!   R    sS   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/pdb_interpretation.pyt   run   s�    		
														
"
		t   __main__R	   i   (   t
   __future__R    R?   R   Rj   t   __name__t   argv(    (    (    sS   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/pdb_interpretation.pyt   <module>   s   		W