Assembly Templates#
Assembly templates combine fragment SMILES into full molecules using
self-contained PEP 723 scripts executed by uv.
Important
uv must be installed and on PATH. Assembly scripts are self-contained
PEP 723 scripts — uv automatically
installs their dependencies (e.g. rdkit) on first run.
from lcmd_db import load_dataset
data = load_dataset("fragflp", include=["fragments"])
template = data.assembly_templates["default"]
# Single assembly — returns SMILES, raises on failure
smiles = template.assemble(
LAr1="c1c(C)c(C)c(C)c(C)c1(C)",
LAr2="c1c(C)c(C)c(C)c(C)c1(C)",
LBr1="*cncc1",
LBr2="*cncc1",
BB="*c1c2c()cnc()c2c()",
)
# Batch — one subprocess, multiple results
results = template.assemble_batch([
{"LAr1": "c1ccccc1", "LAr2": "c1ccccc1",
"LBr1": "*cncc1", "LBr2": "*cncc1",
"BB": "*c1c2c()cnc()c2c()"},
])
for r in results:
print(r.smiles if r.success else r.error)
# Save standalone script for HPC/cluster use
template.save_script("flp_assembler.py")
See also
AssemblyTemplate — full API reference,
AssemblyResult — batch result type,
Fragments — loading fragment data,
Typed Stubs — typed kwargs for assembly functions