Commit 771bad01 authored by miaecle's avatar miaecle
Browse files

merge conflice

parents 583865c2 81b70ad5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ git clone https://github.com/deepchem/deepchem.git # Clone deepchem source
cd deepchem
bash scripts/install_deepchem_conda.sh deepchem
source activate deepchem
yes | pip install tensorflow-gpu==1.4.0      # If you want GPU support
yes | pip install tensorflow-gpu==1.5.0      # If you want GPU support
python setup.py install                                # Manual install
nosetests -a '!slow' -v deepchem --nologcapture        # Run tests
```
+0 −1
Original line number Diff line number Diff line
@@ -11,6 +11,5 @@ from deepchem.dock.pose_scoring import PoseScorer
from deepchem.dock.pose_scoring import GridPoseScorer
from deepchem.dock.docking import Docker
from deepchem.dock.docking import VinaGridRFDocker
from deepchem.dock.docking import VinaGridDNNDocker
from deepchem.dock.binding_pocket import ConvexHullPocketFinder
from deepchem.dock.binding_pocket import RFConvexHullPocketFinder
+6 −4
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ import os
import tempfile
from deepchem.data import DiskDataset
from deepchem.models import SklearnModel
from deepchem.models import TensorflowMultiTaskRegressor
from deepchem.models import MultiTaskRegressor
from deepchem.dock.pose_scoring import GridPoseScorer
from deepchem.dock.pose_generation import VinaPoseGenerator
from sklearn.ensemble import RandomForestRegressor
@@ -71,6 +71,7 @@ class VinaGridRFDocker(Docker):
    return (score, (protein_docked, ligand_docked))


'''
class VinaGridDNNDocker(object):
  """Vina pose-generation, DNN-models on grid-featurization of complexes."""

@@ -88,14 +89,14 @@ class VinaGridDNNDocker(object):
    # Fit model on dataset
    pdbbind_tasks = ["-logKd/Ki"]
    n_features = 2052
    model = TensorflowMultiTaskRegressor(
    model = MultiTaskRegressor(
        len(pdbbind_tasks),
        n_features,
        logdir=self.model_dir,
        dropouts=[.25],
        learning_rate=0.0003,
        weight_init_stddevs=[.1],
        batch_size=64)
        batch_size=64,
        model_dir=self.model_dir)
    model.reload()

    self.pose_scorer = GridPoseScorer(model, feat="grid")
@@ -116,3 +117,4 @@ class VinaGridDNNDocker(object):
    else:
      score = np.zeros((1,))
    return (score, (protein_docked, ligand_docked))
'''
+4 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ class TestDocking(unittest.TestCase):
      return
    docker = dc.dock.VinaGridRFDocker(exhaustiveness=1, detect_pockets=True)

  '''
  @attr("slow")
  def test_vina_grid_dnn_docker_init(self):
    """Test that VinaGridDNNDocker can be initialized."""
@@ -44,6 +45,7 @@ class TestDocking(unittest.TestCase):
    if sys.version_info >= (3, 0):
      return
    docker = dc.dock.VinaGridDNNDocker(exhaustiveness=1, detect_pockets=True)
  '''

  @attr("slow")
  def test_vina_grid_rf_docker_dock(self):
@@ -104,6 +106,7 @@ class TestDocking(unittest.TestCase):

    assert score.shape == (1,)

  '''
  @attr("slow")
  def test_vina_grid_dnn_docker_dock(self):
    """Test that VinaGridDNNDocker can dock."""
@@ -136,3 +139,4 @@ class TestDocking(unittest.TestCase):

    # Check returned files exist
    assert score.shape == (1,)
  '''
+88 −68
Original line number Diff line number Diff line
@@ -12,8 +12,8 @@ from deepchem.feat.mol_graphs import ConvMol, WeaveMol

def one_of_k_encoding(x, allowable_set):
  if x not in allowable_set:
    raise Exception(
        "input {0} not in allowable set{1}:".format(x, allowable_set))
    raise Exception("input {0} not in allowable set{1}:".format(
        x, allowable_set))
  return list(map(lambda s: x == s, allowable_set))


@@ -247,13 +247,25 @@ def find_distance(a1, num_atoms, canon_adj_list, max_distance=7):


class ConvMolFeaturizer(Featurizer):

  name = ['conv_mol']

  def __init__(self):
    # Since ConvMol is an object and not a numpy array, need to set dtype to
    # object.
  def __init__(self, master_atom=False):
    """
    Parameters
    ----------
    master_atom: Boolean
      if true create a fake atom with bonds to every other atom.
      the initialization is the mean of the other atom features in
      the molecule.  This technique is briefly discussed in
      Neural Message Passing for Quantum Chemistry
      https://arxiv.org/pdf/1704.01212.pdf


    Since ConvMol is an object and not a numpy array, need to set dtype to
    object.
    """
    self.dtype = object
    self.master_atom = master_atom

  def _featurize(self, mol):
    """Encodes mol as a ConvMol object."""
@@ -264,10 +276,14 @@ class ConvMolFeaturizer(Featurizer):

    # Stack nodes into an array
    nodes = np.vstack(nodes)
    if self.master_atom:
      master_atom_features = np.expand_dims(np.mean(nodes, axis=0), axis=0)
      nodes = np.concatenate([nodes, master_atom_features], axis=0)

    # Get bond lists with reverse edges included
    edge_list = [(b.GetBeginAtomIdx(), b.GetEndAtomIdx())
                 for b in mol.GetBonds()]
    edge_list = [
        (b.GetBeginAtomIdx(), b.GetEndAtomIdx()) for b in mol.GetBonds()
    ]

    # Get canonical adjacency list
    canon_adj_list = [[] for mol_id in range(len(nodes))]
@@ -275,11 +291,15 @@ class ConvMolFeaturizer(Featurizer):
      canon_adj_list[edge[0]].append(edge[1])
      canon_adj_list[edge[1]].append(edge[0])

    if self.master_atom:
      fake_atom_index = len(nodes) - 1
      for index in range(len(nodes) - 1):
        canon_adj_list[index].append(fake_atom_index)

    return ConvMol(nodes, canon_adj_list)


class WeaveFeaturizer(Featurizer):

  name = ['weave_mol']

  def __init__(self, graph_distance=True, explicit_H=False):
Loading