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 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 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 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
#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` # 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_interface_sele = AndResidueSelector(interface_sele, protein_sele) print('interface_sele.vector_dist_cut =', interface_sele.vector_dist_cut()) print('interface_sele.vector_angle_cut =', interface_sele.vector_angle_cut()) print('interface_sele.nearby_atom_cut =', interface_sele.nearby_atom_cut()) print('interface_sele.cb_dist_cut =', interface_sele.cb_dist_cut()) pymol_from_sele('protein_sele', pose) pymol_from_sele('dna_sele', pose) pymol_from_sele('interface_sele', pose) pymol_from_sele('protein_interface_sele', pose) raise SystemExit #n_close = 0 #n_contact = 0 #n_total = 0 # # #for k, v in n.items():
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)