How to use the lightdock.scoring.functions.ScoringFunction.restraints_satisfied function in lightdock

To help you get started, we’ve selected a few lightdock examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brianjimenez / lightdock / lightdock / scoring / dna / driver.py View on Github external
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
github brianjimenez / lightdock / lightdock / scoring / pisa / driver.py View on Github external
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
github brianjimenez / lightdock / lightdock / scoring / vdw / driver.py View on Github external
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
github brianjimenez / lightdock / lightdock / scoring / cpydock / driver.py View on Github external
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, 
                                                                              DEFAULT_CONTACT_RESTRAINTS_CUTOFF)
        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
github brianjimenez / lightdock / lightdock / scoring / tobi / driver.py View on Github external
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
github brianjimenez / lightdock / lightdock / scoring / dfire / driver.py View on Github external
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
github brianjimenez / lightdock / lightdock / scoring / fastdfire / driver.py View on Github external
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