ó
‚™xTc           @   s    d  d l  m Z d  d l m Z d  d l m Z d  d l m Z d  d l Z d  d l	 Z	 d d „ Z
 d d	 d	 d d
 „ Z e d k rœ e
 d e j d ƒ n  d S(   iÿÿÿÿ(   t   division(   t   pdb(   t   option_parser(   t   show_stringNs   phenix.pdb.hierarchyc         C   sB  t  |  ƒ d k r d g }  n  t d d | ƒ j d  d d d d d	 d
 d  d d d d j t j j ƒ ƒj d  d d d d d d
 d d d d d ƒj d  d d d d d d
 d d d d d ƒj d  d d d d d	 d
 d d d d d ƒj d  d d d d d	 d
 d  d d d d ƒj d  d d d d
 t d d ƒj d  d  d d d d d
 d  d d! d d ƒj d  d" d d d d d
 d d d# d d ƒj d  d$ d d d
 t d d% ƒj d  d& d d d
 t d d' ƒj d  d( d d d
 t d d) ƒj	 d* |  ƒ } | j
 } xH| j D]=} t j j | ƒ sqýn  t d+ | d, | j d- | j d. | j d/ | j ƒ } | j d  k	 r,| j r|| j j ƒ  j ƒ  n  t } | j s×| j j ƒ  } | j ƒ  d k r×t | j d0 ƒ d1 j | ƒ IJt } q×n  | j j d+ | j d2 | d3 t d4 | j d5 | j d6 | j  d7 | j! d8 | j! ƒ n  | j j" ƒ  GHqýWd  S(9   Ni    s   --helpt   usages
   %s file...s	   --detailst   actiont   storet   typet   stringt   defaultt   helps   level of detailt   metavart   |s   --residue_groups_max_showt   inti
   sK   maximum number of residue groups to be listed along with errors or warningst   INTs    --duplicate_atom_labels_max_shows>   maximum number of groups of duplicate atom labels to be listeds   --prefixt    s   prefix for all output linest   STRINGs   --write_pdb_files1   write hierarchy as PDB coordinate section to filet   FILEs   --set_element_simplet
   store_truesW   sets or tidies ATOM record element columns (77-78) if necessary before writing PDB files   --reset_serial_first_values2   resets atom serial numbers before writing PDB files   --interleaved_confsš   interleave alt. conf. when writing PDB file; possible choices are: 0 (not interleaved), 1 (interleaved atom names but not resnames), 2 (fully interleaved)s   --no_anisous-   suppress ANISOU records when writing PDB files   --no_sigatms-   suppress SIGATM records when writing PDB files
   --no_crystsP   suppress crystallographic records (e.g. CRYST1 and SCALEn) when writing PDB filet   argst	   file_namet   prefixt   residue_groups_max_showt   duplicate_atom_labels_max_showt   level_idt   wbs   
t   open_appendt
   append_endt   interleaved_conft   atoms_reset_serial_first_valuet   sigatmt   anisout   siguij(#   t   lenR   t   optiont   Nonet   joinR   t	   hierarchyt	   level_idst   Falset   processt   optionsR   t   ost   patht   isfilet   executeR   R   R   t   detailst   write_pdb_filet   set_element_simplet   atomst(   set_chemical_element_simple_if_necessaryt   no_crystt   inputt   crystallographic_sectiont   sizet   opent   TrueR   t   reset_serial_first_valuet	   no_sigatmt	   no_anisout   rstrip(   R   t   command_namet   command_linet   coR   t   pdb_objsR   t   s(    (    sN   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/pdb.hierarchy.pyt   run	   s¸     																						 								

R   i
   c         C   s€   y/ t  j j d |  d | d | d | d | ƒ SWnJ t k
 rE ‚  n7 t k
 r{ } d t |  ƒ | j j t | ƒ f GHn Xd  S(   NR   R   R   R   R   s   Exception: file %s: %s: %s(	   R   R%   t   show_summaryt   KeyboardInterruptt	   ExceptionR   t	   __class__t   __name__t   str(   R   R   R   R   R   t   e(    (    sN   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/pdb.hierarchy.pyR-   k   s     t   __main__R   i   (   t
   __future__R    t   iotbxR   t   iotbx.option_parserR   t   libtbx.str_utilsR   t   sysR*   RB   R#   R-   RG   t   argv(    (    (    sN   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/pdb.hierarchy.pyt   <module>   s   d