Exemplo n.º 1
0
# score WT and N501Y mutant
WT_score = scorefxn(pose_relaxed)
N501Y_score = scorefxn(pose_N501Y)

print('\nWT score: ' + str(WT_score))
print('\nN501Y score: ' + str(N501Y_score))

# to run FastRelax, make a task factory, a movemap factory, and add them to a FastRelax protocol object

# Make task factory
tf = TaskFactory()
tf.push_back(operation.InitializeFromCommandline())
tf.push_back(operation.IncludeCurrent())
tf.push_back(operation.NoRepackDisulfides())
tf.push_back(operation.OperateOnResidueSubset(
        operation.RestrictToRepackingRLT(),
        residue_selector.TrueResidueSelector()))

# make movemap factory
mmf = pyrosetta.rosetta.core.select.movemap.MoveMapFactory()
mmf.all_bb(setting=True)
mmf.all_bondangles(setting=True)
mmf.all_bondlengths(setting=True)
mmf.all_chi(setting=True)
mmf.all_jumps(setting=True)
mmf.set_cartesian(setting=True)

# make fastrelax protocol
fr = pyrosetta.rosetta.protocols.relax.FastRelax(standard_repeats=5)
fr.set_scorefxn(scorefxn)
fr.set_task_factory(tf)
Exemplo n.º 2
0
def clash_based_taskfactory(pdbpath, pose, workspace):
    insertion = lucs.get_insertion(pdbpath, workspace)
    # How much to add to insertion['stop'] to get the residue number to
    # design
    input_pose = pose_from_file(workspace.input_pdb_path)
    designable, repackable = lucs.relative_resfile_from_reference(
        workspace, insertion, pose, input_pose)
    # Ignoring repackable residues in resfile.
    # This should give us all designed positions
    design_mask = size_list_to_res_selector(designable, pose)
    design_selector = select.residue_selector.ResidueIndexSelector(
        numeric.intlist_to_vector1_size(designable))

    # Takes a resfile and returns a task factory with a clash-based
    # repack shell.
    tf = TaskFactory()
    cl = operation.InitializeFromCommandline()
    notaa = operation.ProhibitSpecifiedBaseResidueTypes(
        strlist_to_vector1_str(['C', 'H']), design_selector)
    # read = operation.ReadResfile(resfile)
    tf.push_back(cl)
    tf.push_back(notaa)
    # tf.push_back(read)

    # Select repackable residues from designed residues
    repack_only = operation.RestrictToRepackingRLT()
    repack = operation.OperateOnResidueSubset(repack_only, design_selector,
                                              False)
    repack.flip_subset(True)
    tf.push_back(repack)

    all_selector = residue_selector.ClashBasedShellSelector(design_mask)
    all_selector.set_num_shells(2)
    all_selector.set_include_focus(True)
    all_selector.invert(True)

    no_packing = operation.PreventRepackingRLT()
    static = operation.OperateOnResidueSubset(no_packing, all_selector, False)

    packertask = tf.create_task_and_apply_taskoperations(pose)

    ld = rosetta_scripts.XmlObjects.static_get_task_operation(
        '''<LayerDesign name="layer_all" layer="core_boundary_surface_Nterm_Cterm" use_sidechain_neighbors="True">
            <core>
                    <all exclude="CW" />
            </core>
            <boundary>
                    <all exclude="CW" />
            </boundary>
            <Nterm>
                    <all append="DEGHKNQRST" />
                    <all exclude="CAFILMPVWY" />
            </Nterm>
            <Cterm>
                    <all append="DEGHKNQRST" />
                    <all exclude="CAFILMPVWY" />
            </Cterm>
    </LayerDesign>''')
    tf.push_back(static)
    tf.push_back(ld)
    packertask = tf.create_task_and_apply_taskoperations(pose)
    print('PRINTING PACKERTASK')
    print(packertask)

    repack_mask = packertask.repacking_residues()
    design_mask = packertask.designing_residues()
    movemap = setup_movemap_from_resselectors(design_mask, repack_mask)

    return tf, movemap
def clash_based_taskfactory(pdbpath, pose):
    insertion = get_insertion(pdbpath)
    # How much to add to insertion['stop'] to get the residue number to
    # design
    lucs_relative_resfile = [4, 5, 6, 8, 12, 16, 20, 23, 24, 26, 27, 30]
    # subtract 1 because LUCS loop definitions stop on the residue after the
    # insertion, whereas normal loop definition stops at the end of the
    # loop.
    lucs_relative_resfile = [
        i + insertion['stop'] - 1 for i in lucs_relative_resfile
    ]
    # This should give us all designed positions
    loop_list = [j for j in range(insertion['start'], insertion['stop'])]
    lucs_relative_resfile += loop_list
    design_mask = size_list_to_res_selector(lucs_relative_resfile, pose)
    design_selector = select.residue_selector.ResidueIndexSelector(
        numeric.intlist_to_vector1_size(lucs_relative_resfile))

    # Takes a resfile and returns a task factory with a clash-based
    # repack shell.
    tf = TaskFactory()
    cl = operation.InitializeFromCommandline()
    notaa = operation.ProhibitSpecifiedBaseResidueTypes(
        strlist_to_vector1_str(['C', 'H']), design_selector)
    # read = operation.ReadResfile(resfile)
    tf.push_back(cl)
    tf.push_back(notaa)
    # tf.push_back(read)

    # Select repackable residues from designed residues
    repack_only = operation.RestrictToRepackingRLT()
    repack = operation.OperateOnResidueSubset(repack_only, design_selector,
                                              False)
    repack.flip_subset(True)
    tf.push_back(repack)

    all_selector = residue_selector.ClashBasedShellSelector(design_mask)
    all_selector.set_num_shells(2)
    all_selector.set_include_focus(True)
    all_selector.invert(True)

    no_packing = operation.PreventRepackingRLT()
    static = operation.OperateOnResidueSubset(no_packing, all_selector, False)

    packertask = tf.create_task_and_apply_taskoperations(pose)

    ld = rosetta_scripts.XmlObjects.static_get_task_operation(
        '''<LayerDesign name="layer_all" layer="core_boundary_surface_Nterm_Cterm" use_sidechain_neighbors="True">
            <Nterm>
                    <all append="DEGHKNQRST" />
                    <all exclude="CAFILMPVWY" />
            </Nterm>
            <Cterm>
                    <all append="DEGHKNQRST" />
                    <all exclude="CAFILMPVWY" />
            </Cterm>
    </LayerDesign>''')
    tf.push_back(static)
    tf.push_back(ld)
    packertask = tf.create_task_and_apply_taskoperations(pose)
    print('PRINTING PACKERTASK')
    print(packertask)

    repack_mask = packertask.repacking_residues()
    design_mask = packertask.designing_residues()
    movemap = setup_movemap_from_resselectors(design_mask, repack_mask)

    return tf, movemap
Exemplo n.º 4
0
scorefxn = create_score_function('ref2015_cart')
pose = pose_from_pdb(pdb_file)
pose.pdb_info().name('6M17_clean')
pose_relaxed = pose.clone()
pose_relaxed.pdb_info().name('6M17_relaxed')

# to run FastRelax, make a task factory, a movemap factory, and add them to a FastRelax protocol object

# Make task factory
tf = TaskFactory()
tf.push_back(operation.InitializeFromCommandline())
tf.push_back(operation.IncludeCurrent())
tf.push_back(operation.NoRepackDisulfides())
tf.push_back(
    operation.OperateOnResidueSubset(operation.RestrictToRepackingRLT(),
                                     residue_selector.TrueResidueSelector()))

# make movemap factory
mmf = pyrosetta.rosetta.core.select.movemap.MoveMapFactory()
mmf.all_bb(setting=True)
mmf.all_bondangles(setting=True)
mmf.all_bondlengths(setting=True)
mmf.all_chi(setting=True)
mmf.all_jumps(setting=True)
mmf.set_cartesian(setting=True)

# make fastrelax protocol
fr = pyrosetta.rosetta.protocols.relax.FastRelax(standard_repeats=5)
fr.set_scorefxn(scorefxn)
fr.set_task_factory(tf)