def predict(self, temp=None, distance_cutoff=5.5, acc_threshold=0.05): if temp is not None: self.temp = temp # Make selection dict from user option or PDB chains selection_dict = {} for igroup, group in enumerate(self.selection): chains = group.split(',') for chain in chains: if chain in selection_dict: errmsg = 'Selections must be disjoint sets: {0} is repeated'.format(chain) raise ValueError(errmsg) selection_dict[chain] = igroup # Contacts self.ic_network = calculate_ic(self.structure, d_cutoff=distance_cutoff, selection=selection_dict) self.bins = analyse_contacts(self.ic_network) # SASA _, cmplx_sasa = execute_freesasa(self.structure, selection=selection_dict) self.nis_a, self.nis_c, _ = analyse_nis(cmplx_sasa, acc_threshold=acc_threshold) # Affinity Calculation self.ba_val = IC_NIS(self.bins['CC'], self.bins['AC'], self.bins['PP'], self.bins['AP'], self.nis_a, self.nis_c) self.kd_val = dg_to_kd(self.ba_val, self.temp)
errmsg = 'Selections must be disjoint sets: {0} is repeated'.format( chain) raise ValueError(errmsg) selection_dict[chain] = igroup else: selection_dict = dict([(c.id, nc) for nc, c in enumerate(structure.get_chains())]) # Contacts ic_network = calculate_ic(structure, selection=selection_dict) print('[+] No. of intermolecular contacts: {0}'.format(len(ic_network))) bins = analyse_contacts(ic_network) # SASA _, cmplx_sasa = execute_freesasa(structure, selection=selection_dict) # Print out features print('[+] No. of charged-charged contacts: {0}'.format(bins['CC'])) print('[+] No. of charged-polar contacts: {0}'.format(bins['CP'])) print('[+] No. of charged-apolar contacts: {0}'.format(bins['AC'])) print('[+] No. of polar-polar contacts: {0}'.format(bins['PP'])) print('[+] No. of apolar-polar contacts: {0}'.format(bins['AP'])) print('[+] No. of apolar-apolar contacts: {0}'.format(bins['AA'])) for aa in [ 'ALA', 'CYS', 'GLU', 'ASP', 'GLY', 'PHE', 'ILE', 'HIS', 'LYS', 'MET', 'LEU', 'ASN', 'GLN', 'PRO', 'SER', 'ARG', 'THR', 'TRP', 'VAL', 'TYR' ]: print('[+] ' + aa + ': ' + str(bins[aa]))
# Make groups from user option or PDB chains if cmd.selection: selection_dict = {} for igroup, group in enumerate(cmd.selection): chains = group.split(',') for chain in chains: if chain in selection_dict: errmsg = 'Selections must be disjoint sets: {0} is repeated'.format(chain) raise ValueError(errmsg) selection_dict[chain] = igroup else: selection_dict = dict([(c.id, nc) for nc, c in enumerate(structure.get_chains())]) # Complex SASA cmplx_asa, cmplx_rsa = execute_freesasa(structure, selection=selection_dict) _, nis_c, nis_p = analyse_nis(cmplx_rsa, acc_threshold=cmd.acc_threshold, selection=selection_dict) # Interface atoms free_asa = {} for group in selection_dict: group_asa, _ = execute_freesasa(structure, selection=group) free_asa.update(group_asa) interface_atoms = calculate_interface_atoms(cmplx_asa, free_asa) # Affinity Calculation ba_val = NIS(nis_c, nis_p, interface_atoms) print('[+] Percentage of polar NIS residues: {0:3.2f}'.format(nis_p)) print('[+] Percentage of charged NIS residues: {0:3.2f}'.format(nis_c)) print('[+] No. of (buried) interface atoms: {0}'.format(interface_atoms))
for chain in chains: if chain in selection_dict: errmsg = 'Selections must be disjoint sets: {0} is repeated'.format(chain) raise ValueError(errmsg) selection_dict[chain] = igroup else: selection_dict = dict([(c.id, nc) for nc, c in enumerate(structure.get_chains())]) # Contacts ic_network = calculate_ic(structure, d_cutoff=cmd.distance_cutoff, selection=selection_dict) print('[+] No. of intermolecular contacts: {0}'.format(len(ic_network))) bins = analyse_contacts(ic_network) # SASA _, cmplx_sasa = execute_freesasa(structure, selection=selection_dict) nis_a, nis_c, _ = analyse_nis(cmplx_sasa, acc_threshold=cmd.acc_threshold, selection=selection_dict) # Affinity Calculation ba_val = IC_NIS(bins['CC'], bins['AC'], bins['PP'], bins['AP'], nis_a, nis_c) kd_val = dg_to_kd(ba_val, cmd.temperature) print('[+] No. of charged-charged contacts: {0}'.format(bins['CC'])) print('[+] No. of charged-polar contacts: {0}'.format(bins['CP'])) print('[+] No. of charged-apolar contacts: {0}'.format(bins['AC'])) print('[+] No. of polar-polar contacts: {0}'.format(bins['PP'])) print('[+] No. of apolar-polar contacts: {0}'.format(bins['AP'])) print('[+] No. of apolar-apolar contacts: {0}'.format(bins['AA'])) print('[+] Percentage of apolar NIS residues: {0:3.2f}'.format(nis_a)) print('[+] Percentage of charged NIS residues: {0:3.2f}'.format(nis_c)) print('[++] Predicted binding affinity (kcal.mol-1): {0:8.3f}'.format(ba_val)) print ('[++] Predicted dissociation constant (M): {0:8.3e}'.format(kd_val))
if cmd.selection: selection_dict = {} for igroup, group in enumerate(cmd.selection): chains = group.split(',') for chain in chains: if chain in selection_dict: errmsg = 'Selections must be disjoint sets: {0} is repeated'.format( chain) raise ValueError(errmsg) selection_dict[chain] = igroup else: selection_dict = dict([(c.id, nc) for nc, c in enumerate(structure.get_chains())]) # Complex SASA cmplx_asa, cmplx_rsa = execute_freesasa(structure, selection=selection_dict) _, nis_c, nis_p = analyse_nis(cmplx_rsa, acc_threshold=cmd.acc_threshold, selection=selection_dict) # Interface atoms free_asa = {} for group in selection_dict: group_asa, _ = execute_freesasa(structure, selection=group) free_asa.update(group_asa) interface_atoms = calculate_interface_atoms(cmplx_asa, free_asa) # Affinity Calculation ba_val = NIS(nis_c, nis_p, interface_atoms) print('[+] Percentage of polar NIS residues: {0:3.2f}'.format(nis_p))