Skip to content

Commit bf97527

Browse files
committed
add error handling for smiles tokenisation
1 parent 6d7ca43 commit bf97527

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

chebai/preprocessing/reader.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,12 @@ def _read_data(self, raw_data: str) -> List[int]:
205205
except Exception as e:
206206
print(f"RDKit failed to process {raw_data}")
207207
print(f"\t{e}")
208-
209-
return [self._get_token_index(v[1]) for v in _tokenize(raw_data)]
208+
try:
209+
return [self._get_token_index(v[1]) for v in _tokenize(raw_data)]
210+
except ValueError as e:
211+
print(f"could not process {raw_data}")
212+
print(f"\t{e}")
213+
return None
210214

211215

212216
class DeepChemDataReader(ChemDataReader):

0 commit comments

Comments
 (0)