Skip to content

Commit

Permalink
Fixing typo and adding chirality test
Browse files Browse the repository at this point in the history
  • Loading branch information
Bharath Ramsundar authored and Bharath Ramsundar committed Sep 3, 2020
1 parent 3d257a0 commit 6ca0b89
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deepchem/feat/graph_features.py
Expand Up @@ -400,7 +400,7 @@ def bond_features(bond, use_chirality=False):
]
if use_chirality:
bond_feats = bond_feats + one_of_k_encoding_unk(
str(bond.GetStereo()), GraphConvCoonstants.possible_bond_stereo)
str(bond.GetStereo()), GraphConvConstants.possible_bond_stereo)
return np.array(bond_feats)


Expand Down
16 changes: 14 additions & 2 deletions deepchem/feat/tests/test_weave.py
Expand Up @@ -55,10 +55,8 @@ def test_weave_single_carbon():
"""Test that single carbon atom is featurized properly."""
mols = ['C']
featurizer = dc.feat.WeaveFeaturizer()
#from rdkit import Chem
mol_list = featurizer.featurize(mols)
mol = mol_list[0]
#mol = featurizer._featurize(Chem.MolFromSmiles("C"))

# Only one carbon
assert mol.get_num_atoms() == 1
Expand All @@ -70,6 +68,20 @@ def test_weave_single_carbon():
assert mol.get_pair_features().shape == (1 * 1, 14)


def test_chiral_weave():
"""Test weave features on a molecule with chiral structure."""
mols = ["F\C=C\F"]
featurizer = dc.feat.WeaveFeaturizer(use_chirality=True)
mol_list = featurizer.featurize(mols)
mol = mol_list[0]

# Only 4 atoms
assert mol.get_num_atoms() == 4

# Test feature sizes for chirality
assert mol.get_num_features() == 78


def test_weave_alkane():
"""Test on simple alkane"""
mols = ['CCC']
Expand Down

0 comments on commit 6ca0b89

Please sign in to comment.