diff --git a/deepchem/feat/graph_features.py b/deepchem/feat/graph_features.py index 836f536d9f..5b957560f9 100644 --- a/deepchem/feat/graph_features.py +++ b/deepchem/feat/graph_features.py @@ -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) diff --git a/deepchem/feat/tests/test_weave.py b/deepchem/feat/tests/test_weave.py index 40e6eee646..0e90a284af 100644 --- a/deepchem/feat/tests/test_weave.py +++ b/deepchem/feat/tests/test_weave.py @@ -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 @@ -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']