Exemple #1
0
def test_run_1a0q_1a07_rsfe_with_openMM(caplog):
    import logging

    # Test that TF can handel multiple dummy regions
    caplog.set_level(logging.DEBUG)
    import warnings
    from transformato import (
        load_config_yaml,
        SystemStructure,
        IntermediateStateFactory,
        ProposeMutationRoute,
    )
    from transformato.mutate import perform_mutations

    warnings.filterwarnings("ignore", module="parmed")

    workdir = get_test_output_dir()
    conf = f"{get_testsystems_dir()}/config/test-1a0q-1a07-rsfe.yaml"
    configuration = load_config_yaml(
        config=conf, input_dir="data/test_systems_mutation", output_dir=workdir
    )
    s1 = SystemStructure(configuration, "structure1")
    s2 = SystemStructure(configuration, "structure2")
    s1_to_s2 = ProposeMutationRoute(s1, s2)
    s1_to_s2.propose_common_core()
    s1_to_s2.finish_common_core()
    # generate the mutation list for the original
    mutation_list = s1_to_s2.generate_mutations_to_common_core_for_mol1()
    print(mutation_list.keys())
    i = IntermediateStateFactory(
        system=s1,
        configuration=configuration,
    )
    perform_mutations(configuration=configuration, i=i, mutation_list=mutation_list)
    run_simulation(i.output_files, engine="openMM")
Exemple #2
0
def test_run_methane_to_methane_cc_with_openMM():
    from transformato.testsystems import mutate_methane_to_methane_cc

    workdir = get_test_output_dir()

    configuration = load_config_yaml(
        config=f"{get_testsystems_dir()}/config/test-toluene-methane-rsfe.yaml",
        input_dir="data/",
        output_dir=workdir,
    )
    change_platform_to_test_platform(configuration=configuration, engine="openMM")
    output_files = mutate_methane_to_methane_cc(configuration=configuration)
    run_simulation(output_files)
Exemple #3
0
def test_run_methane_to_methane_common_core_with_CHARMM():
    from transformato.testsystems import mutate_methane_to_methane_cc

    workdir = get_test_output_dir()

    configuration = load_config_yaml(
        config=f"{get_testsystems_dir()}/config/test-toluene-methane-rsfe.yaml",
        input_dir="data/",
        output_dir=workdir,
    )
    change_platform_to_test_platform(configuration=configuration, engine="CHARMM")
    output_files = mutate_methane_to_methane_cc(configuration=configuration)
    run_simulation(output_files, engine="CHARMM")
    f = "/".join(output_files[0].split("/")[:-3])
    print(f)
    shutil.rmtree(f)
def test_run_1a0q_1a07_rsfe_with_openMM(caplog):

    # Test that TF can handel multiple dummy regions
    caplog.set_level(logging.DEBUG)
    conf = f"{get_testsystems_dir()}/config/test-1a0q-1a07-rsfe.yaml"
    configuration = load_config_yaml(
        config=conf, input_dir=get_testsystems_dir(), output_dir=get_test_output_dir()
    )
    s1 = SystemStructure(configuration, "structure1")
    s2 = SystemStructure(configuration, "structure2")
    s1_to_s2 = ProposeMutationRoute(s1, s2)
    s1_to_s2.propose_common_core()
    s1_to_s2.finish_common_core()
    # generate the mutation list for the original
    mutation_list = s1_to_s2.generate_mutations_to_common_core_for_mol1()
    print(mutation_list.keys())
    i = IntermediateStateFactory(
        system=s1,
        configuration=configuration,
    )
    perform_mutations(configuration=configuration, i=i, mutation_list=mutation_list)
    run_simulation(i.output_files, engine="openMM")

    # Analysis with mda
    ddG_openMM_mda, dddG_mda, f_openMM_mda = postprocessing(
        configuration,
        name="1a0q",
        engine="openMM",
        analyze_traj_with="mda",
        num_proc=4,
        max_snapshots=50,
    )
    print(f"Free energy difference using mda: {ddG_openMM_mda} +- {dddG_mda} [kT")

    # Analysis with mdtraj
    ddG_openMM_mtraj, dddG_mtraj, f_openMM_mtraj = postprocessing(
        configuration,
        name="1a0q",
        engine="openMM",
        max_snapshots=50,
    )
    print(
        f"Free energy difference using mdtraj: {ddG_openMM_mtraj} +- {dddG_mtraj} [kT"
    )

    assert np.isclose(ddG_openMM_mda, ddG_openMM_mda, rtol=0.2)
    assert np.isclose(dddG_mda, dddG_mda, rtol=0.2)
Exemple #5
0
def test_run_2OJ9_tautomer_pair_with_openMM(caplog):
    caplog.set_level(logging.WARNING)
    from .test_mutation import setup_2OJ9_tautomer_pair_rbfe

    workdir = get_test_output_dir()

    conf = f"{get_testsystems_dir()}/config/test-2oj9-tautomer-pair-rsfe.yaml"
    configuration = load_config_yaml(
        config=conf, input_dir="data/", output_dir=workdir
    )  # NOTE: for preprocessing input_dir is the output dir
    change_platform_to_test_platform(configuration=configuration, engine="openMM")

    (output_files_t1, output_files_t2), _, _ = setup_2OJ9_tautomer_pair_rbfe(
        configuration=configuration
    )
    run_simulation(output_files_t1)
    run_simulation(output_files_t2)
Exemple #6
0
def test_run_acetylacetone_tautomer_pair(caplog):
    caplog.set_level(logging.WARNING)
    from .test_mutation import setup_acetylacetone_tautomer_pair

    workdir = get_test_output_dir()

    configuration = load_config_yaml(
        config=f"{get_testsystems_dir()}/config/test-acetylacetone-tautomer-rsfe.yaml",
        input_dir="data/",
        output_dir=workdir,
    )
    change_platform_to_test_platform(configuration=configuration, engine="openMM")
    (output_files_t1, output_files_t2), _, _ = setup_acetylacetone_tautomer_pair(
        configuration=configuration
    )
    run_simulation(output_files_t1)
    run_simulation(output_files_t2)
Exemple #7
0
def test_run_acetylacetone_tautomer_pair_only_in_vacuum(caplog):
    caplog.set_level(logging.WARNING)
    from .test_mutation import setup_acetylacetone_tautomer_pair

    workdir = get_test_output_dir()

    conf = f"{get_testsystems_dir()}/config/test-acetylacetone-tautomer-rsfe.yaml"
    configuration = load_config_yaml(
        config=conf, input_dir="data/", output_dir=workdir
    )  # NOTE: for preprocessing input_dir is the output dir
    change_platform_to_test_platform(configuration=configuration, engine="openMM")

    (output_files_t1, output_files_t2), _, _ = setup_acetylacetone_tautomer_pair(
        configuration=configuration, nr_of_bonded_windows=16
    )

    run_simulation(output_files_t1, only_vacuum=True)
    run_simulation(output_files_t2, only_vacuum=True)
def test_run_28_1h1q_rbfe_with_openMM():
    # Generating output for a run of the CDK2 Ligand System

    configuration = load_config_yaml(
        config=f"{get_testsystems_dir()}/config/test-28_1h1q_rbfe.yaml",
        input_dir=get_testsystems_dir(),
        output_dir=get_test_output_dir(),
    )

    s1 = SystemStructure(configuration, "structure1")
    s2 = SystemStructure(configuration, "structure2")
    s1_to_s2 = ProposeMutationRoute(s1, s2)

    s1_to_s2.propose_common_core()
    s1_to_s2.finish_common_core()

    mutation_list = s1_to_s2.generate_mutations_to_common_core_for_mol1()
    print(mutation_list.keys())
    i = IntermediateStateFactory(
        system=s1,
        configuration=configuration,
    )

    perform_mutations(
        configuration=configuration,
        i=i,
        mutation_list=mutation_list,
        nr_of_mutation_steps_charge=2,
        nr_of_mutation_steps_cc=2,
    )

    run_simulation(i.output_files, engine="charmm")
    from transformato.utils import postprocessing

    ddG_openMM, dddG, f_openMM = postprocessing(
        configuration,
        name="cdk2-28",
        engine="openMM",
        max_snapshots=50,
        num_proc=4,
        analyze_traj_with="mda",
    )
    print(f"Free energy difference: {ddG_openMM} +- {dddG} [kT")