ó
±™xTc           @   sÁ   d  d l  m Z d  d l Z d  d l Z d  d l m Z d  d l Z d  d l Z d  d l	 m
 Z
 d  d l m Z e j j d ƒ Z d e j d „ Z d „  Z e d	 k r½ e e j d
 ƒ n  d S(   iÿÿÿÿ(   t   divisionN(   t   Sorry(   t   conformation_dependent_library(   t   cdl_databasesŸ   
cdl_lookup
  .caption = CDL
{
  residue_names = None
    .type = str
  residue_group_class = None
    .type = choice
  phi_psi_angles = None
    .type = str
}c         C   sÈ  t  j j j d t d d ƒ } g  } g  } g  } x¢ |  D]š } t j j | ƒ r® t j	 j
 | ƒ rt | j | ƒ q7 n  y t j d | ƒ } Wn t k
 r� qÑ X| j | ƒ q7 | j | ƒ | j | j | ƒ ƒ q7 Wt j d | ƒ } | j ƒ  | j ƒ  }	 |	 j j d  k rOt j t |	 j j j d ƒ d ƒ Œ  |	 j _ d |	 j j GHn  |	 j j j d ƒ }
 t |
 d	 ƒ |
 d	 <t |
 d ƒ |
 d <t |
 ƒ }
 t |	 j j |
 } t j | ƒ } d
 | GH| S(   Nt   master_philt
   home_scopet
   cdl_lookupt	   file_namet   sourcest   ,i   s   
Peptide triplet class : %si    s   
CDL values
%s(   t   libtbxt   philt   command_linet   argument_interpreterR   t   ost   patht   isfilet   iotbxt   pdbt   is_pdb_filet   appendt   parset   RuntimeErrort   processt   fetcht   showt   extractR   t   residue_group_classt   NoneR   t   get_res_type_groupt   tuplet   residue_namest   splitt   phi_psi_anglest   intR   t   restraints_show(   t   argst   outR   t   philst	   phil_argst   pdbst   argt	   file_philt   working_philt   working_paramst   keyt   restraints_valuest   outl(    (    sK   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/cdl_lookup.pyt   run2   sB    	
(	c         C   s=   |  j  j d  k s* t |  j  j ƒ d k r9 t d ƒ ‚ n  t S(   Ni    s   No PDB IDs specified!(   t	   fetch_pdbt   pdb_idsR   t   lenR   t   True(   t   params(    (    sK   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/cdl_lookup.pyt   validate_paramsC   s    *t   __main__i   (    (   t
   __future__R    t   libtbx.philR
   t   libtbx.phil.command_linet   libtbx.utilsR   t   sysR   t   mmtbxR   t1   mmtbx.conformation_dependent_library.cdl_databaseR   R   R   R   t   stdoutR0   R6   t   __name__t   argv(    (    (    sK   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/cdl_lookup.pyt   <module>   s   	
	'	