ó
±™xTc           @   s  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l m Z d  d l m	 Z	 d  d l
 m Z e j j d d e ƒZ e j j d d e ƒZ d d	 „ Z d
 d d d d d d d d d d d d d d d d d d d d d d  d! g Z d" „  Z e d# k re e j d$ ƒ n  d S(%   iÿÿÿÿ(   t   divisionN(   t   any_file(   t   mmcif(   t   model_vs_sequences6   
include scope mmtbx.command_line.cc_star.master_phil
t   process_includessÕ  
input
  .style = auto_align
{
  pdb_file = None
    .type = path
    .style = file_type:pdb input_file
  seq_file = None
    .type = path
    .style = file_type:seq input_file
  include scope mmtbx.command_line.cc_star.master_phil
}
output
  .style = auto_align
{
  cif_file = None
    .type = path
}
high_resolution = None
  .type = float
  .input_size = 64
low_resolution = None
  .type = float
  .input_size = 64
include scope mmtbx.validation.sequence.master_phil
c      	   C   su  d d  l  } | d  k r$ t j } n  | j j d |  d t d d d d ƒ } | j j ƒ  } | j j	 ƒ  | j
 j d  k r¢ t j j | j j ƒ d d	 | j
 _ n  t j | ƒ t j d
 | j j ƒ } | j ƒ  } | j } | j } t | j j d d ƒ}	 |	 j d ƒ |	 j }
 t j | |
 d | j ƒ  d | ƒj } | j ƒ  d } d „  } | | j d ƒ ƒ } | | j d ƒ ƒ } | j  d  k	 r˜| | _  n  | j! d  k	 r³| | _! n  | j j" d  k	 rd d l# m$ } | j% d | j d | ƒ } | j& | j' ƒ  ƒ n  | | j& | ƒ | | j( d t) ƒ | d IJ| d | j
 j IJt* | j
 j d ƒ � } | | IJWd  QXd  S(   Niÿÿÿÿt   argst   master_philt   pdb_file_defs   input.pdb_filet   seq_file_defs   input.seq_filei    s   .deposit.cift	   file_namet
   force_typet   seqt   crystal_symmetryt   alignment_paramsc         S   s'   y t  |  ƒ SWn t k
 r" d  SXd  S(   N(   t   floatt	   TypeErrort   None(   t   string(    (    sW   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/prepare_pdb_deposition.pyt   float_or_noneG   s      s   _refine.ls_d_res_highs   _refine.ls_d_res_low(   t   cc_start   paramst   outt   keys   Writing updated CIF file:s     t   wb(+   t
   iotbx.philR   t   syst   stdoutt   philt   process_command_line_with_filesR   t   workt   extractt   showt   outputt   cif_filet   ost   patht   splitextt   inputt   pdb_fileR   t   validate_paramsR   t	   cif_inputt   construct_hierarchyt	   cif_modelt	   cif_blockR   t   seq_filet   check_file_typet   file_objectt(   pdb_hierarchy_as_cif_block_with_sequenceR   t   keyst   gett   high_resolutiont   low_resolutiont   unmerged_datat   mmtbx.command_lineR   t   runt   updatet   as_cif_blockt   sortt   category_sort_functiont   open(   R   R   t   iotbxt   cmdlineR   t	   pdb_inputt   pdb_hierarchyR*   R+   t   seq_int	   sequencest
   block_nameR   t   d_min_from_cift   d_max_from_cifR   t   resultt   f(    (    sW   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/prepare_pdb_deposition.pyR6   +   sT    	)				
t   _cellt   _space_groupt   _space_group_symopt	   _symmetryt
   _computingt	   _softwaret	   _citationt   _reflnst   _reflns_shellt   _refinet   _refine_ls_restrt   _refine_ls_shellt   _pdbx_refine_tlst   _pdbx_refine_tls_groupt   _struct_ncs_opert   _struct_ncs_domt   _struct_ncs_dom_limt   _struct_ncs_enst   _struct_ncs_ens_gent   _entityt   _entity_polyt   _entity_poly_seqt
   _atom_typet
   _atom_sitec         C   s?   |  j  d ƒ d } y t j | ƒ SWn t k
 r: } | SXd  S(   Nt   .i    (   t   splitt   category_ordert   indext
   ValueError(   R   t   key_categoryt   e(    (    sW   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/prepare_pdb_deposition.pyR:      s
    t   __main__i   (   t
   __future__R    R"   R   R   R<   t   iotbx.file_readerR   t	   iotbx.pdbR   R5   R   R   t   parset   TrueR   R   R6   Ra   R:   t   __name__t   argv(    (    (    sW   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/prepare_pdb_deposition.pyt   <module>   sL   		9			