示例#1
0
def test_rbfe_mutate_2oj9():
    from transformato import (ProposeMutationRoute, SystemStructure,
                              load_config_yaml)

    from ..mutate import mutate_pure_tautomers

    conf = f"{get_testsystems_dir()}/config/test-2oj9-tautomer-pair-rbfe.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.calculate_common_core()
    return (
        mutate_pure_tautomers(
            s1_to_s2,
            s1,
            s2,
            configuration,
            nr_of_bonded_windows=4,
        ),
        configuration,
        s1_to_s2,
    )
示例#2
0
def test_generate_alchemical_path_for_methanol_common_core():
    from transformato_testsystems.testsystems import perform_generic_mutation

    configuration = load_config_yaml(
        config=f"{get_testsystems_dir()}/config/test-methanol-methane-rsfe.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.calculate_common_core()

    mutation_list = s1_to_s2.generate_mutations_to_common_core_for_mol1()
    i = IntermediateStateFactory(
        system=s1,
        configuration=configuration,
    )
    perform_mutations(
        configuration=configuration,
        i=i,
        mutation_list=mutation_list,
        nr_of_mutation_steps_charge=3,
    )
    assert len(i.output_files) == 11
示例#3
0
def test_lonepairs_in_common_core():

    configuration = load_config_yaml(
        config=f"{get_testsystems_dir()}/config/tyk2-ejm_45_ejm_42.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()
    i = IntermediateStateFactory(
        system=s1,
        configuration=configuration,
    )

    # check for ligand 1
    cc_region = s1_to_s2.get_common_core_idx_mol1()
    assert (39 in cc_region and 40 in cc_region) == True
    perform_mutations(configuration=configuration,
                      i=i,
                      mutation_list=mutation_list)
    # check for ligand 2
    cc_region2 = s1_to_s2.get_common_core_idx_mol2()
    assert (35 in cc_region2 and 36 in cc_region2) == True
示例#4
0
def test_lonepairs_in_dummy_region():

    configuration = load_config_yaml(
        config=f"{get_testsystems_dir()}/config/jnk1-17124-18631.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()
    i = IntermediateStateFactory(
        system=s1,
        configuration=configuration,
    )

    assert s1_to_s2.dummy_region_cc1.connected_dummy_regions == [
        [46, 22],
        [45, 44, 43, 26, 25],
    ]
    perform_mutations(configuration=configuration,
                      i=i,
                      mutation_list=mutation_list)
    mutation_list = s1_to_s2.generate_mutations_to_common_core_for_mol2()
    assert s1_to_s2.dummy_region_cc2.connected_dummy_regions == [[39], [40]]
示例#5
0
def test_run_1a0q_1a07_rsfe_production_with_CHARMM(caplog):

    from transformato import (
        IntermediateStateFactory,
        ProposeMutationRoute,
        SystemStructure,
        load_config_yaml,
    )
    from transformato.mutate import perform_mutations

    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/",
                                     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,
        nr_of_mutation_steps_cc=2,
        nr_of_mutation_steps_charge=1,
        i=i,
        mutation_list=mutation_list,
    )
示例#6
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")
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)
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")
示例#9
0
def test_generate_alchemical_path_for_1a0q_1a07(caplog):

    # Test that TF can handel multiple dummy regions
    caplog.set_level(logging.INFO)
    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)
    assert i.current_step == 24
示例#10
0
def test_run_28_1h1q_rbfe_production_with_CHARMM():
    # Generating output for a run of the CDK2 Ligand System
    from transformato import (
        IntermediateStateFactory,
        ProposeMutationRoute,
        SystemStructure,
        load_config_yaml,
    )

    from transformato.mutate import perform_mutations

    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=1,
        nr_of_mutation_steps_cc=1,
    )