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

🚚 move data

parent 5e025e46
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -27,8 +27,8 @@ class TestHelperFunctions(unittest.TestCase):
    # TODO test more formats for ligand
    current_dir = os.path.dirname(os.path.realpath(__file__))
    self.protein_file = os.path.join(current_dir,
                                     '3ws9_protein_fixer_rdkit.pdb')
    self.ligand_file = os.path.join(current_dir, '3ws9_ligand.sdf')
                                     'data', '3ws9_protein_fixer_rdkit.pdb')
    self.ligand_file = os.path.join(current_dir, 'data', '3ws9_ligand.sdf')

  def test_load_molecule(self):
    # adding hydrogens and charges is tested in dc.utils
@@ -194,13 +194,13 @@ class TestPiInteractions(unittest.TestCase):

    # load and sanitize two real molecules
    _, self.prot = rgf.load_molecule(
        os.path.join(current_dir, '3ws9_protein_fixer_rdkit.pdb'),
        os.path.join(current_dir, 'data', '3ws9_protein_fixer_rdkit.pdb'),
        add_hydrogens=False,
        calc_charges=False,
        sanitize=True)

    _, self.lig = rgf.load_molecule(
        os.path.join(current_dir, '3ws9_ligand.sdf'),
        os.path.join(current_dir, 'data', '3ws9_ligand.sdf'),
        add_hydrogens=False,
        calc_charges=False,
        sanitize=True)
@@ -320,8 +320,8 @@ class TestFeaturizationFunctions(unittest.TestCase):
  def setUp(self):
    current_dir = os.path.dirname(os.path.realpath(__file__))
    self.protein_file = os.path.join(current_dir,
                                     '3ws9_protein_fixer_rdkit.pdb')
    self.ligand_file = os.path.join(current_dir, '3ws9_ligand.sdf')
                                     'data', '3ws9_protein_fixer_rdkit.pdb')
    self.ligand_file = os.path.join(current_dir, 'data', '3ws9_ligand.sdf')

  def test_compute_all_ecfp(self):
    _, mol = rgf.load_molecule(self.ligand_file)
+0 −43
Original line number Diff line number Diff line
"""
Tests for importing .sdf files
"""
__author__ = "Joseph Gomes"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"

import os
import unittest
import tempfile
import shutil
import deepchem as dc


class TestFeaturizedSamples(unittest.TestCase):
  """
  Test Featurized Samples class.
  """

  def random_test_train_valid_test_split_from_sdf(self):
    """Test of singletask CoulombMatrixEig regression on .sdf file."""
    splittype = "random"
    input_transforms = []
    output_transforms = ["normalize"]
    model_params = {}
    tasks = ["atomization_energy"]
    task_type = "regression"
    task_types = {task: task_type for task in tasks}
    current_dir = os.path.dirname(os.path.abspath(__file__))
    input_file = os.path.join(current_dir, "data/water.sdf")

    featurizer = dc.feat.CoulombMatrixEig(6, remove_hydrogens=False)
    loader = dc.data.SDFLoader(tasks=tasks, featurizer=featurizer)

    dataset = loader.featurize(input_file)

    # Splits featurized samples into train/test
    splitter = dc.splits.RandomSplitter()
    train_dataset, valid_dataset, test_dataset = \
        splitter.train_valid_test_split(dataset)
    assert len(train_dataset) == 8
    assert len(valid_dataset) == 1
    assert len(test_dataset) == 1
+2 −2
Original line number Diff line number Diff line
@@ -10,9 +10,9 @@ class TestFragmentUtil(unittest.TestCase):
    # TODO test more formats for ligand
    current_dir = os.path.dirname(os.path.realpath(__file__))
    self.protein_file = os.path.join(
        current_dir, '../../feat/tests/3ws9_protein_fixer_rdkit.pdb')
        current_dir, '../../feat/tests/data/3ws9_protein_fixer_rdkit.pdb')
    self.ligand_file = os.path.join(current_dir,
                                    '../../feat/tests/3ws9_ligand.sdf')
                                    '../../feat/tests/data/3ws9_ligand.sdf')

  def test_get_contact_atom_indices(self):
    complexes = rdkit_util.load_complex([self.protein_file, self.ligand_file])
Loading