Commit b4459840 authored by seyonechithrananda's avatar seyonechithrananda
Browse files

mypy, pytest issues

parent af2dfd81
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -12,8 +12,6 @@ from deepchem.utils.data_utils import pad_array
from deepchem.utils.rdkit_utils import MoleculeLoadException, get_xyz_from_mol, \
  load_molecule, merge_molecules_xyz, merge_molecules

from typing import Tuple, Optional, Iterable, cast


def compute_neighbor_list(coords, neighbor_cutoff, max_num_neighbors,
                          periodic_box_size):
+6 −6
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ class ChargeVoxelizer(ComplexFeaturizer):
    self.voxel_width = voxel_width
    self.reduce_to_contacts = reduce_to_contacts

  def _featurize(self, datapoint, **kwargs) -> Optional[np.ndarray]:
  def _featurize(self, datapoint, **kwargs):  #-> Optional[np.ndarray]:
    """
    Compute featurization for a single mol/protein complex

@@ -173,7 +173,7 @@ class SaltBridgeVoxelizer(ComplexFeaturizer):
    self.voxel_width = voxel_width
    self.reduce_to_contacts = reduce_to_contacts

  def _featurize(self, datapoint, **kwargs) -> Optional[np.ndarray]:
  def _featurize(self, datapoint, **kwargs):  # -> Optional[np.ndarray]:
    """
    Compute featurization for a single mol/protein complex

@@ -264,7 +264,7 @@ class CationPiVoxelizer(ComplexFeaturizer):
    self.box_width = box_width
    self.voxel_width = voxel_width

  def _featurize(self, datapoint, **kwargs) -> Optional[np.ndarray]:
  def _featurize(self, datapoint, **kwargs):  # -> Optional[np.ndarray]:
    """
    Compute featurization for a single mol/protein complex

@@ -361,7 +361,7 @@ class PiStackVoxelizer(ComplexFeaturizer):
    self.box_width = box_width
    self.voxel_width = voxel_width

  def _featurize(self, datapoint, **kwargs) -> Optional[np.ndarray]:
  def _featurize(self, datapoint, **kwargs):  # -> Optional[np.ndarray]:
    """
    Compute featurization for a single mol/protein complex

@@ -479,7 +479,7 @@ class HydrogenBondCounter(ComplexFeaturizer):
      self.angle_cutoffs = angle_cutoffs
    self.reduce_to_contacts = reduce_to_contacts

  def _featurize(self, datapoint, **kwargs) -> Optional[np.ndarray]:
  def _featurize(self, datapoint, **kwargs):  # -> Optional[np.ndarray]:
    """
    Compute featurization for a single mol/protein complex

@@ -589,7 +589,7 @@ class HydrogenBondVoxelizer(ComplexFeaturizer):
    self.voxel_width = voxel_width
    self.reduce_to_contacts = reduce_to_contacts

  def _featurize(self, datapoint, **kwargs) -> Optional[np.ndarray]:
  def _featurize(self, datapoint, **kwargs):  # -> Optional[np.ndarray]:
    """
    Compute featurization for a single mol/protein complex

+8 −6
Original line number Diff line number Diff line
@@ -67,11 +67,11 @@ class AtomicCoordinates(MolecularFeaturizer):
    # Check whether num_confs >=1 or not
    num_confs = len(datapoint.GetConformers())
    if num_confs == 0:
      mol = Chem.AddHs(datapoint)
      AllChem.EmbedMolecule(mol, AllChem.ETKDG())
      mol = Chem.RemoveHs(mol)
      datapoint = Chem.AddHs(datapoint)
      AllChem.EmbedMolecule(datapoint, AllChem.ETKDG())
      datapoint = Chem.RemoveHs(datapoint)

    N = mol.GetNumAtoms()
    N = datapoint.GetNumAtoms()
    coords = np.zeros((N, 3))

    # RDKit stores atomic coordinates in Angstrom. Atomic unit of length is the
@@ -79,11 +79,13 @@ class AtomicCoordinates(MolecularFeaturizer):
    # consistent with most QM software packages.
    if self.use_bohr:
      coords_list = [
          mol.GetConformer(0).GetAtomPosition(i).__idiv__(0.52917721092)
          datapoint.GetConformer(0).GetAtomPosition(i).__idiv__(0.52917721092)
          for i in range(N)
      ]
    else:
      coords_list = [mol.GetConformer(0).GetAtomPosition(i) for i in range(N)]
      coords_list = [
          datapoint.GetConformer(0).GetAtomPosition(i) for i in range(N)
      ]

    for atom in range(N):
      coords[atom, 0] = coords_list[atom].x