Summary
This tool simulates dynamic, T6SS-mediated interactions between up to three bacterial populations: Attackers (red), Prey (blue), and Defenders (yellow-orange). Cells exist on a hexagonal grid where they can move, replicate, and compete for space based on a wide range of user-configurable parameters. The simulation proceeds in discrete one-minute time steps.
Getting Started 🚀
-
Set Up the Arena: Interactively design your starting battlefield.
- Use the 'Att', 'Prey', 'Def', 'Barr', or 'Rem' buttons to select a tool, then click and drag on the canvas to place or remove cells. Barriers are static obstacles.
- Alternatively, use 'Place Cells Randomly' to populate the grid based on 'Initial Count' settings, or import a specific layout with 'Import Arena (TSV)'.
- Configure Parameters: Adjust settings in the left-hand Control Panel. For the cleanest workflow, load your settings *before* populating the arena. If you do this out of order, a sync button (🔄) will appear to help you fix the state.
- Run the Simulation: Use the main control buttons: Start [S], Pause [P], One Step [O], and Stop & Report [R]. When paused, you can use the Arrow Keys to step through history. For better performance on long runs, increase the Render Rate in the 'Simulation Control' panel to draw the arena less frequently.
- Analyze Results: After stopping, a report appears. From here, you can view a graph of the population dynamics and download various data files, including the full session for later analysis.
Visualizations 🎨
- Cell States: Live cells are solid colors. Dead cells are dark gray, and lysing cells are light gray, both with a faint inner dot of their original color.
- Prey Capsule: A thick, purple inner border on a Prey cell indicates it has synthesized protective capsule layers.
- T6SS Firing: A bright green sector indicates a 'precise hit' capable of delivering toxins. A darker, transparent green sector (Attackers only) indicates a 'miss' that causes no damage but still triggers a cooldown.
- CPRG Reporter: The arena's background color shifts from white towards magenta as lysed Prey cells release LacZ enzyme, which converts the CPRG substrate.
- Prey AI Field: A blue overlay on empty hexes visualizes the concentration of the Prey autoinducer signal. The overlay becomes more opaque as the concentration crosses key thresholds (the Attacker's attraction limit and a fraction of the theoretical maximum AI level).
Preset Scenarios 📚
The 'Load Preset Scenario' button provides a fast way to configure the simulation for specific experimental questions.
To select a preset, simply click anywhere on its title or in the background of its box. The box will become highlighted.
Behavior: Applying a preset will only override the specific settings relevant to that scenario (e.g., disable defenders, enable capsule synthesis, etc.). It leaves all other parameters (like Arena Radius or any settings you have manually changed) untouched. You can use the 'Reset Settings to Defaults' button in the main panel if you wish to return to a baseline state before applying a preset.
The available presets include:
- 1. Role of Initial Density: Vary total cell density and Attacker:Prey ratios.
- 2. Prey Sensitivity: Explore outcomes when Prey are sensitive to only Lytic, only Non-Lytic, or Both toxin types.
- 3. Contact & Kin: Adjust Attacker firing strategies like Contact Sensing Bias and Kin Exclusion.
- 4. Tit-for-Tat: A 3-type scenario (Att, Prey, Def) to model Defender retaliation strategies.
- 5. Role of Capsule: Tests Prey capsule protection by making it always-on. Control protection % and synthesis time.
- 6. Predation: Forces Attackers to "eat to replicate" by disabling normal replication and enabling the Lysis-for-Replication reward.
- 7. Role of Movement: Focuses on mobility and chemotaxis. Control Prey AI production and Attacker movement/attraction.
- 8. Quorum Sensing: A two-column setup to control *both* Attacker T6SS activation and Prey capsule synthesis via their respective QS systems.
- 9. Battle Royale: A full sandbox to quickly configure all three cell types with high-level strategy switches (e.g., 'Movement: AI', 'Predation: Yes', 'Selectivity: High').
Settings Explained ⚙️
The control panel allows fine-tuning of the simulation. Here are the key concepts for each cell type:
Reproducibility & The Seed
The simulation's outcome is determined by the Seed. The controls below give you full power over the simulation's state.
• Seed Input Field: The current seed for the random number generator (RNG).
• New Seed (🔄) Button: Generates a new, random seed for a completely new experiment.
• RNG Reset (🡄) Button: Appears (in green) when the RNG has been used. Click to reset the sequence to the beginning for the current seed. This is crucial for creating identical starting conditions.
• Cell Sync (🔄) Button: Appears (in red) if the placed cells are out of sync with the RNG (e.g., if you change the seed after placing cells). Click to re-initialize the cells' random properties.
• Reset Simulation Button: This is a hard reset. It clears the arena, clears all history, and generates a new random seed.
Common Properties (All Types)
Each cell type has independent parameters for Replication (division time, set mean to -1 to disable) and Movement (cooldown, probability, and directionality preference for empty space).
Replication Reward System
Attackers and Defenders can be rewarded for their effectiveness. For every set number of lyses they cause, they can receive a replication reward. This can either kick-start a new replication cycle or accelerate their current one. This feature is configurable in the Attacker and Defender settings panels, allowing you to create dynamic fitness advantages.
Attacker Behavior
The firing logic of the attackers follows a clear priority:
• Contact Sensing: First, it decides whether to target a specific adjacent contact (cell or barrier) or fire randomly, based on the Contact Sensing Bias %. If it attempts a contact-biased shot but no targets are available, the firing is aborted for that turn.
• Kin Recognition: After a preliminary target is chosen, the Kin Exclusion % determines if self-recognition occurs when targeting another Attacker. The outcome is set by the penalty value (either cancelling the shot or smartly re-targeting a non-kin cell).
• Quorum Sensing (QS): The entire firing sequence is gated by a flexible Quorum Sensing system, which can activate firing based on local Attacker density.
Prey Behavior
Prey are the primary targets but can have their own defense mechanisms:
• Capsule Synthesis: If enabled, Prey can produce up to 5 protective capsule layers, reducing damage from T6SS attacks. Synthesis can be constitutive (always on) or dependent on their own AI concentration.
• Resistance: Prey have separate resistance percentages and toxin sensitivity thresholds against attacks from Attackers and Defenders.
• Reporter Release: Upon lysis, Prey release a set amount of LacZ enzyme, driving the CPRG color change.
Defender Behavior
Defenders are specialized cells that primarily counter-attack.
• Retaliation: Their key feature. After being hit by a T6SS, they have a set chance to fire a burst of shots back at their attacker.
• Random Firing: Defenders can also be set to fire randomly at adjacent cells based on a chance and cooldown timer.
• Immunity: Defenders are immune to toxin damage from other Defenders but will still sense the hit and retaliate.
Data Export & Import 💾
You can save and load both parameters and results, enabling reproducible experiments.
- Shareable Link 🔗: Use the 'Copy Shareable Link' button (in General Settings) to copy a URL to your clipboard. This link encodes your current Seed and any modified parameters, allowing anyone to instantly load your exact experimental setup.
- Settings (TSV): The 'Import/Export Settings' buttons let you save and load your entire parameter setup.
- Arena (TSV): The 'Import/Export Arena' buttons save or load the specific spatial layout of cells you have placed manually.
- Simulation Data (TSV): From the final report, download a time-series table of cell counts and cumulative events, ideal for plotting.
- Arena Images (ZIP): Enables downloading a ZIP file containing a PNG image of the arena for every time step. This feature must be enabled by checking the 'Arena Images' box in the 'Exports' panel before starting the simulation.
- Full Session (.bft6): If 'Full State History' is enabled, you can save the entire simulation—settings and complete step-by-step history—into a single, compact binary file. This is the best way to archive an exact experiment for later re-loading and analysis.
- Export Step (JSON): From the 'Time-Travel Control' panel, you can export the complete state of the currently viewed step—including all cell properties, AI grids, and settings—to a single JSON file. This is ideal for restoring simulations from a certain step.
- Import Step (JSON): From the 'Time-Travel Control' panel, you can import a previously exported Step state JSON file. This will perfectly replicate the conditions of that step, including all settings and the precise RNG state, allowing you to replicate previous simulation or start a new simulation from that exact point with a new set of random numbers.
Memory Management & Buffering Limits
Saving per-step data (like images, arena states, and full history) can consume a large amount of browser memory. To prevent crashes during long runs, you can set buffer limits in the "Exports" panel.
-
When any data buffer exceeds its defined limit, the simulation will automatically pause.
-
A prompt will appear asking you to save the current data batch (e.g., a ZIP of images or a `.bft6` history file).
-
You must click the [Save & Continue] button in the prompt to initiate the download.
-
Once the download begins, the buffer is cleared from memory, and the simulation will resume automatically.
License and Attribution
This "BacFighT6", Simulation of T6SS-mediated Bacterial Interactions, is
Copyright (c) 2025 Marek Basler.
It is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
Source code is available at GitHub.
Support
Development of BacFighT6 runs on coffee! If you find it useful, please consider a small donation ... Thank you!