ó
‚™xTc           @   s‹   d  d l  m Z d  d l m Z d  d l m Z d  d l m Z d  d l Z d  d l	 Z	 d d „ Z
 e d k r‡ e
 d	 e j d
 ƒ n  d S(   iÿÿÿÿ(   t   division(   t   pdb(   t   Sorry(   t   multimerNs   phenix.pdb.mtrix_reconstructionc         C   s6  t  |  ƒ d k r% t d d ƒ ‚ nd |  k s= d |  k rK t t ƒ GHnç t  |  ƒ d k rl t d ƒ ‚ nÆ t j j |  d ƒ s¬ d j |  d t j ƒ  ƒ GHt d	 ƒ ‚ n† t	 d
 |  d d d ƒ } | j
 d k r t  |  ƒ d k r| j |  d ƒ d |  d GHq2| j ƒ  d | j GHn d j |  d ƒ GHd S(   sg   (string) -> file

  Reconstruction of the crystallographic asymmetric unit by applying
  MTRIX transformation, from the MTRIX records in the pdb file, to all chains in file.

  Produce a new pdb file containg the rystallographic asymmetric unit information

  Arguments:
  args: a string containing the pdb file name, 'file_name.pdb' and an optional output file name
        if no file name is given, the output file will have the name 'cryst_asym_unit_file_name.pdb'

  >>> phenix.pdb.mtrix_reconstruction input_file_name.pdb
  mtrix-assembly reconstructed pdb file was added to your current directory
  /path/cryst_asym_unit_input_file_name.pdb

   >>> phenix.pdb.mtrix_reconstruction input_file_name.pdb 'output_file_name.pdb
  mtrix-assembly reconstructed pdb file was added to your current directory
  /path/output_file_name.pdb

  @author: Youval Dar (LBL 2013)
  i    s=   No input filename is given. Please provide a pdb file name. 
s7   >>> phenix.pdb.mtrix_reconstruction input_file_name.pdbs   --helps   -hi   s"   To many input parameters are givens1   There is no file {} in the current directory 
 {}s   File name errort	   file_namet   reconstruction_typet   caui   s&   %s was added to your current directorys   No MTRIX information in {}N(   t   lenR   t   helpt   mtrix_reconstructiont   ost   patht   isfilet   formatt   getcwdR   t   number_of_transformst   writet   pdb_output_file_name(   t   argst   command_namet   m(    (    sU   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/mtrix_reconstruction.pyR	   	   s$    
t   __main__R   i   (   t
   __future__R    t   iotbxR   t   libtbx.utilsR   t!   iotbx.pdb.multimer_reconstructionR   t   sysR
   R	   t   __name__t   argv(    (    (    sU   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/mtrix_reconstruction.pyt   <module>   s   /