ó
‚™xTc           @   s›   d  d l  m Z d  d l Z d  d l m Z m Z d  d l Z d  d l Z e j	 j
 d ƒ Z d	 d d d „ Z d „  Z e d k r— e e j d ƒ n  d S(
   iÿÿÿÿ(   t   divisionN(   t   Sorryt   Usages   
expand_ncs {
  file_name = None
    .type = path
    .short_caption = PDB file
    .style = file_type:pdb bold
  output_file = None
    .type = path
    .short_caption = Output file
    .style = file_type:pdb new_file
  clash_limit = 20
    .type = int
}
c         C   s  | d  k r t j } n  | d  k r„ t |  ƒ d k rE t d ƒ ‚ n  d d  l } | j j d |  d t d d ƒ } | j	 j
 ƒ  } n  d d l m } d d  l } | j | j j d	 d
 ƒ} | j } | j } | j j j d | d | j j ƒ  d | ƒ }	 | j j d  k rAt j j t j j | j j ƒ d ƒ d | j _ n  t | j j d ƒ }
 |
 j |	 j | j ƒ  ƒ ƒ |
 j ƒ  | d | j j IJ| j j  d  k	 rõ| j j! d | j j ƒ } | | j j  k rõt" d d | | j j f ƒ ‚ qõn  t j j# | j j ƒ S(   Ni    s   iotbx.pdb.expand_ncs model.pdbiÿÿÿÿt   argst   master_philt   pdb_file_defs   expand_ncs.file_name(   t   file_readert
   force_typet   pdbt   pdb_hierarchyt   processed_mtrix_recordst   logs   _ncs.pdbt   ws   Wrote %st	   file_names0   %d bad clashes found in output model (%s).  Set s,   clash_limit=None to disable the clash check.($   t   Nonet   syst   stdoutt   lenR   t
   iotbx.philt   philt   process_command_line_with_filesR   t   workt   extractt   iotbxR   t   iotbx.pdb.hierarchyt   any_filet
   expand_ncsR   t   file_objectt	   hierarchyR   t   inputt   process_mtrix_recordst   output_filet   ost   patht   basenamet   splitextt   opent   writet   as_pdb_stringt   crystal_symmetryt   closet   clash_limitt   quick_clash_checkR   t   abspath(   R   t   paramst   outR   t   cmdlineR   t   pdb_filet   pdb_inR	   t   hierarchy_newt   ft   n_bad_pairs(    (    sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/pdb_expand_ncs.pyt   run   sH    						,
c         C   sV   |  j  j d  k r! t d ƒ ‚ n1 t j j |  j  j ƒ sR t d |  j  j ƒ ‚ n  t S(   Ns   No PDB file specified.s   %s is not a valid file.(   R   R   R   R   R    R!   t   isfilet   True(   R,   (    (    sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/pdb_expand_ncs.pyt   validate_params>   s
    t   __main__i   (    (   t
   __future__R    t   libtbx.philt   libtbxt   libtbx.utilsR   R   R    R   R   t   parseR   R   R4   R7   t   __name__t   argv(    (    (    sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/pdb_expand_ncs.pyt   <module>   s   		&	