Beispiel #1
0
    def __call__(self, receptor, receptor_coordinates, ligand,
                 ligand_coordinates):
        energy, interface_receptor, interface_ligand = calculate_dfire(
            receptor, ligand, self.potential.dfire_energy,
            receptor_coordinates, ligand_coordinates,
            DEFAULT_CONTACT_RESTRAINTS_CUTOFF)
        interface_receptor = set(interface_receptor)
        interface_ligand = set(interface_ligand)

        # Code to consider contacts in the interface
        perc_receptor_restraints = ScoringFunction.restraints_satisfied(
            receptor.restraints, interface_receptor)
        perc_ligand_restraints = ScoringFunction.restraints_satisfied(
            ligand.restraints, interface_ligand)

        # Calculate membrane interaction
        # TODO: refactor restraints_satisfied
        membrane_intersection = ScoringFunction.restraints_satisfied(
            receptor.membrane, interface_receptor)
        membrane_penalty = 0.
        if membrane_intersection > 0.:
            membrane_penalty = 999.0 * membrane_intersection
        return (energy + perc_receptor_restraints * energy +
                perc_ligand_restraints * energy -
                membrane_penalty) * self.weight
Beispiel #2
0
 def __call__(self, receptor, receptor_coordinates, ligand,
              ligand_coordinates):
     """Calculates the MJ3h potential taking into account the contacts between receptor
     and ligand. Receptor and ligand are DockingModel objects.
     """
     energy = 0.0
     interface_receptor = []
     interface_ligand = []
     for index_rec, res1 in enumerate(receptor.objects):
         for index_lig, res2 in enumerate(ligand.objects):
             [x1, y1, z1] = receptor_coordinates[index_rec]
             [x2, y2, z2] = ligand_coordinates[index_lig]
             distance = (x1 - x2)**2 + (y1 - y2)**2 + (z1 - z2)**2
             if distance < MJ3h.max_distance_cutoff:
                 if distance < MJ3h.min_distance_cutoff:
                     energy += self.penalization
                 else:
                     try:
                         i_rec = MJ3h.potentials_dict[res1.name]
                         i_lig = MJ3h.potentials_dict[res2.name]
                         energy += self.potentials[i_rec][i_lig]
                     except:
                         pass
                 if distance <= self.cutoff:
                     interface_receptor.append(index_rec)
                     interface_ligand.append(index_lig)
     interface_receptor = set(interface_receptor)
     interface_ligand = set(interface_ligand)
     energy *= -1.
     perc_receptor_restraints = ScoringFunction.restraints_satisfied(
         receptor.restraints, interface_receptor)
     perc_ligand_restraints = ScoringFunction.restraints_satisfied(
         ligand.restraints, interface_ligand)
     return energy + perc_receptor_restraints * energy + perc_ligand_restraints * energy
Beispiel #3
0
 def __call__(self, receptor, receptor_coordinates, ligand, ligand_coordinates):
     energy, interface_receptor, interface_ligand = calculate_dfire(receptor, ligand, 
                                                                    self.potential.dfire_energy, 
                                                                    receptor_coordinates, ligand_coordinates)
     # Code to consider contacts in the interface
     perc_receptor_restraints = ScoringFunction.restraints_satisfied(receptor.restraints, set(interface_receptor))
     perc_ligand_restraints = ScoringFunction.restraints_satisfied(ligand.restraints, set(interface_ligand))
     return energy + perc_receptor_restraints * energy + perc_ligand_restraints * energy
Beispiel #4
0
    def __call__(self, receptor, receptor_coordinates, ligand, ligand_coordinates):
        energy, interface_receptor, interface_ligand = calculate_dfire(receptor, receptor_coordinates, 
                                                                       ligand, ligand_coordinates,
                                                                       self.potential.dfire_dist_to_bins, 
                                                                       self.potential.dfire_energy,
                                                                       interface_cutoff=self.cutoff)

        perc_receptor_restraints = ScoringFunction.restraints_satisfied(receptor.restraints, interface_receptor)
        perc_ligand_restraints = ScoringFunction.restraints_satisfied(ligand.restraints, interface_ligand)
        return (energy + perc_receptor_restraints * energy + perc_ligand_restraints * energy) * self.weight
Beispiel #5
0
 def __call__(self, receptor, receptor_coordinates, ligand,
              ligand_coordinates):
     energy, interface_receptor, interface_ligand = calculate_pisa(
         receptor, receptor_coordinates, ligand, ligand_coordinates,
         self.potential.pisa_energy, DEFAULT_CONTACT_RESTRAINTS_CUTOFF)
     perc_receptor_restraints = ScoringFunction.restraints_satisfied(
         receptor.restraints, interface_receptor)
     perc_ligand_restraints = ScoringFunction.restraints_satisfied(
         ligand.restraints, interface_ligand)
     return energy + perc_receptor_restraints * energy + perc_ligand_restraints * energy
Beispiel #6
0
    def __call__(self, receptor, receptor_coordinates, ligand, ligand_coordinates):
        energy, interface_receptor, interface_ligand = calculate_dfire(receptor, receptor_coordinates, 
                                                                       ligand, ligand_coordinates,
                                                                       self.potential.dfire_dist_to_bins, 
                                                                       self.potential.dfire_energy,
                                                                       interface_cutoff=self.cutoff)

        perc_receptor_restraints = ScoringFunction.restraints_satisfied(receptor.restraints, interface_receptor)
        perc_ligand_restraints = ScoringFunction.restraints_satisfied(ligand.restraints, interface_ligand)
        return energy + perc_receptor_restraints * energy + perc_ligand_restraints * energy
Beispiel #7
0
 def __call__(self, receptor, receptor_coordinates, ligand, ligand_coordinates):
     """Computes the pyDockDNA scoring energy using receptor and ligand which are
     instances of DockingModel.
     """
     elec, vdw, interface_receptor, interface_ligand = cdna.calculate_energy(receptor_coordinates, ligand_coordinates,
                                                                             receptor.charges, ligand.charges,
                                                                             receptor.vdw_energy, ligand.vdw_energy,
                                                                             receptor.vdw_radii, ligand.vdw_radii,
                                                                             DEFAULT_CONTACT_RESTRAINTS_CUTOFF)
     energy = (elec + parameters.scoring_vdw_weight * vdw)*-1.
     perc_receptor_restraints = ScoringFunction.restraints_satisfied(receptor.restraints, set(interface_receptor))
     perc_ligand_restraints = ScoringFunction.restraints_satisfied(ligand.restraints, set(interface_ligand))
     return (energy + perc_receptor_restraints * energy + perc_ligand_restraints * energy) * self.weight
Beispiel #8
0
 def __call__(self, receptor, receptor_coordinates, ligand,
              ligand_coordinates):
     """Computes the truncated VdW energy using receptor and ligand which are
     instances of the DockingModel class"""
     vdw_energy, interface_receptor, interface_ligand = cvdw.calculate_vdw(
         receptor_coordinates, ligand_coordinates, receptor.vdw_energy,
         ligand.vdw_energy, receptor.vdw_radii, ligand.vdw_radii,
         DEFAULT_CONTACT_RESTRAINTS_CUTOFF)
     energy = vdw_energy * -1.0 * self.weight
     perc_receptor_restraints = ScoringFunction.restraints_satisfied(
         receptor.restraints, set(interface_receptor))
     perc_ligand_restraints = ScoringFunction.restraints_satisfied(
         ligand.restraints, set(interface_ligand))
     return energy + perc_receptor_restraints * energy + perc_ligand_restraints * energy
Beispiel #9
0
    def evaluate_energy(self, receptor, receptor_coordinates, ligand,
                        ligand_coordinates):
        coordinates = np.append(receptor_coordinates.coordinates,
                                ligand_coordinates.coordinates).reshape(
                                    (-1, 3))
        energy, interface_receptor, interface_ligand = calculate_dfire2(
            self.res_index, self.atom_index, coordinates,
            self.potential.energy, self.molecule_length,
            DEFAULT_CONTACT_RESTRAINTS_CUTOFF)

        # Code to consider contacts in the interface
        perc_receptor_restraints = ScoringFunction.restraints_satisfied(
            receptor.restraints, set(interface_receptor))
        perc_ligand_restraints = ScoringFunction.restraints_satisfied(
            ligand.restraints, set(interface_ligand))
        return energy + perc_receptor_restraints * energy + perc_ligand_restraints * energy
Beispiel #10
0
 def __call__(self, receptor, receptor_coordinates, ligand,
              ligand_coordinates):
     """Computes the pyDock scoring energy using receptor and ligand which are
     instances of DockingModel
     """
     energy, interface_receptor, interface_ligand = csipper.calculate_sipper(
         receptor_coordinates, ligand_coordinates, self.energy,
         receptor.indexes, ligand.indexes, receptor.atoms_per_residue,
         ligand.atoms_per_residue, len(receptor.atoms_per_residue),
         len(ligand.atoms_per_residue), receptor.oda, ligand.oda)
     perc_receptor_restraints = ScoringFunction.restraints_satisfied(
         receptor.restraints, interface_receptor)
     perc_ligand_restraints = ScoringFunction.restraints_satisfied(
         ligand.restraints, interface_ligand)
     return (energy + perc_receptor_restraints * energy +
             perc_ligand_restraints * energy) * self.weight
Beispiel #11
0
    def __call__(self, receptor, receptor_coordinates, ligand,
                 ligand_coordinates):
        """Computes the SD scoring energy using receptor and ligand which are
        instances of DockingModel
        """
        energy, interface_receptor, interface_ligand = sd.calculate_energy(
            receptor_coordinates, ligand_coordinates, receptor.charges,
            ligand.charges, receptor.vdw_energy, ligand.vdw_energy,
            receptor.vdw_radii, ligand.vdw_radii,
            DEFAULT_CONTACT_RESTRAINTS_CUTOFF)

        perc_receptor_restraints = ScoringFunction.restraints_satisfied(
            receptor.restraints, set(interface_receptor))
        perc_ligand_restraints = ScoringFunction.restraints_satisfied(
            ligand.restraints, set(interface_ligand))
        return energy + perc_receptor_restraints * energy + perc_ligand_restraints * energy
Beispiel #12
0
 def __call__(self, receptor, receptor_coordinates, ligand, ligand_coordinates):
     """Computes the pyDock scoring energy using receptor and ligand which are
     instances of DockingModel.
     """
     elec, vdw, solv_rec, solv_lig, interface_receptor, interface_ligand = cpydock.calculate_energy(receptor_coordinates, ligand_coordinates,
                                                                           receptor.charges, ligand.charges,
                                                                           receptor.vdw_energy, ligand.vdw_energy,
                                                                           receptor.vdw_radii, ligand.vdw_radii,
                                                                           receptor.hydrogens, ligand.hydrogens,
                                                                           receptor.sasa, ligand.sasa,
                                                                           receptor.des_energy, ligand.des_energy, 
                                                                           3.9)
     solv = -1*(solv_rec + solv_lig)
     energy = (elec + parameters.scoring_vdw_weight * vdw + solv)*-1.
     perc_receptor_restraints = ScoringFunction.restraints_satisfied(receptor.restraints, set(interface_receptor))
     perc_ligand_restraints = ScoringFunction.restraints_satisfied(ligand.restraints, set(interface_ligand))
     return energy + perc_receptor_restraints * energy + perc_ligand_restraints * energy
Beispiel #13
0
    def _default(self, receptor, receptor_coordinates, ligand, ligand_coordinates):
        energy = 0.0

        dist_matrix = scipy.spatial.distance.cdist(receptor_coordinates, ligand_coordinates)

        interface_receptor = []
        interface_ligand = []
        for rec_index, rec_tobi in enumerate(receptor.objects):
            for lig_index, lig_tobi in enumerate(ligand.objects):
                d = dist_matrix[rec_index][lig_index]

                if d <= 8.0:
                    if rec_tobi >= 20 and lig_tobi >= 20:
                        # Small distance, backbone-backbone
                        if d <= 4.5:
                            energy += self.potential.tobi_sc_1[rec_tobi][lig_tobi]
                        else:
                            if d <= 6.0:
                                energy += self.potential.tobi_sc_2[rec_tobi][lig_tobi]
                    else:
                        # Medium distance, backbone-sidechain
                        if rec_tobi >= 20 or lig_tobi >= 20:
                            if d <= 5.5:
                                energy += self.potential.tobi_sc_1[rec_tobi][lig_tobi]
                            else:
                                if d <= 7.0:
                                    energy += self.potential.tobi_sc_2[rec_tobi][lig_tobi]
                        else:
                            # Large distance, sidechain-sidechain
                            if d <= 6.5:
                                energy += self.potential.tobi_sc_1[rec_tobi][lig_tobi]
                            else:
                                if d <= 8.0:
                                    energy += self.potential.tobi_sc_2[rec_tobi][lig_tobi]
                if d <= self.cutoff:
                    interface_receptor.append(rec_index)
                    interface_ligand.append(lig_index)

        interface_receptor = set(interface_receptor)
        interface_ligand = set(interface_ligand)
        energy *= -1.
        perc_receptor_restraints = ScoringFunction.restraints_satisfied(receptor.restraints, interface_receptor)
        perc_ligand_restraints = ScoringFunction.restraints_satisfied(ligand.restraints, interface_ligand)
        return (energy + perc_receptor_restraints * energy + perc_ligand_restraints * energy) * self.weight
 def test_call_scoring_function_interface(self):
     sf = ScoringFunction()
     sf(None, None, None, None)
     assert False