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
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
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
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))
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))
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 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(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
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
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)