You are here

Symmetrical Docking Example

3 posts / 0 new
Last post
Symmetrical Docking Example
#1

Dear experts,

 

I would like to ask if there is a symmetrical docking example script, such as D100_Docking.py in /demo folder of PyRosetta.

If not  is there a good guide for symmetrical docking using PyRosetta?

Best regards,

Hovakim

Category: 
Post Situation: 
Wed, 2017-03-08 04:25
johnwo1990

Hello,

At the moment, I cannot find a detailed example of symmetric docking in our tutorials or demos. We will be working to correct that. However you can see a brief explanation and one use case in the symmtery tutorial (https://www.rosettacommons.org/demos/latest/tutorials/Symmetry/Symmetry#what-is-a-symmetry-definition_simple-geometries). There is a deeper explanation provided at https://www.rosettacommons.org/docs/latest/application_documentation/docking/sym-dock.

Though this is not for PyRosetta, it might help you get started. You should at least be able to get your symmetry definition files. After that, we could help you step by step, depending on your requirement.

Shourya

Thu, 2017-03-09 09:34
ssrb
Thank you very much for your answer.

I'm trying to do symmetry docking of two identical monomers, so  based on the article "Modeling Symmetric Macromolecular Structures in Rosetta3"  I created symmetry definition files using make_symmdef_file.pl.

I have also created a modified script based on D100_Docking.py, but 
calling "protocols.docking.setup_foldtree(pose, '_', jmp_arr)" consumes 32 GB of ram quickly, while calling D100_Docking.py does not. Does symmetry docking consume more RAM?
@hlp.timeit
# Create a symmetric pose.
def symmetrize_pose(self, pose):
    print('---------------------------------------------------------------\n')
    print('Pose is ', pose)
    pose.dump_pdb('Pre_Symmetric_pose_test.pdb')
    # pose_symm_data = core.conformation.symmetry.SymmData(pose.n_residue(),
    #                                                      pose.num_jump())

    pose_symm_data = core.conformation.symmetry.SymmData(pose.total_residue(),
                                                         pose.num_jump())
    pose_symm_data.read_symmetry_data_from_file(self.symmetry_dat_file)
    symmetric_pose = core.pose.symmetry.make_symmetric_pose(pose, pose_symm_data)

    pose.dump_pdb('Symmetric_pose_test.pdb')

    # Many other useful utility funtions are in core.pose.symmetry.
# init(extra_options="-mute all")
init("-symmetry:symmetry_definition {0}".format(symmetry_dat_file))


job_output = self.job_output + '_proc:1'

# 1. creates a pose from the desired PDB file
pose = Pose()
pose_from_file(pose, pdb_filename)


# TODO symmetrize pose
self.symmetrize_pose(pose)

print('Curr Pose ', pose)

# 2. setup the docking FoldTree
# using this method, the jump number 1 is automatically set to be the
#    inter-body jump
dock_jump = 1


# TODO This consumes a lot of ram
# protocols.docking.setup_foldtree(pose, partners, Vector1([dock_jump]))

# protocols.docking.setup_foldtree(pose, partners, Vector1([dock_jump]))

jmp_arr = utility.vector1_int()
# jmp_arr = utility.vector1_ulong()
jmp_arr.append(1)
protocols.docking.setup_foldtree(pose, '_', jmp_arr)

# # 3. create centroid <--> fullatom conversion Movers
to_centroid = SwitchResidueTypeSetMover('centroid')
to_fullatom = SwitchResidueTypeSetMover('fa_standard')
# recover_sidechains = protocols.simple_moves.ReturnSidechainMover(pose)
# 4. convert to centroid
to_centroid.apply(pose)

# 5. create a (centroid) test pose
test_pose = Pose()
test_pose.assign(pose)

# TODO 6. create ScoreFunctions for symmetrical docking
sym_sfxn = core.scoring.symmetry.SymmetricScoreFunction()

# # 6. create ScoreFunctions for centroid and fullatom docking
scorefxn_low = create_score_function('interchain_cen')
# scorefxn_high = create_score_function('docking')
#
# # PyRosetta3: scorefxn_high_min = create_score_function_ws_patch('docking', 'docking_min')
# scorefxn_high_min = create_score_function('docking', 'docking_min')
#
# # 7. create Movers for producing an initial perturbation of the structure
dock_pert = RigidBodyPerturbMover(dock_jump, translation, rotation)
# this Mover randomizes a pose's partners (rotation)
spin = RigidBodySpinMover(dock_jump)
# this Mover uses the axis defined by the inter-body jump (jump 1) to move
#    the docking partners close together
slide_into_contact = protocols.docking.DockingSlideIntoContact(dock_jump)

mytask = TaskFactory.create_packer_task(pose)
mytask.initialize_from_command_line()
# parse_resfile(pose, mytask, resfile)

# TODO sympack
# Create a symmetric pack rotamers mover.
# sym_packer = protocols.simple_moves.symmetry.SymPackRotamersMover(sym_sfxn,
#                                                                   task)
sym_packer = protocols.simple_moves.symmetry.SymPackRotamersMover(sym_sfxn,
                                                                  mytask)


# 8. setup the MinMover
# the MoveMap can set jumps (by jump number) as degrees of freedom
movemap = MoveMap()
movemap.set_jump(dock_jump, True)

# the MinMover can minimize score based on a jump degree of freedom, this
#    will find the distance between the docking partners which minimizes
#    the score
# TODO
# minmover = protocols.simple_moves.MinMover()
# TODO symMover
# Create a symmetric min mover.
sym_min_mover = protocols.simple_moves.symmetry.SymMinMover()

move_map = MoveMap()
core.pose.symmetry.make_symmetric_movemap(pose, move_map)

sym_min_mover.movemap(movemap)
# minmover.score_function(scorefxn_high_min)
sym_min_mover.score_function(sym_sfxn)

# 9. create a SequenceMover for the perturbation step
perturb = protocols.moves.SequenceMover()
# perturb.add_mover(randomize_upstream)
# perturb.add_mover(randomize_downstream)

# TODO TESTING PHASE
perturb.add_mover(dock_pert)
# # perturb.add_mover(spin)
perturb.add_mover(slide_into_contact)
perturb.add_mover(to_fullatom)
# perturb.add_mover(recover_sidechains)
perturb.add_mover(sym_min_mover)


dock_prot = protocols.docking.DockingLowRes()  # contains many docking functions
dock_prot.set_movable_jumps(Vector1([1]))  # set the jump to jump 1
dock_prot.set_lowres_scorefxn(scorefxn_low)
# dock_prot.set_highres_scorefxn(scorefxn_high_min)
dock_prot.set_highres_scorefxn(sym_sfxn)

# 11. setup the PyJobDistributor
# jd = PyJobDistributor(job_output, jobs, scorefxn_high)
jd = PyJobDistributor(job_output, jobs, sym_sfxn)
temp_pose = Pose()  # a temporary pose to export to PyMOL
temp_pose.assign(pose)
# to_fullatom.apply(temp_pose)  # the original pose was fullatom
# recover_sidechains.apply(temp_pose)  # with these sidechains
jd.native_pose = temp_pose  # for RMSD comparison


# 13. perform protein-protein docking
counter = 0  # for pretty output to PyMOL
while not jd.job_complete:
    # a. set necessary variables for this trajectory
    # -reset the test pose to original (centroid) structure
    try:
        test_pose.assign(pose)
        # -change the pose name, for pretty output to PyMOL
        counter += 1
        test_pose.pdb_info().name(job_output + '_' + str(counter))

        # b. perturb the structure for this trajectory
        perturb.apply(test_pose)

        # c. perform docking

        # THIS consumes too much ram
        dock_prot.apply(test_pose)

        to_fullatom.apply(test_pose)  # ensure the output is fullatom
        test_pose.pdb_info().name(job_output + '_' + str(counter) + '_fa')
        jd.output_decoy(test_pose)

        print("DONE RUNNING")
    except RuntimeError:
        print('ERROR:NAN occurred in H-bonding calculations!')
Thu, 2017-03-09 12:16
johnwo1990