Пример #1
0
def run(prefix):
    """
  Exercise standard (cctbx-based restraints) optimization (no data required).
  """
    xrs_good, xrs_poor, f_obs, r_free_flags = run_tests.setup_helix_example()
    run_tests.run_cmd(
        prefix=prefix,
        args=["restraints=cctbx mode=opt use_convergence_test=False"],
        mtz_name="")
    # Check results
    pdb_inp = iotbx.pdb.input(
        file_name=os.path.join(prefix, "m00_poor_refined.pdb"))
    model_1 = mmtbx.model.manager(model_input=pdb_inp,
                                  build_grm=True,
                                  log=null_out())
    s1 = model_1.geometry_statistics().result()
    assert s1.bond.mean < 0.005
    ##########################
    xrs_good, xrs_poor, f_obs, r_free_flags = run_tests.setup_helix_example()
    run_tests.run_cmd(
        prefix=prefix,
        args=["restraints=cctbx mode=opt use_convergence_test=False"])
    # Check results
    pdb_inp = iotbx.pdb.input(
        file_name=os.path.join(prefix, "m00_poor_refined.pdb"))
    model_2 = mmtbx.model.manager(model_input=pdb_inp,
                                  build_grm=True,
                                  log=null_out())
    s2 = model_2.geometry_statistics().result()
    assert s2.bond.mean < 0.005
    ###########################
    assert approx_equal(s1.bond.mean, s2.bond.mean, 0.0001)
Пример #2
0
def run(prefix):
    """
  Exercise standard (cctbx-based restraints) refinement with all defaults.
  """
    xrs_good, xrs_poor, f_obs, r_free_flags = run_tests.setup_helix_example()
    run_tests.run_cmd(prefix, args=["restraints=cctbx"])
    # Check results
    xrs_refined = iotbx.pdb.input(file_name=os.path.join(
        prefix, "m00_poor_refined.pdb")).xray_structure_simple()
    d = flex.sqrt((xrs_good.sites_cart() - xrs_poor.sites_cart()).dot())
    assert flex.mean(d) > 0.10
    d = flex.sqrt((xrs_good.sites_cart() - xrs_refined.sites_cart()).dot())
    assert flex.mean(d) < 0.05
    # Check R-factors
    r_start, r_final = None, None
    ofo = open("%s.log" % prefix, "r")
    for l in ofo.readlines():
        if (l.strip().endswith("n_fev: 0")):
            r_start = float(l.split()[2])
        if (l.strip().startswith("Best r_work:")):
            r_final = float(l.split()[2])
    assert r_start > 0.1
    assert r_final < 0.04
    # Make sure output model actually corresponds to reported R-factor
    fmodel = mmtbx.f_model.manager(f_obs=f_obs,
                                   r_free_flags=r_free_flags,
                                   xray_structure=xrs_refined)
    fmodel.update_all_scales()
    assert fmodel.r_work() < 0.04
    assert abs(r_final - fmodel.r_work()) < 0.0005, abs(r_final -
                                                        fmodel.r_work())
Пример #3
0
def run(prefix):
    """
  Exercise refine_sites=False.
  """
    xrs_good, xrs_poor, f_obs, r_free_flags = run_tests.setup_helix_example()
    run_tests.run_cmd(prefix, args=["restraints=cctbx", "refine_sites=False"])
    xrs_start = iotbx.pdb.input(file_name=os.path.join(
        qr_unit_tests, "data_files", "m00_poor.pdb")).xray_structure_simple()
    xrs_refined = iotbx.pdb.input(file_name=os.path.join(
        prefix, "m00_poor_refined.pdb")).xray_structure_simple()
    d = flex.sqrt((xrs_start.sites_cart() - xrs_refined.sites_cart()).dot())
    assert approx_equal(d.min_max_mean().as_tuple(), [0, 0, 0])
Пример #4
0
def run(prefix="tst_06"):
    """
  Exercise altlocs.
  """
    run_tests.assert_folder_is_empty(prefix=prefix)
    xrs_good, xrs_poor, f_obs, r_free_flags = run_tests.setup_helix_example(
        pdb_name="altlocs.pdb", mtz_name="altlocs.mtz")
    r = run_tests.run_cmd(prefix,
                          args=["restraints=cctbx"],
                          pdb_name="altlocs.pdb",
                          mtz_name="altlocs.mtz")
    #assert r.stdout_lines == \
    #   ['Sorry: Alternative conformations are not supported.']
    run_tests.clean_up(prefix, mtz_name="altlocs.mtz")
Пример #5
0
def run(prefix):
    """
  Exercise standard (cctbx-based restraints) optimization.
  Assert mode=opt is approximately equivalent to data_weight=0.
  """
    xrs_good, xrs_poor, f_obs, r_free_flags = run_tests.setup_helix_example()
    # Run optimization
    run_tests.run_cmd(prefix, args=["restraints=cctbx", "mode=opt"])
    assert get_bond_rmsd(file_name=os.path.join(qr_unit_tests, "data_files",
                                                "m00_poor.pdb")) > 0.1
    assert get_bond_rmsd(
        file_name=os.path.join(prefix, "m00_poor_refined.pdb")) < 0.0009
    #Run refinement without data term
    run_tests.run_cmd(prefix, args=["restraints=cctbx", "data_weight=0"])
    assert get_bond_rmsd(
        file_name=os.path.join(prefix, "m00_poor_refined.pdb")) < 0.0009