Synthesis
albert.collections.synthesis.SynthesisCollection
Bases: BaseCollection
Collection for interacting with synthesis records used by notebook Ketcher blocks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The Albert session information. |
required |
Methods:
| Name | Description |
|---|---|
create |
Create a synthesis record for a notebook Ketcher block. |
get_by_id |
Retrieve a synthesis record by ID. |
update_canvas_data |
Update the Ketcher canvas data for a synthesis record. |
update |
Update a synthesis record. |
update_reactant_row_values |
Update the values for a reactant row. |
create_reactant_productant_table |
Initialize the reactant/product table for a synthesis. |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
|
Source code in src/albert/collections/synthesis.py
create
create(
*,
parent_id: NotebookId | str,
name: str,
block_id: str,
smiles: str | None = None,
) -> Synthesis
Create a synthesis record for a notebook Ketcher block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent_id
|
NotebookId | str
|
The notebook ID that owns the synthesis record. |
required |
name
|
str
|
The synthesis name. |
required |
block_id
|
str
|
The Ketcher block ID associated with the synthesis. |
required |
smiles
|
str | None
|
The initial SMILES string for the synthesis. |
None
|
Returns:
| Type | Description |
|---|---|
Synthesis
|
The created synthesis record. |
Source code in src/albert/collections/synthesis.py
get_by_id
get_by_id(
*,
id: SynthesisId,
include_recommendations: bool = False,
include_predictions: bool = False,
version: str | None = None,
) -> Synthesis
Retrieve a synthesis record by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
SynthesisId
|
The synthesis ID. |
required |
include_recommendations
|
bool
|
Whether to include recommendations in the response. |
False
|
include_predictions
|
bool
|
Whether to include predictions in the response. |
False
|
version
|
str | None
|
The specific version to retrieve. |
None
|
Returns:
| Type | Description |
|---|---|
Synthesis
|
The requested synthesis record. |
Source code in src/albert/collections/synthesis.py
update_canvas_data
update_canvas_data(
*,
synthesis_id: SynthesisId,
smiles: str,
data: str,
png: str,
) -> Synthesis
Update the Ketcher canvas data for a synthesis record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
synthesis_id
|
SynthesisId
|
The synthesis ID. |
required |
smiles
|
str
|
The updated SMILES string. |
required |
data
|
str
|
The serialized canvas data. |
required |
png
|
str
|
The base64-encoded PNG for the canvas. |
required |
Returns:
| Type | Description |
|---|---|
Synthesis
|
The updated synthesis record. |
Source code in src/albert/collections/synthesis.py
update
Update a synthesis record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
synthesis
|
Synthesis
|
The synthesis record containing updated fields. |
required |
Returns:
| Type | Description |
|---|---|
Synthesis
|
The refreshed synthesis record. |
Raises:
| Type | Description |
|---|---|
AlbertException
|
If the synthesis record is missing an ID. |
Source code in src/albert/collections/synthesis.py
update_reactant_row_values
update_reactant_row_values(
*,
synthesis_id: SynthesisId,
row_id: str,
values: ReactantValues,
) -> Synthesis
Update the values for a reactant row.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
synthesis_id
|
SynthesisId
|
The synthesis ID. |
required |
row_id
|
str
|
The reactant row ID to update. |
required |
values
|
ReactantValues
|
The values to apply to the reactant row. |
required |
Returns:
| Type | Description |
|---|---|
Synthesis
|
The updated synthesis record. |
Source code in src/albert/collections/synthesis.py
create_reactant_productant_table
create_reactant_productant_table(
*, synthesis_id: SynthesisId
) -> Synthesis
Initialize the reactant/product table for a synthesis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
synthesis_id
|
SynthesisId
|
The synthesis ID. |
required |
Returns:
| Type | Description |
|---|---|
Synthesis
|
The synthesis record. |