tooluniverse.admetai_tool module

class tooluniverse.admetai_tool.BaseTool(tool_config)[source][source]

Bases: object

__init__(tool_config)[source][source]
classmethod get_default_config_file()[source][source]

Get the path to the default configuration file for this tool type.

This method uses a robust path resolution strategy that works across different installation scenarios:

  1. Installed packages: Uses importlib.resources for proper package resource access

  2. Development mode: Falls back to file-based path resolution

  3. Legacy Python: Handles importlib.resources and importlib_resources

Override this method in subclasses to specify a custom defaults file.

Returns:

Path or resource object pointing to the defaults file

classmethod load_defaults_from_file()[source][source]

Load defaults from the configuration file

run(arguments=None)[source][source]

Execute the tool.

The default BaseTool implementation accepts an optional arguments mapping to align with most concrete tool implementations which expect a dictionary of inputs.

check_function_call(function_call_json)[source][source]
get_required_parameters()[source][source]

Retrieve required parameters from the endpoint definition. Returns: list: List of required parameters for the given endpoint.

tooluniverse.admetai_tool.register_tool(tool_type_name=None, config=None)[source][source]

Decorator to automatically register tool classes and their configs.

Usage:

@register_tool(‘CustomToolName’, config={…}) class MyTool:

pass

class tooluniverse.admetai_tool.ADMETModel(models_dir: Path | str = PosixPath('/opt/hostedtoolcache/Python/3.10.18/x64/lib/python3.10/site-packages/admet_ai/resources/models'), include_physchem: bool = True, drugbank_path: Path | str | None = PosixPath('/opt/hostedtoolcache/Python/3.10.18/x64/lib/python3.10/site-packages/admet_ai/resources/data/drugbank_approved.csv'), atc_code: str | None = None, num_workers: int | None = None, cache_molecules: bool = True, fingerprint_multiprocessing_min: int = 100)[source][source]

Bases: object

ADMET-AI model class.

__init__(models_dir: Path | str = PosixPath('/opt/hostedtoolcache/Python/3.10.18/x64/lib/python3.10/site-packages/admet_ai/resources/models'), include_physchem: bool = True, drugbank_path: Path | str | None = PosixPath('/opt/hostedtoolcache/Python/3.10.18/x64/lib/python3.10/site-packages/admet_ai/resources/data/drugbank_approved.csv'), atc_code: str | None = None, num_workers: int | None = None, cache_molecules: bool = True, fingerprint_multiprocessing_min: int = 100) None[source][source]

Initialize the ADMET-AI model.

Parameters:
  • models_dir – Path to a directory containing subdirectories, each of which contains an ensemble of Chemprop-RDKit models.

  • include_physchem – Whether to include physicochemical properties in the predictions.

  • drugbank_path – Path to a CSV file containing DrugBank approved molecules with ADMET predictions and ATC codes.

  • atc_code – The ATC code to filter the DrugBank reference set by. If None, the entire DrugBank reference set will be used.

  • num_workers – Number of workers for the data loader. Zero workers (i.e., sequential data loading) may be faster if not using a GPU, while multiple workers (e.g., 8) are faster with a GPU. If None, defaults to 0 if no GPU is available and 8 if a GPU is available.

  • cache_molecules – Whether to cache molecules. Caching improves prediction speed but requires more memory.

  • fingerprint_multiprocessing_min – Minimum number of molecules for multiprocessing to be used for fingerprint computation. Otherwise, single processing is used.

property num_ensembles: int[source]

Get the number of ensembles.

property atc_code: str | None[source]

Get the ATC code.

predict(smiles: str | list[str]) dict[str, float] | DataFrame[source][source]

Make predictions on a list of SMILES strings.

Parameters:

smiles – A SMILES string or a list of SMILES strings.

Returns:

If smiles is a string, returns a dictionary mapping property name to prediction. If smiles is a list, returns a DataFrame containing the predictions with SMILES strings as the index and property names as the columns.

class tooluniverse.admetai_tool.ADMETAITool(**kwargs)[source][source]

Bases: BaseTool

Tool to predict ADMET properties for a given SMILES string using the admet-ai Python package.

__init__(**kwargs)[source][source]
run(arguments: dict) dict[source][source]

Predicts ADMET properties for a given SMILES string.

Parameters:

smiles – The SMILES string(s) of the molecule(s).

Returns:

A dictionary mapping each SMILES string to a subdictionary of selected ADMET properties and their predicted values.