コード例 #1
0
def generate_domino_model(exp, fn_database, fn_log = None):
    """
        Generate a model for an assembly using DOMINO.
        @param exp Class with the parameters for the experiment
        @param fn_database Databse file that will contain the solutions
                    SQLite format
    """
    log.info(io.imp_info([IMP, em2d]))
    t0 = time.time()
    m = DominoModel.DominoModel()
    if exp.test_opts.do_test:
        m.set_assembly(exp.test_opts.test_fn_assembly, exp.names)
    else:
        m.set_assembly_components(exp.fn_pdbs, exp.names)
    setup_sampling_schema(m, exp)
    if hasattr(exp, "benchmark"):
        m.set_native_assembly_for_benchmark(exp.benchmark.fn_pdb_native,
                                            exp.anchor,
                                            exp.names)
    set_pair_score_restraints(exp, m)
    set_xlink_restraints(exp, m)
    set_geometric_complementarity_restraints(exp, m)
    if hasattr(exp.domino_params,"fn_merge_tree"):
        m.read_merge_tree(exp.domino_params.fn_merge_tree)
    else:
        m.create_merge_tree()
    set_connectivity_restraints(exp, m)
    set_pairs_excluded_restraint(exp, m)
    set_em2d_restraints(exp, m)
    m.setup_domino_sampler()
    m.do_sampling("assignments_heap_container", exp.domino_params)
    tf = time.time()
    log.info("Total time for the sampling (non-parallel): %s",tf-t0)
    m.write_solutions_database(fn_database, exp.n_solutions)
コード例 #2
0
ファイル: emagefit.py プロジェクト: drussel/imp
def generate_monte_carlo_model(params, fn_database, seed,
                               write_solution=False, fn_log = None):
    """
        Generate a model for an assembly using MonteCarlo optimization
        @param params Class with the parameters for the experiment
        @param fn_database Datbase file where the solutions will be written.
                            SQLite format.
        @param write_solution If True, writes a PDB with the final model
        @param fn_log File for logging. If the value is None, no file is written
    """
    log.info(io.imp_info([IMP, em2d]))
    m = DominoModel.DominoModel()
    m.set_assembly_components(params.fn_pdbs, params.names)
    set_pair_score_restraints(params, m)
    set_xlink_restraints(params, m)
    set_geometric_complementarity_restraints(params, m)
    set_connectivity_restraints(params, m)
    set_pairs_excluded_restraint(params, m)
    set_em2d_restraints(params, m )
    if hasattr(params, "benchmark"):
        m.set_native_assembly_for_benchmark(params)

    MonteCarloRelativeMoves.set_random_seed(seed)
    mc = MonteCarloRelativeMoves.MonteCarloRelativeMoves(m.model,
                                                m.components_rbs, params.anchor)
    mc.set_temperature_pattern(params.monte_carlo.temperatures,
                                  params.monte_carlo.iterations,
                                  params.monte_carlo.cycles)
    mc.set_moving_parameters(params.monte_carlo.max_translations,
                                params.monte_carlo.max_rotations)
    if not hasattr(params,"dock_transforms"):
        mc.dock_transforms = []
    else:
        mc.dock_transforms = params.dock_transforms

    # Probability for a component of the assembly of doing random movement
    # of doing a relative movement respect to another component
    mc.non_relative_move_prob = params.monte_carlo.non_relative_move_prob
    mc.run_monte_carlo_with_relative_movers()
    m.write_monte_carlo_solution(fn_database)
    if write_solution:
        atom.write_pdb(m.assembly, fn_database + ".pdb")
コード例 #3
0
ファイル: emagefit.py プロジェクト: drussel/imp
def generate_domino_model(params, fn_database, fn_log = None):
    """
        Generate a model for an assembly using DOMINO.
        @param params Class with the parameters for the experiment
        @param fn_database Databse file that will contain the solutions
                    SQLite format
    """
    log.info(io.imp_info([IMP, em2d]))
    t0 = time.time()
    m = DominoModel.DominoModel()
    if hasattr(params, "test_opts") and params.test_opts.do_test:
        m.set_assembly(params.test_opts.test_fn_assembly, params.names)
    else:
        m.set_assembly_components(params.fn_pdbs, params.names)
    setup_sampling_schema(m, params)
    if hasattr(params.sampling_positions, "align_before_domino") and \
                params.sampling_positions.align_before_domino:
        m.align_rigid_bodies_states()

    if hasattr(params, "benchmark"):
        m.set_native_assembly_for_benchmark(params)
    set_pair_score_restraints(params, m)
    set_xlink_restraints(params, m)
    set_geometric_complementarity_restraints(params, m)
    if hasattr(params.domino_params,"fn_merge_tree"):
        fn = params.domino_params.fn_merge_tree
        if not os.path.exists(fn):
            raise IOError("merge tree file not found: %s" % fn)
        m.read_merge_tree(fn)
    else:
        m.create_merge_tree()
    set_connectivity_restraints(params, m)
    set_pairs_excluded_restraint(params, m)
    set_em2d_restraints(params, m)
    m.setup_domino_sampler()
    m.do_sampling("assignments_heap_container", params.domino_params)
    tf = time.time()
    log.info("Total time for the sampling (non-parallel): %s",tf-t0)
    m.write_solutions_database(fn_database, params.n_solutions)
コード例 #4
0
ファイル: emagefit.py プロジェクト: drussel/imp
def print_restraints(params):
    """
        Generate a model for an assembly using DOMINO.
        @param params Class with the parameters for the experiment
        @param fn_database Databse file that will contain the solutions
                    SQLite format
    """
    log.info(io.imp_info([IMP, em2d]))
    t0 = time.time()
    m = DominoModel.DominoModel()
    if hasattr(params, "test_opts") and params.test_opts.do_test:
        m.set_assembly(params.test_opts.test_fn_assembly, params.names)
    else:
        m.set_assembly_components(params.fn_pdbs, params.names)
    if hasattr(params, "benchmark"):
        m.set_native_assembly_for_benchmark(params)
    set_pair_score_restraints(params, m)
    set_xlink_restraints(params, m)
    set_geometric_complementarity_restraints(params, m)
    set_connectivity_restraints(params, m)
    set_pairs_excluded_restraint(params, m)
    set_em2d_restraints(params, m)
    log.debug("RESTRAINTS FOR THE INPUT CONFIGURATION")
    DominoModel.print_restraints_values(m.model)