Morph residues gui.py

From CCP4 wiki
Jump to navigation Jump to search
if (have_coot_python):
    if coot_python.main_menubar():
        menu = coot_menubar_menu("Morph")

        add_simple_coot_menu_menuitem(
            menu,
            "Morph Fit This Molecule",
            lambda func:
            using_active_atom(morph_fit_all, "aa_imol", 10)
            )

        
        add_simple_coot_menu_menuitem(
            menu,
            "Morph Fit This Chain",
            lambda func:
            using_active_atom(morph_fit_chain, "aa_imol", "aa_chain_id", 10)
            )

        
        def morph_fit_region_func(select_radius, morph_radius):
            with UsingActiveAtom() as \
            [aa_imol, aa_chain_id, aa_res_no, aa_ins_code,
             aa_atom_name, aa_alt_conf]:
                central_residue = [aa_chain_id, aa_res_no, aa_ins_code]
                other_residues = residues_near_residue(aa_imol,
                                                       central_residue,
                                                       select_radius)
                morph_residues = [central_residue] + other_residues
                morph_fit_residues(aa_imol, morph_residues, morph_radius)
            
        add_simple_coot_menu_menuitem(
            menu,
            "Morph Fit This Region 12 9",
            lambda func:
            morph_fit_region_func(12, 9)
            )

        add_simple_coot_menu_menuitem(
            menu,
            "Morph Fit This Region 8 6",
            lambda func:
            morph_fit_region_func(8, 6)
            )

        add_simple_coot_menu_menuitem(
            menu,
            "Jiggle-fit This Molecule",
            lambda func:
            using_active_atom(fit_molecule_to_map_by_random_jiggle,
                              "aa_imol", 1000, 2)
            )

Load with:

Calculate->Run Script

Or put the file in e.g. .coot-preferences directory to make it permanent.