Skip to content

Commit

Permalink
Merge pull request #1874 from deepchem/conda_env_rtd
Browse files Browse the repository at this point in the history
Fixing Read the Docs Environment
  • Loading branch information
Bharath Ramsundar committed May 30, 2020
2 parents 55f283b + 517061a commit 48d40fc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
18 changes: 12 additions & 6 deletions deepchem/feat/graph_features.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import numpy as np
from rdkit import Chem

import deepchem as dc
from deepchem.feat import Featurizer
Expand Down Expand Up @@ -55,11 +54,9 @@ def safe_index(l, e):
possible_numH_list = [0, 1, 2, 3, 4]
possible_valence_list = [0, 1, 2, 3, 4, 5, 6]
possible_formal_charge_list = [-3, -2, -1, 0, 1, 2, 3]
possible_hybridization_list = [
Chem.rdchem.HybridizationType.SP, Chem.rdchem.HybridizationType.SP2,
Chem.rdchem.HybridizationType.SP3, Chem.rdchem.HybridizationType.SP3D,
Chem.rdchem.HybridizationType.SP3D2
]
# To avoid importing rdkit, this is a placeholder list of the correct
# length. These will be replaced with rdkit HybridizationType below
possible_hybridization_list = ["SP", "SP2", "SP3", "SP3D", "SP3D2"]
possible_number_radical_e_list = [0, 1, 2]
possible_chirality_list = ['R', 'S']

Expand All @@ -84,13 +81,22 @@ def get_feature_list(atom):
atom: RDKit.rdchem.Atom
Atom to get features for
"""
# Replace the hybridization
from rdkit import Chem
global possible_hybridization_list
possible_hybridization_list = [
Chem.rdchem.HybridizationType.SP, Chem.rdchem.HybridizationType.SP2,
Chem.rdchem.HybridizationType.SP3, Chem.rdchem.HybridizationType.SP3D,
Chem.rdchem.HybridizationType.SP3D2
]
features = 6 * [0]
features[0] = safe_index(possible_atom_list, atom.GetSymbol())
features[1] = safe_index(possible_numH_list, atom.GetTotalNumHs())
features[2] = safe_index(possible_valence_list, atom.GetImplicitValence())
features[3] = safe_index(possible_formal_charge_list, atom.GetFormalCharge())
features[4] = safe_index(possible_number_radical_e_list,
atom.GetNumRadicalElectrons())

features[5] = safe_index(possible_hybridization_list, atom.GetHybridization())
return features

Expand Down
4 changes: 2 additions & 2 deletions deepchem/feat/tests/test_graph_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_carbon_nitrogen(self):
# Note there is a central nitrogen of degree 4, with 4 carbons
# of degree 1 (connected only to central nitrogen).
raw_smiles = ['C[N+](C)(C)C']
import rdkit
import rdkit.Chem
mols = [rdkit.Chem.MolFromSmiles(s) for s in raw_smiles]
featurizer = ConvMolFeaturizer()
mols = featurizer.featurize(mols)
Expand Down Expand Up @@ -70,7 +70,7 @@ def test_single_carbon(self):
def test_alkane(self):
"""Test on simple alkane"""
raw_smiles = ['CCC']
import rdkit
import rdkit.Chem
mols = [rdkit.Chem.MolFromSmiles(s) for s in raw_smiles]
featurizer = ConvMolFeaturizer()
mol_list = featurizer.featurize(mols)
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))

# -- Project information -----------------------------------------------------

Expand Down
6 changes: 6 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
sphinx_rtd_theme
numpy
pandas
sklearn
tensorflow
pillow
tensorflow_probability

0 comments on commit 48d40fc

Please sign in to comment.