Skip to content

Commit

Permalink
Merge pull request #2090 from nd-02110114/fix-base-classes-feat
Browse files Browse the repository at this point in the history
Add canonicalize option to MolecularFeaturizer
  • Loading branch information
nissy-dev committed Aug 18, 2020
2 parents 9c879e4 + c94fa0b commit ab91135
Show file tree
Hide file tree
Showing 20 changed files with 232 additions and 251 deletions.
16 changes: 8 additions & 8 deletions deepchem/dock/binding_pocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def extract_active_site(protein_file: str,
Parameters
----------
protein_file : str
protein_file: str
Location of protein PDB
ligand_file : str
ligand_file: str
Location of ligand input file
cutoff : float, optional (default 4.0)
cutoff: float, optional (default 4.0)
The distance in angstroms from the protein pocket to
consider for featurization.
Expand Down Expand Up @@ -73,7 +73,7 @@ def find_pockets(self, molecule: Any):
Parameters
----------
molecule : object
molecule: object
Some representation of a molecule.
"""
raise NotImplementedError
Expand All @@ -90,9 +90,9 @@ def __init__(self, scoring_model: Optional[Model] = None, pad: float = 5.0):
Parameters
----------
scoring_model : Model, optional (default None)
scoring_model: Model, optional (default None)
If specified, use this model to prune pockets.
pad : float, optional (default 5.0)
pad: float, optional (default 5.0)
The number of angstroms to pad around a binding pocket's atoms
to get a binding pocket box.
"""
Expand All @@ -104,7 +104,7 @@ def find_all_pockets(self, protein_file: str) -> List[CoordinateBox]:
Parameters
----------
protein_file : str
protein_file: str
Protein to load in.
Returns
Expand All @@ -125,7 +125,7 @@ def find_pockets(self, macromolecule_file: str) -> List[CoordinateBox]:
Parameters
----------
macromolecule_file : str
macromolecule_file: str
Location of the macromolecule file to load
Returns
Expand Down
22 changes: 11 additions & 11 deletions deepchem/dock/docking.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ def __init__(self,
Parameters
----------
pose_generator : PoseGenerator
pose_generator: PoseGenerator
The pose generator to use for this model
featurizer : ComplexFeaturizer, optional (default None)
featurizer: ComplexFeaturizer, optional (default None)
Featurizer associated with `scoring_model`
scoring_model : Model, optional (default None)
scoring_model: Model, optional (default None)
Should make predictions on molecular complex.
"""
if ((featurizer is not None and scoring_model is None) or
Expand Down Expand Up @@ -73,27 +73,27 @@ def dock(self,
Parameters
----------
molecular_complex : Tuple[str, str]
molecular_complex: Tuple[str, str]
A representation of a molecular complex. This tuple is
(protein_file, ligand_file).
centroid : np.ndarray, optional (default None)
centroid: np.ndarray, optional (default None)
The centroid to dock against. Is computed if not specified.
box_dims : np.ndarray, optional (default None)
box_dims: np.ndarray, optional (default None)
A numpy array 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)
exhaustiveness: int, optional (default 10)
Tells pose generator how exhaustive it should be with pose
generation.
num_modes : int, optional (default 9)
num_modes: int, optional (default 9)
Tells pose generator how many binding modes it should generate at
each invocation.
num_pockets : int, optional (default None)
num_pockets: int, optional (default None)
If specified, `self.pocket_finder` must be set. Will only
generate poses for the first `num_pockets` returned by
`self.pocket_finder`.
out_dir : str, optional (default None)
out_dir: str, optional (default None)
If specified, write generated poses to this directory.
use_pose_generator_scores : bool, optional (default False)
use_pose_generator_scores: bool, optional (default False)
If `True`, ask pose generator to generate scores. This cannot be
`True` if `self.featurizer` and `self.scoring_model` are set
since those will be used to generate scores in that case.
Expand Down
20 changes: 10 additions & 10 deletions deepchem/dock/pose_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,27 @@ def generate_poses(self,
Parameters
----------
molecular_complexes : Tuple[str, str]
molecular_complexes: Tuple[str, str]
A representation of a molecular complex. This tuple is
(protein_file, ligand_file).
centroid : np.ndarray, optional (default None)
centroid: np.ndarray, optional (default None)
The centroid to dock against. Is computed if not specified.
box_dims : np.ndarray, optional (default None)
box_dims: np.ndarray, optional (default None)
A numpy array 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)
exhaustiveness: int, optional (default 10)
Tells pose generator how exhaustive it should be with pose
generation.
num_modes : int, optional (default 9)
num_modes: int, optional (default 9)
Tells pose generator how many binding modes it should generate at
each invocation.
num_pockets : int, optional (default None)
num_pockets: int, optional (default None)
If specified, `self.pocket_finder` must be set. Will only
generate poses for the first `num_pockets` returned by
`self.pocket_finder`.
out_dir : str, optional (default None)
out_dir: str, optional (default None)
If specified, write generated poses to this directory.
generate_score : bool, optional (default False)
generate_score: bool, optional (default False)
If `True`, the pose generator will return scores for complexes.
This is used typically when invoking external docking programs
that compute scores.
Expand All @@ -88,8 +88,8 @@ class VinaPoseGenerator(PoseGenerator):
is an environment variable you set) and invokes the executable
to perform pose generation for you.
Notes
-----
Note
----
This class requires RDKit to be installed.
"""

Expand Down
40 changes: 20 additions & 20 deletions deepchem/dock/pose_scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ def pairwise_distances(coords1: np.ndarray, coords2: np.ndarray) -> np.ndarray:
Parameters
----------
coords1 : np.ndarray
coords1: np.ndarray
A numpy array of shape `(N, 3)`
coords2 : np.ndarray
coords2: np.ndarray
A numpy array of shape `(M, 3)`
Returns
Expand All @@ -27,11 +27,11 @@ def cutoff_filter(d: np.ndarray, x: np.ndarray, cutoff=8.0) -> np.ndarray:
Parameters
----------
d : np.ndarray
d: np.ndarray
Pairwise distances matrix. A numpy array of shape `(N, M)`
x : np.ndarray
x: np.ndarray
Matrix of shape `(N, M)`
cutoff : float, optional (default 8)
cutoff: float, optional (default 8)
Cutoff for selection in Angstroms
Returns
Expand All @@ -47,11 +47,11 @@ def vina_nonlinearity(c: np.ndarray, w: float, Nrot: int) -> np.ndarray:
Parameters
----------
c : np.ndarray
c: np.ndarray
A numpy array of shape `(N, M)`
w : float
w: float
Weighting term
Nrot : int
Nrot: int
Number of rotatable bonds in this molecule
Returns
Expand All @@ -68,7 +68,7 @@ def vina_repulsion(d: np.ndarray) -> np.ndarray:
Parameters
----------
d : np.ndarray
d: np.ndarray
A numpy array of shape `(N, M)`.
Returns
Expand All @@ -86,7 +86,7 @@ def vina_hydrophobic(d: np.ndarray) -> np.ndarray:
Parameters
----------
d : np.ndarray
d: np.ndarray
A numpy array of shape `(N, M)`.
Returns
Expand All @@ -112,7 +112,7 @@ def vina_hbond(d: np.ndarray) -> np.ndarray:
Parameters
----------
d : np.ndarray
d: np.ndarray
A numpy array of shape `(N, M)`.
Returns
Expand All @@ -139,7 +139,7 @@ def vina_gaussian_first(d: np.ndarray) -> np.ndarray:
Parameters
----------
d : np.ndarray
d: np.ndarray
A numpy array of shape `(N, M)`.
Returns
Expand All @@ -164,7 +164,7 @@ def vina_gaussian_second(d: np.ndarray) -> np.ndarray:
Parameters
----------
d : np.ndarray
d: np.ndarray
A numpy array of shape `(N, M)`.
Returns
Expand All @@ -187,9 +187,9 @@ def weighted_linear_sum(w: np.ndarray, x: np.ndarray) -> np.ndarray:
Parameters
----------
w : np.ndarray
w: np.ndarray
A numpy array of shape `(N,)`
x : np.ndarray
x: np.ndarray
A numpy array of shape `(N,)`
Returns
Expand All @@ -206,15 +206,15 @@ def vina_energy_term(coords1: np.ndarray, coords2: np.ndarray,
Parameters
----------
coords1 : np.ndarray
coords1: np.ndarray
Molecular coordinates of shape `(N, 3)`
coords2 : np.ndarray
coords2: np.ndarray
Molecular coordinates of shape `(M, 3)`
weights : np.ndarray
weights: np.ndarray
A numpy array of shape `(5,)`
wrot : float
wrot: float
The scaling factor for nonlinearity
Nrot : int
Nrot: int
Number of rotatable bonds in this calculation
Returns
Expand Down
Loading

0 comments on commit ab91135

Please sign in to comment.