ó
é™xTc           @   së   d  d l  m Z d  d l m Z m Z d  d l m Z d  d l Z d  d l Z d  d l	 m
 Z
 d  d l Z d „  Z e d „ Z d „  Z d	 „  Z e d
 k rç e ƒ  e d d e j d k pÍ d e j d k ƒ e ƒ  e ƒ  d GHn  d S(   iÿÿÿÿ(   t   division(   t	   show_difft   Exception_expected(   t	   interfaceN(   t   StringIOc       	   C   sð  t  j j d d t ƒ}  t  j j d ƒ } d } t  j j d ƒ } d } t  j j j d |  d | d	 t ƒ } | j ƒ  } t | j j	 j
 ƒ d
 k s™ t ‚ | j | ƒ | j d ƒ } t | ƒ d k sÍ t ‚ | j d ƒ } t | ƒ d
 k sô t ‚ | j d ƒ }	 |	 j ƒ  d k st ‚ |	 j ƒ  }
 |
 t k s9t ‚ | j ƒ  } t | j j j j ƒ d k sit ‚ | j d | ƒ | j ƒ  } t | j j	 j
 ƒ d k s¦t ‚ | j j j	 t k sÁt ‚ | j j j t k sÜt ‚ | j j j d k s÷t ‚ | j j j j d g k st ‚ | j d | ƒ | j ƒ  } t | j j j j ƒ d k sXt ‚ t  j j d ƒ } t  j j d ƒ } | j d d d | | g d d d t ƒ | j d ƒ } | j j j d g k sÑt ‚ | j j j j d d g k sõt ‚ | j j j t k st ‚ | j d t ƒ } | j ƒ  } | j j j	 sDt ‚ | j d t ƒ } | j ƒ  } | j j j	 t k s}t ‚ | j  ƒ  } | d k s›t ‚ | j! d  d! t d" t ƒ} t | ƒ d k sÎt ‚ | j! d  d! t d" t ƒ} t | ƒ d# k st ‚ | j! d$ d% t ƒ} t | ƒ d
 k s.t ‚ | j! d& d! t d" t ƒ} t | ƒ d# k sat ‚ | j! d' ƒ } t | ƒ d k sˆt ‚ | j d( ƒ | j d) ƒ | j" ƒ  d* k sºt ‚ | j# ƒ  d+ k sÒt ‚ t  j j j$ d, d- ƒ d. k söt ‚ t  j j d/ ƒ }  |  j% d0 t  j j d1 ƒ ƒ } t  j j j d |  d | d	 t ƒ } | j& d2 ƒ } | j' ƒ  d3 g k stt ‚ | j( ƒ  d8 g k s�t ‚ t  j j d6 ƒ }  y t  j j j) |  ƒ Wn+ t k
 rå} t* | ƒ d7 k sìt ‚ n Xt+ ‚ d  S(9   NsÏ  
refinement {
  input {
    pdb {
      file_name = None
        .type = path
        .multiple = True
    }
    sequence = None
      .type = path
      .style = seq_file
  }
  refine {
    strategy = *individual_sites *individual_adp *occupancies tls rigid_body
      .type = choice(multi=True)
    adp {
      tls = None
        .type = str
        .multiple = True
        .help = Selection for TLS group
    }
  }
  main {
    ncs = False
      .type = bool
      .help = This turns on NCS restraints
    ordered_solvent = False
      .type = bool
    number_of_macro_cycles = 3
      .type = int
    ias = False
      .type = bool
  }
  ncs {
    restraint_group
      .multiple = True
      .optional = True
      .short_caption = Restraint group
    {
      reference = None
        .type = str
        .help = Reference selection for restraint group
      selection = None
        .type = str
        .multiple = True
        .optional = False
        .help = Restrained selection
    }
  }
  developer
    .expert_level = 3
  {
    place_elemental_ions = False
      .type = bool
  }
  gui {
    include scope libtbx.phil.interface.tracking_params
    output_dir = None
      .type = path
      .style = output_dir
  }
}
t   process_includessƒ  
refinement {
  input {
    pdb {
      file_name = protein.pdb
      file_name = ligand.pdb
    }
  }
  refine {
    adp {
      tls = "chain A"
      tls = "chain B"
    }
  }
  main {
    ncs = True
    ordered_solvent = True
  }
  ncs {
    restraint_group {
      reference = "chain A"
      selection = "chain B"
      selection = "chain C"
      selection = "chain D"
    }
  }
}
s6  
refinement {
  input {
    pdb {
      file_name = model1.pdb
    }
  }
  main {
    ncs = True
    ordered_solvent = False
  }
  ncs {
    restraint_group {
      reference = "chain A"
      selection = "chain B"
    }
    restraint_group {
      reference = "chain C"
      selection = "chain D"
    }
  }
}s(   refinement.main.number_of_macro_cycles=5s–   
refinement.refine.adp.tls = None
refinement.ncs.restraint_group {
  reference = "chain C and resseq 1:100"
  selection = "chain D and resseq 1:100"
}t   master_philt   working_philt	   fetch_newi   s   refinement.ncs.restraint_groupi   s   refinement.input.pdb.file_names   refinement.main.ordered_solventt   phil_objecti   s
   model1.pdbt   phil_stringi    s!   refinement.refine.strategy = *tlss,   refinement.input.pdb.file_name = ligand2.pdbt	   file_names   tst_params.efft   sourcest
   extra_phils   refinement.main.ias = Truet	   diff_onlyt   tlss   ligand2.pdbt   preserve_changess   refinement.input.sequences   Restraint groupt	   match_allt   labels_onlyi   t   macro_cyclest   phil_name_onlys   selection groupt	   elementals"   refinement.gui.output_dir=/var/tmps(   refinement.gui.job_title="Hello, world!"s   /var/tmps   Hello, world!s$   refinement.input.xray_data.file_namet   labelss!   refinement.input.xray_data.labelss¡   
pdb_in = None
  .type = path
  .short_caption = Input model
  .style = file_type:pdb input_file
pdb_out = None
  .type = path
  .style = file_type:pdb new_file
t   sources-   
pdb_in = foo.pdb
pdb_out = foo.modified.pdb
t   pdbt   pdb_ins   foo.pdbs   Input models�   
my_options {
opt1 = *foo bar
  .type = choice
  .caption = Foo Bar
opt2 = *two_fofc fofc
  .type = choice(multi=True)
  .caption = 2mFo-DFc
}
s   my_options.opt2(   s   foo.pdbs   Input modelR   (,   t   libtbxt   philt   parset   TrueR   t   indext   get_python_objectt   lent
   refinementt   ncst   restraint_groupt   AssertionErrort   updatet   get_scope_by_namet	   full_patht   extractt   Falset   refinet   adpR   t
   merge_philt   maint   ordered_solventt   number_of_macro_cyclest   inputR   R   t   save_param_filet   get_python_from_filet   strategyt   iast   copyt   get_seq_file_def_namet   search_phil_textt   get_output_dirt   get_job_titlet   get_adjoining_phil_patht   fetcht   get_file_type_mapt   get_param_namest   get_input_filest   validate_choice_captionst   strR   (   R   t   refine_phil1t   refine_phil2_strt   refine_phil3t   refine_phil4_strt   it   paramst   ncs_philt   pdb_philt   os_philt   os_paramt   phil1t   phil2t   i2t   params2t   i3t   params3t   seq_file_deft   namesR   t   pdb_mapt   e(    (    sG   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/phil/tst_interface.pyt   exercise
   s²    	>			!$!!$	$										c         C   sa  t  j j d d ƒ s d GHd  Sd d l m } d d  l } d d l m } d } d } d	 } d
 } | j ƒ  } t j	 d | d | j
 j ƒ }	 | ƒ  }
 |	 j d | ƒ | ƒ  } |	 j ƒ  } | j j j d j d k sÜ t ‚ | ƒ  } |	 j d | d d ƒ | ƒ  } |	 j ƒ  } | j j j d j d k s2t ‚ |	 j d ƒ } | j ƒ  } | j d j d k sit ‚ |  r”d | |
 d GHd | | d GHn  |	 j d | d d ƒ |	 j ƒ  } | j j j d j d k sØt ‚ |	 j d | d d ƒ |	 j ƒ  } | j j j d j d k st ‚ |	 j d d ƒ |	 j d ƒ } | d d d d g k sYt ‚ |	 j ƒ  d= d> d? d@ g k s}t ‚ |	 j ƒ  d( k s•t ‚ |	 j d) ƒ } | j d  k s¹t ‚ |	 j d% ƒ } | j d* ƒ d+ g k sæt ‚ | j ƒ  i d, d- 6d. d/ 6d0 d1 6d2 d3 6k st ‚ |	 j  d4 ƒ s/t ‚ |	 j d4 ƒ } | j! ƒ  i d5 d5 6k s]t ‚ |	 j" d6 ƒ } | j# ƒ  d! d7 g k sŠt ‚ | j$ ƒ  d! k s¢t ‚ |	 j" d+ ƒ } | j% ƒ  d8 k sÉt ‚ t& | j# ƒ  ƒ d k sçt ‚ | j' d% ƒ d9 k st ‚ |	 j( ƒ  } t& | j) ƒ  ƒ d: k s,t ‚ | j* d; ƒ } t+ | j) ƒ  d ƒ d< k s]t ‚ d  S(A   Nt   namet   phenixs4   phenix module not available: skipping advanced testsiÿÿÿÿ(   t   runtime(   t   timesÏ   
refinement.secondary_structure {
  helix {
    selection = "chain A and resseq 10:20"
  }
  helix {
    selection = "chain A and resseq 30:40"
  }
  helix {
    selection = "chain A and resseq 50:60"
  }
}
sÏ   
refinement.secondary_structure {
  helix {
    selection = "chain B and resseq 10:20"
  }
  helix {
    selection = "chain B and resseq 30:40"
  }
  helix {
    selection = "chain B and resseq 50:60"
  }
}
sT   
refinement.ncs.restraint_group {
  reference = "chain A"
  selection = "chain B"
}
sS   
refinement.ncs.restraint_group {
  reference = "chain C"
  selection = "chain D"
}R   R   R
   i    s   chain A and resseq 10:20t
   only_scopes   refinement.secondary_structures   chain B and resseq 10:20s    Merge with global fetch: %6.1fmsiè  s    Merge with local fetch:  %6.1fmss   refinement.ncs.restraint_groups   chain As   chain Csé   
refinement.input.pdb.file_name = protein.pdb
refinement.input.pdb.file_name = ligand.pdb
refinement.input.xray_data.file_name = data.mtz
refinement.input.monomers.file_name = ligand.cif
refinement.output.title = Test refinement run
t   CIFs&   refinement.output.write_model_cif_files0   refinement.ncs.simple_ncs_from_pdb.max_rmsd_users+   refinement.output.write_reflection_cif_files#   refinement.input.monomers.file_names   protein.pdbs   Input models   refinement.input.pdb.file_names
   ligand.pdbs   data.mtzs   Reflections files$   refinement.input.xray_data.file_names
   ligand.cifs   Restraints (CIF)s   Test refinement runs   refinement.refine.strategyt	   file_typet   hklR   t   fobst   low_resolutiont   d_maxt   high_resolutiont   d_mins   r_free_flags.file_namet
   rfree_files!   refinement.input.xray_data.labelsR   R   s   refinement.reference_model.filei   i   i   t   Atom_selectionss   refinement.refine.sites(   s   protein.pdbs   Input models   refinement.input.pdb.file_name(   s
   ligand.pdbs   Input models   refinement.input.pdb.file_name(   s   data.mtzs   Reflections files$   refinement.input.xray_data.file_name(   s
   ligand.cifs   Restraints (CIF)s#   refinement.input.monomers.file_name(,   R   t   envt
   has_modulet   phenix.refinementRX   t
   iotbx.philRY   R   R   R   R   R   R,   R   R!   t   secondary_structuret   helixt	   selectionR$   R&   R(   R"   R#   t	   referenceR7   R>   t   get_run_titlet   get_scope_styleR\   t   Nonet   get_listt   get_child_paramst   is_list_typet   get_parent_paramsR<   t   get_multiple_paramst   get_default_paramt   get_overall_max_countR    t   get_max_countt   get_menu_dbt	   get_itemst   get_submenuR@   (   t   verboseRX   t   iotbxRY   t   phil_strt
   phil_str_2t
   phil_str_3t
   phil_str_4R   RE   t   t1t   t2RF   t   t3t   t4t   scopeRN   RR   t   stylet   file_mapt   menut   submenu(    (    sG   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/phil/tst_interface.pyt
   exercise_2ò   s˜    				""			c          C   s  t  j j d d ƒ s d GHd  Sd d  l }  d d  l } | j j ƒ  } t j d | d |  j	 j
 ƒ } | j d d ƒ d( d) d* g } | j ƒ  | k sš t ‚ | j d d d d d d ƒ t j d | d |  j	 j
 ƒ } | j d d ƒ | j ƒ  j } | j ƒ  | k st ‚ | j d	 k s t ‚ t | j ƒ d k s;t ‚ | j d j d g k sZt ‚ t j d | d d d d d d d t ƒ t j d | d |  j	 j
 ƒ } | j d d ƒ | j ƒ  j } | j d  k sÔt ‚ | j d d! ƒ t j d | d d! d d d d" d t ƒ t j d | d |  j	 j
 ƒ } | j d d! ƒ | j ƒ  j } | j d# k s^t ‚ | j d ƒ | j d$ ƒ d k s†t ‚ | j d% ƒ d  k	 s¡t ‚ t j d | d d! d d" d d& d t ƒ t j d | d |  j	 j
 ƒ } | j d d! ƒ | j ƒ  j } | j d' k st ‚ d  S(+   NRV   t   phasers4   phaser module not available: skipping advanced testsiÿÿÿÿR   R   R
   s  phaser {
  hklin = "/Users/nat/Documents/beta-blip/beta_blip_P3221.mtz"
  labin = Fobs,Sigma
  composition {
    chain {
      sequence_file = "/Users/nat/Documents/beta-blip/beta.seq"
    }
    chain {
      sequence_file = "/Users/nat/Documents/beta-blip/blip.seq"
    }
  }
  ensemble {
    model_id = "beta"
    coordinates {
      pdb = "/Users/nat/Documents/beta-blip/beta.pdb"
    }
  }
  ensemble {
    model_id = "blip"
    coordinates {
      pdb = "/Users/nat/Documents/beta-blip/blip.pdb"
    }
  }
}
s2   /Users/nat/Documents/beta-blip/beta_blip_P3221.mtzs	   Data files   phaser.hklins'   /Users/nat/Documents/beta-blip/blip.seqs   Sequence files&   phaser.composition.chain.sequence_files'   /Users/nat/Documents/beta-blip/blip.pdbs   Ensemble models   phaser.ensemble.coordinates.pdbR   s
   phaser.effR   sd   
phaser.search {
  ensembles = beta
  copies = 1
}
phaser.search {
  ensembles = blip
  copies = 1
}t   replace_paths   /Users/nat/Documents/beta-blipt	   phil_filei   i    t   betat   old_patht   new_paths'   /Users/nat/Documents/projects/beta-blipt   use_iotbx_parsers;   /Users/nat/Documents/projects/beta-blip/beta_blip_P3221.mtzs   phaser2.effs   /home/nat/projects/beta-blips0   /home/nat/projects/beta-blip/beta_blip_P3221.mtzs   .hklins	   .keywordss   C:\projects\xtal\beta-blips.   C:\projects\xtal\beta-blip/beta_blip_P3221.mtz(   s2   /Users/nat/Documents/beta-blip/beta_blip_P3221.mtzs	   Data files   phaser.hklin(   s'   /Users/nat/Documents/beta-blip/blip.seqs   Sequence files&   phaser.composition.chain.sequence_file(   s'   /Users/nat/Documents/beta-blip/blip.pdbs   Ensemble models   phaser.ensemble.coordinates.pdb(   R   Re   Rf   Rh   t   phaser.phenix_interfacet   phenix_interfaceR   R   R   R   R   R,   R>   R$   R1   R   R‹   t   hklinR    t   searcht	   ensemblest   update_phil_file_pathsR   t
   set_prefixt   get_full_pathR&   Ro   (   R|   R‹   R   RE   t   files_int   p(    (    sG   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/phil/tst_interface.pyt
   exercise_3p  s†    	   						c          C   sö   t  j j d ƒ }  t  j j d ƒ } t  j j j d |  d | d t ƒ } | j ƒ  } t  j j d ƒ } | j d | ƒ | j d ƒ } t	 ƒ  } | j
 d	 | ƒ t | j ƒ  d
 ƒ sº t ‚ t	 ƒ  } | j j
 d	 | ƒ t | j ƒ  d ƒ sò t ‚ d  S(   Ns;   scope1 {
  a = 1
    .type = int
  b = 2
    .type = int
}
s   scope1.a = 3
scope1.b = 4
R   R   R   st   scope1 {
  c = 3
    .type = int
}
scope2 {
  subscope2 {
    d = 4
      .type = int
  }
  e = 5
    .type = int
}
R	   t   scope1t   outs#   scope1 {
  a = 3
  b = 4
  c = 3
}
sR   scope1 {
  a = 3
  b = 4
  c = 3
}
scope2 {
  subscope2 {
    d = 4
  }
  e = 5
}
(   R   R   R   R   R   R   R   t
   adopt_philR&   R   t   showR   t   getvalueR$   R   (   R   R   RE   RF   t   other_master_philR�   t   s(    (    sG   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/phil/tst_interface.pyt   exercise_adopt_philÜ  s(    									t   __main__R{   s   -vi   s	   --verboset   OK(   t
   __future__R    t   libtbx.test_utilsR   R   t   libtbx.philR   t   libtbx.load_envR   t	   cStringIOR   t   sysRU   R)   RŠ   Rœ   R¤   t   __name__t   argv(    (    (    sG   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/phil/tst_interface.pyt   <module>   s    	è~	l	;-