Commit b6eb7473 authored by Karl Leswing's avatar Karl Leswing
Browse files

PR Updates

parent d2a928b0
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
from unittest import TestCase

from nose.tools import assert_equals
from nose.plugins.attrib import attr
import pytest
from rdkit import Chem

import deepchem as dc
@@ -12,7 +11,7 @@ from deepchem.models.autoencoder_models.autoencoder import TensorflowMoleculeEnc

class TestTensorflowEncoders(TestCase):

  @pytest.mark.slow('slow')
  @pytest.mark.slow
  def test_fit(self):
    tf_enc = TensorflowMoleculeEncoder.zinc_encoder()

@@ -36,4 +35,4 @@ class TestTensorflowEncoders(TestCase):
    tf_de = TensorflowMoleculeDecoder.zinc_decoder()
    one_hot_decoded = tf_de.predict_on_batch(prediction)
    decoded_smiles = featurizer.untransform(one_hot_decoded)
    assert_equals(len(decoded_smiles), len(smiles))
    assert len(decoded_smiles) == len(smiles)
+1 −1
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ class TestBindingPocket(unittest.TestCase):

    assert len(pockets) < len(all_pockets)

  @pytest.mark.skip(reson="Unknown")
  @pytest.mark.skip(reason="Unknown")
  def test_rf_convex_find_pockets(self):
    """Test that filter with pre-trained RF models works."""
    if sys.version_info >= (3, 0):
+1 −37
Original line number Diff line number Diff line
@@ -5,10 +5,9 @@ __author__ = "Bharath Ramsundar"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"

import unittest
import os

import sys
import unittest

import pytest

@@ -106,38 +105,3 @@ class TestDocking(unittest.TestCase):
      return

    assert score.shape == (1,)

  '''
  @pytest.mark.slow("slow")
  def test_vina_grid_dnn_docker_dock(self):
    """Test that VinaGridDNNDocker can dock."""
    current_dir = os.path.dirname(os.path.realpath(__file__))
    protein_file = os.path.join(current_dir, "1jld_protein.pdb")
    ligand_file = os.path.join(current_dir, "1jld_ligand.sdf")

    docker = dc.dock.VinaGridDNNDocker(exhaustiveness=1, detect_pockets=False)
    (score, (protein_docked, ligand_docked)) = docker.dock(
        protein_file, ligand_file)

    # Check returned files exist
    assert score.shape == (1,)
    assert os.path.exists(protein_docked)
    assert os.path.exists(ligand_docked)

  @pytest.mark.slow('slow')
  def test_pocket_vina_grid_dnn_docker_dock(self):
    """Test that VinaGridDNNDocker can dock."""
    if sys.version_info >= (3, 0):
      return

    current_dir = os.path.dirname(os.path.realpath(__file__))
    protein_file = os.path.join(current_dir, "1jld_protein.pdb")
    ligand_file = os.path.join(current_dir, "1jld_ligand.sdf")

    docker = dc.dock.VinaGridDNNDocker(exhaustiveness=1, detect_pockets=True)
    (score, (protein_docked, ligand_docked)) = docker.dock(
        protein_file, ligand_file, dry_run=True)

    # Check returned files exist
    assert score.shape == (1,)
  '''
+2 −2
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ class TestAtomicConv(unittest.TestCase):
    atomic_convnet.fit(train, nb_epoch=300)
    assert np.allclose(labels, atomic_convnet.predict(train), atol=0.01)

  @pytest.mark.slow("slow")
  @pytest.mark.slow
  def test_atomic_conv_variable(self):
    """A simple test that initializes and fits an AtomicConvModel on variable input size."""
    # For simplicity, let's assume both molecules have same number of
@@ -102,7 +102,7 @@ class TestAtomicConv(unittest.TestCase):
    train = NumpyDataset(features, labels)
    atomic_convnet.fit(train, nb_epoch=1)

  @pytest.mark.slow("slow")
  @pytest.mark.slow
  def test_atomic_conv_with_feat(self):
    """A simple test for running an atomic convolution on featurized data."""
    dir_path = os.path.dirname(os.path.realpath(__file__))
+9 −12
Original line number Diff line number Diff line
@@ -7,20 +7,17 @@ __copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"

import os
import tempfile

import numpy as np
import unittest
import sklearn
import shutil
import pytest
import tensorflow as tf
import deepchem as dc
import scipy.io
from deepchem.models.optimizers import Adam, ExponentialDecay
from tensorflow.python.framework import test_util
from flaky import flaky
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import RandomForestRegressor
from flaky import flaky
import pytest
from tensorflow.python.framework import test_util

import deepchem as dc
from deepchem.models.optimizers import Adam


class TestOverfit(test_util.TensorFlowTestCase):
@@ -573,7 +570,7 @@ class TestOverfit(test_util.TensorFlowTestCase):
    scores = model.evaluate(dataset, [regression_metric])
    assert scores[regression_metric.name] < .2

  @pytest.mark.slow('slow')
  @pytest.mark.slow
  def test_DAG_singletask_regression_overfit(self):
    """Test DAG regressor multitask overfits tiny data."""
    np.random.seed(123)
@@ -691,7 +688,7 @@ class TestOverfit(test_util.TensorFlowTestCase):

    assert scores[regression_metric.name] > .8

  @pytest.mark.slow("slow")
  @pytest.mark.slow
  def test_MPNN_singletask_regression_overfit(self):
    """Test MPNN overfits tiny data."""
    np.random.seed(123)