File tree 1 file changed +7
-4
lines changed 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,7 @@ class InorganicsFilter(_MolToMolPipelineElement):
221
221
"""Filters Molecules which do not contain any organic (i.e. Carbon) atoms."""
222
222
223
223
CARBON_INORGANICS = ["O=C=O" , "[C-]#[O+]" ] # CO2 and CO are not organic
224
+ CARBON_INORGANICS_MAX_ATOMS = 3
224
225
225
226
def __init__ (
226
227
self ,
@@ -258,8 +259,10 @@ def pretransform_single(self, value: RDKitMol) -> OptionalMol:
258
259
return InvalidInstance (
259
260
self .uuid , "Molecule contains no organic atoms." , self .name
260
261
)
261
- smiles = Chem .MolToSmiles (value )
262
- print (smiles )
263
- if smiles in self .CARBON_INORGANICS :
264
- return InvalidInstance (self .uuid , "Molecule is not organic." , self .name )
262
+
263
+ # Only check for inorganic molecules if the molecule is small enough
264
+ if value .GetNumAtoms () <= self .CARBON_INORGANICS_MAX_ATOMS :
265
+ smiles = Chem .MolToSmiles (value )
266
+ if smiles in self .CARBON_INORGANICS :
267
+ return InvalidInstance (self .uuid , "Molecule is not organic." , self .name )
265
268
return value
You can’t perform that action at this time.
0 commit comments