amberNPS package

Module contents

class amberNPS.amberNPS(mlp: str = 'multitask_regressor.pkl', scaler: str = 'scaler.pkl', rf: str = 'random_forest_model.pkl', le: str = 'label_encoder.pkl')[source]

Bases: object

Predicts drug class and lethal blood concentration (LBC) values from SMILES strings.

The AmberNPS API provides drug classification and prediction of LBC values using pre-trained machine learning models stored as pickle files.

Parameters:
  • mlp (str or Path) – Path to the Multitask Regressor model file (.pkl).

  • scaler (str or Path) – Path to the Scaler used to normalize Mordred descriptors.

  • rf (str or Path) – Path to the Random Forest model used for drug class prediction.

  • le (str or Path) – Path to the LabelEncoder used to map numeric labels to class names.

smiles

The input SMILES string provided to predict().

Type:

str

mol

RDKit molecule object created from the SMILES.

Type:

rdkit.Chem.Mol

mw

Exact molecular weight of the molecule.

Type:

float

drug_class

Predicted drug class label.

Type:

str

LBC50

Median predicted lethal blood concentration (ng/mL or µg/mL).

Type:

float

LOLBC

Lower bound of lethal blood concentration range.

Type:

float

HOLBC

Upper bound of lethal blood concentration range.

Type:

float

structure

Rendered image of the molecule structure.

Type:

PIL.Image.Image

predict(smiles)[source]

Predicts drug class and concentration values for the given SMILES.

to_dict()[source]

Returns the results as a dictionary for easy serialization.

structure()

Property that returns an image of the molecule.

convert_pLBC_to_LBC(pLBC, mw)[source]

Converts predicted -log(LBC) values to actual concentrations.

classmethod convert_pLBC_to_LBC(pLBC: float, mw: float) float[source]

Performs antilog transformation of the predicted LBC values

predict(smiles: str) dict[source]

Predicts the drug class and lethal blood concentrations (LBC, in ng/mL) for the provided smiles and sets them as instance properties.

property structure: <module 'PIL.Image' from '/home/docs/checkouts/readthedocs.org/user_builds/ambernps-api/envs/latest/lib/python3.13/site-packages/PIL/Image.py'>

Generates image of structure in the console

to_dict() dict[str, float | str][source]

Returns a dictionary containing predicted drug class and LBC values.