diff --git a/src/gt4sd/algorithms/conditional_generation/regression_transformer/implementation.py b/src/gt4sd/algorithms/conditional_generation/regression_transformer/implementation.py index a53efd0c3..ec4025c68 100644 --- a/src/gt4sd/algorithms/conditional_generation/regression_transformer/implementation.py +++ b/src/gt4sd/algorithms/conditional_generation/regression_transformer/implementation.py @@ -1086,9 +1086,11 @@ def filter_substructures( f"{keep} is not a valid SMILES/SELFIES. Instead substructure filtering " f"based on sequence alone can be done and is set to: {self.text_filtering}" ) - if keep not in self.substructures_to_keep and not Chem.MolFromSmiles( # type: ignore + if keep not in self.substructures_to_keep and not Chem.MolFromSmiles( # type: ignore self.target - ).HasSubstructMatch(subs_mol): + ).HasSubstructMatch( + subs_mol + ): logger.info( f"{keep} could not be identified in SMILES/SELFIES on text level AND no " "substructure match occurred, hence it will be ignored" @@ -1120,7 +1122,7 @@ def filter_substructures( sane = False break else: - if not mol.HasSubstructMatch(subs_mol): # type: ignore + if not mol.HasSubstructMatch(subs_mol): # type: ignore # Desired substructure not found sane = False break diff --git a/src/gt4sd/algorithms/conditional_generation/regression_transformer/utils.py b/src/gt4sd/algorithms/conditional_generation/regression_transformer/utils.py index 4ec04b31e..60dc497a9 100644 --- a/src/gt4sd/algorithms/conditional_generation/regression_transformer/utils.py +++ b/src/gt4sd/algorithms/conditional_generation/regression_transformer/utils.py @@ -65,10 +65,10 @@ def filter_stubbed( Tuple of tuples of length 2 with filtered, generated molecule and its properties. """ - seed = Chem.MolFromSmiles(target) # type: ignore + seed = Chem.MolFromSmiles(target) # type: ignore seed_atoms = len(list(seed.GetAtoms())) - seed_bonds = seed.GetNumBonds() # type: ignore + seed_bonds = seed.GetNumBonds() # type: ignore smis: List[str] = [] props: List[str] = [] @@ -76,7 +76,7 @@ def filter_stubbed( if smi == "": continue try: - mol = Chem.MolFromSmiles(smi) # type: ignore + mol = Chem.MolFromSmiles(smi) # type: ignore num_atoms = len(list(mol.GetAtoms())) num_bonds = mol.GetNumBonds() diff --git a/src/gt4sd/algorithms/generation/diffusion/geodiff/core.py b/src/gt4sd/algorithms/generation/diffusion/geodiff/core.py index 3e7ed67c0..41f16a81f 100644 --- a/src/gt4sd/algorithms/generation/diffusion/geodiff/core.py +++ b/src/gt4sd/algorithms/generation/diffusion/geodiff/core.py @@ -253,8 +253,8 @@ def visualize_2d_input(self, data: Data) -> None: molSize = (450, 300) drawer = MD2.MolDraw2DSVG(molSize[0], molSize[1]) drawer.DrawMolecule(mc) - drawer.FinishDrawing() # type: ignore - svg = drawer.GetDrawingText() #type: ignore + drawer.FinishDrawing() # type: ignore + svg = drawer.GetDrawingText() # type: ignore display(SVG(svg.replace("svg:", ""))) def visualize_3d(self, mols_gen: List[Chem.Mol]) -> None: diff --git a/src/gt4sd/domains/materials/__init__.py b/src/gt4sd/domains/materials/__init__.py index 2b25f7909..3836f89ae 100644 --- a/src/gt4sd/domains/materials/__init__.py +++ b/src/gt4sd/domains/materials/__init__.py @@ -71,7 +71,7 @@ def validate_smiles( for index, molecule in enumerate(molecules) if molecule is not None and molecule != "" ] - return molecules, valid_ids # type: ignore + return molecules, valid_ids # type: ignore def validate_selfies( diff --git a/src/gt4sd/properties/molecules/functions.py b/src/gt4sd/properties/molecules/functions.py index 1b2a9143f..2c5d1d6ad 100644 --- a/src/gt4sd/properties/molecules/functions.py +++ b/src/gt4sd/properties/molecules/functions.py @@ -195,7 +195,7 @@ def number_of_rotatable_bonds(mol: SmallMolecule) -> int: def number_of_large_rings(mol: SmallMolecule) -> int: """Calculate the amount of large rings (> 6 atoms) of a molecule.""" mol = to_mol(mol) - ringinfo = mol.GetRingInfo() # type: ignore + ringinfo = mol.GetRingInfo() # type: ignore return len([x for x in ringinfo.AtomRings() if len(x) > 6]) diff --git a/src/gt4sd/properties/scores/core.py b/src/gt4sd/properties/scores/core.py index c9291ad29..bc0b6cd5d 100644 --- a/src/gt4sd/properties/scores/core.py +++ b/src/gt4sd/properties/scores/core.py @@ -235,7 +235,7 @@ def score(self, smiles: str) -> float: descriptor=self.descriptor, score_modifier=self.modifier, ) - return scoring_function.score_mol(Chem.MolFromSmiles(smiles)) # type: ignore + return scoring_function.score_mol(Chem.MolFromSmiles(smiles)) # type: ignore class TanimotoScorer(TargetValueScorer): @@ -274,7 +274,7 @@ def score(self, smiles: str) -> float: fp_type=self.fp_type, score_modifier=self.modifier, ) - return scoring_function.score_mol(Chem.MolFromSmiles(smiles)) # type: ignore + return scoring_function.score_mol(Chem.MolFromSmiles(smiles)) # type: ignore class IsomerScorer(TargetValueScorer): diff --git a/src/gt4sd/properties/utils.py b/src/gt4sd/properties/utils.py index d603e2379..a6a5286b3 100644 --- a/src/gt4sd/properties/utils.py +++ b/src/gt4sd/properties/utils.py @@ -49,14 +49,14 @@ def to_mol(mol: SmallMolecule) -> Chem.Mol: a rdkit.Chem.Mol object. """ if isinstance(mol, str): - mol = Chem.MolFromSmiles(mol) # type: ignore + mol = Chem.MolFromSmiles(mol) # type: ignore elif isinstance(mol, Chem.Mol): pass else: raise TypeError( f"Please provide SMILES string or rdkit.Chem.Mol object not {type(mol)}" ) - return mol # type: ignore + return mol # type: ignore def to_smiles(mol: SmallMolecule) -> str: @@ -70,7 +70,7 @@ def to_smiles(mol: SmallMolecule) -> str: """ if isinstance(mol, str): try: - mol = Chem.MolFromSmiles(mol) # type: ignore + mol = Chem.MolFromSmiles(mol) # type: ignore except Exception: raise ValueError( f"Could not convert SMILES string to rdkit.Chem.Mol: {mol}" @@ -82,7 +82,7 @@ def to_smiles(mol: SmallMolecule) -> str: f"Pass a SMILES string or rdkit.Chem.Mol object not {type(mol)}" ) - return Chem.MolToSmiles(mol, canonical=True) # type: ignore + return Chem.MolToSmiles(mol, canonical=True) # type: ignore def get_similarity_fn(