Assembly#

lcmd_db.AssemblyTemplate

Execute a PEP 723 assembly script via uv run --script.

lcmd_db.AssemblyResult

Result of a single assembly in a batch.

lcmd_db.AssemblyTemplateInfo

Metadata for an assembly template, read from metadata.json.

lcmd_db.SlotInfo

Metadata for a single assembly template slot.

Template#

class AssemblyTemplate[source]#

Bases: object

Execute a PEP 723 assembly script via uv run --script.

Wraps a self-contained Python script that combines fragment SMILES into a molecule. The script declares its own dependencies (e.g. rdkit) via PEP 723 inline metadata; uv resolves them automatically.

assemble(**fragments)[source]#

Assemble a single molecule from fragment SMILES.

Returns the resulting SMILES string. Raises AssemblyError on failure with the error message from the script.

Keyword arguments must match slot IDs defined in the template. Required slots must be provided; optional slots use their defaults.

Return type:

str

assemble_batch(fragments_list)[source]#

Assemble multiple molecules in a single subprocess call.

Returns one AssemblyResult per input. Failed assemblies have result.error set instead of raising, so one bad input doesn’t abort the whole batch.

Return type:

list[AssemblyResult]

save_script(path)[source]#

Copy the standalone assembly script to path.

The saved script can be executed directly with uv run --script on any machine (e.g. HPC clusters) without the lcmd-db client.

Return type:

Path

Result#

class AssemblyResult[source]#

Bases: object

Result of a single assembly in a batch.

For single assembly, use template.assemble() which returns the SMILES string directly and raises on failure.

Metadata#

class AssemblyTemplateInfo[source]#

Bases: BaseModel

Metadata for an assembly template, read from metadata.json.

class SlotInfo[source]#

Bases: BaseModel

Metadata for a single assembly template slot.