Base package to create NERDD modules
Project description
NERDD Module
This package provides the basis to implement molecular prediction modules in the NERDD ecosystem.
Installation
pip install -U nerdd-module
Implement your own module
A new module is created by inheriting from the AbstractModel
class. A
preprocessing pipeline can be configured via calling the constructor of the superclass.
The actual prediction procedure is implemented in _predict_mols
:
import pandas as pd
from typing import List
from rdkit.Chem import Mol
from nerdd_module import AbstractModel
class MyModel(AbstractModel):
def __init__(self):
super().__init__(
preprocessing_pipeline="chembl_structure_pipeline",
)
def _predict_mols(self, mols: List[Mol], custom_param: int = 5) -> pd.DataFrame:
# implement prediction logic and return a dataframe with new columns
# containing values per input molecule
return pd.DataFrame(dict(predictions=[custom_param]*len(mols)))
For custom preprocessing, specify preprocessing_pipeline="custom"
when calling
the constructor of the superclass and override the method _preprocess_single_mol
:
class MyModel(AbstractModel):
def __init__(self):
# important:
super().__init__(preprocessing_pipeline="custom")
def _preprocess_single_mol(self, mol: Mol) -> Tuple[Mol, List[str]]:
# implement custom preprocessing logic here
# return preprocessed molecule and a list of error messages
return preprocessed_mol, errors
# ...
Contribute
- Fork and clone the code
- Install test dependencies with
pip install -e .[test]
- Run tests via
pytest
orpytest-watch
(short:ptw
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nerdd-module-0.1.11.tar.gz
(22.1 kB
view hashes)
Built Distribution
Close
Hashes for nerdd_module-0.1.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45fd1aa1f1951e39627af2214fbfa6825bdc7a93e203e9fed8ac2deb5cac1d7f |
|
MD5 | 9b568254cfc460dcffa0f07edea34347 |
|
BLAKE2b-256 | c46959787bbffa90c3a2bf666d93635bbbd944187a33b4b565e1130837ae87f6 |