Skip to main content

Constructs

A Construct is an ordered collection of Segments representing a complete biological design. Just as a gene is assembled from regulatory and coding parts (a promoter, ribosome binding site, coding sequence, and terminator), a Construct assembles Segment objects into a coherent whole.
Construct: gene_constructPromoter100 bpSegmentRBSAGGAGGSegmentCDS900 bpSegmentTerminator50 bpSegment
Construct: gene_constructPromoter100 bpSegmentRBSAGGAGGSegmentCDS900 bpSegmentTerminator50 bpSegment
The Construct handles validation (all segments must share the same type), auto-labeling, and, crucially, joined sequence concatenation, which gives the full designed sequence after optimization.

Creating Constructs

Pass an ordered list of Segments to create a Construct:
python
Segment order matters; it defines the physical arrangement of the final biological sequence.

Validation Rules

Constructs enforce several rules at creation time to catch design errors early:
All segments must share the same sequence type. DNA and protein segments cannot be mixed in one Construct. To represent a gene and its protein product, use separate Constructs.
All segments must share the same valid character set. If one segment uses custom valid_chars, all segments in the Construct must use the same set.
Segment labels must be unique within a Construct. Duplicate labels cause a ValueError.
python

Joined Sequences

The most important property of a Construct is joined_sequences. After optimization, this gives the full concatenated sequence from all segments, with merged metadata from each segment.
Individual SegmentsATGCSeg 1 result:GGAASeg 2 result:TTCCSeg 3 result:ATGCGGAATTCCjoined_sequences:
Individual SegmentsATGCSeg 1 result:GGAASeg 2 result:TTCCSeg 3 result:ATGCGGAATTCCjoined_sequences:
python

Multiple Results (Top-K)

When the optimizer selects multiple results per segment (e.g., top-3), joined_sequences pairs them by index:
python
All segments in a Construct must have the same number of result sequences. joined_sequences raises a RuntimeError if the per-segment result pools have mismatched lengths.

Auto-Labeling

Both Constructs and Segments support automatic labeling:
python
Always provide explicit labels for clarity. They appear in constraint metadata and make optimization results easier to interpret.

Biological Design Patterns

The classic pattern for designing gene circuits: promoter, RBS, coding sequence, and terminator in series.
python
Use cross-segment constraints to evaluate predicted expression levels considering all elements together.

Working with Optimizers

Optimizers take a list of Constructs to optimize. Multiple optimizers in a Program must share the same Construct objects by identity so that results persist between stages.
python
Do not create separate Construct instances for each optimizer stage. The result sequences from stage 1 would be lost. Always reuse the same Construct object.

Properties


Serialization

Constructs serialize to dictionaries, including all their segments and both sequence pools:

Next Steps

Generators

How generators propose candidate sequences for each segment

Constraints

Scoring functions for design objectives

Programs

Chain optimizers into multi-stage pipelines

Overview

See how Constructs fit into the full architecture