The Science Gab

Personal gablog of Gabriel Abrahams.

A Simple Biological Circuit Simulator

Posted at — Apr 28, 2022

Take me straight to the simulator!

In a few months time, I’m very excited to be embarking on a PhD in Interdisciplinary Biosciences. Since I trained as a physicist, I’m keenly aware of the amount of stuff I don’t know, keenly unaware of the stuff I don’t know I don’t know, and trying to avoid the wonderful physics tradition of deceiving myself that I know what I in fact don’t know about any field that isn’t physics or pure maths.1

Mandatory XKCD

Basically, I need to prepare and learn some biology! Speaking to a an alumni of the course, I was given a great list of textbook recommendations, including An Introduction to Systems Biology - Design Principles of Biological Circuits by Uri Alon.

Reading this, alongside Biochemistry (Berg, Tymoczko & Stryer), has proved a fascinating introduction to the biological mechanisms acting at the sub-cellular level.

The essential story is this: most biological processes are governed by the actions of proteins - tiny molecular machines which can manipulate matter to build, transform and destroy other molecules. Proteins are produced in cells by special proteins called transcription factors, according to instructions coded for by DNA. The rates at which transcription factors produce proteins are governed by basic rules involving the concentration of other proteins in the cell, which can be abstractly defined according to simple mathematical equations. Because protein concentration affects protein production, a network emerges (called the transcriptome) in which the production of one protein governs the production of other proteins. This network can be quite complex, and can implement various functions with particular timing sequences. For example, the transcriptome might contain a healing algorithm: when the cell is damaged, this triggers production of a regeneration protein. Once that protein has performed it’s function, it’s production is reduced as it is no longer required.

While there are excellent exercises in Alon’s textbook, reading it I couldn’t help but think it would fun to “play” with the circuits. Inspired by the brilliant Falstad electronic circuit simulator I decided to make my own (much less sophisticated) biological circuit simulator.

There are currently three components to my transcriptome simulator:

  1. Promoters
    These are the transcription factors: they produce a protein $X_n$ at a rate determined by intrinsic growth and decay parameters, as well as the concentration of other promoters or signals connected to them.

    The concentration $X_n$ of promoter $n$ is governed by the equation $$\frac{dX_n}{dt} = \beta - \alpha X_n$$ where $\beta$ is the growth term, which can be turned ON and OFF by connections, and $\alpha$ is the decay term (due to protein degradation or diffusion as the cell size expands). Promoters have an additional term $\beta_0$ which represents a constant growth term (regardless of the connection state), usually small.

    Promoters have two modes: AND and OR. In AND mode, the $\beta$ term is ON when all connections are active, in OR mode only one connection needs to be active.

  2. Signals
    These represent some external chemical signal to the cell - they are periodic functions which can be connected into promoters.

  3. Connections
    Connections indicate that the production of one protein is influenced by the concentration of another. There are two types of connections, repressors which turn ON when the input protein is below a threshold concentration $K$ (and OFF otherwise), and activators which act the opposite way. Repressors have a bar head, activators have an arrow head.

The simplest non-trivial example is the autoregulator. In this circuit, a promoter is connected to itself with a repressor connection. The result is that the concentration of protein produced by that promoter can be raised much more quickly than without the repressor.

To see autoregulation simulated, look no further than the simulator below! Other examples can be loaded from File -> Load Example (top left), and instructions to build your own circuits can be found by clicking the Help button in the simulator (top left). Concentrations can be reset by clicking the reset button (top right).

Transcriptome Simulator

Please enable JavaScript.

Made using the Godot game engine.

Brief descriptions of the examples


The simplest no trivial example of a network motif. Here, $X_0$ is unregulated, and $X_1$ is autoregulated. In the E. coli network, the number of autoregulated nodes exceeds the expected number (were the network random) by 35 standard deviations.

C1-FFL Sign Sensitive Delay Element

This network motif makes use of an AND gate (nodes $X_1$ and $X_3$) to filter out short term fluctuations in the input signals $S_0$ and $S_1$. The networks on the left and right are identical, except for the period of the signal nodes. In the output, $X_1$ is not activated because the period of $S_0$ is too short, whereas $X_3$ is activated because $S_1$ has a longer period. In E. coli, such a motif is used to determine if the cell should start processing the inferior sugar arabinose in the absence of glucose. The cell should only switch to arabinose processing if glucose is absent for an extended period of time - to respond to only short absences would be a waste of energy and resources. Thus the absence of glucose signal cAMP is an input to a C1-FFL network motif.

Bistable long term memory

This motif is bistable because there are two stable states of $X_0$: OFF or ON. Initially in the stable OFF state, a sufficiently long step is provided (driving the concentration of $X_0$ above the threshold of it’s self-activator), the output switches to ON and remains there after the pulse finishes (because it is now in the stable ON state).


This is the repressilator, theorised by Goodwin. According to Alon, it’s implementation in E. coli in 2000 by Elowitz and Liebler helped start the field of synthetic biology.


Thanks for reading this far! Next, I plan to continue reading both these textbooks, and possibly make a start on some others. Hopefully there will be more to share here 😊🧬💻

If you want to get in touch (to correct biological misconceptions, or otherwise!), please contact me at or @GabrielAbrahams.

  1. though as an experimentalist, the pure maths thing is not an issue for me ↩︎