ó
ąxTc           @   sv   d  d l  m Z d  d l Z d  d l Z d Z d   Z d e j d  Z	 d   Z
 e d k rr e	 e j d  n  d S(	   i˙˙˙˙(   t   divisionNs  
input {
  model = None
    .type = path
    .multiple = True
  include scope mmtbx.utils.xray_data_str
  skip_twin_detection = False
    .type = bool
}
include scope mmtbx.refinement.select_best_starting_model.master_phil
nproc = Auto
  .type = int
output {
  write_files = False
    .type = bool
  model_file_name = best_model.pdb
    .type = path
  data_file_name = best_model_data.mtz
    .type = path
}
c           C   s   t  j j t d t S(   Nt   process_includes(   t   libtbxt   philt   parset   master_phil_strt   True(    (    (    s[   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/select_best_starting_model.pyt   master_params   s    c         C   s  d d l  m } d d  l } d d l m } d d  l } | j j d |  d t   d d d d	 d
 d  } | j	 j
   } t |  | | j j j  }	 | j j d |	 j d | j j d d d d d |  }
 g  } xW | j j D]I } | j d | d d  j } | j } | j   } | j | | f  qß W| } | d  k rG| } n  | j d | j j d | d |
 j d |
 j d | d | j d | j j d |  } | j   r| j j  r| j! d | j j"  | d IJ| d | j j" IJ| j# d | j j$  | d | j j$ IJn  | S(    Ni˙˙˙˙(   t   select_best_starting_model(   t   any_filet   argst   master_philt   pdb_file_defs   input.modelt   reflection_file_defs   input.xray_data.file_namet   usage_stringsX  mmtbx.select_best_starting_model data.mtz model1.pdb model2.pdb [...]

Given experimental data and a set of models, determines whether any of the
models can be refined directly (i.e. if isomorphous), and picks the one
with the best R-free below a specified cutoff.  Will optionally perform
rigid-body refinement on suitable models if requested.t   reflection_file_servert
   parameterst   data_parameter_scopes
   input.datat   flags_parameter_scopes   input.data.r_free_flagst   logt	   file_namet
   force_typet   pdbt   model_namest
   model_datat   f_obst   r_free_flagst   paramst   nproct   skip_twin_detectiont    s   Wrote best model to %ss   Wrote updated data to %s(%   t   mmtbx.refinementR   t   mmtbx.utilst   iotbx.file_readerR	   t
   iotbx.philR   t   process_command_line_with_filesR   t   workt   extractt   validate_paramst   inputt	   xray_dataR   t   utilst   determine_data_and_flagst   file_servert   modelt   get_filet   file_objectt	   hierarchyt   xray_structure_simplet   appendt   Nonet   select_modelR   R   R   R   t   successt   outputt   write_filest   save_best_modelt   model_file_namet   save_updated_datat   data_file_name(   R
   t   external_paramst   outR   t   mmtbxR	   t   iotbxt   cmdlineR   t   hkl_int   data_and_flagsR   R   t   model_int   pdb_hierarchyt   xray_structuret   params_t   result(    (    s[   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/select_best_starting_model.pyt   run   s\    		
										
c         C   sO   t  |  j j  d k r' t d   n$ |  j j j d  k rK t d   n  t S(   Ni    s   No models specified.s   No data file specified.(   t   lenR'   R,   t   SorryR(   R   R2   R   (   R   (    (    s[   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/select_best_starting_model.pyR&   W   s
    t   __main__i   (   t
   __future__R    t   libtbx.philR   t   sysR   R   R2   t   stdoutRG   R&   t   __name__t   argv(    (    (    s[   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/select_best_starting_model.pyt   <module>   s   	8	