b558d6e423f8ba97141f0c865c54e11b6a40b65e,deepchem/feat/tests/test_molgan_featurizer.py,TestMolganFeaturizer,test_featurizer_smiles,#TestMolganFeaturizer#,8
Before Change
valid_mols = list(filter(lambda x: isinstance(x, Chem.rdchem.Mol), mols))
invalid_mols = list(
filter(lambda x: not isinstance(x, Chem.rdchem.Mol), mols))
assert len(valid_mols) == len(valid_mols)
assert len(invalid_mols) == len(invalid_graph)
def test_featurizer_rdkit(self):
After Change
except ModuleNotFoundError:
raise ImportError("This method requires RDKit to be installed.")
smiles = [
"Cc1ccccc1CO", "CC1CCC(C)C(N)C1", "CCC(N)=O", "Fc1cccc(F)c1", "CC(C)F",
"C1COC2NCCC2C1", "C1=NCc2ccccc21"
]
invalid_smiles = ["axa", "xyz", "inv"]
featurizer = MolGanFeaturizer()
valid_data = featurizer.featurize(smiles)
invalid_data = featurizer.featurize(invalid_smiles)
// test featurization
valid_graphs = list(
filter(lambda x: isinstance(x, GraphMatrix), valid_data))
invalid_graphs = list(
filter(lambda x: not isinstance(x, GraphMatrix), invalid_data))
assert len(valid_graphs) == len(smiles)
assert len(invalid_graphs) == len(invalid_smiles)
// test defeaturization
valid_mols = featurizer.defeaturize(valid_graphs)
invalid_mols = featurizer.defeaturize(invalid_graphs)
valid_mols = list(
filter(lambda x: isinstance(x, Chem.rdchem.Mol), valid_mols))
invalid_mols = list(
filter(lambda x: not isinstance(x, Chem.rdchem.Mol), invalid_mols))
assert len(valid_graphs) == len(valid_mols)
assert len(invalid_graphs) == len(invalid_mols)
mols = list(map(Chem.MolFromSmiles, smiles))
redone_smiles = list(map(Chem.MolToSmiles, mols))
// sanity check; see if something weird does not happen with rdkit
assert redone_smiles == smiles
// check if original smiles match defeaturized smiles
defe_smiles = list(map(Chem.MolToSmiles, valid_mols))
assert defe_smiles == smiles
def test_featurizer_rdkit(self):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: deepchem/deepchem
Commit Name: b558d6e423f8ba97141f0c865c54e11b6a40b65e
Time: 2021-01-29
Author: m.grabski@sygnaturediscovery.com
File Name: deepchem/feat/tests/test_molgan_featurizer.py
Class Name: TestMolganFeaturizer
Method Name: test_featurizer_smiles
Project Name: ilastik/ilastik
Commit Name: bdb4aac1292f1b873bde0cc7dfb9ea77f7615e26
Time: 2013-03-18
Author: bergs@janelia.hhmi.org
File Name: lazyflow/operators/opCompressedCache.py
Class Name: OpCompressedCache
Method Name: setInSlot
Project Name: jsalt18-sentence-repl/jiant
Commit Name: 2573c649518391ada6214cfc72d20421dfac4072
Time: 2018-03-16
Author: wang.alex.c@gmail.com
File Name: src/preprocess.py
Class Name:
Method Name: get_embeddings