Commit 84f9046e authored by Bharath Ramsundar's avatar Bharath Ramsundar
Browse files

Fixing tests

parent 65cd15b9
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -186,12 +186,7 @@ class SplifVoxelizer(ComplexFeaturizer):
  """Computes SPLIF voxel grid for a macromolecular complex.

  SPLIF fingerprints are based on a technique introduced in the
  following paper. 

  Da, C., and D. Kireev. "Structural protein–ligand interaction
  fingerprints (SPLIF) for structure-based virtual screening:
  method and benchmark study." Journal of chemical information
  and modeling 54.9 (2014): 2555-2561.
  following paper [1]_.

  The SPLIF voxelizer localizes local SPLIF descriptors in
  space, by assigning features to the voxel in which they
@@ -201,6 +196,13 @@ class SplifVoxelizer(ComplexFeaturizer):
  Featurizes a macromolecular complex into a tensor of shape
  `(voxels_per_edge, voxels_per_edge, voxels_per_edge, size)`
  where `voxels_per_edge = int(box_width/voxel_width)`.

  References
  ----------
  .. [1] Da, C., and D. Kireev. "Structural protein–ligand interaction
  fingerprints (SPLIF) for structure-based virtual screening:
  method and benchmark study." Journal of chemical information
  and modeling 54.9 (2014): 2555-2561.
  """

  def __init__(self,
@@ -270,10 +272,10 @@ class SplifVoxelizer(ComplexFeaturizer):
              [
                  voxelize(
                      convert_atom_pair_to_voxel,
                      self.box_width,
                      self.voxel_width,
                      hash_ecfp_pair,
                      xyzs,
                      hash_function=hash_ecfp_pair,
                      coordinates=xyzs,
                      box_width=self.box_width,
                      voxel_width=self.voxel_width,
                      feature_dict=splif_dict,
                      nb_channel=self.size)
                  for splif_dict in featurize_splif(
+4 −4
Original line number Diff line number Diff line
@@ -24,11 +24,11 @@ class TestSplifFingerprints(unittest.TestCase):
  def test_splif_voxels_shape(self):
    box_width = 48
    voxel_width = 2
    voxels_per_edge = box_width / voxel_width
    voxels_per_edge = int(box_width / voxel_width)
    size = 8
    voxelizer = dc.feat.SplifVoxelizer(
        box_width=box_width, voxel_width=voxel_width, size=size)
    features, failures = voxelizer._featurize(self.ligand_file,
                                              self.protein_file)
    features, failures = voxelizer.featurize([self.ligand_file],
                                             [self.protein_file])
    assert features.shape == (1, voxels_per_edge, voxels_per_edge,
                              voxels_per_edge, size)
                              voxels_per_edge, size * 3)
+4 −0
Original line number Diff line number Diff line
"""The functions in these utilities check that noncovalent interactions happen"""
import numpy as np
from collections import Counter
from deepchem.utils.fragment_utils import get_partial_charge
from deepchem.utils.rdkit_utils import compute_ring_center
from deepchem.utils.rdkit_utils import compute_ring_normal
from deepchem.utils.geometry_utils import angle_between
from deepchem.utils.geometry_utils import compute_centroid


def is_salt_bridge(atom_i, atom_j):
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ from deepchem.utils.pdbqt_utils import pdbqt_to_pdb
from deepchem.utils.pdbqt_utils import convert_mol_to_pdbqt
from deepchem.utils.pdbqt_utils import convert_protein_to_pdbqt
from deepchem.utils.geometry_utils import compute_pairwise_distances
from deepchem.utils.geometry_utils import compute_centroid
from deepchem.utils.fragment_utils import MolecularFragment
from typing import Any, List, Tuple, Set, Optional, Dict
from deepchem.utils.typing import OneOrMany, RDKitMol
+3 −2
Original line number Diff line number Diff line
import os
import unittest
import numpy as np
from deepchem.utils.rdkit_utils import load_molecule
from deepchem.utils.rdkit_utils import compute_ring_center
from deepchem.utils.rdkit_utils import compute_ring_normal
@@ -26,13 +27,13 @@ class TestPiInteractions(unittest.TestCase):
    # load and sanitize two real molecules
    _, self.prot = load_molecule(
        os.path.join(current_dir,
                     '../../feat/tests/3ws9_protein_fixer_rdkit.pdb'),
                     '../../feat/tests/data/3ws9_protein_fixer_rdkit.pdb'),
        add_hydrogens=False,
        calc_charges=False,
        sanitize=True)

    _, self.lig = load_molecule(
        os.path.join(current_dir, '../../feat/tests/3ws9_ligand.sdf'),
        os.path.join(current_dir, '../../feat//tests/data/3ws9_ligand.sdf'),
        add_hydrogens=False,
        calc_charges=False,
        sanitize=True)