Example #1
0
    def design(self, antibody=True, antigen=False, pack_only=False):
        self.pose = self.native_pose.clone()
        info = self.pose.pdb_info()

        tf = TaskFactory()
        tf.push_back(operation.InitializeFromCommandline())

        epi_res = ''
        for res in self.epitopes_pose:
            epi_res += '{0},'.format(res)
        epi_selector = ResidueIndexSelector(epi_res)

        antibody_selector = ChainSelector()
        vec = vector1_std_string()
        for chain in self.antibody:
            vec.append(chain)
            vec.append(chain)
        antibody_selector.set_chain_strings(vec)
        interface_res_selector = InterGroupInterfaceByVectorSelector(
            epi_selector, antibody_selector)
        interface_antibody_selector = AndResidueSelector(
            interface_res_selector, antibody_selector)

        if pack_only: tf.push_back(operation.RestrictToRepacking())

        else:
            if antigen: design_selector = epi_selector

            elif antibody: design_selector = interface_antibody_selector

            # FIRST select designable residues and prevent everything else from design and packing
            no_design_selector = NotResidueSelector(design_selector)
            prevent_repacking_rlt = operation.PreventRepackingRLT()
            #restrict_topack = operation.RestrictToRepackingRLT()
            prevent_design = operation.OperateOnResidueSubset(
                prevent_repacking_rlt, no_design_selector, False)
            tf.push_back(prevent_design)

        print(tf.create_task_and_apply_taskoperations(self.pose))

        packer = pack_min.PackRotamersMover('ref2015')
        packer.task_factory(tf)

        packer.apply(self.pose)
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
Example #3
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)
Example #4
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