deeporigin.drug_discovery.enumerator¶
Enumerator -- generate analogue libraries from a parent ligand (served, sync-only).
Backed by the served platform tool deeporigin.enumerator (a direct
execution). One :class:Enumerator is configured with a single job_type and
executed with a blocking :meth:run, which returns a :class:pandas.DataFrame.
The tool exposes four job_type values:
SCAFFOLD-- CReM matched-molecular-pair (MMP) enumeration that grows a fragment at a single attachment atom (onereplace_ixindex).ANALOGUE-- CReM MMP enumeration that swaps a connected fragment (one or morereplace_ixindices forming a connected substructure).AVAILABLE_REACTIONS-- discovers named-reaction sites on the parent and returns their atom indices. Writes no CSV; the DataFrame is built from the inline result list.REACTION-- enumerates products against the Enamine fragment library at explicitreaction_sites. Each site must match a hit returned by a priorAVAILABLE_REACTIONSrun.
SCAFFOLD and ANALOGUE are the two MMP flavors.
Usage::
from deeporigin.drug_discovery import Enumerator, Ligand
parent = Ligand.from_smiles("Brc1ccccc1")
# MMP: grow a fragment at atom 0
df = Enumerator(ligand=parent, job_type="SCAFFOLD", replace_ix=0).run()
# Discover reaction sites, then enumerate against them
sites = Enumerator(ligand=parent, job_type="AVAILABLE_REACTIONS").run()
df = Enumerator(
ligand=parent,
job_type="REACTION",
reaction_sites=[
{"reaction_id": "suzuki", "reactant_role": "core_halide", "atom_indices": [0, 1]},
],
).run()
Classes¶
Enumerator
¶
Bases: Execution, SyncExecutableMixin
Enumerate analogues of a parent ligand via the served enumerator tool.
Configure the instance with a parent :class:~deeporigin.drug_discovery.structures.ligand.Ligand,
a job_type, and its mode-specific parameters, then call :meth:run to
execute synchronously and receive a :class:pandas.DataFrame.
For SCAFFOLD / ANALOGUE / REACTION the DataFrame is parsed from
the tool's descriptor-enriched results.csv. For AVAILABLE_REACTIONS
the DataFrame is built from the inline available_reactions list (no CSV
is written).
Attributes:
| Name | Type | Description |
|---|---|---|
ligand |
Ligand
|
Parent ligand whose |
job_type |
str
|
One of |
replace_ix |
list[int] | None
|
RDKit atom indices marking the MMP enumeration site (MMP modes). |
reaction_sites |
list[dict[str, Any]] | None
|
Named-reaction sites for REACTION enumeration. |
radius |
int
|
CReM environment radius (MMP modes). |
max_fragment_size |
int
|
Maximum heavy atoms in the added/replacement fragment (MMP modes). |
cap_hit |
bool | None
|
Whether the last run hit the platform enumeration cap (MMP/REACTION),
or |
Attributes¶
cap_hit
property
¶
cap_hit: bool | None
Whether the last MMP/REACTION run hit the platform enumeration cap.
None before :meth:run, or for AVAILABLE_REACTIONS (which has no cap).
max_fragment_size
property
¶
max_fragment_size: int
Maximum heavy atoms in the added/replacement fragment (MMP modes, read-only).
reaction_sites
property
¶
reaction_sites: list[dict[str, Any]] | None
Named-reaction sites for REACTION enumeration, if any (read-only).
replace_ix
property
¶
replace_ix: list[int] | None
RDKit atom indices marking the MMP enumeration site, if any (read-only).
tool_key
class-attribute
instance-attribute
¶
tool_key: str = TOOL_KEYS_AND_VERSIONS["enumerator"][
"tool_key"
]
Methods:¶
from_dto
classmethod
¶
from_dto(
dto: dict[str, Any],
*,
client: DeepOriginClient | None = None
) -> Self
Construct an Enumerator from a tools execution DTO.
Rehydrates the parent ligand and mode-specific inputs from userInputs
(falling back to inputs for older payloads).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dto
|
dict[str, Any]
|
Execution payload (same shape as |
required |
client
|
DeepOriginClient | None
|
Optional API client. Uses the default if not provided. |
None
|
Returns:
| Type | Description |
|---|---|
Self
|
An |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the stored inputs are missing a ligand SMILES or carry
a missing/unknown |
get_results
¶
get_results(dto: dict[str, Any] | None = None) -> DataFrame
Return this execution's results as a :class:pandas.DataFrame.
Reads jobOutputs from dto (or fetches it via
client.executions.get when omitted, e.g. after
:meth:~deeporigin.drug_discovery.execution.Execution.from_id).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dto
|
dict[str, Any] | None
|
Optional execution payload from |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame of enumeration products (MMP / REACTION) or discovered |
DataFrame
|
reaction sites (AVAILABLE_REACTIONS). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If :attr: |
DeepOriginException
|
If no results could be parsed. |
run
¶
run() -> DataFrame
Execute the enumeration synchronously (blocking) and return a DataFrame.
Submits one synchronous execution (sync=True), applies the response
via :meth:~deeporigin.drug_discovery.execution.Execution.update_from_dto,
and returns results via :meth:get_results.
Returns:
| Name | Type | Description |
|---|---|---|
A |
DataFrame
|
class: |
DataFrame
|
|
|
DataFrame
|
|
|
DataFrame
|
data: |
Raises:
| Type | Description |
|---|---|
DeepOriginException
|
If the execution did not complete successfully or no results could be parsed. |