nerdd-module 0.3.6__tar.gz → 0.3.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/PKG-INFO +1 -1
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/__init__.py +1 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/model/model.py +3 -6
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/model/simple_model.py +2 -7
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/model/write_output_step.py +3 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/output/__init__.py +2 -1
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/output/writer.py +1 -1
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/preprocessing/filter_by_element.py +4 -14
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/preprocessing/filter_by_weight.py +2 -10
- nerdd_module-0.3.8/nerdd_module/problem.py +42 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/tests/models/AtomicMassModel.py +1 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/tests/models/MolWeightModel.py +1 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module.egg-info/PKG-INFO +1 -1
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/pyproject.toml +1 -1
- nerdd_module-0.3.6/nerdd_module/problem.py +0 -16
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/LICENSE +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/README.md +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/cli.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/config/__init__.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/config/configuration.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/config/default_configuration.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/config/dict_configuration.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/config/merged_configuration.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/config/package_configuration.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/config/search_yaml_configuration.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/config/yaml_configuration.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/converters/__init__.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/converters/converter.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/converters/identity_converter.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/input/__init__.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/input/depth_first_explorer.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/input/explorer.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/input/file_reader.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/input/gzip_reader.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/input/inchi_reader.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/input/list_reader.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/input/mol_reader.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/input/reader.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/input/sdf_reader.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/input/smiles_reader.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/input/string_reader.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/input/tar_reader.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/input/zip_reader.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/model/__init__.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/model/assign_mol_id_step.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/model/assign_name_step.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/model/convert_representations_step.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/model/enforce_schema_step.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/model/read_input_step.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/output/csv_writer.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/output/file_writer.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/output/iterator_writer.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/output/pandas_writer.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/output/record_list_writer.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/output/sdf_writer.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/polyfills/__init__.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/polyfills/files.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/polyfills/get_entry_points.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/polyfills/types.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/polyfills/version.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/preprocessing/__init__.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/preprocessing/check_valid_smiles.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/preprocessing/chembl_structure_pipeline.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/preprocessing/preprocessing_step.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/preprocessing/remove_stereochemistry.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/preprocessing/sanitize.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/py.typed +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/steps/__init__.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/steps/map_step.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/steps/output_step.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/steps/step.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/tests/__init__.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/tests/checks.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/tests/models/__init__.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/tests/predictions.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/tests/preprocessing/DummyPreprocessingStep.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/tests/preprocessing/__init__.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/tests/representations.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/util/__init__.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/util/call_with_mappings.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/util/package.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/version.py +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module.egg-info/SOURCES.txt +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module.egg-info/dependency_links.txt +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module.egg-info/requires.txt +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module.egg-info/top_level.txt +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/setup.cfg +0 -0
- {nerdd_module-0.3.6 → nerdd_module-0.3.8}/tests/test_features.py +0 -0
|
@@ -49,10 +49,6 @@ class Model(ABC):
|
|
|
49
49
|
def _get_postprocessing_steps(self, output_format: Optional[str], **kwargs: Any) -> List[Step]:
|
|
50
50
|
pass
|
|
51
51
|
|
|
52
|
-
@abstractmethod
|
|
53
|
-
def _get_output_step(self, output_format: Optional[str], **kwargs: Any) -> OutputStep:
|
|
54
|
-
pass
|
|
55
|
-
|
|
56
52
|
def predict(
|
|
57
53
|
self,
|
|
58
54
|
input: Any,
|
|
@@ -63,14 +59,15 @@ class Model(ABC):
|
|
|
63
59
|
input_steps = self._get_input_steps(input, input_format, **kwargs)
|
|
64
60
|
preprocessing_steps = self._get_preprocessing_steps(input, input_format, **kwargs)
|
|
65
61
|
postprocessing_steps = self._get_postprocessing_steps(output_format, **kwargs)
|
|
66
|
-
output_step =
|
|
62
|
+
output_step = postprocessing_steps[-1]
|
|
63
|
+
|
|
64
|
+
assert isinstance(output_step, OutputStep), "The last step must be an OutputStep."
|
|
67
65
|
|
|
68
66
|
steps = [
|
|
69
67
|
*input_steps,
|
|
70
68
|
*preprocessing_steps,
|
|
71
69
|
PredictionStep(self, batch_size=self.batch_size, **kwargs),
|
|
72
70
|
*postprocessing_steps,
|
|
73
|
-
output_step,
|
|
74
71
|
]
|
|
75
72
|
|
|
76
73
|
# build the pipeline from the list of steps
|
|
@@ -14,7 +14,7 @@ from ..config import (
|
|
|
14
14
|
from ..input import DepthFirstExplorer
|
|
15
15
|
from ..preprocessing import PreprocessingStep
|
|
16
16
|
from ..problem import Problem
|
|
17
|
-
from ..steps import
|
|
17
|
+
from ..steps import Step
|
|
18
18
|
from ..util import get_file_path_to_instance
|
|
19
19
|
from .assign_mol_id_step import AssignMolIdStep
|
|
20
20
|
from .assign_name_step import AssignNameStep
|
|
@@ -66,12 +66,9 @@ class SimpleModel(Model):
|
|
|
66
66
|
ConvertRepresentationsStep(
|
|
67
67
|
self.get_config().get("result_properties", []), output_format, **kwargs
|
|
68
68
|
),
|
|
69
|
+
WriteOutputStep(output_format, **kwargs),
|
|
69
70
|
]
|
|
70
71
|
|
|
71
|
-
def _get_output_step(self, output_format: Optional[str], **kwargs: Any) -> OutputStep:
|
|
72
|
-
output_format = output_format or "pandas"
|
|
73
|
-
return WriteOutputStep(output_format, **kwargs)
|
|
74
|
-
|
|
75
72
|
def _preprocess(self, mol: Mol) -> Tuple[Optional[Mol], List[Problem]]:
|
|
76
73
|
return mol, []
|
|
77
74
|
|
|
@@ -129,9 +126,7 @@ class SimpleModel(Model):
|
|
|
129
126
|
{"name": "source"},
|
|
130
127
|
{"name": "name", "type": "string"},
|
|
131
128
|
{"name": "input_mol", "type": "mol"},
|
|
132
|
-
{"name": "input_smiles", "type": "string"},
|
|
133
129
|
{"name": "preprocessed_mol", "type": "mol"},
|
|
134
|
-
{"name": "preprocessed_smiles", "type": "string"},
|
|
135
130
|
]
|
|
136
131
|
|
|
137
132
|
default_properties_end = [
|
|
@@ -17,3 +17,6 @@ class WriteOutputStep(OutputStep):
|
|
|
17
17
|
writer = Writer.get_writer(self._output_format, **self._kawrgs)
|
|
18
18
|
result = writer.write(source)
|
|
19
19
|
return result
|
|
20
|
+
|
|
21
|
+
def __repr__(self) -> str:
|
|
22
|
+
return f"WriteOutputStep(output_format={self._output_format}, kwargs={self._kawrgs})"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
from typing import Iterable, List, Optional, Tuple
|
|
1
|
+
from typing import Iterable, List, Optional, Set, Tuple
|
|
2
2
|
|
|
3
3
|
from rdkit.Chem import Mol
|
|
4
4
|
|
|
5
|
-
from ..problem import Problem
|
|
5
|
+
from ..problem import InvalidElementsProblem, Problem
|
|
6
6
|
from .preprocessing_step import PreprocessingStep
|
|
7
7
|
|
|
8
8
|
__all__ = ["FilterByElement", "ORGANIC_SUBSET"]
|
|
@@ -37,7 +37,7 @@ class FilterByElement(PreprocessingStep):
|
|
|
37
37
|
problems = []
|
|
38
38
|
result_mol = mol
|
|
39
39
|
|
|
40
|
-
elements = set(atom.GetSymbol() for atom in mol.GetAtoms())
|
|
40
|
+
elements: Set[str] = set(atom.GetSymbol() for atom in mol.GetAtoms())
|
|
41
41
|
invalid_elements = elements - self.allowed_elements
|
|
42
42
|
|
|
43
43
|
# special case: hydrogens are not recognized by mol.GetAtoms()
|
|
@@ -52,16 +52,6 @@ class FilterByElement(PreprocessingStep):
|
|
|
52
52
|
if self.remove_invalid_molecules:
|
|
53
53
|
result_mol = None
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
invalid_elements_str = ", ".join(list(invalid_elements)[:3]) + "..."
|
|
57
|
-
else:
|
|
58
|
-
invalid_elements_str = ", ".join(list(invalid_elements))
|
|
59
|
-
|
|
60
|
-
problems.append(
|
|
61
|
-
Problem(
|
|
62
|
-
"invalid_elements",
|
|
63
|
-
f"Molecule contains invalid elements {invalid_elements_str}",
|
|
64
|
-
)
|
|
65
|
-
)
|
|
55
|
+
problems.append(InvalidElementsProblem(invalid_elements))
|
|
66
56
|
|
|
67
57
|
return result_mol, problems
|
|
@@ -3,7 +3,7 @@ from typing import List, Optional, Tuple
|
|
|
3
3
|
from rdkit.Chem import Mol
|
|
4
4
|
from rdkit.Chem.rdMolDescriptors import CalcExactMolWt
|
|
5
5
|
|
|
6
|
-
from ..problem import Problem
|
|
6
|
+
from ..problem import InvalidWeightProblem, Problem
|
|
7
7
|
from .preprocessing_step import PreprocessingStep
|
|
8
8
|
|
|
9
9
|
|
|
@@ -27,14 +27,6 @@ class FilterByWeight(PreprocessingStep):
|
|
|
27
27
|
if weight < self.min_weight or weight > self.max_weight:
|
|
28
28
|
if self.remove_invalid_molecules:
|
|
29
29
|
result_mol = None
|
|
30
|
-
problems.append(
|
|
31
|
-
Problem(
|
|
32
|
-
type="invalid_weight",
|
|
33
|
-
message=(
|
|
34
|
-
f"Molecular weight {weight:.2f} out of range "
|
|
35
|
-
f"[{self.min_weight}, {self.max_weight}]"
|
|
36
|
-
),
|
|
37
|
-
)
|
|
38
|
-
)
|
|
30
|
+
problems.append(InvalidWeightProblem(weight, self.min_weight, self.max_weight))
|
|
39
31
|
|
|
40
32
|
return result_mol, problems
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from typing import Iterable, NamedTuple
|
|
2
|
+
|
|
3
|
+
__all__ = [
|
|
4
|
+
"Problem",
|
|
5
|
+
"InvalidSmiles",
|
|
6
|
+
"UnknownProblem",
|
|
7
|
+
"InvalidWeightProblem",
|
|
8
|
+
"InvalidElementsProblem",
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Problem(NamedTuple):
|
|
13
|
+
type: str
|
|
14
|
+
message: str
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def InvalidSmiles() -> Problem:
|
|
18
|
+
return Problem(type="invalid_smiles", message="Invalid SMILES string")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def UnknownProblem() -> Problem:
|
|
22
|
+
return Problem(type="unknown", message="Unknown error occurred")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def InvalidWeightProblem(weight: float, min_weight: float, max_weight: float) -> Problem:
|
|
26
|
+
return Problem(
|
|
27
|
+
type="invalid_weight",
|
|
28
|
+
message=(f"Molecular weight {weight:.2f} out of range " f"[{min_weight}, {max_weight}]"),
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def InvalidElementsProblem(invalid_elements: Iterable[str]) -> Problem:
|
|
33
|
+
invalid_element_list = list(invalid_elements)
|
|
34
|
+
if len(invalid_element_list) > 3:
|
|
35
|
+
invalid_elements_str = ", ".join(invalid_element_list[:3]) + "..."
|
|
36
|
+
else:
|
|
37
|
+
invalid_elements_str = ", ".join(invalid_element_list)
|
|
38
|
+
|
|
39
|
+
return Problem(
|
|
40
|
+
"invalid_elements",
|
|
41
|
+
f"Molecule contains invalid elements {invalid_elements_str}",
|
|
42
|
+
)
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
from typing import NamedTuple
|
|
2
|
-
|
|
3
|
-
__all__ = ["Problem", "InvalidSmiles", "UnknownProblem"]
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class Problem(NamedTuple):
|
|
7
|
-
type: str
|
|
8
|
-
message: str
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def InvalidSmiles() -> Problem:
|
|
12
|
-
return Problem(type="invalid_smiles", message="Invalid SMILES string")
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def UnknownProblem() -> Problem:
|
|
16
|
-
return Problem(type="unknown", message="Unknown error occurred")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/model/convert_representations_step.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/preprocessing/chembl_structure_pipeline.py
RENAMED
|
File without changes
|
|
File without changes
|
{nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/preprocessing/remove_stereochemistry.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nerdd_module-0.3.6 → nerdd_module-0.3.8}/nerdd_module/tests/preprocessing/DummyPreprocessingStep.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|