Cheetah: a computational toolkit for cybergenetic control

Advances in microscopy, microfluidics and optogenetics enable single-cell monitoring and environmental regulation and offer the means to control cellular phenotypes. The development of such systems is challenging and often results in bespoke setups that hinder reproducibility. To address this, we introduce Cheetah – a flexible computational toolkit that simplifies the integration of real-time microscopy analysis with algorithms for cellular control. Central to the platform is an image segmentation system based on the versatile U-Net convolutional neural network. This is supplemented with functionality to robustly count, characterise and control cells over time. We demonstrate Cheetah’s core capabilities by analysing long-term bacterial and mammalian cell growth and by dynamically controlling protein expression in mammalian cells. In all cases, Cheetah’s segmentation accuracy exceeds that of a commonly used thresholding-based method, allowing for more accurate control signals to be generated. Availability of this easy-to-use platform will make control engineering techniques more accessible and offer new ways to probe and manipulate living cells.


15
Modern automated microscopy techniques enable researchers to collect vast amounts of single- 16 cell imaging data at high temporal resolutions. This has resulted in time-lapse microscopy 17 becoming the go to method for studying cellular dynamics, enabling the quantification of 18 processes such as stochastic fluctuations during gene expression 1-3 , emerging oscillatory 19 patterns in protein concentrations 4 , lineage selection 5,6 , and many more 7 . 20 To make sense of microscopy images, segmentation is performed whereby an image is  This combination of computational, physical, and genetic aspects has resulted in this type of 51 4 approach being termed external cybergenetic control and has been successfully applied for gene 52 expression regulation in yeast 21-24 , bacteria 25 and mammalian cells 26 . Such external feedback 53 control can also be implemented using optogenetics 2,27 and in combination with flow cytometry 54 for online measurement of the control output 28 . When compared to embedded cellular controllers 55 (where both the controlled process and the controller are implemented within the cell using 56 synthetic regulatory networks), external controllers benefit from requiring only minimal cellular 57 modification, placing little burden on a cell; also, a single control platform can be used for the 58 automatic regulation of different cellular processes across cellular species (e.g. gene expression 59 21,22 , cell growth 28 , cytosol-nuclear protein translocation 29 ).

60
In terms of software, while control algorithms such as proportional integral, model 61 predictive control and zero average dynamics are versatile enough to be used in many contexts 30 , 62 an online segmentation algorithm usually needs to be tailored given the cell type and the image 63 acquisition settings. For example, if using a thresholding-based approach, various parameters in 64 the segmentation code must be adjusted by trial-and-error before running a closed-loop control 65 experiment. Furthermore, these settings must not significantly change during an experiment (e.g.

66
due to a loss of focus), otherwise accuracy will be compromised. If the online measurements 67 deviate from the real state of the cells, the overall control experiments will fail as inputs become 68 calibrated to a miscalculated control error.

69
In this work, we aim to address these difficulties by developing a computational toolkit 70 called Cheetah to help simplify external cybergenetic control applications. We demonstrate its

82
The Cheetah computational toolkit 83 Cheetah is a Python package designed to support closed-loop control in cybergenetic  The second module is focused on the segmentation of images into various classes (e.g.,    116 To demonstrate the core functionality of Cheetah, we made use of an integrated microfluidics 117 and imaging platform that we have previously used for external feedback control of engineered  population, which simplifies their classification. A more challenging problem is the analysis of 156 mammalian cells whose shape can significantly vary over time. To assess Cheetah's ability to 157 handle these more complex cell types, we tested its ability to accurately isolate and characterise To test the effectiveness of Cheetah for external in silico feedback control, mESCs 199 carrying the dual-input genetic construct were exposed overnight to high concentrations of Doxy

200
(1 µg/mL) and TMP (100 mM) to cause strong mCherry expression. These cells were then 201 seeded into a microfluidic chip placed on our control platform ( Figure 3A) and a Relay control   As our ability to create cybergenetic systems that combine computational, physical, and 227 biological elements advances, the need for supporting software to coordinate and control these 228 systems will grow. Cheetah is an attempt to simplify this process by providing an easy-to-use 229 computational toolkit that while containing core functionality to speed up most projects, is also 230 highly adaptable to new needs. Here, we have demonstrated Cheetah's abilities to rapidly 231 classify and segment two morphologically different cell types in two different microfluidic settings. 232 We show that Cheetah can rapidly compute highly accurate image segmentation (99.5% and 233 98% for E. coli and mESCs, respectively) even when trained using only a small number of 234 manually annotated images (2 and 34 images for E. coli and mESCs, respectively). Furthermore, 235 9 we demonstrate how these capabilities allow for accurate control signals to be generated for 236 external feedback control applications. In particular, the ability for Cheetah to not only segment, 237 but also classify cells as potentially 'dead' or 'alive' enables it to filter out non-viable cells and 238 leads to improved accuracy, as compared to a commonly used Otsu thresholding-based method.

239
In addition to segmentation and control algorithms, Cheetah also includes a wide range of built      were used as waste ports, the C port became a waste port once the experiment had begun. Ports 326 B and I were connected to an actuation system for motorised control of syringes to deliver fresh 327 media and inputs to the cells growing inside the device. The R port was used as a mixing port.

328
The microscope (see below for details) was programmed to take phase contrast (PhC), green

12
The day after, the device was transferred on the widefield microscope and connected to the

352
During the open-loop experiment (Figures 2E, 2F) mESCs were exposed to plain media for the 353 entire duration of the time-lapse, whereas dynamic switching between plain and Doxy/TMP 354 media was automatically controlled during the closed-loop experiment (Figures 3C, 3D) to reach 355 and maintain a desired reference red fluorescence level. Relay control algorithm 369 The Relay Control algorithm provides at each timepoint a control action that aims to minimise the 370 error signal (e, defined as the difference between a reference signal and the process output).

371
Formally, the controller generates the following control input