ó
ƒ™xTc           @   sa   d  d l  m Z d  d l Z d  d l Z d  d l Z d „  Z e d k r] e e j d ƒ n  d S(   iÿÿÿÿ(   t   divisionNc      	   C   s�  x–|  D]Ž} t  j j d | ƒ } | j ƒ  } | j ƒ  j ƒ  d GHxñ | j ƒ  D]ã } d | j GHxÎ | j ƒ  D]À } d | j GHx« | j	 ƒ  D]� } d | j
 | j f GHx | j ƒ  D]q } d | j | j f GHxS | j ƒ  D]E } d G| j ƒ  GHd G| j GHd	 G| j GHd
 G| j GHd | j GHqÞ Wq¶ WqŽ Wqo WqP Wd GHx¾ | j ƒ  D]° } d | j GHx› | j ƒ  D]� } d | j GHxx | j ƒ  D]j }	 d |	 j GHxU |	 j ƒ  D]G }
 d |
 j |
 j
 |
 j f GHx# |
 j ƒ  D] } d G| j ƒ  GHqÔWq¦Wq‡WqhWqIWd GHx› | j ƒ  D]� } d | j GHxx | j ƒ  D]j } d | j GHxU | j ƒ  D]G }
 d |
 j |
 j
 |
 j f GHx# |
 j ƒ  D] } d G| j ƒ  GHq{WqMWq.WqWd GHxÐ | j ƒ  D]Â } d | j GHx­ | j ƒ  D]Ÿ } d | j GHxŠ | j	 ƒ  D]| } d | j
 | j f GHx^ | j ƒ  D]P }	 d |	 j GH|	 j ƒ  }
 d |
 j GHx# |
 j ƒ  D] } d G| j ƒ  GHqOWqWqðWqÑWq²W| j ƒ  } t j | ƒ } | j ƒ  } | j ƒ  } | j ƒ  } | j ƒ  } | j ƒ  } | j d | ƒ sçt ‚ | j ƒ  | j ƒ  k st ‚ d | _ d | _ d | _ d | _
 d | _ d | _ d | _ t  j j j  ƒ  } d | _ | j! d | ƒ d GH| j" d t# ƒ GH| j$ d d ƒ q Wd  S(    Nt	   file_namesY   
    # Primary "view" of hierarchy:
    #   model, chain, residue_group, atom_group, atoms   model: "%s"s   chain: "%s"s'     residue_group: resseq="%s" icode="%s"s(       atom_group: altloc="%s" resname="%s"s        s           atom.xyz:  s           atom.occ:  s           atom.b:    s           atom.segid: "%s"sd   
    # Secondary (read-only) "view" of the hierarchy:
    #   model, chain, conformer, residue, atoms     conformer: "%s"s0       residue: resname="%s" resseq="%s" icode="%s"sŠ   
    # Special case: if there are no alt. conf. you can eliminate one
    # level of the hierarchy (which may be more intuitive at first).s  
    # A third "view" of the hierarchy:
    #   model, chain, residue_group, conformer, residue, atom
    # This is useful for handling all conformers of a given residue_group
    # together.
    # All meaningful PDB files will only have one residue per conformer.s       conformer: altloc="%s"s       residue: resname="%s"t   othert   XYt   Zt   NOPt   9999t   It   Qt   9t   NEWt   atoms:   
    # Format entire hierarchy as pdb string and pdb file.t
   append_ends   junk.pdb(%   t   iotbxt   pdbt   inputt   construct_hierarchyt   overall_countst   showt   modelst   idt   chainst   residue_groupst   resseqt   icodet   atom_groupst   altloct   resnamet   atomst   format_atom_recordt   xyzt   occt   bt   segidt
   conformerst   residuest   only_residuet   randomt   choicet   parentt   is_similar_hierarchyt   AssertionErrort	   memory_idt   namet	   hierarchyR   t   append_atomt   as_pdb_stringt   Truet   write_pdb_file(   t   argsR   t   pdb_inpR,   t   modelt   chaint   residue_groupt
   atom_groupR   t	   conformert   residuet	   pdb_atomst   root(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/examples/pdb_hierarchy.pyt   run   s      #	#								t   __main__i   (	   t
   __future__R    t	   iotbx.pdbR   R%   t   sysR;   t   __name__t   argv(    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/examples/pdb_hierarchy.pyt   <module>   s   	q