Examples

Note: all examples here are available in the examples/ folder of the code repository. The snippets given below are only for quick reference.

Combinatorial Golden Gate Assembly

import dnacauldron as dc
import os

repository = dc.SequenceRepository()
repository.import_records(folder="parts", use_file_names_as_ids=True)
parts_list = list(repository.collections["parts"])
assembly = dc.Type2sRestrictionAssembly(
    name="combinatorial_asm",
    parts=parts_list,
    expected_constructs="any_number",
)
simulation = assembly.simulate(sequence_repository=repository)
report_writer = dc.AssemblyReportWriter(
    include_mix_graphs=True, include_part_plots=True
)
simulation.write_report(
    target=os.path.join("output", "combinatorial"),
    report_writer=report_writer,
)
print("Done! see output/combinatorial folder for the results.")

Hierarchical Golden Gate assembly

import dnacauldron as dc

repository = dc.SequenceRepository()
repository.import_records(folder="parts", use_file_names_as_ids=True)
assembly_plan = dc.AssemblyPlan.from_spreadsheet(
    assembly_class=dc.Type2sRestrictionAssembly,
    path="golden_gate_two_levels.csv",
)
plan_simulation = assembly_plan.simulate(sequence_repository=repository)
report_writer = dc.AssemblyReportWriter(
    include_mix_graphs=True, include_assembly_plots=True
)
plan_simulation.write_report("output", assembly_report_writer=report_writer)

Gibson Assembly Plan

import dnacauldron as dc

repository = dc.SequenceRepository()
repository.import_records(files=["gibson_sequences.fa"])
assembly_plan = dc.AssemblyPlan.from_spreadsheet(
    assembly_class=dc.GibsonAssembly, path="gibson_assembly.csv"
)
plan_simulation = assembly_plan.simulate(sequence_repository=repository)
print("Assembly stats:", plan_simulation.compute_stats())

report_writer = dc.AssemblyReportWriter(
    include_mix_graphs=True,
    include_assembly_plots=True,
    show_overhangs_in_graph=True,
    annotate_parts_homologies=True,
)
plan_simulation.write_report(
    target="output", assembly_report_writer=report_writer
)

Hierarchical BioBrick assembly

import dnacauldron as dc

repository = dc.SequenceRepository()
repository.import_records(folder="biobrick_parts", use_file_names_as_ids=True)
assembly_plan = dc.AssemblyPlan.from_spreadsheet(
    assembly_class=dc.BioBrickStandardAssembly,
    path="hierarchical_biobrick.csv",
)
plan_simulation = assembly_plan.simulate(sequence_repository=repository)
plan_simulation.write_report(target="output")
print("Done! See the output/ folder for the results.")

Connectors autoselection with Golden Gate assembly

import dnacauldron as dc

repository = dc.SequenceRepository()
repository.import_records(
    collection="parts",
    folder="genetic_parts",
    use_file_names_as_ids=True,
    topology="circular",
)
repository.import_records(
    collection="emma_connectors",
    folder="emma_connectors",
    use_file_names_as_ids=True,
)
all_parts = list(repository.collections["parts"])  # part names, no connectors
assembly = dc.Type2sRestrictionAssembly(
    name="assembly_with_connectors",
    parts=all_parts,
    connectors_collection="emma_connectors",
)
report_writer = dc.AssemblyReportWriter(include_mix_graphs=True)
simulation = assembly.simulate(sequence_repository=repository)

simulation.write_report("output", report_writer=report_writer)
print ("Done! see output/ folder for the results.")

BASIC assembly

import dnacauldron as dc

repo = dc.SequenceRepository()
repo.import_records(folder="parts_and_oligos")
plan = dc.AssemblyPlan.from_spreadsheet(
    path="basic_assembly.csv", assembly_class="from_spreadsheet"
)
simulation = plan.simulate(repo)
simulation.write_report("output")
print ("Done! see output/ folder for the results.")