Ejemplo n.º 1
0
def selector_union(*selectors):
    """ Returns the intersection of any set of selectors """
    union_selection = OrResidueSelector()
    for s in selectors:
        union_selection.add_residue_selector(s)

    return union_selection
def create_design_task_factory(designable_res_indexes: list, active_site_positions: list = list(), \
        neighborhood: float = 0, cystine: bool = True, noncanonical_amino_acids: list = list()):
    task_factory = TaskFactory()
    if len(noncanonical_amino_acids) > 0:
        ncaa_palette = CustomBaseTypePackerPalette()
        for ncaa in noncanonical_amino_acids:
            ncaa_palette.add_type(ncaa)
        task_factory.set_packer_palette(ncaa_palette)
    task_factory.push_back(IncludeCurrent())
    # Mutatable
    designable_selector = ResidueIndexSelector(','.join(
        str(designable_res_index)
        for designable_res_index in designable_res_indexes))
    if not cystine:
        restriction = RestrictAbsentCanonicalAASRLT()
        restriction.aas_to_keep('AGILPVFWYDERHKSTMNQ')  # AGILPVFWYDERHKSTCMNQ
        task_factory.push_back(
            OperateOnResidueSubset(restriction, designable_selector))
    # Repack
    repack = RestrictToRepackingRLT()
    prevent = PreventRepackingRLT()
    if neighborhood > 0:
        if len(active_site_positions) > 0:
            enzdes_cst_selector = ResidueIndexSelector(','.join(
                str(enzdes_cst_index)
                for enzdes_cst_index in active_site_positions))
            designable_repacking_selector = NeighborhoodResidueSelector()
            designable_repacking_selector.set_focus_selector(
                OrResidueSelector(designable_selector, enzdes_cst_selector))
            designable_repacking_selector.set_distance(neighborhood)
            designable_repacking_selector.set_include_focus_in_subset(True)
            repacking_selector = AndResidueSelector(
                designable_repacking_selector,
                NotResidueSelector(designable_selector))
            task_factory.push_back(
                OperateOnResidueSubset(repack, repacking_selector))
            task_factory.push_back(
                OperateOnResidueSubset(prevent, designable_repacking_selector,
                                       True))
        else:
            repacking_selector = NeighborhoodResidueSelector()
            repacking_selector.set_focus_selector(designable_selector)
            repacking_selector.set_distance(neighborhood)
            repacking_selector.set_include_focus_in_subset(False)
            task_factory.push_back(
                OperateOnResidueSubset(repack, repacking_selector))
            task_factory.push_back(OperateOnResidueSubset(prevent, \
                OrResidueSelector(designable_selector, repacking_selector), True))
    else:
        task_factory.push_back(
            OperateOnResidueSubset(repack, designable_selector, True))
    return task_factory
Ejemplo n.º 3
0
def packable_residues_selector(mutable_selector):
	"""
	Selects the shell of neighbor residues to repack
	Presently hard coded for HCV protease.
	"""
	# Selecting regions
	mutable = mutable_selector
	not_mutable = NotResidueSelector(mutable_selector)
	catalytic = ResidueIndexSelector('72,96,154')
	peptide = ChainSelector('B')

	pep_not_mutable = AndResidueSelector()
	pep_not_mutable.add_residue_selector(peptide)
	pep_not_mutable.add_residue_selector(not_mutable)

	# Selecting residues near mutable shell
	near_mutable = InterGroupInterfaceByVectorSelector()
	near_mutable.group1_selector(not_mutable)
	near_mutable.group2_selector(mutable)
	near_mutable.nearby_atom_cut(4)
	near_mutable.vector_dist_cut(4)

	# Selecting residues near the peptide
	near_pep = InterGroupInterfaceByVectorSelector()
	near_pep.group1_selector(not_mutable) # Protease
	near_pep.group2_selector(peptide) # Peptide recognition region
	near_pep.nearby_atom_cut(10)
	near_pep.vector_dist_cut(12)

	# Combining selections for near peptide and near mutable residues
	wide_set = OrResidueSelector()
	wide_set.add_residue_selector(near_mutable)
	wide_set.add_residue_selector(near_pep)	

	# Setting up exclusion of catalytic and mutable residues
	limit_selection = AndResidueSelector()
	limit_selection.add_residue_selector(NotResidueSelector(catalytic))
	limit_selection.add_residue_selector(wide_set)
	limit_selection.add_residue_selector(not_mutable)

	# Add back in the peptide
	expand_selection = OrResidueSelector()
	expand_selection.add_residue_selector(limit_selection)
	expand_selection.add_residue_selector(pep_not_mutable)

	return expand_selection
Ejemplo n.º 4
0
def ligand_neighbor_selection(lig, radius, pose, include_ligand=False):
    rad = float(radius)
    not_ligand = NotResidueSelector()
    not_ligand.set_residue_selector(lig)

    lig_distant_neighbors = InterGroupInterfaceByVectorSelector()
    lig_distant_neighbors.group1_selector(lig)
    lig_distant_neighbors.group2_selector(not_ligand)
    lig_distant_neighbors.cb_dist_cut(2.0 * rad)
    lig_distant_neighbors.nearby_atom_cut(rad)

    lig_contacts = pr.rosetta.core.select.residue_selector.CloseContactResidueSelector(
    )
    lig_contacts.central_residue_group_selector(lig)
    lig_contacts.threshold(rad)

    lig_neighbors = OrResidueSelector()
    lig_neighbors.add_residue_selector(lig_distant_neighbors)
    lig_neighbors.add_residue_selector(lig_contacts)

    if include_ligand:
        selection = AndResidueSelector()
        selection.add_residue_selector(not_ligand)
    else:
        selection = OrResidueSelector()
        selection.add_residue_selector(lig)

    selection.add_residue_selector(lig_neighbors)
    return get_residues_from_subset(selection.apply(pose))
Ejemplo n.º 5
0
def other_residues_selector(mutable_selector, packable_selector):
	""" Selects the residues that are not designable or repackable """
	all_mobile_res = OrResidueSelector()
	all_mobile_res.add_residue_selector(mutable_selector)
	all_mobile_res.add_residue_selector(packable_selector)

	other_res_selector = NotResidueSelector(all_mobile_res)

	return other_res_selector
Ejemplo n.º 6
0
def movemap_packable_residues_selector(peptides, mutables, packables):
	""" 
	Combines selectors for all residues for which a MoveMap should 
	set chi true.
	"""
	combined = OrResidueSelector()
	combined.add_residue_selector(peptides)
	combined.add_residue_selector(mutables)
	combined.add_residue_selector(packables)

	return combined
Ejemplo n.º 7
0
def task_factory_builder(repacking_residues='all', designing_residues=None, \
        extra_rotamers=[1,2]):
    #Setting this up for now, need to implement these conditions:
    #Repackable set, Designable Set, prevent ligand repacking
    #Building a Task Factory for repacking/design around the neighbors residues
    #Task factory builder should accept: repackable residues, designable
    #residues, specifically preventing repacking residues, and prevent the rest.
    #tf = task_factory_builder(repack=repacking_neighbors)

    #distance - distance for Neighborhood residue selector - need to remov
    print_out("Building task factory")
    #Start up Task factory, starting ex1 and ex2, and include current
    tf = TaskFactory()
    tf.push_back(IncludeCurrent())

    if extra_rotamers:
        for x in extra_rotamers:
            tf.push_back(ExtraRotamers(0, x, 1))
    print(repacking_residues)

    #Set up repack and prevent repack
    repack = RestrictToRepackingRLT()
    prevent = PreventRepackingRLT()
    prevent_everything_else = NotResidueSelector()

    residues_for_repack = None
    residues_for_design = None
    changing_residues = OrResidueSelector()

    if repacking_residues != 'all':
        print_out("Repacking these residues: " + str(repacking_residues))
        residues_for_repack = ResidueIndexSelector(
            ','.join(repacking_residues))
        changing_residues.add_residue_selector(residues_for_repack)
        tf.push_back(OperateOnResidueSubset(repack, residues_for_repack))

    if designing_residues:
        residues_for_design = ResidueIndexSelector(designing_residues)
        changing_residues.add_residue_selector(residues_for_design)

    prevent_everything_else.set_residue_selector(changing_residues)

    if repack == 'all':
        tf.push_back(OperateOnResidueSubset(repack, prevent_everything_else))
    else:
        tf.push_back(OperateOnResidueSubset(prevent, prevent_everything_else))
    return tf
Ejemplo n.º 8
0
def make_point_mutant_task_factory(site_1,
                                   change_1,
                                   site_2=None,
                                   change_2=None,
                                   fast=True):
    """
    Given a site integer and a 1-letter residue name (or two sites and two 
    residue names), generates a TaskFactory to repack all residues 
    in a pose with the altered sites repacking to the new sequence.
    """
    # Initialize selection of all altered residues
    modified_residues = OrResidueSelector()  # Keep list of mobile residues

    # Make TaskFactory to input changes
    task_factory = TaskFactory()
    task_factory.push_back(IncludeCurrent())
    if not fast:
        task_factory.push_back(ExtraRotamers(0, 1, 1))
        task_factory.push_back(ExtraRotamers(0, 2, 1))

    # Force packing to new residue for the mutated site
    res_selection_1 = ResidueIndexSelector(str(site_1))
    aa_force_1 = RestrictAbsentCanonicalAASRLT()
    aa_force_1.aas_to_keep(change_1)
    task_factory.push_back(OperateOnResidueSubset(aa_force_1, res_selection_1))
    modified_residues.add_residue_selector(res_selection_1)

    # Add second site if necessary
    if site_2 and change_2:
        res_selection_2 = ResidueIndexSelector(str(site_2))
        aa_force_2 = RestrictAbsentCanonicalAASRLT()
        aa_force_2.aas_to_keep(change_2)
        task_factory.push_back(
            OperateOnResidueSubset(aa_force_2, res_selection_2))
        modified_residues.add_residue_selector(res_selection_2)

    # Repack all other residues to accommodate substitutions
    unchanged_residues = NotResidueSelector(modified_residues)
    repack = RestrictToRepackingRLT()
    task_factory.push_back(OperateOnResidueSubset(repack, unchanged_residues))

    return task_factory
def apply_constraints(pose):
    """ 
	Applies enzdes constraints form the input CST file to a pose
	Also applies coordinate constraints to the substrate peptide, assumed to 
	be chain B
	"""
    # Enzdes constraints
    cstm = AddOrRemoveMatchCsts()
    cstm.set_cst_action(ADD_NEW)
    cstm.apply(pose)

    # Coordinate constraints
    cg = CoordinateConstraintGenerator()
    ors = OrResidueSelector()
    ors.add_residue_selector(ChainSelector('A'))  # Constrain main backbone
    ors.add_residue_selector(
        ResidueIndexSelector('113-115'))  # Preserving original peptide
    cg.set_residue_selector(ors)

    ac = AddConstraints()
    ac.add_generator(cg)
    ac.apply(pose)

    return
def create_relax_task_factory(point_mutations: list = list(),
                              active_site_positions: list = list(),
                              neighborhood: float = 0):
    task_factory = TaskFactory()
    task_factory.push_back(IncludeCurrent())
    repack = RestrictToRepackingRLT()
    prevent = PreventRepackingRLT()
    if len(point_mutations) > 0:
        # Mutate
        mutated_selector = OrResidueSelector()
        for point_mutation in point_mutations:
            mutation_info = point_mutation.split(',')
            restriction = RestrictAbsentCanonicalAASRLT()
            restriction.aas_to_keep(mutation_info[1])
            point_mutation_selector = ResidueIndexSelector(mutation_info[0])
            task_factory.push_back(
                OperateOnResidueSubset(restriction, point_mutation_selector))
            mutated_selector.add_residue_selector(point_mutation_selector)
        # Repack and static
        if neighborhood > 0:
            if len(active_site_positions) > 0:
                # Repack
                enzyme_core_selector = ResidueIndexSelector(','.join(
                    str(active_site_position)
                    for active_site_position in active_site_positions))
                designable_repacking_selector = NeighborhoodResidueSelector()
                designable_repacking_selector.set_focus_selector(
                    OrResidueSelector(mutated_selector, enzyme_core_selector))
                designable_repacking_selector.set_distance(neighborhood)
                designable_repacking_selector.set_include_focus_in_subset(True)
                repacking_selector = AndResidueSelector(
                    designable_repacking_selector,
                    NotResidueSelector(mutated_selector))
                task_factory.push_back(
                    OperateOnResidueSubset(repack, repacking_selector))
                # Static
                task_factory.push_back(
                    OperateOnResidueSubset(prevent,
                                           designable_repacking_selector,
                                           True))
            else:
                # Repack
                repacking_selector = NeighborhoodResidueSelector()
                repacking_selector.set_focus_selector(mutated_selector)
                repacking_selector.set_distance(args.neighborhood)
                repacking_selector.set_include_focus_in_subset(False)
                task_factory.push_back(
                    OperateOnResidueSubset(repack, repacking_selector))
                # Static
                mutated_and_repacking_selector = OrResidueSelector(
                    mutated_selector, repacking_selector)
                task_factory.push_back(
                    OperateOnResidueSubset(prevent,
                                           mutated_and_repacking_selector,
                                           True))
        else:
            # Repack
            task_factory.push_back(
                OperateOnResidueSubset(repack, mutated_selector, True))
    else:
        if neighborhood > 0:
            if len(active_site_positions) > 0:
                # Repack
                enzyme_core_selector = ResidueIndexSelector(','.join(
                    str(active_site_position)
                    for active_site_position in active_site_positions))
                repacking_selector = NeighborhoodResidueSelector()
                repacking_selector.set_focus_selector(enzyme_core_selector)
                repacking_selector.set_distance(neighborhood)
                repacking_selector.set_include_focus_in_subset(True)
                task_factory.push_back(
                    OperateOnResidueSubset(repack, repacking_selector))
                # Static
                task_factory.push_back(
                    OperateOnResidueSubset(prevent, repacking_selector, True))
            else:
                # Static
                task_factory.push_back(PreventRepacking())
        else:
            # Repack
            task_factory.push_back(RestrictToRepacking())
    return task_factory
def make_residue_changes(pose, sf, subst_seq, subst_start, cat_res,
                         manual_muts):
    """
    Applies substrate sequence changes and manual mutations to a given pose.
    This is done through repacking, so unlike SimpleThreadingMover, the side 
    chains don't begin clashing. This means that the residue selectors will be 
    more accurate, and that design can begin without an initial relax step.

    pose is a Rosetta pose
    sf is a Rosetta scorefunction
    subst_seq is a string (doesn't need to be uppercase)
    subst_start is an integer corresponding to the first of a contiguous block 
        of  residues to re-sequence
    manual_muts is a list of two-member lists, of the following form: 
        [site, single-letter residue name]
    """
    # Create dict of {res: AA} for changes to make
    res_changes = {}

    # Add manual mutations list
    if manual_muts:
        print("\nApplying point substitutions:")
        for m in manual_muts:
            res_changes[int(m[0])] = m[1].upper()
            print(m[0], m[1].upper())

    # Add substrate threading to list of res changes
    print("\nInserting substrate sequence:\n{}".format(subst_seq))
    subst_range = range(subst_start, subst_start + len(subst_seq))
    for n, i in enumerate(subst_range):
        res_changes[i] = subst_seq[n].upper()

    # Make TaskFactory to input changes
    mobile_residues = OrResidueSelector()  # Keep list of mobile residues
    tf = TaskFactory()

    # Force packing to target residue for each desired change
    for r, aa in res_changes.items():
        res_selection = ResidueIndexSelector(str(r))
        restriction = RestrictAbsentCanonicalAASRLT()
        restriction.aas_to_keep(aa.upper())
        tf.push_back(OperateOnResidueSubset(restriction, res_selection))
        mobile_residues.add_residue_selector(res_selection)

    # Repack nearby residues to accommodate substitutions
    shell = NeighborhoodResidueSelector()
    shell.set_focus_selector(mobile_residues)
    shell.set_include_focus_in_subset(False)
    shell.set_distance(8)

    # Exclude catalytic residues
    if cat_res:
        catalytic = ResidueIndexSelector(','.join([str(i) for i in cat_res]))
        not_catalytic = NotResidueSelector(catalytic)
        shell = selector_intersection(shell, not_catalytic)

    restrict = RestrictToRepackingRLT()
    tf.push_back(OperateOnResidueSubset(restrict, shell))

    # Prevent repacking of all other residues
    unchanging = NotResidueSelector(OrResidueSelector(mobile_residues, shell))
    prevent = PreventRepackingRLT()
    tf.push_back(OperateOnResidueSubset(prevent, unchanging))

    # Apply changes with PackRotamersMover
    pt = tf.create_task_and_apply_taskoperations(pose)
    prm = PackRotamersMover(sf, pt)
    mutated_pose = Pose(pose)
    prm.apply(mutated_pose)

    return mutated_pose
Ejemplo n.º 12
0
def residue_selection(selection_one, selection_two):
    #For now, just an or selector to group up the residues.
    first = ResidueIndexSelector(selection_one)
    second = ResidueIndexSelector(selection_one)
    both = OrResidueSelector(first, second)
    return both
Ejemplo n.º 13
0
def main(args):
    init()
    sf = create_score_function('ref2015_cst')
    sf.set_weight(ScoreType(1).atom_pair_constraint,
                  2)  # Increasing repulsion weight
    sf.set_weight(ScoreType(1).dihedral_constraint,
                  0.5)  # Reducing dihedral weight
    def_score = get_fa_scorefxn()

    if not isdir(args.outdir):
        makedirs(args.outdir)

    # Reading in PDB, determining middle chain
    pose = pose_from_pdb(args.start_struct)
    chain_count = pose.num_chains()
    chain_no = chain_count / 2

    # Determining which sites to tug
    if args.test_single:
        tug_sites = [args.test_single]
    else:
        chain_residues = selector_to_list(pose, get_mobile_range(chain_no))
        tug_sites = chain_residues[1::args.frame]  # First res will error
        # Error because dihedrals are calculated using the upstream residue

    # Making decoy set for each sliding frame on the tau middle monomer
    for site in tug_sites:
        in_res = int(pose.pdb_info().pose2pdb(site).split()[0])
        site_name = join(args.outdir, 'tau_fibril_distort_' + str(in_res))

        # Determining backbone-mobile section of pose
        if args.mobile_range:
            mobile_selection = get_mobile_range(chain_no, \
             central_res=in_res, range_from_tug=args.mobile_range)
        else:
            mobile_selection = get_mobile_range(chain_no)

        # Selecting repackable shell within 18A of the target (includes target)
        ris = ResidueIndexSelector(str(site))
        nrs = NeighborhoodResidueSelector(ris, 18)

        # Combining selections
        combined_selection = OrResidueSelector()
        combined_selection.add_residue_selector(mobile_selection)
        combined_selection.add_residue_selector(nrs)

        # Making move map and task factory for FastRelax
        mm = make_move_map(pose, mobile_selection, combined_selection)
        tf = make_task_factory(combined_selection)

        # Making FastRelax
        fr = FastRelax()
        fr.set_scorefxn(sf)
        fr.set_movemap(mm)
        fr.set_task_factory(tf)

        # Making constraints
        csts = make_constraints(pose, chain_no, site, args.tug_distance)

        # Making ten decoys
        jd = PyJobDistributor(site_name, args.num_decoys, sf)
        while not jd.job_complete:
            p = Pose()
            p.assign(pose)

            # Add constraints
            for c in csts:
                p.add_constraint(c)

            fr.apply(p)

            print("\n" * 5, jd.current_name)
            print(sf.show(p), "\n" * 5)

            jd.output_decoy(p)
Ejemplo n.º 14
0
def main(args):

    if args.ligand_type == 'ligand':
        init_args = ' '.join(['-extra_res_fa', args.ligand_name])
        lig_name = args.ligand_name.split('/')[-1].strip('.params')
    else:
        init_args = ''

    pr.init(init_args)
    sf = pr.get_fa_scorefxn()
    sf.add_weights_from_file('ref2015')

    pose = pr.pose_from_pdb(args.input_pdb)
    sf(pose)

    print_notice("Scaffold protein Loaded Successfully!")
    print_notice("Scaffold protein has" + str(pose.total_residue()) +
                 "residues.")

    if args.symmetric_file:
        sfsm = SetupForSymmetryMover(args.symmetric_file)
        sfsm.apply(pose)

    #Importing list of residues if the ligand is a protein
    if args.ligand_type == 'protein':
        ligres = ResidueIndexSelector(args.residue_set)
    #Targeting the ligand if the ligand isn't protein
    elif args.ligand_type == 'ligand':
        ligres = ResidueNameSelector()
        ligres.set_residue_name3(lig_name)

    print_notice("Ligand found at resnum: " + \
            str(get_residues_from_subset(ligres.apply(pose))) )

    #Setting the proteins not in the ligand
    not_ligand = NotResidueSelector()
    not_ligand.set_residue_selector(ligres)

    #Setting the protein considered part of the ligand
    ligand_distant_contacts = InterGroupInterfaceByVectorSelector()
    ligand_distant_contacts.group1_selector(ligres)
    ligand_distant_contacts.group2_selector(not_ligand)
    ligand_distant_contacts.cb_dist_cut(2.5 * float(args.radius))
    ligand_distant_contacts.nearby_atom_cut(float(args.radius))

    #Test set: ClosecontactResidueSelector
    close_contacts = pr.rosetta.core.select.residue_selector.CloseContactResidueSelector(
    )
    close_contacts.central_residue_group_selector(ligres)
    close_contacts.threshold(float(args.radius))

    all_contacts = OrResidueSelector()
    all_contacts.add_residue_selector(close_contacts)
    all_contacts.add_residue_selector(ligand_distant_contacts)

    non_lig_residues = AndResidueSelector()
    non_lig_residues.add_residue_selector(all_contacts)
    non_lig_residues.add_residue_selector(not_ligand)

    #Collecting the residues from the subset
    neighbor_residues = get_residues_from_subset(non_lig_residues.apply(pose))
    pdb_residues = []
    for residue in neighbor_residues:
        print(pose.pdb_info().pose2pdb(residue))
        resid = pose.pdb_info().pose2pdb(residue).split()
        pdb_residues.append(''.join(resid))

    print_notice("Ligand found, neighbor residues are: " +
                 ', '.join([x for x in pdb_residues]))
    print_notice("Ligand found, total neighbor residues is " +
                 str(len(pdb_residues)))

    #Removing residues in the REMARKS section
    remove_set = []
    f = open(args.input_pdb, 'r')
    for line in f.readlines():
        if 'REMARK' in line:
            items = [x for x in line.split(' ') if x != '']
            residue_set = [int(items[6]), int(items[11])]
            for resi in residue_set:
                if resi not in remove_set:
                    remove_set.append(resi)

    residue_final_set = []
    for resi in pdb_residues:
        idx = int(resi[0:-1])
        if idx not in remove_set:
            residue_final_set.append(resi)
    #Final list for the designable residues
    residue_final_set.append('0')
    print_notice("Neighbor residues cleaned \n \n Residues are: " +\
            ', '.join([x for x in residue_final_set]))

    if args.out_file:
        out_name = args.out_file
    else:
        out_name = args.input_pdb.strip('.pdb') + '_lig.pos'

    f = open(out_name, "w")
    for x in residue_final_set:
        f.write(x + '\n')
    f.close
    print("emd182::Wrote ligand position residues of pdb file " +
          args.input_pdb + " to filename: " + out_name)
Ejemplo n.º 15
0
    'R386V-M388R-K394V': 'pdz_relaxed_2.pdb_designed_13.pdb',
    'I415K': 'pdz_relaxed_2.pdb_designed_13.pdb',
    'I415K-E416Y': 'pdz_relaxed_2.pdb_designed_13.pdb',
    'R386V-M388R-K394V-T415K-E416Y': 'pdz_relaxed_2.pdb_designed_13.pdb',
    'Y382W-R386V-M388R-K394V-T415K-E416Y': 'pdz_relaxed_2.pdb_designed_13.pdb',
    'S389D-S444R-N446Q': 'pdz_relaxed_3.pdb_designed_47.pdb',
    'N446E': 'pdz_relaxed_2.pdb_designed_9.pdb'
}
for des, muts in res_changes.items():
    pp = pose_from_pdb('pdz_designs/examples/' + start_pdb[des])
    peptide = ChainSelector('B')
    shell = NeighborhoodResidueSelector()
    shell.set_focus_selector(peptide)
    shell.set_include_focus_in_subset(True)
    shell.set_distance(12)
    mobile_residues = OrResidueSelector()
    tf = TaskFactory()
    tf.push_back(IncludeCurrent())
    tf.push_back(ExtraRotamers(0, 1, 1))
    tf.push_back(ExtraRotamers(0, 2, 1))
    for r, aa in muts.items():
        res_selection = ResidueIndexSelector(str(r))
        restriction = RestrictAbsentCanonicalAASRLT()
        restriction.aas_to_keep(aa.upper())
        tf.push_back(OperateOnResidueSubset(restriction, res_selection))
        mobile_residues.add_residue_selector(res_selection)
    packable = AndResidueSelector(shell, NotResidueSelector(mobile_residues))
    tf.push_back(OperateOnResidueSubset(RestrictToRepackingRLT(), packable))
    not_changing = NotResidueSelector(shell)
    tf.push_back(OperateOnResidueSubset(PreventRepackingRLT(), not_changing))
    pt = tf.create_task_and_apply_taskoperations(pose)
Ejemplo n.º 16
0

parser = argparse.ArgumentParser()
parser.add_argument('model', help='Select starting model.')
parser.add_argument('job', help='job from SLURM')
args = parser.parse_args()

#opts = '-use_input_sc -ex1 -ex2 -enzdes::cstfile htra1_pdz.cst -run:preserve_header'
opts = '-enzdes::cstfile htra1_pdz.cst -run:preserve_header'
init(opts)

pdz = ChainSelector('A')
peptide = ChainSelector('B')
designable = shell_selection(pdz, peptide, 6)
packable = shell_selection(pdz, designable, 6)
mobile = OrResidueSelector(designable, packable)
mobile.add_residue_selector(peptide)
static = NotResidueSelector(mobile)

sf = get_fa_scorefxn()

tf = TaskFactory()
tf.push_back(IncludeCurrent())
tf.push_back(ExtraRotamers(0, 1, 1))
tf.push_back(ExtraRotamers(0, 2, 1))

prevent = PreventRepackingRLT()  # No repack, no design
repack = RestrictToRepackingRLT()  # No design
tf.push_back(OperateOnResidueSubset(prevent, static))
tf.push_back(OperateOnResidueSubset(repack, packable))
tf.push_back(OperateOnResidueSubset(repack, peptide))