def on_ppi(self, receptor_path, ligand_path, fold_name=None): ''' Compute the split potentials for a ppi receptor_path = Complete path to the structure of the receptor ligand_path = Complete path to the structure of the ligand fold_name = Optional parameter, name given to the PPI ''' # Get PDB structure (fold structure) receptor = PDB.read_pdb(receptor_path) ligand = PDB.read_pdb(ligand_path) receptor_name = self.get_fold_name_from_fold_path(receptor_path) ligand_name = self.get_fold_name_from_fold_path(ligand_path) if not fold_name: fold_name = '{}-{}'.format(receptor_name, ligand_name) if isinstance(receptor, list): # if the structure obtained is an instance of a list, it means that it is not a unique structure: it is a COMPLEX of more than one chain receptor = PDB.read_pdb(receptor_path, merge_chains=True) # The complex will always be merged if isinstance(ligand, list): # if the structure obtained is an instance of a list, it means that it is not a unique structure: it is a COMPLEX of more than one chain ligand = PDB.read_pdb(ligand_path, merge_chains=True) # The complex will always be merged receptor.set_dssp() receptor.clean() receptor.normalize_residues() ligand.set_dssp() ligand.clean() ligand.normalize_residues() ppi = Interaction(receptor, ligand) # Compute split potentials if self.pot_type == 'CB': cutoff = 12 else: cutoff = 5 split_potentials = SplitPotentialsPPI(c_type=self.pot_type, cutoff=cutoff) # definition of SplitPotentialsPPI class (BioLib.Docking) #global_energies = [] global_energies = split_potentials.calculate_global_energies(ppi, Zscores=True) # calculation of global energies using the method of the SplitPotentialsPPI class print('\nGLOBAL ENERGIES') #residues_energies = [] residues_energies = split_potentials.calculate_residue_energies_between_pairs(ppi, 'R', Zscores=True) # same for residues energies print('\nRESIDUE ENERGIES') self.ppi_xml(fold_name, global_energies, residues_energies, receptor, ligand) # creation of xml results file return
def check_pdb_format(self, structure_path): file_name = self.get_fold_name_from_fold_path(structure_path) try: struct = PDB.read_pdb(structure_path) except: self.print_error(8, file_name) self.write_output_file(self.xml_errors, self.xml_err_file) self.write_output_file(self.xml_result, self.xml_out_file) # Output an empty results file sys.exit(10) return