ó
±™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	 d  d l
 Z
 e j j d d e ƒZ d
 d d d „ Z d „  Z e d k r© e e
 j d	 ƒ n  d S(   iÿÿÿÿ(   t   divisionN(   t   Sorryt   Usagesç   
input
  .style = auto_align
{
  pdb_file = None
    .type = path
    .style = file_type:pdb input_file
  seq_file = None
    .type = path
    .style = file_type:seq input_file
}
include scope mmtbx.validation.sequence.master_phil
t   process_includesc      	   C   s   | d  k r t j } n  t |  ƒ d k rE | d  k rE t d ƒ ‚ n  d d  l } | j j d |  d t d d d d	 ƒ } | j	 j
 ƒ  } y t | ƒ Wn$ t k
 r» } | GHt d
 ƒ ‚ n Xd d  l } d d l m } | | j j d d ƒ} | j d ƒ | | j j d d ƒ}	 |	 j d ƒ | j j }
 |	 j } t | ƒ d k rbt d | j j ƒ ‚ n  | j j j d |
 d | d | d | ƒ } | j d | ƒ d  S(   Ni    sÃ   phenix.model_vs_sequence model.pdb sequence.fa

Verify the sequence of each chain in a PDB file to detect residue mismatches
and other inconsistencies (similar to validation upon PDB deposition).iÿÿÿÿt   argst   master_philt   pdb_file_defs   input.pdb_filet   seq_file_defs   input.seq_files.   phenix.model_vs_sequence model.pdb sequence.fa(   t   any_filet
   force_typet   pdbt   seqs3   There don't appear to be any valid sequences in %s!t   pdb_hierarchyt	   sequencest   paramst   logt   out(   t   Nonet   syst   stdoutt   lenR   t
   iotbx.philt   philt   process_command_line_with_filesR   t   workt   extractt   validate_paramsR   t   mmtbx.validation.sequencet   iotbx.file_readerR   t   inputt   pdb_filet   check_file_typet   seq_filet   file_objectt	   hierarchyt
   validationt   sequencet   show(   R   R   R   t   iotbxt   cmdlinet   et   mmtbxR   t   pdb_int   seq_inR   R   t   v(    (    sR   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/model_vs_sequence.pyt   run   sD    			c         C   s¨   |  j  j d  k r! t d ƒ ‚ nƒ t j j |  j  j ƒ sR t d |  j  j ƒ ‚ nR |  j  j d  k rs t d ƒ ‚ n1 t j j |  j  j ƒ s¤ t d |  j  j ƒ ‚ n  t S(   Ns   No PDB file specified.s   '%s' is not a file.s   No sequence file specified.(	   R   R   R   R   t   ost   patht   isfileR    t   True(   R   (    (    sR   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/model_vs_sequence.pyR   ?   s    t   __main__i   (    (   t
   __future__R    R   R)   t   libtbx.utilsR   R   t   libtbx.philt   libtbxR.   R   R   t   parseR1   R   R   R-   R   t   __name__t   argv(    (    (    sR   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/model_vs_sequence.pyt   <module>   s   	'	