Пример #1
0
def exercise():
    import mmtbx.utils
    from iotbx.file_reader import any_file
    pdb_file = libtbx.env.find_in_repositories(
        relative_path="phenix_regression/pdb/CypA_refine_3.pdb",
        test=os.path.isfile)
    mtz_file = libtbx.env.find_in_repositories(
        relative_path="phenix_regression/reflection_files/3k0n.mtz",
        test=os.path.isfile)
    pdb_in = any_file(pdb_file)
    hierarchy = pdb_in.file_object.construct_hierarchy()
    xrs = pdb_in.file_object.xray_structure_simple()
    mtz_in = any_file(mtz_file)
    f_obs = mtz_in.file_server.miller_arrays[0].f_sq_as_f()
    flags = mtz_in.file_server.miller_arrays[-1]
    flags = flags.customized_copy(data=(flags.data() == 0))
    assert ((flags.data().count(True) / len(flags.data())) <= 0.1)
    f_obs, flags = f_obs.common_sets(other=flags)
    fmodel = mmtbx.utils.fmodel_simple(f_obs=f_obs,
                                       r_free_flags=flags,
                                       scattering_table="n_gaussian",
                                       xray_structures=[xrs])
    fmodel.info().show_targets()
    selection = hierarchy.atom_selection_cache().selection(
        "chain A and resseq 111:115")
    two_fofc_map, fofc_map, = disorder.get_partial_omit_map(
        fmodel=fmodel,
        selection=selection,
        map_file_name="omit.mtz",
        partial_occupancy=0.7)
    xrs.shake_sites_in_place(0.1, selection=selection)
    sites_new = building.run_real_space_annealing(xray_structure=xrs,
                                                  pdb_hierarchy=hierarchy,
                                                  selection=selection,
                                                  target_map=fofc_map,
                                                  d_min=f_obs.d_min(),
                                                  target_map_rsr=two_fofc_map,
                                                  debug=True)
    hierarchy.atoms().set_xyz(sites_new)
    hierarchy.write_pdb_file("anneal.pdb", crystal_symmetry=xrs)
    print "wrote anneal.pdb and omit.mtz"
Пример #2
0
def exercise():
    import mmtbx.utils
    from iotbx.file_reader import any_file

    pdb_file = libtbx.env.find_in_repositories(
        relative_path="phenix_regression/pdb/CypA_refine_3.pdb", test=os.path.isfile
    )
    mtz_file = libtbx.env.find_in_repositories(
        relative_path="phenix_regression/reflection_files/3k0n.mtz", test=os.path.isfile
    )
    pdb_in = any_file(pdb_file)
    hierarchy = pdb_in.file_object.construct_hierarchy()
    xrs = pdb_in.file_object.xray_structure_simple()
    mtz_in = any_file(mtz_file)
    f_obs = mtz_in.file_server.miller_arrays[0].f_sq_as_f()
    flags = mtz_in.file_server.miller_arrays[-1]
    flags = flags.customized_copy(data=(flags.data() == 0))
    assert (flags.data().count(True) / len(flags.data())) <= 0.1
    f_obs, flags = f_obs.common_sets(other=flags)
    fmodel = mmtbx.utils.fmodel_simple(
        f_obs=f_obs, r_free_flags=flags, scattering_table="n_gaussian", xray_structures=[xrs]
    )
    fmodel.info().show_targets()
    selection = hierarchy.atom_selection_cache().selection("chain A and resseq 111:115")
    two_fofc_map, fofc_map, = disorder.get_partial_omit_map(
        fmodel=fmodel, selection=selection, map_file_name="omit.mtz", partial_occupancy=0.7
    )
    xrs.shake_sites_in_place(0.1, selection=selection)
    sites_new = building.run_real_space_annealing(
        xray_structure=xrs,
        pdb_hierarchy=hierarchy,
        selection=selection,
        target_map=fofc_map,
        d_min=f_obs.d_min(),
        target_map_rsr=two_fofc_map,
        debug=True,
    )
    hierarchy.atoms().set_xyz(sites_new)
    hierarchy.write_pdb_file("anneal.pdb", crystal_symmetry=xrs)
    print "wrote anneal.pdb and omit.mtz"
Пример #3
0
def run(args, out=None):
    if (out is None): out = sys.stdout
    from mmtbx.building.alternate_conformations import resolve_build
    from mmtbx.building import disorder
    import mmtbx.maps.utils
    import mmtbx.utils
    cmdline = mmtbx.utils.cmdline_load_pdb_and_data(
        args=args,
        master_phil=master_phil,
        process_pdb_file=True,
        scattering_table="n_gaussian",
        out=out)
    params = cmdline.params
    working_phil = master_phil.format(python_object=params)
    master_phil.fetch_diff(source=working_phil).show(out=out)
    fmodel = cmdline.fmodel
    hierarchy = cmdline.pdb_hierarchy
    sele_cache = hierarchy.atom_selection_cache()
    if (params.selection is None):
        raise Sorry("Please specify the selection parameter.")
    selection = sele_cache.selection(params.selection)
    assert (selection.count(True) > 0)
    t1 = time.time()
    two_fofc_map, fofc_map = disorder.get_partial_omit_map(
        fmodel=fmodel,
        selection=selection.iselection(),
        selection_delete=None,  #nearby_water_selection,
        negate_surrounding=False,
        partial_occupancy=params.partial_occupancy)
    build = resolve_build.resolve_builder(
        params=params.resolve_build,
        pdb_hierarchy=hierarchy,
        xray_structure=fmodel.xray_structure,
        processed_pdb_file=cmdline.processed_pdb_file,
        target_map=fofc_map,
        selection=selection,
        d_min=fmodel.f_obs().d_min(),
        out=out)
def run (args, out=None) :
  if (out is None) : out = sys.stdout
  from mmtbx.building.alternate_conformations import resolve_build
  from mmtbx.building import disorder
  import mmtbx.maps.utils
  import mmtbx.utils
  cmdline = mmtbx.utils.cmdline_load_pdb_and_data(
    args=args,
    master_phil=master_phil,
    process_pdb_file=True,
    scattering_table="n_gaussian",
    out=out)
  params = cmdline.params
  working_phil = master_phil.format(python_object=params)
  master_phil.fetch_diff(source=working_phil).show(out=out)
  fmodel = cmdline.fmodel
  hierarchy = cmdline.pdb_hierarchy
  sele_cache = hierarchy.atom_selection_cache()
  if (params.selection is None) :
    raise Sorry("Please specify the selection parameter.")
  selection = sele_cache.selection(params.selection)
  assert (selection.count(True) > 0)
  t1 = time.time()
  two_fofc_map, fofc_map = disorder.get_partial_omit_map(
    fmodel=fmodel,
    selection=selection.iselection(),
    selection_delete=None,#nearby_water_selection,
    negate_surrounding=False,
    partial_occupancy=params.partial_occupancy)
  build = resolve_build.resolve_builder(
    params=params.resolve_build,
    pdb_hierarchy=hierarchy,
    xray_structure=fmodel.xray_structure,
    processed_pdb_file=cmdline.processed_pdb_file,
    target_map=fofc_map,
    selection=selection,
    d_min=fmodel.f_obs().d_min(),
    out=out)