Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 193 additions & 0 deletions notebooks/full_build_quickstart.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# BuildCompiler `full_build(...)` Quickstart\n",
"\n",
"This notebook shows how to run the high-level `BuildCompiler.full_build(...)` workflow end-to-end.\n",
"\n",
"The orchestrated stages are:\n",
"1. domestication (only when missing parts are detected)\n",
"2. assembly level 1\n",
"3. transformation\n",
"4. plating\n",
"\n",
"`assembly_lvl2` is intentionally skipped for now and recorded as skipped in the output manifest."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1) Imports and setup"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"import sbol2\n",
"\n",
"from buildcompiler.buildcompiler import BuildCompiler"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2) Load an SBOL design document\n",
"\n",
"Replace the path below with your own SBOL file containing one or more abstract designs."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"doc = sbol2.Document()\n",
"# Example: doc.read(\"path/to/your/designs.xml\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3) Construct the compiler\n",
"\n",
"Provide one or more SynBioHub collections that contain available parts/backbones/implementations."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"compiler = BuildCompiler(\n",
" collections=[\n",
" # \"https://synbiohub.org/public/example_collection\",\n",
" ],\n",
" sbh_registry=\"https://synbiohub.org\",\n",
" auth_token=\"\",\n",
" sbol_doc=doc,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4) Full build with concrete designs (list of `ComponentDefinition`)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Example lookup by displayId (adjust to your document)\n",
"# design_1 = doc.getComponentDefinition(\"design_1\")\n",
"# design_2 = doc.getComponentDefinition(\"design_2\")\n",
"# designs = [design_1, design_2]\n",
"\n",
"# result = compiler.full_build(\n",
"# designs=designs,\n",
"# results_dir=Path(\"results/full_build\"),\n",
"# chassis_name=\"E_coli_DH5alpha\",\n",
"# protocol_type=\"manual\",\n",
"# plating_params={\n",
"# \"incubation_temperature_c\": 37,\n",
"# \"incubation_time_h\": 16,\n",
"# },\n",
"# product_name_prefix=\"build\",\n",
"# overwrite=True,\n",
"# )\n",
"\n",
"# print(result[\"status\"])\n",
"# print(result[\"manifest_path\"])\n",
"# print(result[\"zip_path\"])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 5) Full build with a `CombinatorialDerivation`\n",
"\n",
"Use this when your input is combinatorial. `full_build(...)` expands the derivation into concrete variants automatically."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# derivation = doc.combinatorialderivations[0]\n",
"\n",
"# combo_result = compiler.full_build(\n",
"# designs=derivation,\n",
"# results_dir=Path(\"results/full_build_combinatorial\"),\n",
"# chassis_name=\"E_coli_DH5alpha\",\n",
"# protocol_type=\"automated\",\n",
"# plating_params={\n",
"# \"replicates\": 1,\n",
"# \"number_dilutions\": 1,\n",
"# \"volume_colony\": 6,\n",
"# \"thermocycler_starting_well\": 0,\n",
"# },\n",
"# product_name_prefix=\"combo_build\",\n",
"# overwrite=True,\n",
"# )\n",
"\n",
"# print(combo_result[\"status\"])\n",
"# print(combo_result[\"manifest_path\"])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 6) Return shape and generated files"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Top-level keys in returned result:\n",
"# stage, status, results_dir, zip_path, manifest_path, sbol_path,\n",
"# inputs, domestication, assembly_lvl1, transformation, plating, skipped, errors\n",
"\n",
"# Files written under <results_dir>:\n",
"# - full_build_manifest.json\n",
"# - full_build_results.zip\n",
"# - sbol/full_build.xml\n",
"# - domestication/* and assembly_lvl1/* plating/transformation artifacts"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading
Loading