ó
±™xTc           @   s„   d  d l  m Z d  d l m Z d  d l m Z d  d l Z d  d l Z d „  Z e j	 d „ Z
 e d k r€ e
 e j d ƒ n  d S(	   iÿÿÿÿ(   t   division(   t   make_sub_header(   t   SorryNc          C   s#   d d l  m }  |  d t d d ƒ S(   Niÿÿÿÿ(   t    generate_master_phil_with_inputst   enable_automatic_twin_detectiont   phil_stringsž   
ligand_code = None
  .type = str
  .multiple = True
reference_structure = None
  .type = path
only_segid = None
  .type = str
verbose = False
  .type = bool
(   t   mmtbx.command_lineR   t   True(   R   (    (    sQ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/validate_ligands.pyt   master_phil   s    c   
      C   s•  d } d d  l  } d d  l } g  } x` |  D]X } t | ƒ d k rv | j ƒ  rv t j j | ƒ rv | j d | ƒ q+ | j | ƒ q+ W| j j	 d | d t
 ƒ  d t d | ƒ } | j } | j d  k sÞ t | j ƒ d	 k rí t d
 ƒ ‚ n  t d d | ƒx‘ | j D]† } | j j j d | j d | j d | d | j d | j ƒ }	 |	 d  k rht d | ƒ ‚ n  | j j j d |	 d | d | j ƒ qWd  S(   Ns¥   mmtbx.validate_ligands model.pdb data.mtz LIGAND_CODE [...]

Print out basic statistics for residue(s) with the given code(s), including
electron density values/CC.
iÿÿÿÿi   s   ligand_code=%st   argsR   t   process_pdb_filet   usage_stringi    s   Ligand code required!s   Validating ligandst   outt   pdb_hierarchyt   fmodelt   ligand_codet   reference_structuret
   only_segids   No ligands named '%s' found.t   validationst   verbose(   t   mmtbx.validation.ligandsR   t   lent   isalnumt   ost   patht   existst   appendt   command_linet   load_model_and_dataR   t   Falset   paramsR   t   NoneR   R   t
   validationt   ligandst   validate_ligandsR   R   R   R   t   show_validation_resultsR   (
   R	   R   R   t   mmtbxt   args_t   argt   cmdlineR   R   R   (    (    sQ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/validate_ligands.pyt   run   s:    1			$			t   __main__i   (   t
   __future__R    t   libtbx.str_utilsR   t   libtbx.utilsR   R   t   sysR   t   stdoutR(   t   __name__t   argv(    (    (    sQ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/validate_ligands.pyt   <module>   s   	%