ó
±xTc           @   s   d  d l  m Z d  d l m Z m Z d  d l Z d  d l Z e j j	 d  Z
 e j d  Z e d k r e e j d  n  d S(   i’’’’(   t   division(   t   Sorryt   UsageNsō   
resname = None
  .type = str
d_max = None
  .type = float
polymeric_type = *Any Free Polymeric
  .type = choice
xray_only = True
  .type = bool
data_only = False
  .type = bool
identity_cutoff = None
  .type = int
quiet = False
  .type = bool
c         C   s»  t  |   d k s d |  k r= t d t j d d    n  g  } d   } t j j j d t  } | j d |  d	 |  } | j	   } | j
 d  k r¦ t d
   n  d d l m } | j d | j
 d | j d | j d | j d | j d | j  } g  | D] }	 |	 j   ^ q’ } t  |  d k r8t d   n | j s£| d t  |  IJd }
 xY |
 t  |  k  r| d d j | |
 |
 d ! IJ|
 d 7}
 q^Wn | d t  |  IJd  S(   Ni    s   --helps§   mmtbx.find_residue_in_pdb RESNAME [options]

Use the RCSB web services to retrieve a list of PDB structures containing the
specified chemical ID.

Full parameters:
%s
t   prefixs     c         S   sF   d t  |   k o d k n rB |  j   rB t j j d |   Sd  S(   Ni   i   s
   resname=%s(   t   lent   isalnumt   libtbxt   philt   parse(   t   arg(    (    sT   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/find_residue_in_pdb.pyt   process_unknown#   s    .t   master_philt   argst   custom_processors   No residue ID specified.i’’’’(   t   rcsb_web_servicest   resnamet   d_maxt   polymeric_typet	   xray_onlyt	   data_onlyt   identity_cutoffs4   No structures found matching the specified criteria.s   %d PDB IDs retrieved:s     %st    i   s   %d PDB IDs matching(   R   R   R   t   as_strR   R   t   command_linet   argument_interpretert   process_and_fetcht   extractR   t   NoneR   t   mmtbx.wwpdbR   t   chemical_id_searchR   R   R   R   R   t   lowert   quiett   join(   R   t   outt   sourcesR
   t   cait   working_philt   paramsR   t   pdb_idst   idt   i(    (    sT   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/find_residue_in_pdb.pyt   run   s:    									"t   __main__i   (   t
   __future__R    t   libtbx.utilsR   R   t   libtbx.phil.command_lineR   t   sysR   R   R   t   stdoutR)   t   __name__t   argv(    (    (    sT   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/find_residue_in_pdb.pyt   <module>   s   		)