ó
‚™xTc           @   sÐ   d  d l  m Z d  d l m Z d  d l Z d  d l Z d  d l m Z d  d l	 m
 Z
 d  d l m Z m Z d  d l m Z d  d l m Z d  d l Z d	 „  Z d
 „  Z e d k rÌ e e j d ƒ n  d S(   iÿÿÿÿ(   t   division(   t   strudatN(   t   option_parser(   t   coordination_sequences(   t   crystalt   xray(   t   show_string(   t   Sorryc         C   s¸   | j  ƒ  j ƒ  H| j d |  d | d t ƒ j } H| j j ƒ  d k r^ d Gt | j ƒ GHHn  | d  k rs d  } n; t	 j
 j d | j d | ƒ } t
 j d | d	 | d
 | ƒ H| | f S(   Nt   distance_cutofft   show_cartesiant   keep_pair_asu_tablei   s   Pair counts:t   pair_asu_tablet	   max_shellt	   structuret
   term_tablet
   coseq_dict(   t   show_summaryt   show_scattererst   show_distancest   Truet   distances_infot   pair_countst   sizet   listt   NoneR   R   t   simpleR   t
   show_terms(   R   R	   R   R   t   xray_structuret   pairsR   (    (    sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/show_distances.pyt   display   s*    					c   	         s(  t  d d d d ƒ j d  d d d d d	 d
 d  d d ƒj 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 ƒj ƒ  j d  d d d d d d d d d ƒj d  d d d d d	 d d  d d! ƒj d" |  ƒ } t | j ƒ d# k rC| j j ƒ  d  S| j	 ‰  ˆ  j
 ‰ ˆ  j d  k	 r‘t j d$ ˆ  j ƒ ‰ ˆ d  k r—d% ‰ q—n d  ‰ ‡  ‡ ‡ f d& †  } d# } x8| j D]-} d  } t j j d$ | ƒ r6t j j d$ | ƒ j d' | j d( t d ˆ  j d) ƒ d* ˆ  j d+ t ƒ } | | ƒ q¼n  | j ƒ  j d, ƒ rÜt j j d- | ƒ j ƒ  } ˆ  j d  k	 r¯| j ˆ  j ƒ } | d  k r™q¼n  | d) 7} | g } n | j ƒ  } x | D] } | | ƒ qÂWq¼n  | j d. ƒ sú| j d/ ƒ r%t  j! j" d0 | d1 t# ƒ } | | ƒ q¼n  | j d  k	 rm| j j$ ƒ  d  k	 s^| j j% ƒ  d  k	 rmt& d2 ƒ ‚ n  t' j( t) | ƒ ƒ } xd | j* D]Y } ˆ  j+ d  k	 r¹ˆ  j+ | j+ k r¹qŒn  d3 G| j+ GHH| j, d* ˆ  j ƒ } | | ƒ qŒWq¼Wˆ  j d  k	 r$| d# k r$t& d4 t- ˆ  j ƒ ƒ ‚ n  d  S(5   Nt   usages0   iotbx.show_distances [options] studat_file [...]t   descriptions/   Example: iotbx.show_distances strudat --tag=SODs   --cif_data_block_namet   actiont   storet   typet   stringt   defaultt   helps-   data block name as it appears in the CIF files   --tags%   tag as it appears in the strudat files   --distance_cutofft   floati   s!   Maximum distance to be consideredt   metavart   FLOATs   --min_distance_sym_equivg      à?sG   Minimum distance between symmetry mates (for special position analysis)s   --show_cartesiant
   store_trues2   Show Cartesian coordinates (instead of fractional)s   --cst   ints-   Compute N terms of the coordination sequencest   Ns   --coseqs.   name of file with known coordination sequencest   FILEt   argsi    t	   file_namei
   c            s/   t  d ˆ  j d ˆ  j d ˆ d ˆ d |  ƒ d  S(   NR   R	   R   R   R   (   R   R   R	   (   R   (   t   coR   R   (    sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/show_distances.pyt   call_display]   s    		t   crystal_symmetryt    cryst1_substitution_buffer_layeri   t   min_distance_sym_equivt   enable_scattering_type_unknowns   .cift	   file_paths   .inss   .rest   filenamet   strictly_shelxls>   Command-line symmetry options not supported for strudat files.s   strudat tag:s3   cif_data_block_name %s not found in any input files(.   R   t   optionR   t   enable_symmetry_comprehensivet   processt   lenR-   t   parsert	   show_helpt   optionst   cst   coseqR   t   get_kriber_coseq_filet   iotbxt   pdbt   is_pdb_filet   inputt   xray_structure_simplet   symmetryt   maxR   R3   R   t   lowert   endswitht   cift   readert   build_crystal_structurest   cif_data_block_namet   gett   valuesR   R   t
   from_shelxt   Falset	   unit_cellt   space_group_infoR   R   t   read_all_entriest   opent   entriest   tagt   as_xray_structureR   (	   R-   t   command_lineR0   t   cif_data_block_name_use_counterR.   R   t   xray_structurest   strudat_entriest   entry(    (   R/   R   R   sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/show_distances.pyt   run)   sÌ    																	 			


	t   __main__i   (   t
   __future__R    t   iotbx.kriberR   t	   iotbx.pdbRB   t	   iotbx.cift   iotbx.option_parserR   t   cctbx.crystalR   t   cctbxR   R   t   libtbx.str_utilsR   t   libtbx.utilsR   t   sysR   R_   t   __name__t   argv(    (    (    sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/show_distances.pyt   <module>   s   		q