ó
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 d e Z d
 d e j d  Z d   Z e d k r  e e j d	  n  d S(   i˙˙˙˙(   t   divisionN(   t   Usaget   Sorrys\  
remediator
  .short_caption = PDB remediation
  .caption = This utility converts between version 2.3 and version 3.2 of     the PDB format, which differ primarily in the treatment of hydrogen     atoms.  PHENIX always uses v3.2 atom names, as do recent     versions of Coot, Refmac, and other programs using the CCP4 monomer     library, but it can also interpret previous formats.  You may however     need to convert between formats for certain applications.  (The PDB will     always convert to v3.2 upon submission.)
  .style = box auto_align caption_img:icons/custom/phenix.pdbtools.png
{
  file_name = None
    .type = path
    .short_caption = PDB file
    .help = '''input coordinate file (pdb)'''
    .style = bold file_type:pdb input_file
  output_file = None
    .type = path
    .optional = True
    .help = '''Enter a .pdb output name'''
    .style = new_file file_type:pdb
  version = *3.2 2.3
    .type = choice(multi=False)
    .short_caption = Format version
  dict = None
    .type = path
    .optional = True
    .short_caption = Custom definition file
    .help = '''custom definition file'''
}
t   process_includesc         C   s˘  d d l  m } d d l m } | d  k rî t j   } d  } g  } x |  D]~ } t j j	 |  rŞ | j
 |  }	 |	 j d k rÉ |	 } | j | j d d |   qÉ qK | j d |  }
 | j |
  qK Wt j d |  } | j   } nI | } | j j d  k r7t j j | j j  \ } } | d | j _ n  | j j d  k r| d  k rp| j   } t |   q| j | j _ n  | j } | j |  | j j S(	   Ni˙˙˙˙(   t
   remediator(   t   file_readert   pdbt   args   file_name="%s"t   sourcess   _remediated.pdb(   t   iotbx.pdb.remediationR   t   iotbxR   t   Nonet   master_philt!   command_line_argument_interpretert   ost   patht   isfilet   any_filet	   file_typet   appendt   processt   fetcht   extractt   output_filet   splitextt	   file_namet   get_summaryR   (   t   argst   paramst   outR   R   t   interpretert   pdb_fileR   R   t
   input_filet   arg_philt	   work_philt   work_paramst   baset   extt   summary(    (    sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/pdb_remediator.pyt   run*   s8    #	c         C   s%   |  j  j d  k r! t d   n  t S(   Ns   Please specify a PDB file.(   R   R   R   R   t   True(   R   (    (    sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/pdb_remediator.pyt   validate_paramsK   s    t   __main__i   (    (   t
   __future__R    t   libtbx.philt   libtbxt   libtbx.utilsR   R   R   t   syst   philt   parseR(   R   R   t   stdoutR'   R)   t   __name__t   argv(    (    (    sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/pdb_remediator.pyt   <module>   s   	!	