ó
‚™xTc           @   s®   d  d l  m Z d  d l Z d  d l m Z d  d l Z d  d l Z d  d l Z d
 d e j
 d „ Z d „  Z d Z e j j e d ƒ Z e d k rª e e j d	 ƒ n  d S(   iÿÿÿÿ(   t   divisionN(   t   Sorryc         C   s¸  d d  l  } d d  l } | d  k re | j j d |  d t d d d ƒ } | j j ƒ  } t | ƒ n  | j	 } g  } xè| j
 D]Ý} d } t | j
 ƒ d k rÈ d	 t j j t j j | ƒ ƒ d
 } n  t j j | ƒ sà t ‚ | j j d | ƒ } | j ƒ  }	 xW|	 j ƒ  D]I}
 x@|
 j ƒ  D]2} | j ƒ  sE| j d d ƒ r!| j rg| j d | j ƒ } n9 | j s‹| j d t d t ƒ } n d j | j ƒ  ƒ } | j  rÁt! j" d d | ƒ } n  g  } d
 } xT | t | ƒ k  r#| d d
 k r| j# d ƒ n  | d c | | 7<| d 7} qÐWd j | ƒ } | j# d | | j$ | f ƒ q!q!WqWq~ W| j% d  k	 r£t& | j% d ƒ } | j' d j | ƒ ƒ | j( ƒ  n d j | ƒ GH| j% S(   Niÿÿÿÿt   argst   master_phil_stringt   Nonet   pdb_file_defs   pdb_as_fasta.file_namet    i   s   %s i    t	   file_namet   min_contentg      à?t   skip_insertionst   pads   ^X*iF   s   
s   >%schain '%2s'
%st   w()   t	   iotbx.pdbt
   iotbx.philR   t   philt   process_command_line_with_filest   master_phil_str_templatet   workt   extractt   validate_paramst   pdb_as_fastaR   t   lent   ost   patht   splitextt   basenamet   isfilet   AssertionErrort   pdbt   inputt   construct_hierarchyt   modelst   chainst
   is_proteint   is_nat   pad_missing_residuest   as_padded_sequencet   include_insertion_residuest   Truet   Falset   joint   as_sequencet    ignore_missing_residues_at_startt   ret   subt   appendt   idt   output_filet   opent   writet   close(   R   t   paramst   outt   iotbxt   cmdlinet
   fasta_seqst   pdb_filet	   name_baset   pdb_objt	   hierarchyt   modelt   chaint   seqt	   seq_linest   kt   f(    (    sM   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/pdb_as_fasta.pyt   run   sZ    
		)				,c         C   s+   t  |  j j ƒ d k r' t d ƒ ‚ n  d  S(   Ni    s   No PDB files defined!(   R   R   R   R   (   R3   (    (    sM   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/pdb_as_fasta.pyR   7   s    sx  
pdb_as_fasta
  .short_caption = Extract sequence from PDB file(s)
  .caption = Only protein and nucleic acid chains are supported by this     program.  Except for selenomethionine (MSE), non-standard residues and     bases will be replaced by 'X' and 'N', respectively.
  .style = caption_img:icons/custom/phenix.pdbtools.png
{
  file_name = None
    .type = path
    .multiple = True
    .short_caption = PDB file
    .style = bold noauto file_type:pdb
  output_file = %s
    .type = path
    .style = bold noauto file_type:seq new_file
  pad_missing_residues = True
    .type = bool
    .short_caption = """Use 'X' in place of missing residues"""
    .style = bold noauto
  ignore_missing_residues_at_start = False
    .type = bool
    .style = bold noauto
  include_insertion_residues = True
    .type = bool
    .short_caption = Include insertion residues
    .style = bold noauto
}
s   pdb_sequences.fat   __main__i   (    (   t
   __future__R    t   libtbx.philt   libtbxt   libtbx.utilsR   t   sysR   R+   R   t   stdoutRB   R   R   R   t   parset   master_philt   __name__t   argv(    (    (    sM   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/pdb_as_fasta.pyt   <module>   s   $1	 