Commit a3d5e0e7 authored by nd-02110114's avatar nd-02110114
Browse files

🐛 fix bug

parent 628d726e
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -3,7 +3,8 @@ Docks Molecular Complexes
"""
import logging
import tempfile
from typing import Any, Optional, cast
from typing import cast, Optional, Tuple
import numpy as np

from deepchem.models import Model
from deepchem.feat import ComplexFeaturizer
@@ -52,9 +53,9 @@ class Docker(object):
    self.scoring_model = scoring_model

  def dock(self,
           molecular_complex: Any,
           centroid: Optional[int] = None,
           box_dims: Optional[int] = None,
           molecular_complex: Tuple[str, str],
           centroid: Optional[np.ndarray] = None,
           box_dims: Optional[np.ndarray] = None,
           exhaustiveness: int = 10,
           num_modes: int = 9,
           num_pockets: Optional[int] = None,
@@ -68,8 +69,14 @@ class Docker(object):

    Parameters
    ----------
    molecular_complex: Object
      Some representation of a molecular complex.
    molecular_complex: Tuple[str]
      A representation of a molecular complex. This tuple is
      (protein_file, ligand_file).
    centroid: np.ndarray, optional (default None)
      The centroid to dock against. Is computed if not specified.
    box_dims: np.ndarray, optional (default None)
      Of shape `(3,)` holding the size of the box to dock. If not
      specified is set to size of molecular complex plus 5 angstroms.
    exhaustiveness: int, optional (default 10)
      Tells pose generator how exhaustive it should be with pose
      generation.
@@ -118,8 +125,8 @@ class Docker(object):
        # NOTE: this casting is workaround. This line doesn't effect anything to the runtime
        self.featurizer = cast(ComplexFeaturizer, self.featurizer)
        # TODO: How to handle the failure here?
        features, _ = self.featurizer.featurize(  # type: ignore
            [molecular_complex])
        (protein_file, ligand_file) = molecular_complex
        features, _ = self.featurizer.featurize([protein_file], [ligand_file])
        dataset = NumpyDataset(X=features)
        score = self.scoring_model.predict(dataset)
        yield (posed_complex, score)
+3 −3
Original line number Diff line number Diff line
@@ -47,8 +47,8 @@ class PoseGenerator(object):

    Parameters
    ----------
    molecular_complexes: Tuple[str, str]
      A representation of a molecular complex. This is a tuple of
    molecular_complexes: Tuple[str]
      A representation of a molecular complex. This tuple is
      (protein_file, ligand_file).
    centroid: np.ndarray, optional (default None)
      The centroid to dock against. Is computed if not specified.
@@ -165,7 +165,7 @@ class VinaPoseGenerator(PoseGenerator):
    Parameters
    ----------
    molecular_complexes: Tuple[str]
      A representation of a molecular complex. This is a tuple of
      A representation of a molecular complex. This tuple is
      (protein_file, ligand_file).
    centroid: np.ndarray, optional
      The centroid to dock against. Is computed if not specified.
+2 −1
Original line number Diff line number Diff line
@@ -222,7 +222,8 @@ def vina_energy_term(coords1: np.ndarray, coords2: np.ndarray,
  np.ndarray
    A scalar value with free energy
  """
  # TODO(rbharath): The autodock vina source computes surface distances which take into account the van der Waals radius of each atom type.
  # TODO(rbharath): The autodock vina source computes surface distances
  # which take into account the van der Waals radius of each atom type.
  dists = pairwise_distances(coords1, coords2)
  repulsion = vina_repulsion(dists)
  hydrophobic = vina_hydrophobic(dists)