예제 #1
0
def exercise_3():
    if (not libtbx.env.has_module(name="phaser")):
        print "phaser module not available: skipping advanced tests"
        return
    import iotbx.phil
    import phaser.phenix_interface
    master_phil = phaser.phenix_interface.master_phil()
    i = interface.index(master_phil=master_phil, parse=iotbx.phil.parse)
    i.merge_phil(phil_string="""\
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"
    }
  }
}
""")
    files_in = [('/Users/nat/Documents/beta-blip/beta_blip_P3221.mtz',
                 'Data file', 'phaser.hklin'),
                ('/Users/nat/Documents/beta-blip/blip.seq', 'Sequence file',
                 'phaser.composition.chain.sequence_file'),
                ('/Users/nat/Documents/beta-blip/blip.pdb', 'Ensemble model',
                 'phaser.ensemble.coordinates.pdb')]
    assert (i.get_input_files() == files_in)
    i.save_param_file(file_name="phaser.eff",
                      extra_phil="""
phaser.search {
  ensembles = beta
  copies = 1
}
phaser.search {
  ensembles = blip
  copies = 1
}""",
                      replace_path="/Users/nat/Documents/beta-blip")
    i = interface.index(master_phil=master_phil, parse=iotbx.phil.parse)
    i.merge_phil(phil_file="phaser.eff")
    p = i.get_python_object().phaser
    assert (i.get_input_files() == files_in)
    assert (p.hklin == "/Users/nat/Documents/beta-blip/beta_blip_P3221.mtz")
    assert (len(p.search) == 2)
    assert (p.search[0].ensembles == ["beta"])
    # update file in-place (with variable substitution)
    interface.update_phil_file_paths(
        master_phil=master_phil,
        file_name="phaser.eff",
        old_path="/Users/nat/Documents/beta-blip",
        new_path="/Users/nat/Documents/projects/beta-blip",
        use_iotbx_parser=True)
    i = interface.index(master_phil=master_phil, parse=iotbx.phil.parse)
    i.merge_phil(phil_file="phaser.eff")
    p = i.get_python_object().phaser
    assert (p.hklin ==
            "/Users/nat/Documents/projects/beta-blip/beta_blip_P3221.mtz")
    # update file in-place, by modifying phil objects directly
    i.save_param_file(file_name="phaser2.eff")
    interface.update_phil_file_paths(
        master_phil=master_phil,
        file_name="phaser2.eff",
        old_path="/Users/nat/Documents/projects/beta-blip",
        new_path="/home/nat/projects/beta-blip",
        use_iotbx_parser=True)
    i = interface.index(master_phil=master_phil, parse=iotbx.phil.parse)
    i.merge_phil(phil_file="phaser2.eff")
    p = i.get_python_object().phaser
    assert (p.hklin == "/home/nat/projects/beta-blip/beta_blip_P3221.mtz")
    i.set_prefix("phaser")
    assert (i.get_full_path(".hklin") == "phaser.hklin")
    assert (i.get_scope_by_name(".keywords") is not None)
    # and now with Windows-style paths
    interface.update_phil_file_paths(
        master_phil=master_phil,
        file_name="phaser2.eff",
        old_path="/home/nat/projects/beta-blip",
        new_path="C:\\projects\\xtal\\beta-blip",  # \x and \b are key here
        use_iotbx_parser=True)
    i = interface.index(master_phil=master_phil, parse=iotbx.phil.parse)
    i.merge_phil(phil_file="phaser2.eff")
    p = i.get_python_object().phaser
    # XXX obviously these are not entirely transferrable between Unix and
    # Windows - we need to caution users against this
    assert (p.hklin == "C:\\projects\\xtal\\beta-blip/beta_blip_P3221.mtz")
예제 #2
0
def exercise_2(verbose=False):
    if (not libtbx.env.has_module(name="phenix")):
        print "phenix module not available: skipping advanced tests"
        return
    from phenix.refinement import runtime
    import iotbx.phil
    from time import time
    phil_str = """
refinement.pdb_interpretation.secondary_structure.protein {
  helix {
    selection = "chain A and resseq 10:20"
  }
  helix {
    selection = "chain A and resseq 30:40"
  }
  helix {
    selection = "chain A and resseq 50:60"
  }
}
"""

    phil_str_2 = """
refinement.pdb_interpretation.secondary_structure.protein {
  helix {
    selection = "chain B and resseq 10:20"
  }
  helix {
    selection = "chain B and resseq 30:40"
  }
  helix {
    selection = "chain B and resseq 50:60"
  }
}
"""

    master_phil = runtime.master_phil()
    i = interface.index(master_phil=master_phil, parse=iotbx.phil.parse)
    t1 = time()
    i.merge_phil(phil_string=phil_str)
    t2 = time()
    params = i.get_python_object()
    assert (params.refinement.pdb_interpretation.secondary_structure.\
        protein.helix[0].selection == "chain A and resseq 10:20")
    t3 = time()
    i.merge_phil(
        phil_string=phil_str_2,
        only_scope="refinement.pdb_interpretation.secondary_structure")
    t4 = time()
    params = i.get_python_object()
    assert (params.refinement.pdb_interpretation.secondary_structure.\
        protein.helix[0].selection == "chain B and resseq 10:20")
    scope = i.get_scope_by_name(
        "refinement.pdb_interpretation.secondary_structure")
    params2 = scope.extract()
    assert (params2.protein.helix[0].selection == "chain B and resseq 10:20")
    if verbose:
        print "Merge with global fetch: %6.1fms" % ((t2 - t1) * 1000)
        print "Merge with local fetch:  %6.1fms" % ((t4 - t3) * 1000)
    i.merge_phil(phil_string="""
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.job_title = Test refinement run
""")
    names = i.search_phil_text("CIF")
    assert (set(names) == {
        'refinement.output.write_model_cif_file',
        'refinement.output.write_reflection_cif_file',
        'refinement.input.monomers.file_name',
    })

    assert (i.get_input_files() == [
        ('protein.pdb', 'Input model', 'refinement.input.pdb.file_name'),
        ('ligand.pdb', 'Input model', 'refinement.input.pdb.file_name'),
        ('data.mtz', 'Reflections file',
         'refinement.input.xray_data.file_name'),
        ('ligand.cif', 'Restraints (CIF)',
         'refinement.input.monomers.file_name')
    ])
    assert (i.get_job_title() == "Test refinement run")
    #
    # .style processing
    style = i.get_scope_style("refinement.refine.strategy")
    #assert (style.auto_launch_dialog == [
    #  'refinement.refine.sites.individual', 'refinement.refine.sites.individual',
    #  'refinement.refine.sites.rigid_body', 'refinement.refine.adp.individual',
    #  'refinement.refine.adp.group', 'refinement.refine.adp.tls',
    #  'refinement.refine.occupancies', 'refinement.refine.anomalous_scatterers'])
    assert (style.file_type is None)
    style = i.get_scope_style("refinement.input.xray_data.file_name")
    assert (style.get_list("file_type") == ["hkl"])
    assert (style.get_child_params() == {
        'fobs': 'labels',
        'd_max': 'low_resolution',
        'd_min': 'high_resolution',
        'rfree_file': 'r_free_flags.file_name'
    })
    assert i.is_list_type("refinement.input.xray_data.labels")
    style = i.get_scope_style("refinement.input.xray_data.labels")
    assert (style.get_parent_params() == {"file_name": "file_name"})
    file_map = i.get_file_type_map("pdb")
    assert (file_map.get_multiple_params() == \
      ['refinement.input.pdb.file_name',
       'refinement.reference_model.file'])
    assert (file_map.get_default_param() == "refinement.input.pdb.file_name")
    file_map = i.get_file_type_map("hkl")
    assert (file_map.get_overall_max_count() == 5)
    assert (len(file_map.get_multiple_params()) == 0)
    assert (
        file_map.get_max_count("refinement.input.xray_data.file_name") == 1)
    menu = i.get_menu_db()
    assert (len(menu.get_items()) > 15)  # XXX ballpark (currently 17)
    submenu = menu.get_submenu("Atom_selections")
    assert (str(submenu.get_items()[0]) == "refinement.refine.sites")
예제 #3
0
  {
    include scope xia2.Modules.Analysis.phil_scope
  }
  symmetry
    .short_caption = "symmetry"
  {
    chirality = chiral nonchiral centrosymmetric
      .type = choice
    program = *pointless dials
      .type = choice
  }
}
""",
    process_includes=True,
)

# override default resolution parameters
master_phil = master_phil.fetch(source=parse("""\
xia2.settings {
  resolution {
    isigma = None
    misigma = None
  }
}
"""))

PhilIndex = interface.index(master_phil=master_phil)

if __name__ == "__main__":
    PhilIndex.working_phil.show()
예제 #4
0
def exercise_3 () :
  if (not libtbx.env.has_module(name="phaser")):
    print "phaser module not available: skipping advanced tests"
    return
  import iotbx.phil
  import phaser.phenix_interface
  master_phil = phaser.phenix_interface.master_phil()
  i = interface.index(master_phil=master_phil,
    parse=iotbx.phil.parse)
  i.merge_phil(phil_string="""\
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"
    }
  }
}
""")
  files_in = [
    ('/Users/nat/Documents/beta-blip/beta_blip_P3221.mtz', 'Data file',
      'phaser.hklin'),
    ('/Users/nat/Documents/beta-blip/blip.seq', 'Sequence file',
      'phaser.composition.chain.sequence_file'),
    ('/Users/nat/Documents/beta-blip/blip.pdb', 'Ensemble model',
      'phaser.ensemble.coordinates.pdb')
  ]
  assert (i.get_input_files() == files_in)
  i.save_param_file(
    file_name="phaser.eff",
    extra_phil="""
phaser.search {
  ensembles = beta
  copies = 1
}
phaser.search {
  ensembles = blip
  copies = 1
}""",
    replace_path="/Users/nat/Documents/beta-blip")
  i = interface.index(master_phil=master_phil,
    parse=iotbx.phil.parse)
  i.merge_phil(phil_file="phaser.eff")
  p = i.get_python_object().phaser
  assert (i.get_input_files() == files_in)
  assert (p.hklin == "/Users/nat/Documents/beta-blip/beta_blip_P3221.mtz")
  assert (len(p.search) == 2)
  assert (p.search[0].ensembles == ["beta"])
  # update file in-place (with variable substitution)
  interface.update_phil_file_paths(
    master_phil=master_phil,
    file_name="phaser.eff",
    old_path="/Users/nat/Documents/beta-blip",
    new_path="/Users/nat/Documents/projects/beta-blip",
    use_iotbx_parser=True)
  i = interface.index(master_phil=master_phil,
    parse=iotbx.phil.parse)
  i.merge_phil(phil_file="phaser.eff")
  p = i.get_python_object().phaser
  assert (p.hklin ==
    "/Users/nat/Documents/projects/beta-blip/beta_blip_P3221.mtz")
  # update file in-place, by modifying phil objects directly
  i.save_param_file(file_name="phaser2.eff")
  interface.update_phil_file_paths(
    master_phil=master_phil,
    file_name="phaser2.eff",
    old_path="/Users/nat/Documents/projects/beta-blip",
    new_path="/home/nat/projects/beta-blip",
    use_iotbx_parser=True)
  i = interface.index(master_phil=master_phil,
    parse=iotbx.phil.parse)
  i.merge_phil(phil_file="phaser2.eff")
  p = i.get_python_object().phaser
  assert (p.hklin == "/home/nat/projects/beta-blip/beta_blip_P3221.mtz")
  i.set_prefix("phaser")
  assert (i.get_full_path(".hklin") == "phaser.hklin")
  assert (i.get_scope_by_name(".keywords") is not None)
  # and now with Windows-style paths
  interface.update_phil_file_paths(
    master_phil=master_phil,
    file_name="phaser2.eff",
    old_path="/home/nat/projects/beta-blip",
    new_path="C:\\projects\\xtal\\beta-blip", # \x and \b are key here
    use_iotbx_parser=True)
  i = interface.index(master_phil=master_phil,
    parse=iotbx.phil.parse)
  i.merge_phil(phil_file="phaser2.eff")
  p = i.get_python_object().phaser
  # XXX obviously these are not entirely transferrable between Unix and
  # Windows - we need to caution users against this
  assert (p.hklin == "C:\\projects\\xtal\\beta-blip/beta_blip_P3221.mtz")
예제 #5
0
def exercise_2 (verbose=False) :
  if (not libtbx.env.has_module(name="phenix")):
    print "phenix module not available: skipping advanced tests"
    return
  from phenix.refinement import runtime
  import iotbx.phil
  from time import time
  phil_str = """
refinement.pdb_interpretation.secondary_structure.protein {
  helix {
    selection = "chain A and resseq 10:20"
  }
  helix {
    selection = "chain A and resseq 30:40"
  }
  helix {
    selection = "chain A and resseq 50:60"
  }
}
"""

  phil_str_2 = """
refinement.pdb_interpretation.secondary_structure.protein {
  helix {
    selection = "chain B and resseq 10:20"
  }
  helix {
    selection = "chain B and resseq 30:40"
  }
  helix {
    selection = "chain B and resseq 50:60"
  }
}
"""

  master_phil = runtime.master_phil()
  i = interface.index(master_phil=master_phil,
    parse=iotbx.phil.parse)
  t1 = time()
  i.merge_phil(phil_string=phil_str)
  t2 = time()
  params = i.get_python_object()
  assert (params.refinement.pdb_interpretation.secondary_structure.\
      protein.helix[0].selection == "chain A and resseq 10:20")
  t3 = time()
  i.merge_phil(phil_string=phil_str_2,
    only_scope="refinement.pdb_interpretation.secondary_structure")
  t4 = time()
  params = i.get_python_object()
  assert (params.refinement.pdb_interpretation.secondary_structure.\
      protein.helix[0].selection == "chain B and resseq 10:20")
  scope = i.get_scope_by_name("refinement.pdb_interpretation.secondary_structure")
  params2 = scope.extract()
  assert (params2.protein.helix[0].selection == "chain B and resseq 10:20")
  if verbose :
    print "Merge with global fetch: %6.1fms" % ((t2-t1) * 1000)
    print "Merge with local fetch:  %6.1fms" % ((t4-t3) * 1000)
  i.merge_phil(phil_string="""
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.job_title = Test refinement run
""")
  names = i.search_phil_text("CIF")
  assert (set(names) == {
    'refinement.output.write_model_cif_file',
    'refinement.output.write_reflection_cif_file',
    'refinement.input.monomers.file_name',}
)

  assert (i.get_input_files() == [
    ('protein.pdb', 'Input model', 'refinement.input.pdb.file_name'),
    ('ligand.pdb', 'Input model', 'refinement.input.pdb.file_name'),
    ('data.mtz', 'Reflections file', 'refinement.input.xray_data.file_name'),
    ('ligand.cif', 'Restraints (CIF)', 'refinement.input.monomers.file_name')])
  assert (i.get_job_title() == "Test refinement run")
  #
  # .style processing
  style = i.get_scope_style("refinement.refine.strategy")
  #assert (style.auto_launch_dialog == [
  #  'refinement.refine.sites.individual', 'refinement.refine.sites.individual',
  #  'refinement.refine.sites.rigid_body', 'refinement.refine.adp.individual',
  #  'refinement.refine.adp.group', 'refinement.refine.adp.tls',
  #  'refinement.refine.occupancies', 'refinement.refine.anomalous_scatterers'])
  assert (style.file_type is None)
  style = i.get_scope_style("refinement.input.xray_data.file_name")
  assert (style.get_list("file_type") == ["hkl"])
  assert (style.get_child_params() == {'fobs': 'labels',
    'd_max': 'low_resolution', 'd_min': 'high_resolution',
    'rfree_file': 'r_free_flags.file_name'})
  assert i.is_list_type("refinement.input.xray_data.labels")
  style = i.get_scope_style("refinement.input.xray_data.labels")
  assert (style.get_parent_params() == {"file_name" : "file_name"})
  file_map = i.get_file_type_map("pdb")
  assert (file_map.get_multiple_params() == \
    ['refinement.input.pdb.file_name',
     'refinement.reference_model.file'])
  assert (file_map.get_default_param() == "refinement.input.pdb.file_name")
  file_map = i.get_file_type_map("hkl")
  assert (file_map.get_overall_max_count() == 5)
  assert (len(file_map.get_multiple_params()) == 0)
  assert (file_map.get_max_count("refinement.input.xray_data.file_name") == 1)
  menu = i.get_menu_db()
  assert (len(menu.get_items()) > 15) # XXX ballpark (currently 17)
  submenu = menu.get_submenu("Atom_selections")
  assert (str(submenu.get_items()[0]) == "refinement.refine.sites")
예제 #6
0
파일: Phil.py 프로젝트: xia2/xia2
    .expert_level = 1
  multiprocessing
    .short_caption = "Multiprocessing"
    .expert_level = 1
  {
    mode = *serial parallel
      .type = choice
      .help = "Whether to process each sweep in serial (using n processes per"
              " sweep) or to process sweeps in parallel (using 1 process per"
              " sweep)."
    nproc = Auto
      .type = int(value_min=1)
      .help = "The number of processors to use per job."
    njob = Auto
      .type = int(value_min=1)
      .help = "The number of sweeps to process simultaneously."
    type = *simple qsub
      .type = choice
      .help = "How to run the parallel processing jobs, e.g. over a cluster"
    qsub_command = ''
      .type = str
      .help = "The command to use to submit qsub jobs"
  }
}
""", process_includes=True)

PhilIndex = interface.index(master_phil=master_phil)

if __name__ == '__main__':
  PhilIndex.working_phil.show()