Model
Overview
MOSAIC uses programmable genetic circuits to generate populations with different cell fractions from a common ancestor. Three complementary models support the design, measurement, and exploration of population composition.
The Cre–Bxb1 model guides circuit design and colony-picking plans. Fluorescence unmixing estimates mixing fractions from calibrated reporter signals, while the C:R:S model explores how initial composition affects competition and transient coexistence in a theoretical three-strain community.
Cre–Bxb1 Circuit Model
Modelling Objectives
MOSAIC aims to construct a library of populations with different A/B-type cell compositions from a common ancestral population using programmable genetic circuits. As illustrated below, Cre first selects different lox71 sites for rearrangement, generating circuit architectures with different DNA arm lengths. After single-colony isolation, each architecture is introduced into a separate culture well, and Bxb1 is then induced to generate an A/B-type cell population with the corresponding composition in each well.
We therefore developed a coupled Cre–Bxb1 model to connect NS array design with the composition of the final ratio library, providing a quantitative basis for circuit construction and colony-picking plans.
The model addresses the following questions:
- Fraction prediction: What within-well A/B-type fractions and differentiated fractions does each Cre-rearranged architecture produce at a specified induction time?
- Colony-picking budget: After picking N single colonies, how many wells of each composition are expected? How many colonies must be picked to cover all usable ratio types or obtain wells close to a target fraction?
- Circuit design: How should the NS spacer length and number of candidate sites be selected so that the resulting ratio library meets experimental needs such as broad exploration, coverage of multiple specified fractions, or identification of a single target fraction?
Through these predictions, we aim to help users compare candidate circuits and estimate ratio coverage and colony-picking requirements before experiments, then use the actual composition and application performance of each well to guide subsequent screening and iterative design.
Model Development
Stage One: Cre Site Selection
Mathematical Assumptions
The circuit contains one fixed lox66 site and n lox71 sites separated by nonsense (NS) spacer sequences. Candidate sites are indexed by i from nearest to farthest. Intramolecular Cre recombination involves DNA looping and synaptic complex formation[1]. Following previous distance-dependent modelling of the Cre–Lox system[2], we approximate site-contact weights using sequence separation:
Here, L_{\mathrm{base,Cre}} is the length of the base segment from the fixed lox66 site to the beginning of the first NS spacer, and L_{\mathrm{NS}} and L_{\mathrm{lox71}} are the lengths of a single NS spacer and a lox71 site, respectively. We assume that all candidate sites have identical effective reaction conditions apart from sequence separation, and define p_i as the conditional probability of selecting site i when one effective Cre rearrangement occurs. The parameter \gamma is an effective distance-decay exponent, with a baseline value of \gamma=1, assigning higher selection weights to proximal sites. This weighting is a model assumption that requires experimental calibration.
Simulation Results
To estimate the relative frequencies of different Cre-rearranged architectures, we set n=5, L_{\mathrm{NS}}=773\ \mathrm{bp}, L_{\mathrm{base,Cre}}=773\ \mathrm{bp}, and L_{\mathrm{lox71}}=34\ \mathrm{bp}, with \gamma=1, and calculated the sequence separation and selection probability for each candidate site. The results below assign higher weights to proximal sites, with predicted selection probabilities decreasing as site distance increases.
| Architecture ID | Cre distance d_i (bp) | Bxb1 right arm h_B(i) (bp) | Selection probability |
|---|---|---|---|
| 1 | 1,546 | 1,580 | 34.97% |
| 2 | 2,353 | 2,387 | 22.97% |
| 3 | 3,160 | 3,194 | 17.11% |
| 4 | 3,967 | 4,001 | 13.63% |
| 5 | 4,774 | 4,808 | 11.32% |
Under the assumption of random colony picking without growth bias, p_i also represents the probability of randomly selecting a clone of type i.
Stage Two: Bxb1 Differentiation
Mathematical Assumptions
When Cre recombination occurs between the oppositely oriented lox66 site and lox71 site i, the segment between the two sites is inverted[3]. The NS sequences, right-hand attB site, and reporter gene B within this segment consequently change position or orientation. The central attP and left-hand attB sites lie outside the inverted segment, so the left-arm length remains unchanged. Selection of different sites places different numbers of NS–lox units between the central attP and right-hand attB sites, generating different right-arm lengths.
We denote the sequence distance from the central attP site to the left-hand attB site by h_A, and the distance to the rearranged right-hand attB site by h_B(i). Under the current geometric assumptions:
Here, L_{\mathrm{B,0}} is the invariant segment between the central attP site and the fixed left-hand lox66 site before inversion.
We assume that the Cre architecture of each picked colony has been fixed and that the starting cells within each well carry the same architecture. At Bxb1 induction, all wells are normalised to the same initial state, and time t is measured from this point.
Following the Bxb1 differentiation model proposed by An et al., we describe the two branches using arm-length-dependent effective recombination rates and account for steric occlusion caused by binding of the transcriptional machinery[4]. The unoccluded rates on the two sides are:
Here, k_{A0} and k_{B0} are rate prefactors, and \beta>0 indicates that the effective rate decreases with increasing arm length. For architecture i, the corresponding h_B(i) is substituted into the right-side rate equation.
The model contains five states: D is the initial state, in which Bxb1 rearrangement has not yet occurred and neither side is occluded by the transcriptional machinery; M_A and M_B are intermediate states with occlusion on the A and B sides, respectively; and L_A and L_B are terminal states corresponding to A-type and B-type cells. All variables represent normalised state fractions.
The transcriptional machinery binds at rate r_A or r_B, moving D into the corresponding occluded state. We assume that occlusion reduces only the effective recombination rate on the same side, leaving the opposite side unchanged:
Thus, M_A transitions to L_A at rate v_A and to L_B at rate k_B; M_B transitions to L_B at rate v_B and to L_A at rate k_A. According to the state transitions in the diagram, the kinetic equations are[4]:
The initial conditions are:
The model satisfies D+L_A+L_B+M_A+M_B=1. The program uses the analytical solution of this linear system to calculate the time evolution of each state.
The table below uses the fitted parameters reported in the Methods section of the original paper as reference settings[4].
| Kinetic parameter | Symbol | Reference setting |
|---|---|---|
| A-side rate prefactor | k_A0 | 0.38 h⁻¹ |
| B-side rate prefactor | k_B0 | 0.14 h⁻¹ |
| Arm-length exponent | beta | 1.3 |
| A-side transcriptional machinery binding rate | r_A | 0.56 h⁻¹ |
| B-side transcriptional machinery binding rate | r_B | 0.01 h⁻¹ |
| Relative rate after occlusion | alpha | 0.01 |
This implementation substitutes arm lengths as numerical values in bp into the rate equations above and uses the fitted parameters reported in the literature as reference values. All absolute cell fractions, differentiated fractions, and colony-picking requirements below are conditional predictions under the stated assumptions.
For architecture i, we define the within-well composition and differentiated fraction as:
F_i(t) is the fraction of A-type cells among differentiated A/B-type cells at time t after Bxb1 induction, with the B-type fraction given by 1-F_i(t); Y_i(t) is the fraction of the model's normalised total population that has entered the A/B-type terminal states. The former is used to compare A/B compositions across wells, whereas the latter indicates how many cells have differentiated.
Simulation Results
In Figure 1-6(A), the A-type fraction decreases over the first 24 h after induction for all three left-arm lengths. At the same time point, a longer left arm produces a lower A-type fraction. Representative results are shown below:
| Left-arm length | A-type fraction at 2 h | A-type fraction at 24 h | Limiting A-type fraction |
|---|---|---|---|
| 1,000 bp | 54.31% | 16.28% | 3.63% |
| 2,000 bp | 32.56% | 7.32% | 2.50% |
| 4,000 bp | 16.39% | 3.11% | 2.02% |
Figure 1-6(B) shows that the 24 h results still differ from the limiting results. Based on communication with the authors of the original paper, we selected 24 h after induction as the main time point for predictions and experimental comparison. The 24 h results of the currently parameterized model still differ from the mathematical limit, so we refer to them as the “predicted fractions at 24 h.” In future work, we will check the parameters and units against the actual constructs and use time-series measurements to determine when the fractions stabilize.
In Figure 1-7, as the left:right arm-length ratio changes from 1:1 to 1:10, the A-type fraction at 24 h increases from 21.36% to 84.39%, while the corresponding limiting fraction increases from 4.36% to 36.42%. Shortening the left arm increases the effective rate of the A branch, raising the A-type fraction at the same observation time.
Figure 1-8 shows the opposite direction of regulation: as the left:right arm-length ratio increases from 1:1 to 10:1, the A-type fraction at 24 h decreases from 21.36% to 1.34%, and the limiting fraction decreases from 4.36% to 1.77%. Together, the two scans show that arm length can alter branch competition, but the output is not determined solely by the geometric ratio. Even when both arms are 773 bp, the A-type fraction is not 50%, because the rate prefactors and transcriptional machinery binding parameters differ between the two sides.
Stage Three: The Cre–Bxb1 Circuit
Mathematical Assumptions
Stage one predicts the probability that Cre selects each candidate site, and stage two predicts differentiation after Bxb1 induction for a fixed architecture. This stage links the two to analyse which within-well fractions a circuit design can produce and how frequently these fractions are expected to occur during random colony picking.
The experimental sequence represented by the model is: Cre rearrangement → single-colony isolation on solid medium → one colony picked into each well → separate Bxb1 induction in each well. We assume that each single colony carries one stable Cre-rearranged architecture, colony picks are independent and unbiased with respect to architecture, and differentiation in all wells starts from the same normalised initial state.
If Cre selects lox71 site i, the resulting architecture is obtained with probability p_i and has the corresponding right-arm length h_B(i). Substituting this arm length into the stage-two kinetic model gives the A-type fraction F_i(t) and differentiated fraction Y_i(t) for this well type at time t. Thus, p_i determines the chance of obtaining a well type, whereas F_i(t) and Y_i(t) describe its within-well differentiation outcome.
Under these assumptions, the expected A-type fraction in a randomly selected well is:
This mean summarizes the average composition of the ratio library. Individual wells retain their respective Cre architectures and within-well fractions. For N independently picked colonies, the expected number of wells of type i is Np_i. Here, n is the number of candidate sites and N is the number of colony picks; these are distinct quantities.
Simulation Results
In the default design, the number of candidate sites is n=5, the NS length is 773 bp, and the lox71 length is 34 bp. The Cre base segment L_{\mathrm{base,Cre}} and the Bxb1 invariant segment L_{\mathrm{B,0}} are each assigned the reference value of 773 bp. The left arm is fixed at 773 bp, and the kinetic parameters follow the reference settings in stage two. Following the comparison scheme above, 24 h after Bxb1 induction is used as the main prediction time point.
The predicted results for the five default architectures are:
| Cre architecture | Selection probability | Bxb1 right-arm length | A-type fraction at 24 h |
|---|---|---|---|
| 1 | 34.97% | 1,580 bp | 40.76% |
| 2 | 22.97% | 2,387 bp | 54.05% |
| 3 | 17.11% | 3,194 bp | 63.20% |
| 4 | 13.63% | 4,001 bp | 69.72% |
| 5 | 11.32% | 4,808 bp | 74.51% |
As the selected lox71 site moves farther away, more NS–lox units enter the right arm after inversion, increasing h_B(i) and reducing the effective rate k_B of the B branch. Consequently, at the same observation time, the A-type fraction among differentiated cells increases. The default design maps the five rearranged architectures to A-type fractions of approximately 40.76%–74.51%, providing a candidate range for constructing independent culture wells with different compositions.
The site-selection probabilities also show that different fractions do not occur with equal probability. Under the default conditions, the proximal type-1 architecture has a selection probability of 34.97%, compared with 11.32% for the distal type-5 architecture. Lower-index architectures are therefore expected to be more common during random colony picking. Obtaining the fractions associated with higher-index architectures requires consideration of their lower occurrence probabilities. Both the fraction range and site-selection probabilities should therefore inform colony-picking plans.
The time courses show that fraction predictions must specify the observation time. For example, the A-type fraction in type-2 wells is 66.90% at 12 h and 54.05% at 24 h. Thus, when using the 24 h comparison scheme established in stage two, induction and sampling schedules should be consistent across wells.
The default expected A-type fraction at 24 h is 55.42%. This value is the average across the five well types weighted by their occurrence probabilities and does not describe every individual well.
Beyond the single design, we scanned candidate site numbers of n=1–10 and NS lengths of 200–2,000 bp in 200 bp increments, holding other parameters fixed to compare the expected A-type fractions of different circuits.
At fixed n=5, increasing the NS length from 200 bp to 2,000 bp raises the expected A-type fraction at 24 h from 36.40% to 72.78%. Longer NS spacers increase the right-arm length of each architecture, reducing the B-branch rate and shifting the average composition toward A-type cells.
At a fixed NS length of 800 bp, increasing the site number from 1 to 5 and then to 10 gives mean fractions at 24 h of 41.29%, 56.03%, and 63.46%, respectively. Additional distal sites provide candidate architectures with longer right arms, but their lower selection weights mean that further increases in site number produce progressively smaller changes in the mean.
This heatmap describes average trends in the ratio library. Designs with similar means may still encode different fraction ranges, numbers of types, and occurrence frequencies. The heatmap can therefore support initial screening of circuit parameters, but the number of usable ratio types, target coverage probabilities, and colony-picking budget must also be compared to determine which design better meets experimental needs.
Modelling Experimental Design
Question One: After Picking N Single Colonies, How Many Wells of Each Ratio Type Are Expected?
Mathematical Assumptions
We assume a sufficiently large source population of colonies, independent picking without architecture-selection bias, and one colony per well. The well counts for the different architectures follow a multinomial distribution:
Thus, the expected number and standard deviation of type-i wells are:
Simulation Results
| Architecture ID | Within-well A-type fraction | Expected count in 96 wells | 95% marginal prediction interval |
|---|---|---|---|
| 1 | 40.76% | 33.57 | 25–43 |
| 2 | 54.05% | 22.06 | 14–30 |
| 3 | 63.20% | 16.42 | 10–24 |
| 4 | 69.72% | 13.08 | 7–20 |
| 5 | 74.51% | 10.87 | 5–17 |
Expected well counts are averages over repeated identical colony-picking experiments; actual counts are integers and fluctuate randomly. The 95% prediction intervals in the table describe the count range for each well type separately and account only for random colony-picking variation. They do not give the probability that all categories simultaneously fall within their respective intervals.
These results help estimate how many wells of each composition may be obtained in a colony-picking experiment, particularly the chance of obtaining less common ratio types.
Question Two: How Many Colonies Must Be Picked to Cover All Types or Find a Target Fraction?
Mathematical Assumptions
Different architectures do not necessarily need to be treated as distinct types in terms of their differentiation fractions. We therefore report architecture coverage and ratio-type coverage separately:
- Architecture types: Distinguished by the indexed Cre rearrangement outcomes.
- Usable ratio types: At a specified observation time t, retain architectures with a differentiated fraction Y_i(t)\ge Y_{\min}, then assign them to predefined fraction bins according to their within-well A-type fraction F_i(t).
The default bin width is 0.05, giving [0,5\%), [5\%,10\%), and so on, with the final bin including 100%. Multiple architectures within the same bin are combined into one ratio type.
Bin width is a user-defined classification scale and should be chosen according to experimental needs. Two similar fractions on opposite sides of a bin boundary may be classified as different types. Architectures that do not meet the minimum differentiated fraction are excluded from usable types but still consume colony picks.
Assuming independent colony picks without architecture-selection bias, the probability of selecting architecture i is p_i. Let I_b denote usable fraction bin b. The probability of obtaining this ratio type from one randomly picked colony is:
After picking N colonies, the probability that this type appears at least once is:
Here, C_b is the number of wells belonging to this ratio type.
If there are r usable ratio types, the expected number of observed types is:
This metric answers “How many different ratios can be obtained on average?” Covering all types requires an additional calculation of the joint probability.
“Full coverage” means obtaining at least one well of every usable ratio type. The occurrence events of different types are dependent, so their occurrence probabilities cannot simply be multiplied. For nonoverlapping fraction bins, we use the inclusion–exclusion principle:
Here, S denotes any subset of the set of ratio types. Given a desired coverage probability c, the minimum number of colony picks is defined as:
This coverage requirement is at least one well per type. If multiple independent replicates per type are needed, the colony-picking requirement must be calculated separately.
When the experiment only requires wells close to a target fraction, a target A-type fraction f_\star and an absolute tolerance \varepsilon can be specified. The set of architectures that match the target and meet the minimum differentiated-fraction requirement is:
The probability of a target hit from one randomly picked colony is:
Thus, the probability of obtaining at least one matching well after picking N colonies is:
When 0<q_\star<1, the minimum number of colony picks required to achieve a specified success probability c is:
When q_\star=1, one colony pick guarantees a hit. When q_\star=0, no architecture in the current design meets the requirements, and increasing the number of picks cannot yield the target fraction. The program verifies the minimum count through an integer search to avoid boundary errors caused by rounding.
To obtain multiple target fractions simultaneously, a matching set of architectures is constructed for each target, and the joint probability of covering all targets is then calculated.
Simulation Results
Under the default parameters, classification based on predictions at 24 h after Bxb1 induction gives 5 usable ratio types. Achieving a probability of at least 95% of covering all types requires a minimum of 29 colony picks. Picking 96 colonies gives a probability of approximately 99.9989% of covering all types.
As the number of colony picks increases, the expected number of observed ratio types approaches the total number available from the current design, and the probability of covering all types increases. Increasing the number of picks mainly reduces the risk of missing existing types; it does not generate new fractions that the circuit does not encode.
For the default circuit, an observation time of 24 h, a tolerance of 5 percentage points, and a success probability of 95%, the predictions for each target are:
| Target A-type fraction | Acceptable range | Matching architectures | Single-pick hit probability | Minimum picks (95%) |
|---|---|---|---|---|
| 40% | 35%–45% | 1 | 34.97% | 7 |
| 50% | 45%–55% | 2 | 22.97% | 12 |
| 60% | 55%–65% | 3 | 17.11% | 16 |
| 70% | 65%–75% | 4, 5 | 24.95% | 11 |
These results show that colony-picking requirements depend on the total probability of the architectures matching the target. For example, a target of 50% has an acceptable range of 45%–55%, and architecture 2 meets this requirement with a predicted fraction of 54.05%. Its single-pick hit probability is 22.97%, so at least 12 colonies must be picked to achieve a 95% probability of obtaining at least one matching well.
The 70% target can be met by architecture 4 or 5. Summing their probabilities gives a single-pick hit probability of 24.95%, requiring 11 colony picks. A higher target fraction does not necessarily require more picks; the key factors are how many architectures match the target and how likely they are to occur.
Hit probabilities increase with the number of picks, but increasing the budget is useful only if the current design can produce a matching architecture. For example, for a target of 20% ±5 percentage points, none of the five default architectures matches, so the circuit design should be adjusted rather than further increasing the number of picks.
For MOSAIC, these calculations translate ratio-library requirements into concrete colony-picking budgets: full ratio-type coverage for broad exploration, target hits when candidate fractions are already available, and joint coverage when comparing multiple specified fractions.
Question Three: How Should NS Length and Site Number Be Selected for Experimental Needs?
Design Method
Experiments have different requirements for ratio libraries: some aim to explore as many different fractions as possible, some require several specified fractions simultaneously, and others need only wells close to one target fraction. We therefore define three design objectives to compare candidate circuits under the same experimental budget.
We scan candidate lox71 site numbers of n=1–10 and NS spacer lengths of 200–2,000 bp in 200 bp increments, keeping other model parameters fixed. The default comparison assumes 96 colony picks, observation at 24 h after Bxb1 induction, and usable ratio types defined by fixed bins of 5 percentage points.
| Design objective | Primary comparison metrics | Applicable needs |
|---|---|---|
Multiple-target ratio library library | Probability of simultaneously covering all specified target intervals; ties are compared by the expected number of usable types and total NS length | Obtaining several specified fractions in one colony-picking experiment |
Diversity diversity | Expected number of observed usable ratio types; ties are compared by the fraction span and total NS length | Broad initial exploration when the optimal fraction is unknown |
Single target target | Probability of obtaining at least one target well; ties are compared by single-pick hit probability, distance of the nearest fraction from the target, and total NS length | Obtaining wells close to an existing candidate fraction |
Here, total NS length is nL_{\mathrm{NS}}, used as a simplified indicator of construction burden. It excludes lox sites and other circuit components and cannot be treated as the full plasmid length.
Simulation Results
The default multiple targets are A-type fractions of 40%, 50%, 60%, and 70%, each with a tolerance of ±5 percentage points. With 96 picks and observation at 24 h, the design with 6 candidate sites and 600 bp NS spacers ranks first.
This design produces 6 usable ratio types, with predicted A-type fractions spanning 37.18%–73.28%. Achieving a 95% joint probability of covering all four target intervals requires at least 17 colony picks. Here, “17 colony picks” refers to obtaining at least one matching well for each of the four specified targets; it does not require all six architectures to appear.
If the optimal fraction is unknown in the first round of experiments, the diversity objective prioritizes the expected number of ratio types observed under the given colony-picking budget.
Within the current scan range, the design with 10 candidate sites and 600 bp NS spacers ranks highly. Its 10 rearranged architectures occupy 8 usable fraction bins, with predicted A-type fractions spanning 37.18%–82.95%. With 96 colony picks, the expected number of observed ratio types is 7.9989. A probability of at least 95% of covering all 8 types requires a minimum of 50 colony picks.
This result is suitable for an initial exploration of the relationship between population composition and application performance.
When application analysis has already identified a candidate fraction, the target objective can be used to select matching architectures based on the target value and tolerance, then compare the probability of obtaining at least one matching well with 96 colony picks.
The single-pick hit probability q_\star and the probability of at least one hit after N colony picks satisfy:
Thus, a circuit with fewer architecture types may still be suitable for obtaining a specified fraction. Single-target design selection should focus on target hit probability. If several fractions on either side of the target are also to be explored, a multiple-target ratio-library design should be used instead.
library objective; crosses indicate unreachable targets or colony-picking requirements above the search limit.The three metrics reflect different experimental needs. A compares how many ratio types an experiment is expected to yield; B supports budgeting colony picks to cover a specified set of fractions; C indicates how readily a particular target fraction can be obtained. The three objectives may therefore recommend different circuits, and no single heatmap determines the best design for all experiments.
Guidance for Experimental Design
The objective can be selected according to the research stage:
- When first exploring an application: Use
diversityto prioritize obtaining more ratio types, then measure the actual composition and application performance of each well. - When comparing a specified set of fractions: Use
libraryto select circuits more likely to cover these fractions simultaneously and estimate the colony-picking budget. - When seeking wells close to a candidate fraction: Use
targetto prioritize target hit probability; if the current design has no matching architecture, adjust the circuit parameters.
These rankings compare designs under the given model parameters, candidate range, and experimental budget. When coverage probabilities for multiple designs are already close to 100%, extremely small probability differences are insufficient to establish a reliable experimental advantage. Candidate circuits should be selected with consideration of construction difficulty, architecture verification, and experimental measurements.
Running the Code
Usage Examples
Open a terminal in the directory containing design_model.py and simulation.py. Prediction calculations require Python 3.10 or later and use only the standard library.
Run the default design:
python design_model.py --out example_default
Change the number of picks and the target fraction:
python design_model.py --colonies 48 --target 0.60 --target-tolerance 0.03 --objective target --out example_target
Specify a multiple-target ratio library:
python design_model.py --colonies 96 --library-targets 0.40 0.50 0.60 0.70 --objective library --out example_library
Use the diversity objective to predict a specified circuit and scan candidate designs:
python design_model.py --n-sites 10 --spacer-bp 600 --colonies 96 --time 24 --objective diversity --out example_diversity
Generating Plots
Generate plots from existing outputs:
python -m pip install matplotlib==3.10.9
python simulation.py --input example_default --out example_default/figures
This command generates 11 numerical analysis figures, each saved in both PNG and SVG formats. The six basic figures use fixed reference parameters, whereas Figures 1-11 to 1-15 read the analysis results from the specified directory.
If only the five independent-well analysis figures for the current prediction are needed, add --plots to the prediction command:
python design_model.py --out example_default --plots
Figures are saved in the figures/ folder within the output directory.
Input Parameters
Parameter list
| Option | Meaning | Default |
|---|---|---|
--n-sites | Number of candidate lox71 sites n, distinct from the number of colonies picked | 5 |
--spacer-bp | Length of a single NS sequence, excluding lox sites | 773 bp |
--left-arm-bp | Fixed Bxb1 left-arm length | 773 bp |
--cre-base-bp / --base-right-bp | Base term L_base,Cre in the Cre distance; these are aliases for the same parameter, independent of the Bxb1 base length | 773 bp |
--bxb1-base-bp | Invariant segment L_B,0 from attP to the fixed lox66 site | 773 bp |
--lox-site-bp | Length contribution of one lox71 site or retained recombination site | 34 bp |
--gamma | Exponent for the inverse-power weighting of Cre distance; 0 gives equal weights | 1.0 |
--k-a0, --k-b0 | A/B-branch rate prefactors; actual rates also include the arm-length power-law term | 0.38, 0.14 h⁻¹ |
--beta | Power-law exponent relating arm length to effective recombination rate | 1.3 |
--r-a, --r-b | Transcriptional machinery binding rates on the A/B sides | 0.56, 0.01 h⁻¹ |
--alpha | Ratio of the occluded rate to the unoccluded rate | 0.01 |
| Option | Meaning | Default |
|---|---|---|
--colonies / --wells | Number of colonies picked N, with one colony establishing one well | 96 |
--time | Comparison time after Bxb1 induction in each well | 24 h |
--horizon | End time of exported time courses, no earlier than --time | 72 h |
--target | Single target within-well A-type fraction to query | 0.50 |
--target-tolerance | Absolute tolerance shared by the single target and all multiple-target intervals | 0.05, i.e., ±5 percentage points |
--library-targets | Target fractions to cover simultaneously, separated by spaces | 0.40 0.50 0.60 0.70 |
--confidence | Success probability required for the minimum number of picks; also used for marginal prediction intervals of well counts | 0.95 |
--bin-width | Width of fixed fraction bins starting from zero | 0.05 |
--min-yield | Minimum differentiated fraction required for an architecture to be considered usable | 0.0001, i.e., 0.01% |
--objective | Objective for design ranking: library, diversity, or target | library |
--scan-sites | List of site numbers for candidate design scanning, separated by spaces | 1–10 |
--scan-spacers | List of NS lengths for candidate design scanning, separated by spaces | 200–2,000 bp, in 200 bp increments |
--max-picks | Upper search limit for the minimum number of colony picks | 10,000 |
--seed | Random seed controlling only the example plate | 2026 |
--out | Output directory for results | output |
--plots | Also generate the five independent-well analysis figures; requires plotting dependencies | Off by default |
All fraction inputs use the range 0–1. For example, a target of 0.50 means 50%, and a tolerance of 0.05 means ±5 percentage points.
Use the following command to view the full help:
python design_model.py --help
Output Files
The program generates seven CSV files and one JSON file.
| File | What each row or object represents | Main contents and uses |
|---|---|---|
site_outcomes.csv | One Cre-rearranged architecture | Selection probability, Cre distance, repeat-unit length, Bxb1 left- and right-arm lengths, five-state fractions, within-well A/B fractions, differentiated fraction, expected well count, well-count standard deviation and marginal prediction interval, usability, target matching, and example well count; used to inspect which wells the current circuit can produce |
ratio_types.csv | One fraction bin containing usable architectures | Lower and upper bin bounds, included architectures, total probability, expected well count, probability of appearing at least once, marginal prediction interval of well count, and example well count; used to inspect the classified usable ratio types |
example_wells.csv | One well in the random example | Colony index, plate number, well position, architecture ID, right-arm length, expected A/B fractions, differentiated fraction, usability, fraction bin, and target matching; used to illustrate one possible sampling outcome |
coverage_by_picks.csv | One colony-picking count | Coverage probabilities for all architectures, all usable ratio types, and all specified targets, single-target hit probability, and expected number of types; used to compare colony-picking budgets |
target_picking.csv | One queried target | Tolerance, matching architectures, single-pick hit probability, expected number of matching wells, probability of at least one hit, minimum number of picks, and status; used to plan colony picking for a target fraction |
design_scan.csv | One candidate circuit | Site number, NS length, total NS length, number of usable architectures, fraction range, number of usable types, expected diversity, coverage and hit probabilities, colony-picking requirements, and ranking; used to compare candidate designs |
per_site_timecourse.csv | Results for one architecture at one time point | Five-state fractions, effective rates, within-well A-type fraction, differentiated fraction, and limiting fraction; used to compare the effects of observation time on predictions |
summary.json | Complete summary of the current run | Circuit parameters, analysis conditions, key results, results for each target, scan range, recommended designs, and model assumptions; pooled-sample metrics are saved as supplementary results |
Expected well counts are long-run averages over repeated identical sampling experiments and may be fractional; actual well counts are integers. Marginal prediction intervals for well counts apply to individual categories. They do not jointly guarantee that all categories fall within their intervals and do not include model-parameter uncertainty.
Architecture types and ratio types are different: multiple architectures may fall into the same fraction bin. Fraction bins are a user-defined classification scale, not confidence intervals for predicted fractions.
For more than 96 colonies, example well positions continue onto the next 96-well plate. Figure 1-12A shows only the first plate, whereas the count plot summarizes all picks.
The status fields mean:
reached: The minimum number of picks meeting the required success probability was found within the search range.unreachable: The currently usable architectures cannot meet the coverage or target requirement.above_max_picks: The requirement may be achievable, but the specified success probability was not reached within the search limit.
All coverage requirements mean obtaining at least one matching well per type or target; they do not require multiple replicate wells per type. When no usable ratio types exist, the type table retains its column headers and the recommendation results are empty.
The rankings in design_scan.csv and recommended designs in summary.json depend on the current --objective. Unreachable candidates may still appear in the scan table and should be interpreted together with their status fields. “Top-ranked” does not mean optimal for every experimental need.
PALETTE
To help users apply the model to circuit design, we developed PALETTE, which integrates parameter input, candidate design comparison, within-well fraction prediction, and sequence file generation into a single interface.
Users can specify the desired range of type A cell fractions, the number of colony picks, the observation time after Bxb1 induction, and the left-arm length. The tool scans different numbers of candidate lox71 sites and NS spacer lengths. Designs are ranked primarily by the number of usable fraction types within the target range, followed by the overlap of their predicted fraction span with the target range and the array length. Users can also enter a DNA payload sequence and select the insertion arm.
After selecting a candidate design, users can view a simulated plate layout, the expected well count for each fraction type, and its probability of appearing at least once. They can also inspect the generated plasmid map and download GenBank files for the plasmid and synthesis fragment.
PALETTE translates model predictions into comparable candidate designs and draft sequences, helping users plan subsequent construction and screening.
Plate-Reader Signal Unmixing
Modelling Objectives
In mixtures of bacteria carrying different fluorescent labels, determining the fraction of each component is an important step in connecting experimental measurements with population models. Available approaches include fluorescent colony counting, fluorescence microscopy, and plate-reader measurements of bulk fluorescence. These provide different levels of information and should be selected according to the experimental objectives.
We selected a plate reader as the platform for estimating cell fractions, primarily because it is compatible with multiwell experiments and facilitates relatively high-throughput testing. This measurement approach is also supported by previous research. Hallinen et al. used microplate fluorescence measurements and spectral unmixing to estimate the composition of two-component mixtures of fluorescently labelled Enterococcus faecalis, demonstrating that appropriately calibrated bulk fluorescence can support composition analysis under specific conditions[5]. This study provides a methodological reference, but its calibration relationship cannot be directly applied to our strains and measurement conditions.
A plate reader measures the total fluorescence in each well rather than directly counting different cells. In addition to component fractions, readings may be affected by total cell abundance, reporter expression and brightness, background signals, and cross-channel responses[5]. We therefore cannot directly equate GFP-channel intensity or GFP/(GFP+mCherry) with the fraction of GFP-labelled bacteria.
Accordingly, our modelling objective is to establish an empirical calibration relationship between dual-channel fluorescence and cell fraction using samples with known mixing fractions under similar cell concentrations and measurement conditions, then use this relationship to estimate the fraction of GFP-labelled bacteria in test samples.
Modelling Approach
Preliminary Experiments
To establish measurement conditions for the fraction-calibration experiment, we first conducted concentration-series experiments using GFP-positive and mCherry-positive bacteria separately, examining the detection response of both channels, the effects of cell density, and cross-channel signals.
For each strain, four nominal OD600 levels of 0.5, 1, 5, and 10 were set using a NanoDrop, with 3 parallel replicates per condition. A SpectraMax i3 plate reader was used to measure the GFP channel (Ex460/Em512), mCherry channel (Ex560/Em620), and OD600, with medium blanks and PBS controls. Cell density in the following analysis is represented by plate-reader-measured OD600; nominal values serve only to distinguish sample preparation conditions.
Both channels detected their corresponding positive signals, but their response strengths differed. Readings from GFP-positive bacteria in the GFP channel were approximately 190–466 times the pooled control mean, whereas readings from mCherry-positive bacteria in the mCherry channel were approximately 2.8–6.7 times the pooled control mean. The raw values from the two channels therefore cannot be directly treated as cell-count indicators on the same scale.
The GFP-channel signal generally increased with measured OD600, but the signal/OD600 ratio decreased at high density. The mCherry-channel signal peaked at the nominal OD1 condition and then decreased at nominal OD5 and OD10. These results show that the assumption that fluorescence intensity is proportional to cell number cannot be applied uniformly across the tested density range. The available data are insufficient to determine the specific mechanisms underlying these changes, so subsequent calibration requires control of measurement conditions and examination of potential cell-density effects.
In addition, the GFP-channel readings of mCherry-positive bacteria were significantly positively correlated with measured OD600 (Pearson r=0.974, p=9.6×10⁻⁸), suggesting that bacterial samples lacking GFP still contribute density-dependent signals to the GFP channel. This result alone cannot distinguish spectral crosstalk from cell-associated background, but it shows that GFP-channel readings cannot be attributed entirely to GFP-labelled bacteria. No significant linear correlation was observed in the reverse direction (GFP-positive bacteria in the mCherry channel, r=0.171, p=0.594), but this does not establish a complete absence of interference in that direction.
Based on these findings, we designed the subsequent calibration experiment as follows:
- Control bacterial suspension concentration: Adjust both strains to similar OD600 values before mixing them at known volume fractions, and record the measured OD600 of each well.
- Retain dual-channel and control measurements: Acquire both GFP and mCherry signals, with same-batch blanks and singly labelled controls to examine background and cross-channel responses.
- Establish the fraction relationship from data: Rather than directly treating single-channel intensity or GFP/(GFP+mCherry) as a cell fraction, compare calibration models and evaluate predictions at fraction levels excluded from fitting.
Calibration Experiment and Data Splitting
Based on the preliminary results, we adjusted the two strains to similar OD600 values before preparing samples with known mixing fractions, reducing the effect of differences in total cell abundance on fluorescence readings.
First, the OD600 of GFP-positive and mCherry-positive bacteria was individually adjusted to approximately 1 using a NanoDrop. The suspensions were then mixed by volume to give GFP-positive bacterial fractions decreasing from 1.00 to 0 in increments of 0.05, yielding 21 fraction levels with 3 replicate wells each, for a total of 63 measurements.
Three additional fraction levels outside the main grid, 0.075, 0.275, and 0.575, were measured in 3, 3, and 2 replicate wells, respectively, giving 8 additional points. These were excluded from model fitting and used to evaluate predictions for unseen fraction levels within the same batch.
The GFP-channel signal increased approximately linearly with the specified GFP fraction, while the mCherry-channel signal generally decreased, supporting further calibration of fluorescence signals against mixing fractions. The measured OD600 values of the 71 mixture samples ranged from 0.4155 to 0.6746 and showed no significant linear correlation with the specified GFP fraction (Pearson r=−0.112, p=0.355). No density trend systematically varying with the mixing fraction was observed.
Before modelling, we corrected each fluorescence channel using the mean reading of the medium blank wells from the same batch:
Here, G and M denote the background-corrected GFP- and mCherry-channel signals, respectively. Blank subtraction corrects for medium background but does not automatically remove cell-associated background or cross-channel interference; calibration using known mixing fractions is therefore still required.
The 63 measurements from the main fraction series were used for model fitting and leave-one-fraction-level-out cross-validation (LOGO-CV), with all replicate wells at the same fraction held out together in each fold[11]. The 8 additional measurements were used for held-out testing. All candidate models used the same data split to compare predictive performance across input representations and model complexities.
Candidate Models
The following models share the corrected GFP and mCherry signals. Let f denote the fraction of GFP-labelled cells, G the corrected GFP signal, and M the corrected mCherry signal. All models use the same data split and evaluation procedure.
M1: GFP Single-Channel Linear Model
M1 uses only the GFP channel and fits a linear relationship between the GFP signal and the fraction of GFP-labelled cells:
from sklearn.linear_model import LinearRegression
m1 = LinearRegression().fit(GFPc_train.reshape(-1, 1), fraction_train)
pred_m1 = m1.predict(GFPc_test.reshape(-1, 1))
M2: mCherry Single-Channel Linear Model
M2 uses only the mCherry channel, estimating the fraction of GFP-labelled cells through a linear relationship with this single-channel signal:
m2 = LinearRegression().fit(mCherryc_train.reshape(-1, 1), fraction_train)
pred_m2 = m2.predict(mCherryc_test.reshape(-1, 1))
M3: Dual-Channel Linear Model
M3 uses both fluorescence channels and estimates the fraction of GFP-labelled cells as a linear combination:
import numpy as np
from sklearn.linear_model import LinearRegression
X_train = np.column_stack((GFPc_train, mCherryc_train))
m3 = LinearRegression().fit(X_train, fraction_train)
X_test = np.column_stack((GFPc_test, mCherryc_test))
pred_m3 = m3.predict(X_test)
M4: Normalised Channel-Ratio Linear Model
M4 first calculates the fraction q of the total corrected signal from both channels contributed by GFP, then predicts the cell fraction through a linear relationship:
q_train = GFPc_train / (GFPc_train + mCherryc_train)
m4 = LinearRegression().fit(q_train.reshape(-1, 1), fraction_train)
M5: Normalised Channel-Ratio Quadratic Model
M5 extends M4 by adding a squared term for the ratio variable to fit a potential nonlinear relationship:
q_train = GFPc_train / (GFPc_train + mCherryc_train)
Xq_train = np.column_stack((q_train, q_train**2))
m5 = LinearRegression().fit(Xq_train, fraction_train)
M6: GFP Single-Channel Quadratic Model
M6 uses only the GFP signal but includes a squared term to test for a curved relationship between the single-channel signal and cell fraction:
Code implementation:
Xg_train = np.column_stack((GFPc_train, GFPc_train**2))
m6 = LinearRegression().fit(Xg_train, fraction_train)
M7: Dual-Channel Random Forest Model
M7 uses both corrected channels and combines multiple decision trees to fit potential nonlinear relationships: Code implementation:
from sklearn.ensemble import RandomForestRegressor
m7 = RandomForestRegressor(
n_estimators=300,
max_depth=4,
min_samples_leaf=2,
random_state=0
)
m7.fit(X_train, fraction_train)
pred_m7 = m7.predict(X_test)
Results and Analysis
We evaluate model performance using both R^2 and RMSE. An R^2 closer to 1 indicates that predictions better capture variation in cell fractions; a lower RMSE indicates that predictions are closer to the measured fractions. A negative R^2 means that the model has greater prediction error than a prediction that always uses the mean fraction of that dataset.
| Model | Inputs and form | LOGO-CV R² | Held-out test R² |
|---|---|---|---|
| M1 | GFP only, linear | 0.9942 | 0.8963 |
| M2 | mCherry only, linear | 0.9706 | 0.6548 |
| M3 | GFP and mCherry, linear | 0.9956 | 0.9098 |
| M4 | Normalised channel ratio, linear | −8.0634 | −1.0239 |
| M5 | Normalised channel ratio, quadratic | −817.0938 | 0.1912 |
| M6 | GFP only, quadratic | 0.9941 | 0.8937 |
| M7 | GFP and mCherry, random forest | 0.9847 | 0.9295 |
We selected M3 as the current calibration model by considering prediction errors across the specified fraction levels, performance on the additional test points, and model complexity together.
In LOGO-CV, where an entire fraction level was held out in each fold, M3 had the highest R² (0.9956) and the lowest RMSE and MAE, at 0.0201 and 0.0149, respectively. Compared with the GFP-only M1, M3 reduced cross-validation RMSE from 0.0231 to 0.0201, a reduction of approximately 12.9%, indicating a predictive benefit from adding the mCherry signal in this dataset. In contrast, the GFP quadratic model M6 did not outperform M1, while the ratio-based models M4 and M5 produced substantially larger errors. Adding curvature terms or applying a ratio transformation therefore did not improve the current calibration.
Random forest M7 performed better in held-out testing: its RMSE of 0.0514 was lower than M3's 0.0582. However, in LOGO-CV across the 21 main fraction levels, M7 had an RMSE of 0.0374, higher than M3.
Model selection also requires consideration of whether the model form is compatible with the measurement process. Previous research estimated the composition of mixtures of two fluorescently labelled strains under the assumption of linearly additive spectral contributions[5]. In our experiment, the two bacterial suspensions were standardised by OD600 and mixed at specified volume fractions. Across the tested conditions and fraction range, dual-channel signals varied approximately linearly with the specified fraction, providing experimental support for linear calibration.
Accordingly, considering grouped validation performance, model simplicity, and compatibility with the approximately linear responses above, we selected M3 as the calibration model. It uses information from both channels and explicitly expresses how changes in readings affect fraction estimates, facilitating inspection, error propagation, and recalibration.
The M3 calibration relationship is:
Here, G and M are the background-corrected dual-channel signals, and f is the estimated mixing fraction of GFP-positive bacteria.
Figure 2-6 further shows the pointwise predictions of M3. In the left panel, most cross-validation predictions and additional test points lie close to the ideal prediction line y=x, indicating good overall agreement with the known fractions. The right panel plots prediction residuals (predicted minus measured fractions) against the true fraction. Most cross-validation residuals are distributed around 0, but deviations are more pronounced for the held-out test points, particularly the underestimation near a fraction of 0.575.
Figure 2-7 presents the same results as a calibration curve: training-set cross-validation points generally follow the ideal line, and most additional test points are close to it, although the test points near 0.575 deviate more noticeably. The held-out test RMSE of 0.0582 and MAE of 0.0413 indicate that the model can generally distinguish different cell fractions, while predictions for individual unknown samples may still contain errors.
Model Application
In the project, we use a fixed workflow: after measuring the GFP and mCherry signals of test samples with a plate reader, we correct them using blank signals from the same batch, then apply M3 to estimate the fraction of GFP-labelled cells.
import numpy as np
GFPc_new = GFP_raw_new - blank_gfp
mCherryc_new = mCherry_raw_new - blank_mCherry
fraction_gfp = (
2.6363458858e-7 * GFPc_new
- 5.5041279846e-6 * mCherryc_new
+ 0.1932729405
)
fraction_other = 1 - fraction_gfp
This model applies to samples measured under conditions similar to those used for calibration. It should be reassessed when the instrument, gain, or assay system changes. Blank subtraction corrects background signals but does not automatically eliminate differences in cell density or between batches. If a predicted fraction falls outside 0–1, measurement conditions and calibration applicability should be checked before simply clipping the result to this interval.
Fluorescence Unmixing Workbench
To facilitate practical use of the calibration model, we developed a fluorescence unmixing workbench that integrates well assignment, data import, background correction, and fraction prediction in one interactive interface. The workbench uses the M3 dual-channel linear model described above, allowing users to estimate the fraction of GFP-labelled cells from GFP and mCherry fluorescence readings without writing code.
Users first mark blank wells and sample wells in the 96-well plate interface. Clicking a well switches its role, while dragging marks sample wells in bulk. Once the layout is complete, users can download an Excel template corresponding to the current design, fill in the three columns Well, GFP_raw, and mCherry_raw, and upload it to the workbench. Alternatively, they can directly upload an .xlsx, .xls, or .csv file containing these columns. The workbench displays data-matching results and flags wells with missing readings.
Users specify blank and sample wells in the plate interface and import the corresponding dual-channel fluorescence readings.
When analysis is run, the workbench calculates the mean GFP- and mCherry-channel readings of blank wells with available data, using these as background baselines. It then subtracts the background from sample-well readings and applies M3 to predict fractions. Results are presented as a plate colour map and a per-well table containing raw readings, corrected signals, predicted fractions, and intervals calculated from the standard deviation of cross-validation residuals (prediction ±1.96 SD). Results can also be downloaded as a CSV file.
The plate colours represent the fraction of GFP-labelled cells in each sample well, and the results table provides per-well predictions and intervals. Wells with corrected signals outside the range represented in the training data are marked with “!” to indicate extrapolation.
For colour mapping, the plate display and mean-fraction summary use predictions clipped to 0–1. The per-well results table retains the raw model predictions, and exported files include both raw and clipped values. Display clipping does not establish prediction validity; measurement conditions and model applicability still need to be checked when signals fall outside the calibration range or abnormal fractions occur.
Future Extensions
For mixtures of three or more fluorescently labelled strains, response-matrix-based multicomponent unmixing could be explored using the existing dual-channel calibration workflow as a foundation. When total cell concentration and the expression state of each component are relatively stable, the signal in each detection channel can be approximated as a linear combination of contributions from the components. This requires measuring each singly labelled strain's response in all channels and preparing mixtures of known composition for calibration and held-out validation.
The model can impose nonnegativity and sum-to-one constraints on component fractions, but constraints cannot replace sufficient measurement information. If different labels have overly similar channel responses, the label combination or excitation and emission settings must be adjusted, or additional discriminating channels introduced. The existing workbench's well assignment, data import, and result export functions provide a foundation for extensions supporting custom channels and calibration models. The current work provides a reproducible two-component example and experimental and computational workflows for further development.
C:R:S Application Model
Modelling Objectives
Within MOSAIC's overall modelling framework, this application model investigates how cell fractions may affect population performance.
We selected coculture of colicin-producing (C), resistant (R), and sensitive (S) bacteria as a theoretical application scenario. Previous studies have shown that competition between toxin producers and sensitive bacteria is frequency-dependent and affected by the spatial structure of the culture environment [6]. Experiments with three-strain systems also show that local interactions and dispersal patterns affect the maintenance of diversity [7]. Against this background, we developed a competition model under well-mixed conditions, using the initial C:R:S ratio as input and strain trajectories and the duration of three-strain coexistence as population performance metrics. We analyse how changes in composition affect population persistence and identify composition regions worth further experimental comparison.
Model Assumptions
Toxin Dynamics Under Well-Mixed Conditions
In spatially expanding systems, Weber et al. found that initial composition, relative growth rates, and the effective range of toxin action jointly affect three-strain coexistence [8]. This provides background for examining composition, growth differences, and toxin conditions together.
The model assumes a well-mixed culture in which the three strains share resources, with toxin exposure represented by a concentration T acting throughout the culture. It does not represent spatial neighborhoods or local protection of nearby S cells by R cells. C produces toxin, which gradually degrades and kills S through a mass-action term; R is not directly killed by the toxin. The cost of toxin production in C is represented by a lower growth rate, without an additional separate growth-cost term for toxin production.
Classical three-species competition models can produce periodic or more complex oscillatory dynamics [9], but those results do not establish the same properties for the present model with an explicit toxin variable. This section directly analyzes the following mean-field equations and measures coexistence by its duration within a finite observation period or during serial passage:
Here, N is the total bacterial abundance and K is the shared carrying capacity; \kappa, \delta, and k_{\mathrm{kill}} are the toxin production, degradation, and killing parameters, respectively. To explore the effects of initial composition on population competition, we use illustrative growth rates satisfying \mu_S>\mu_R>\mu_C, normalising the timescale with \mu_R=1 and bacterial abundance with K=1.
Simulation Results
Single-Batch Culture: Initial Ratios Alter Short-Term Trajectories
We simulated four initial C:R:S ratios, 1:1:1, 5:1:1, 0.1:1:1, and 0.02:1:1, and tracked their dynamics over 30 model time units.
Even with identical growth and toxin parameters, different initial compositions produce different population trajectories: a higher initial C fraction leads to faster toxin accumulation and stronger suppression of S, whereas a lower initial C fraction allows S to persist longer within the observation period.
Serial Passage: Screening Composition Regions for Longer Three-Strain Persistence
To examine composition changes over multiple culture rounds, we scanned 435 initial C:R:S compositions, each simulated for 60 serial passages. After 12 model time units of growth in each round, the culture was diluted 1:100 into fresh medium and the toxin concentration was reset to zero.
At the end of each culture round, we checked the relative abundance of each strain. If any strain fell below a relative abundance of 10^{-6}, three-strain coexistence was considered to have ended under that condition, and its duration was recorded as the number of passages completed before that round. For example, if a strain was already below the threshold at the end of the first round, the coexistence count was 0.
For most initial compositions, at least one strain was below the threshold by the end of the first culture round. A high initial C fraction tended to cause strong suppression of S. When C was relatively low and R and S had similar fractions, all three strains generally persisted longer, with a maximum of 20 passages in this simulation. The first strain to fall below the threshold also varied with the initial composition.
Toxin Parameter Scan
To investigate how toxin action affects performance at different compositions, we simulated 396 combinations of 22 initial C fractions and 18 toxin parameter values. Each combination was simulated for 40 serial passages, using the same culture, dilution, and coexistence criteria as in the preceding analysis.
We used parameter p to jointly adjust the toxin production rate and killing strength by setting \kappa=k_{\mathrm{kill}}=p, with p increasing from 0.5 to 10 and the toxin degradation parameter held fixed. A larger p therefore represents stronger toxin production and killing in the model.
Figure 3-4 shows that compositions supporting longer coexistence change with toxin conditions. Under stronger toxin conditions, longer coexistence occurs mainly in regions with lower C fractions. This is consistent with the model's toxin mechanism: more toxin-producing cells combined with stronger toxin action accelerate the decline of S, ending three-strain coexistence earlier.
However, lower C fractions are not always better. Because C grows more slowly than R in the current model, an excessively low initial C fraction may also cause C itself to fall below the threshold earlier. Longer coexistence therefore requires a balance between maintaining C and avoiding overly rapid suppression of S.
Sensitivity Analysis Across Conditions
The preceding results suggest prioritizing lower initial C fractions. To examine whether this recommendation holds when conditions change, we fixed the initial R:S ratio at 1:1, selected 36 compositions with C fractions ranging from 1–50%, and used equal-ratio inoculation at C:R:S=1:1:1 as the comparison baseline.
We varied one factor at a time: increasing or decreasing the growth rate of C or S by 10%, changing the culture duration per passage from 12 to 9 or 15 model time units, or changing the relative-abundance threshold from 10^{-6} to 10^{-7} or 10^{-5}. All other conditions were held fixed, with 60 passages simulated per condition, yielding 252 population trajectories in total. Results for different thresholds were calculated from the same set of baseline trajectories.
Under baseline conditions, equal-ratio inoculation resulted in a strain falling below the threshold by the end of the first round, giving a coexistence count of 0. In contrast, a C fraction of approximately 12.4% gave the longest coexistence in this scan, reaching 19 passages. This shows that adjusting the initial composition can substantially change the duration of three-strain persistence under the same culture conditions.
Changes in growth rates alter the suitable C fraction. When the growth rate of C was reduced by 10%, the C fraction associated with the longest coexistence increased to approximately 25.5%; when its growth rate was increased by 10%, that fraction decreased to approximately 2.6%. This is consistent with the model mechanism: slower-growing C requires a higher initial fraction to maintain itself, whereas faster-growing C can start at a lower fraction.
Coexistence duration is also affected by the culture schedule and classification criterion. Lowering the threshold from 10^{-5} to 10^{-7} allows a strain to reach a lower relative abundance before coexistence is considered to have ended, increasing the longest coexistence duration in the scan from 16 to 23 passages. Changing the culture duration per passage likewise changes the location of the more favourable compositions.
Across the conditions examined here, the C fraction associated with the longest coexistence was always below the 1/3 used in equal-ratio inoculation. For MOSAIC ratio-library design, this supports prioritizing lower C fractions for comparison while retaining several neighboring compositions to accommodate differences in growth and culture conditions.
Implications for Subsequent Experimental Design
The current results narrow the space to be tested and clarify the conditions that need to be controlled. For subsequent construction of the three functional cell types, equal-ratio inoculation can serve as a baseline, with lower C fractions prioritized for comparison and the range adjusted according to measured growth differences and toxin conditions.
Experimental comparisons should use consistent culture durations, observation times, and detection criteria. Cyclic competition models in finite populations show that stochastic fluctuations can turn coexistence predicted by deterministic models into extinction [10]. Biological replicates should therefore be included when inoculum sizes are small, and actual detection limits should be distinguished from the numerical thresholds used in this section.
Code Availability
The model code and running instructions are available in the GitHub repository for other teams to inspect, reproduce, and reuse.
References
- Shoura MJ, et al. Measurements of DNA-loop formation via Cre-mediated recombination. Nucleic Acids Research. 2012;40(15):7452–7464. doi:10.1093/nar/gks430.
- Weber TS, et al. Site-specific recombinatorics: in situ cellular barcoding with the Cre Lox system. BMC Systems Biology. 2016;10:43. doi:10.1186/s12918-016-0290-3.
- Zhang Z, Lutz B. Cre recombinase-mediated inversion using lox66 and lox71: method to introduce conditional point mutations into the CREB-binding protein. Nucleic Acids Research. 2002;30(17):e90. doi:10.1093/nar/gnf089.
- An B, Tang T-C, Zhang Q, et al. Synthetic circuits for cell ratio control. Nature. 2026;653:587–598. doi:10.1038/s41586-026-10259-3.
- Hallinen KM, Guardiola-Flores KA, Wood KB. Fluorescent reporter plasmids for single-cell and bulk-level composition assays in E. faecalis. PLOS ONE. 2020;15(5):e0232539. doi:10.1371/journal.pone.0232539.
- Chao L, Levin BR. Structured habitats and the evolution of anticompetitor toxins in bacteria. Proceedings of the National Academy of Sciences. 1981;78(10):6324–6328. doi:10.1073/pnas.78.10.6324.
- Kerr B, Riley MA, Feldman MW, Bohannan BJM. Local dispersal promotes biodiversity in a real-life game of rock–paper–scissors. Nature. 2002;418:171–174. doi:10.1038/nature00823.
- Weber MF, Poxleitner G, Hebisch E, Frey E, Opitz M. Chemical warfare and survival strategies in bacterial range expansions. Journal of the Royal Society Interface. 2014;11(96):20140172. doi:10.1098/rsif.2014.0172.
- May RM, Leonard WJ. Nonlinear aspects of competition between three species. SIAM Journal on Applied Mathematics. 1975;29(2):243–253. doi:10.1137/0129022.
- Reichenbach T, Mobilia M, Frey E. Coexistence versus extinction in the stochastic cyclic Lotka–Volterra model. Physical Review E. 2006;74(5):051907. doi:10.1103/PhysRevE.74.051907.
- Scikit-learn developers. Cross-validation: evaluating estimator performance. Section: Cross-validation iterators for grouped data. Documentation. Accessed 20 October 2026.