def test_smiles_to_image_with_img_spec(self): """Test SmilesToImage with img_spec""" featurizer = SmilesToImage() base_features = featurizer.featurize(self.smiles) featurizer = SmilesToImage(img_spec='engd') features = featurizer.featurize(self.smiles) assert features.shape == (2, 80, 80, 4) assert not np.allclose(base_features, features)
def test_smiles_to_image_with_res(self): """Test SmilesToImage with res""" featurizer = SmilesToImage() base_features = featurizer.featurize(self.smiles) featurizer = SmilesToImage(res=0.6) features = featurizer.featurize(self.smiles) assert features.shape == (2, 80, 80, 1) assert not np.allclose(base_features, features)
def test_smiles_to_image_long_molecule(self): """Test SmilesToImage for a molecule which does not fit the image""" featurizer = SmilesToImage(img_size=80, res=0.5, max_len=250, img_spec="std") features = featurizer.featurize(self.long_molecule_smiles) assert features.shape == (1, 0)
def test_smiles_to_image_with_max_len(self): """Test SmilesToImage with max_len""" smiles_length = [len(s) for s in self.smiles] assert smiles_length == [26, 25] featurizer = SmilesToImage(max_len=25) features = featurizer.featurize(self.smiles) assert features[0].shape == (0, ) assert features[1].shape == (80, 80, 1)
def test_smiles_to_image_with_image_size(self): """Test SmilesToImage with image_size""" featurizer = SmilesToImage(img_size=100) features = featurizer.featurize(self.smiles) assert features.shape == (2, 100, 100, 1)
def test_smiles_to_image(self): """Test default SmilesToImage""" featurizer = SmilesToImage() features = featurizer.featurize(self.smiles) assert features.shape == (2, 80, 80, 1)