Unverified Commit b41f5f4e authored by Daiki Nishikawa's avatar Daiki Nishikawa Committed by GitHub
Browse files

Merge pull request #2088 from nd-02110114/fix-docs-rdkit

Clarify rdkit type annotation
parents 37e61ee9 f7c12790
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -88,8 +88,8 @@ class VinaPoseGenerator(PoseGenerator):
  is an environment variable you set) and invokes the executable
  to perform pose generation for you.

  Note
  ----
  Notes
  -----
  This class requires RDKit to be installed.
  """

+18 −18
Original line number Diff line number Diff line
@@ -66,13 +66,13 @@ class ConformerGenerator(object):

    Parameters
    ----------
    mol: RDKit Mol
    mol : rdkit.Chem.rdchem.Mol
      RDKit Mol object

    Returns
    -------
    mol: RDKit Mol
      A new RDKit Mol containing the chosen conformers, sorted by
    mol : rdkit.Chem.rdchem.Mol
      A new RDKit Mol object containing the chosen conformers, sorted by
      increasing energy.
    """
    return self.generate_conformers(mol)
@@ -86,13 +86,13 @@ class ConformerGenerator(object):

    Parameters
    ----------
    mol: RDKit Mol
    mol : rdkit.Chem.rdchem.Mol
      RDKit Mol object

    Returns
    -------
    mol: RDKit Mol
      A new RDKit Mol containing the chosen conformers, sorted by
    mol : rdkit.Chem.rdchem.Mol
      A new RDKit Mol object containing the chosen conformers, sorted by
      increasing energy.
    """

@@ -119,12 +119,12 @@ class ConformerGenerator(object):

    Parameters
    ----------
    mol: RDKit Mol
    mol : rdkit.Chem.rdchem.Mol
      RDKit Mol object

    Returns
    -------
    mol: RDKit Mol
    mol : rdkit.Chem.rdchem.Mol
      RDKit Mol object with embedded multiple conformers.
    """
    try:
@@ -147,7 +147,7 @@ class ConformerGenerator(object):

    Parameters
    ----------
    mol: RDKit Mol
    mol : rdkit.Chem.rdchem.Mol
      RDKit Mol object with embedded conformers.
    conf_id : int, optional
      ID of the conformer to associate with the force field.
@@ -156,7 +156,7 @@ class ConformerGenerator(object):

    Returns
    -------
    ff: RDKit ForceField
    ff : rdkit.ForceField.rdForceField.ForceField
      RDKit force field instance for a molecule.
    """
    try:
@@ -183,7 +183,7 @@ class ConformerGenerator(object):

    Parameters
    ----------
    mol: RDKit Mol
    mol : rdkit.Chem.rdchem.Mol
      RDKit Mol object with embedded conformers.
    """
    for conf in mol.GetConformers():
@@ -196,7 +196,7 @@ class ConformerGenerator(object):

    Parameters
    ----------
    mol: RDKit Mol
    mol : rdkit.Chem.rdchem.Mol
      RDKit Mol object with embedded conformers.

    Returns
@@ -219,13 +219,13 @@ class ConformerGenerator(object):

    Parameters
    ----------
    mol: RDKit Mol
    mol : rdkit.Chem.rdchem.Mol
      RDKit Mol object

    Returns
    -------
    new_mol: RDKit Mol
      A new RDKit Mol containing the chosen conformers, sorted by
    new_mol : rdkit.Chem.rdchem.Mol
      A new rdkit.Chem.rdchem.Mol containing the chosen conformers, sorted by
      increasing energy.
    """
    try:
@@ -278,7 +278,7 @@ class ConformerGenerator(object):

    Parameters
    ----------
    mol: RDKit Mol
    mol : rdkit.Chem.rdchem.Mol
      RDKit Mol object

    Returns
+22 −22
Original line number Diff line number Diff line
@@ -366,10 +366,10 @@ def get_face_boxes(coords: np.ndarray, pad: float = 5.0) -> List[CoordinateBox]:
    x_min, x_max = int(np.floor(x_min)) - pad, int(np.ceil(x_max)) + pad
    x_bounds = (x_min, x_max)

    y_min, y_max = np.amin(points[:, 1]), np.amax(points[:, 1])
    y_min, y_max = np.amin(y_coords), np.amax(y_coords)
    y_min, y_max = int(np.floor(y_min)) - pad, int(np.ceil(y_max)) + pad
    y_bounds = (y_min, y_max)
    z_min, z_max = np.amin(points[:, 2]), np.amax(points[:, 2])
    z_min, z_max = np.amin(z_coords), np.amax(z_coords)
    z_min, z_max = int(np.floor(z_min)) - pad, int(np.ceil(z_max)) + pad
    z_bounds = (z_min, z_max)
    box = CoordinateBox(x_bounds, y_bounds, z_bounds)
+10 −10
Original line number Diff line number Diff line
"""A collection of utilities for dealing with Molecular Fragments"""
import itertools
import numpy as np
from typing import Any, List, Iterable, Optional, Sequence, Set, Tuple, Union
from typing import List, Optional, Sequence, Set, Tuple, Union

from deepchem.utils.typing import RDKitAtom, RDKitMol
from deepchem.utils.geometry_utils import compute_pairwise_distances
@@ -90,7 +90,7 @@ class MolecularFragment(object):

    Parameters
    ----------
    atoms: Iterable[RDKit Atom]
    atoms: Iterable[rdkit.Chem.rdchem.Atom]
      Each entry in this list should be a RDKit Atom.
    coords: np.ndarray
      Array of locations for atoms of shape `(N, 3)` where `N ==
@@ -135,7 +135,7 @@ def get_partial_charge(atom: Union[RDKitAtom, AtomShim]) -> float:

  Parameters
  ----------
  atom: RDKit Atom or AtomShim
  atom: rdkit.Chem.rdchem.Atom or AtomShim
    Either a rdkit.Atom object or `AtomShim`

  Returns
@@ -209,7 +209,7 @@ def get_mol_subset(
  ----------
  coords: np.ndarray
    Must be of shape (N, 3) and correspond to coordinates of mol.
  mol: RDKit Mol or MolecularFragment
  mol : rdkit.Chem.rdchem.Mol or MolecularFragment
    The molecule to strip
  atom_indices_to_keep: list
    List of the indices of the atoms to keep. Each index is a unique
@@ -252,7 +252,7 @@ def strip_hydrogens(coords: np.ndarray, mol: Union[RDKitMol, MolecularFragment]
  ----------
  coords: np.ndarray
    The coords must be of shape (N, 3) and correspond to coordinates of mol.
  mol: RDKit Mol or MolecularFragment
  mol : rdkit.Chem.rdchem.Mol or MolecularFragment
    The molecule to strip

  Returns
@@ -288,7 +288,7 @@ def get_contact_atom_indices(fragments: List[Tuple[np.ndarray, RDKitMol]],

  Parameters
  ----------
  fragments: List[Tuple[np.ndarray, RDKit Mol]]
  fragments: List[Tuple[np.ndarray, rdkit.Chem.rdchem.Mol]]
    As returned by `rdkit_utils.load_complex`, a list of tuples of
    `(coords, mol)` where `coords` is a `(N_atoms, 3)` array and `mol`
    is the rdkit molecule object.
@@ -335,7 +335,7 @@ def reduce_molecular_complex_to_contacts(

  Parameters
  ----------
  fragments: List[Tuple[np.ndarray, RDKit Mol]]
  fragments: List[Tuple[np.ndarray, rdkit.Chem.rdchem.Mol]]
    As returned by `rdkit_utils.load_complex`, a list of tuples of
    `(coords, mol)` where `coords` is a `(N_atoms, 3)` array and `mol`
    is the rdkit molecule object.
+9 −9
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ def convert_protein_to_pdbqt(mol: RDKitMol, outfile: str) -> None:

  Parameters
  ----------
  mol: RDKit Mol
  mol : rdkit.Chem.rdchem.Mol
    Protein molecule
  outfile: str
    filename which already has a valid pdb representation of mol
@@ -75,7 +75,7 @@ def mol_to_graph(mol: RDKitMol):

  Parameters
  ----------
  mol: RDKit Mol
  mol : rdkit.Chem.rdchem.Mol
    The molecule to convert into a graph.

  Returns
@@ -111,7 +111,7 @@ def get_rotatable_bonds(mol: RDKitMol) -> List[Tuple[int, int]]:

  Parameters
  ----------
  mol: RDKit Mol
  mol : rdkit.Chem.rdchem.Mol
    Ligand molecule

  Returns
@@ -148,7 +148,7 @@ def convert_mol_to_pdbqt(mol: RDKitMol, outfile: str) -> None:

  Parameters
  ----------
  mol: RDKit Mol
  mol : rdkit.Chem.rdchem.Mol
    The molecule whose value is stored in pdb format in outfile
  outfile: str
    Filename for a valid pdb file with the extention .pdbqt
@@ -245,8 +245,8 @@ def _create_component_map(mol: RDKitMol,

  Parameters
  ----------
  mol: RDKit Mol
    molecule to find disconnected compontents in 
  mol : rdkit.Chem.rdchem.Mol
    The molecule to find disconnected components in
  components: List[List[int]]
    List of connected components

@@ -348,4 +348,4 @@ def _valid_bond(used_partitions: Set[int], bond: Tuple[int, int],
    next_partition = part2
  else:
    next_partition = part1
  return not next_partition in used_partitions, next_partition
  return next_partition not in used_partitions, next_partition
Loading