Skip to content

Commit 92703ac

Browse files
authored
Block logs for physchem descriptors (#49)
* block logs for physchem descriptors * version bump
1 parent 0144baf commit 92703ac

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

molpipeline/mol2any/mol2rdkit_phys_chem.py

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import numpy as np
1717
import numpy.typing as npt
1818
from loguru import logger
19+
from rdkit import rdBase
1920
from rdkit import Chem
2021
from rdkit.Chem import Descriptors
2122
from sklearn.preprocessing import StandardScaler
@@ -133,13 +134,15 @@ def pretransform_single(
133134
Descriptor vector for given molecule. None if calculation failed.
134135
"""
135136
vec = np.full((len(self._descriptor_list),), np.nan)
137+
log_block = rdBase.BlockLogs() # pylint: disable=unused-variable
136138
for i, name in enumerate(self._descriptor_list):
137139
descriptor_func = RDKIT_DESCRIPTOR_DICT[name]
138140
try:
139141
vec[i] = descriptor_func(value)
140142
except Exception: # pylint: disable=broad-except
141143
if self._log_exceptions:
142144
logger.exception(f"Failed calculating descriptor: {name}")
145+
del log_block
143146
if not self._return_with_errors and np.any(np.isnan(vec)):
144147
return InvalidInstance(self.uuid, "NaN in descriptor vector", self.name)
145148
return vec

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ authors = [
1111
{name = "Jochen Sieg"}
1212
]
1313
description = "Integration of rdkit functionality into sklearn pipelines."
14-
version = "0.8.4"
14+
version = "0.8.5"
1515
readme = "README.md"
1616

1717
[tool.setuptools.dynamic]

0 commit comments

Comments
 (0)