def mutable_residues_selector(protease_selection,
                              peptide_selection,
                              catalytic_selection,
                              design_peptide=False):
    """
    Selects the residues in a shell around the peptide using the 
    InterGroupInterfaceByVectorSelector residue selector
    """
    # Making protease shell selector (includes peptide)
    first_shell_select = InterGroupInterfaceByVectorSelector()
    first_shell_select.group1_selector(protease_selection)
    first_shell_select.group2_selector(peptide_selection)
    first_shell_select.nearby_atom_cut(8)
    first_shell_select.vector_dist_cut(10)

    # Excluding the catalytic residues, peptide (if not designed)
    not_cats_sel = NotResidueSelector(catalytic_selection)
    if design_peptide:
        mutable_selection = selector_intersection(not_cats_sel,
                                                  first_shell_select)
    else:
        mutable_selection = selector_intersection(not_cats_sel,
                                                  first_shell_select,
                                                  protease_selection)

    return mutable_selection
Пример #2
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))
Пример #3
0
def shell_selection(selection_1, selection_2, base_range):
    shell_select = InterGroupInterfaceByVectorSelector()
    shell_select.group1_selector(selection_1)
    shell_select.group2_selector(selection_2)
    shell_select.nearby_atom_cut(base_range)
    shell_select.vector_dist_cut(base_range + 2)

    return AndResidueSelector(shell_select, NotResidueSelector(selection_2))
Пример #4
0
def check_selection_proximity(pose, selection_1, selection_2):
    """
    Determines whether any residues in one selector are close enough to 
    potentially interact with residues from a second selector, 
    using an InterGroupInterfaceByVector selector with default settings.
    """
    # Make full-pose selection
    full_pose = TrueResidueSelector()

    # Make selection for the full pose minus the first selector
    not_selection_1 = NotResidueSelector(selection_1)
    full_minus_1 = selector_intersection(full_pose, not_selection_1)

    # Make selection for interacting residues between selection 1 the rest of the pose
    igibv = InterGroupInterfaceByVectorSelector()
    igibv.group1_selector(selection_1)
    igibv.group2_selector(full_minus_1)

    # Find intersection of selector_1's interaction partners and selector_2
    selection_overlap = selector_intersection(igibv, selection_2)

    # Check if there are residues in the intersection, or if it is empty
    # If it is empty, the Boolean will be False. Otherwise, it will be True
    selections_do_overlap = bool(selector_to_list(pose, selection_overlap))

    return selections_do_overlap
Пример #5
0
def mutable_residues_selector(design_peptide=False, single_pep_res=None):
	"""
	Selects the residues in a shell around the peptide using the 
	InterGroupInterfaceByVectorSelector residue selector
	Presently hard coded for HCV protease.
	Decided to design just around peptide, not pep + cat, and only the
	six mutable residues in the peptide.
	"""
	# Selecting regions
	protease = ChainSelector("A")
	catalytic = ResidueIndexSelector('72,96,154')
	if single_pep_res:
		variable_pep_res = ResidueIndexSelector(str(single_pep_res))
	else:
		variable_pep_res = ResidueIndexSelector("198-203")

	# Making positive residue selector
	rs = InterGroupInterfaceByVectorSelector()
	rs.group1_selector(protease) # Protease
	rs.group2_selector(variable_pep_res) # Peptide recognition region
	rs.nearby_atom_cut(6)
	rs.vector_dist_cut(8)

	# Excluding the catalytic residues
	limit_selection = AndResidueSelector()
	limit_selection.add_residue_selector(NotResidueSelector(catalytic))
	limit_selection.add_residue_selector(rs)

	# If the peptide sequence is mutable
	if design_peptide:
		return limit_selection

	# If only the protease is designable
	else: 
		# Setting up exclusion of catalytic and peptide residues
		exclusive_selection = AndResidueSelector()
		exclusive_selection.add_residue_selector(limit_selection)
		exclusive_selection.add_residue_selector(ChainSelector("A"))
		return exclusive_selection
Пример #6
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 detect_inter_group_interface(pose, chains):
    protein_selector = ResiduePropertySelector(ResidueProperty.PROTEIN)
    group1_selector = AndResidueSelector(ChainSelector(chains[0]),
                                         protein_selector)
    group2_selector = AndResidueSelector(ChainSelector(chains[1]),
                                         protein_selector)
    interface_selector = InterGroupInterfaceByVectorSelector()
    interface_selector.group1_selector(group1_selector)
    interface_selector.group2_selector(group2_selector)
    group1_interface_selector = AndResidueSelector(interface_selector,
                                                   group1_selector)
    group2_interface_selector = AndResidueSelector(interface_selector,
                                                   group2_selector)
    group1_interface_vector = group1_interface_selector.apply(pose)
    group2_interface_vector = group2_interface_selector.apply(pose)
    return group1_interface_vector, group2_interface_vector
def select_by_cb_vector(pose):
    # The Cα-Cβ vector will be <0,0,0> for everything, because the DNA doesn't 
    # have Cα.  See `core::select::util::cbeta_vector()`.  This means that 
    # nothing will be selected on the basis of angle.  A residue would be 
    # selected based on angle if the dot product between Cα1-Cβ1 and Cβ1-Cβ2 is 
    # greater than a threshold (0.25 by default), but the product will always 
    # be 0 if one of the operands is a null vector.

    # To be included based on distance, the rules are different for protein and 
    # DNA residues.  For protein, a sidechain atom needs to be within 
    # `nearby_atom_cut` of any atom in the other group.  For DNA, C1' (the 
    # sugar carbon supporting the base, defined as the "neighbor" atom, see 
    # database/chemical/...) needs to be within `nearby_atom_cut` of any atom 
    # in the other group.  So DNA is a little more restrictive, because it only 
    # counts distances from one atom, not all atoms.

    protein_sele = ResiduePropertySelector(core.chemical.PROTEIN)
    dna_sele = ResiduePropertySelector(core.chemical.DNA)
    interface_sele = InterGroupInterfaceByVectorSelector(protein_sele, dna_sele)
    protein_interface_sele = AndResidueSelector(interface_sele, protein_sele)

    return protein_interface_sele.apply(pose)
def create_enzyme_design_task_factory(active_site_positions: 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
    enzyme_core_selector = ResidueIndexSelector(','.join(
        str(active_site_position)
        for active_site_position in active_site_positions))
    interface_selector = InterGroupInterfaceByVectorSelector()
    interface_selector.group1_selector(enzyme_core_selector)
    interface_selector.group2_selector(
        NotResidueSelector(enzyme_core_selector))
    designable_selector = AndResidueSelector(
        interface_selector, NotResidueSelector(enzyme_core_selector))
    if not cystine:
        restriction = RestrictAbsentCanonicalAASRLT()
        restriction.aas_to_keep('AGILPVFWYDERHKSTMNQ')  # AGILPVFWYDERHKSTCMNQ
        task_factory.push_back(
            OperateOnResidueSubset(restriction, designable_selector))
    # Repack
    repack = RestrictToRepackingRLT()
    if neighborhood > 0:
        repacking_wo_enzyme_core_selector = NeighborhoodResidueSelector()
        repacking_wo_enzyme_core_selector.set_focus_selector(
            interface_selector)
        repacking_wo_enzyme_core_selector.set_distance(neighborhood)
        repacking_wo_enzyme_core_selector.set_include_focus_in_subset(False)
        repacking_selector = OrResidueSelector(
            repacking_wo_enzyme_core_selector, enzyme_core_selector)
        task_factory.push_back(
            OperateOnResidueSubset(repack, repacking_selector))
        prevent = PreventRepackingRLT()
        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
def packable_residues_selector(peptide_selection, mutable_selection,
                               catalytic_selection):
    """
    Selects the shell of neighbor residues to repack. Packable set should not
    include the mutable set, since the action is RestrictToRepacking.
    """
    # Making negative selections for mutable and catalytic
    not_mutable = NotResidueSelector(mutable_selection)
    not_catalytic = NotResidueSelector(catalytic_selection)

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

    # Selecting residues near the peptide, with wider range for BB mobility
    near_pep = InterGroupInterfaceByVectorSelector()
    near_pep.group1_selector(not_mutable)
    near_pep.group2_selector(peptide_selection)
    near_pep.nearby_atom_cut(10)
    near_pep.vector_dist_cut(12)

    # Combining selections for peptide and near peptide and near mutable
    inclusive_packable = selector_union(
        near_mutable, near_pep, peptide_selection,
        ChainSelector('B'))  ##################Chain B hacky

    # Setting up exclusion of catalytic and mutable residues
    exclusive_packable = selector_intersection(inclusive_packable, not_mutable,
                                               not_catalytic)

    return exclusive_packable
Пример #11
0

def pymol_from_sele(name, pose):
    bools = globals()[name].apply(pose)
    resis = set()
    for i, x in enumerate(bools, 1):
        if x:
            resis.add(pose.pdb_info().number(i))

    sele = 'resi ' + '+'.join(str(x) for x in resis) if resis else 'none'
    print(f'select {name}, {sele}')


protein_sele = ResiduePropertySelector(core.chemical.PROTEIN)
dna_sele = ResiduePropertySelector(core.chemical.DNA)
interface_sele = InterGroupInterfaceByVectorSelector(protein_sele, dna_sele)

# The Cα-Cβ vector will be <0,0,0> for everything, because the DNA doesn't have
# Cα.  See `core::select::util::cbeta_vector()`.  This means that nothing will
# be selected on the basis of angle.  A residue would be selected based on
# angle if the dot product between Cα1-Cβ1 and Cβ1-Cβ2 is greater than a
# threshold (0.25 by default), but the product will always be 0 if one of the
# operands is a null vector.

#interface_sele.vector_dist_cut(0.0)
#interface_sele.vector_angle_cut(0.0)
#interface_sele.nearby_atom_cut(100.0)
#interface_sele.cb_dist_cut(100.0)

# To be included based on distance, the rules are different for protein and DNA
# residues.  For protein, a sidechain atom needs to be within `nearby_atom_cut`
Пример #12
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
Пример #13
0
    #'-relax:constrain_relax_to_start_coords on'
    '-relax:ramp_constraints off',

    #'-out:levels core.pack.rotamer_set.RotamerSet_:400',
    #'-out:levels core.pack.rotamer_set.RotamerSet_.extra_rotamers:400',
]

pyrosetta.init(' '.join(flags))

pose = pose_from_pdb('1aay.pdb')
sfxn = core.scoring.ScoreFunctionFactory.create_score_function('ref2015')

protein_sele = ResiduePropertySelector(core.chemical.PROTEIN)
dna_sele = ResiduePropertySelector(core.chemical.DNA)
interface_sele = InterGroupInterfaceByVectorSelector(protein_sele, dna_sele)
protein_interface_sele = AndResidueSelector(interface_sele, protein_sele)

ex = core.pack.task.operation.ExtraRotamersGenericRLT()
ex.ex1(True)
ex.ex2(True)
ex.extrachi_cutoff(1)

tf = core.pack.task.TaskFactory()
tf.push_back(core.pack.task.operation.RestrictToRepacking())
tf.push_back(
    core.pack.task.operation.OperateOnResidueSubset(ex,
                                                    protein_interface_sele))

task = tf.create_task_and_apply_taskoperations(pose)
rotsets = core.pack.rotamer_set.RotamerSetsFactory.create_rotamer_sets(pose)
Пример #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)