Cocktail, a Computer Program for Modelling Bacteriophage Infection Kinetics

Cocktail is an easy-to-use computer program for mathematical modelling of bacteriophage (phage) infection kinetics in a chemostat. The infection of bacteria by phages results in complicated dynamic processes as both have the ability to multiply and change during the course of an infection. There is a need for a simple way to visualise these processes, not least due to the increased interest in phage therapy. Cocktail is completely self-contained and runs on a Windows 64-bit operating system. By changing the publicly available source code, the program can be developed in the directions that users see fit. Cocktail’s models consist of coupled differential equations that describe the infection of a bacterium in a vessel by one or two (interfering) phages. In the models, the bacterial population can be controlled by sixteen parameters, for example, through different growth rates, phage resistance, metabolically inactive cells or biofilm formation. The phages can be controlled by eight parameters each, such as different adsorption rates or latency periods. As the models in Cocktail describe the infection kinetics of phages in vitro, the program is primarily intended to generate hypotheses, but the results can however be indicative in the application of phage therapy.


Introduction
The ability of bacteriophages to kill bacteria has attracted increased interest in recent times. This is probably partly due to reports from clinics where they have been used for decades as bactericidal agents in the treatment of various infections, so-called phage therapy, but more recently also to a large number of studies of isolated phages (short for bacteriophages) which in laboratory experiments have been shown to be able to effectively kill bacteria in vitro, including antibiotic-resistant strains [1,2]. The increasing interest has also led to experimental treatments of severe infections, being carried out at other clinics than where they have traditionally been used for a long time [3,4]. The outcomes of clinical treatments are nevertheless difficult to predict, depending on many factors. Both bacteria and phages show an enormous variation between different clones and can change during the course of treatment, which together with largely unknown pharmacokinetics and pharmacodynamics results in treatments not being comparable and the effect of a certain treatment not being predictable. Although the variation between clinical experiments is very large, the combined results of them suggest that there is reason to continue studying how phage treatments against bacterial infections can be optimised.
A large number of mathematical models have been developed to study the dynamics between host organisms and their parasites, and bacteria-phages are no exception. Depending on the question, models use everything from evolutionary game theory (EGT), for example, on the evolution of the life cycle of phages, or networks of bacteria's genetic changes after a bacteriophage infection (flux-balance analysis, FBA), but the most common bacteria-bacteriophage models are reaction kinetic models [5] (and references therein). These models essentially consist of coupled differential equations that describe the changes in the bacterial and bacteriophage population sizes over time in a vessel given a set of parameters.
As with all models, there has to be a balance between reality and generality. Hence, it is important to stress that some parameters, e.g., temperature, pH, release of nutrients from lysed bacteria or phages binding to cell debris, are not included in the program and others, e.g., modelling of the dynamics of an immune defence or cells in biofilm, are simplified. Therefore, the program should be seen as a tool for inducing hypotheses about the population dynamics of bacteria and phages during a phage infection and not exact predictions. This is especially important to stress regarding phage therapy experiments. The program does not consider the in vitro pharmacokinetics and pharmacodynamics of phages. Hypotheses will always need to be tested experimentally. Mathematical modelling of phage infection in a chemostat may however set boundaries to what can be expected while it can reflect the dynamics under ideal conditions (e.g., constant nutrient supply and agitation).
The following information describes the models and calculations in more detail. The basic condition is a bacterial population, growing in a vessel in a constant volume of nutrient, which can become infected by phages at varying titres and times. Although the volume is constant in such a chemostat, there could be an inflow and outflow of nutrients, and an outflow of bacteria and phages.

Materials and Methods
An overview of symbols used for all bacteria, phages and parameters can be found in Table 1. In the program, values can in general be given with three significant digits. If the input should be an integer, it can be given either as that or in scientific notation, e.g., 1,000,000 or 1.0 × 10 6 . Real numbers should be given either in decimal or scientific format with a point as the decimal separator. If the wrong format is used, values are auto corrected in most cases. Hovering with the mouse pointer above a box displays a hint on which values can be given. The tab key can be used for jumping between boxes and it is also possible to use the up and down arrows in some boxes to increase or decrease values in fixed steps. Please note that some parameter values should be given per hour and others per minute, as shown by the default values (Table 1). Additionally, note that many parameters are represented with their average values despite in reality being distributed in time or size, e.g., the latent period will vary from cell to cell and not all cells will generate the same burst size (produce exactly the same number of phages).

Bacteria
For most bacteria, the rate of growth mainly depends on the concentration of nutrients (physical factors, e.g., temperature and the presence of various gases are of course also important). In a closed system, while nutrients are consumed by the bacteria, their concentration decreases and growth slows. Seen over time, in such cases the bacterial growth becomes a logistic function of the concentration of nutrients. One of the most widely used relationships between growth rate and nutrient concentration was formulated by Monod [21]; the growth of bacteria depends on three parameters, µ = µ max × s/(K s + s) where the growth rate, µ, is a function of the maximum growth rate, µ max , a constant, K, and the concentration of nutrients, s. This is also the basic growth function in the Cocktail program where most parameter symbols and default parameter settings are taken from Lenski [19] (Table 1). In the program, the max growth rate per hour is denoted as ψ, a real number between 0 and 1.5 and the Monod half-saturation constant, K in µg/mL, is a real number between 0.01 and 100. The reason for allowing this large span is the observed variation among strains and experimental conditions when assessing the half-saturation constant, but the values are usually between 0.1 and 10 µg/mL [22]. The concentration of nutrients varies in a chemostat while the nutrients are consumed by bacteria and where there is an inflow and outflow. It is denoted C in the program and the concentration of nutrients over time equation is described in more detail below. While mutated bacteria may suffer from reduced fitness, the growth rate of bacteria that have become resistant to either one or both phages can be entered separately. Bacteria can become resistant to phage infection by mutation but only at cell division when new cells are produced. The mutation rates should also be written as decimal numbers or in scientific notation. Note that bacteria becoming resistant to both phages, A and B, occurs at a rate being the product of the rate of mutation to resistance against A and B, respectively, and does not need to be specified. It is also possible that the starting population of bacteria may contain resistant bacteria to either one or both phages. These frequencies are also entered either as decimal numbers or in scientific notation as above.  Decay rate of phage B 0 0-1 /h * The symbol for the micro prefix, "µ", is denoted by "u" in the program user interface.
Bacteria can also decay from natural causes, and not just die from a phage infection. In an in vitro situation, this would be, e.g., from neutralisation by antibodies or phagocytosis. This results in an exponential decay N t = N 0 × e −γt where N 0 is the number of bacteria at time 0 and N t at time t and γ is the decay rate constant. The decay is calculated as N t+1 = N t − (N t × γ) in the equations below while this equals N 0 × e −γt . γ is quite small for bacteria growing in a chemostat, half of the population has decayed at t = ln(2)/γ, and values of γ is generally around 0.02 per hour in nature [23,24]. The decay rate per hour, γ, should be given as a real number between 0 and 1. Note that new bacteria resulting from cell division each generation is excluded from decay.

Resources
The addition of nutrition is necessary for the growth of bacteria. The concentration of nutrients is regulated by the flow into and out of the system at a rate of ω turnovers/hour. The starting concentration, C 0 in µg/mL, can be set independently from the concentration of nutrients continuously flowing into the system, C in µg/mL. The flow in and out of the system causes dynamic changes in the system while it is not just nutrients flowing out but also bacteria and phages. The conversion efficiency, the resources used by one dividing cell, is denoted as ε and given in µg/cell as a decimal number or in scientific notation, e.g., 1.0 × 10 −6 . The equation for dC/dt is shown below in the following text.

Phages
Two virulent phages, A and B, can infect the bacterial population in different titres, adsorption rates, and at different times while it is possible to let the bacterial population grow for some time and add phages at three different time points. As with the bacteria, phages can decay and be washed out of the system. Phages inactivated by binding to lysed cell debris cannot be entered separately but must be included in the decay. Phage populations grow by two additional parameters. When the latent period comes to an end, infected bacteria burst open producing the burst size number of phages. Note that a fast phage of one type, e.g., A, infecting a bacterium already infected with a slower phage, e.g., B, will produce only type A phages if its latent period is shorter than the remaining time of phage B's latent period. If only one phage is chosen to infect, the added titre of the other phage should be set to 0. Additionally, if one wants to study a nonproductive infection, the burst size should be set to zero.

Model Settings
A phage infection starts with the adsorption of the phage to receptors on the bacterial surface. The adsorption can be set to happen by different mathematical models described in the following text. In short, phages can adsorb one by one per unit time as described in the primary adsorption "Standard" model below or several phages at once per unit time according to the Poisson probability of infection. The "Poisson" setting hence allows for multiple adsorption proportional to the multiplicity of infection. It is also possible to adjust both models to allow adsorption to uninfected and non-resistant cells only or to all susceptible and non-resistant cells irrespective if they have already been infected. These secondary adsorption alternatives are chosen with the settings "Uninfected" or "Susceptible". An overview over which types of cells that get adsorbed and infected by which phages is given in Table 2. Details and the mathematical background to all models is given in the text that follows.

Primary Adsorption: Standard Model
Bacteria can divide and the population grow, but bacteria can also decay, be completely resistant or mutate to resistance against phage infection (Section 2.4.3), hide in a refuge (Section 2.4.4) as well as become infected by phages and lyse from the infection. In the Cocktail program, this results in the possibility of thirteen types of bacteria being present in the system at the same time ( Table 1). As mentioned, phages A and B can infect at different times and by different adsorption rates, and after varying latent periods lyse infected bacteria resulting in a burst of phages of different size. Bacteria and phages can both flow out of the system. Starting with the concentration of nutrients, this results in the following basic equations: The first Equation (1) describes the nutrient content in the system over time where C is the concentration of nutrient in µg/mL (C 0 is the start concentration), ω is the flow rate in turnovers/h, ε is the resource consumption by one bacterium in µg/cell and ψ is the specific growth rate of bacteria per hour. N stands for the S and R types of bacteria (S, R A , R B , R AB ) as the infected bacteria are supposed to cease both to consume nutrients and to divide. K is the Monod half-saturation constant in µg/mL (the concentration of nutrients resulting in half the maximum growth of the bacteria). For simplicity, ε and K are the same for all dividing bacteria, but ψ can vary and be different for phage-resistant bacteria.
This second Equation (2) describes the growth and losses of susceptible bacteria. The losses over time are due to bacteria mutating to become resistant against phage A or B or both at a specific rate of µ per cell division (µ AB is calculated as µ A × µ B ). This means that it is only divided bacteria that mutate. Bacteria can also move into a refuge population, S r , at a rate of σ where they may or may not be adsorbed by phages, and move out of the refuge at a rate of ρ. Bacteria can also decay or be neutralised at a rate γ, becoming infected by phages at the adsorption rate δ, and finally be washed out of the system at a rate of ω. The equations for phage-resistant bacteria become: Phage resistance is intended to result in complete blocking of adsorption by the phage. Hence, a bacterium resistant to phage A can mutate to become resistant to phage B as well but also be infected by phage B, and vice versa. Needless to say, a bacterium resistant to both phages (Equation (5)) cannot become infected at all.
Infected bacteria (Equations (6)- (8)) are thought not to consume resources or divide and not to be part of the refuge population of cells. Cells in the refuge (see Equations (26) and (27) below) is simulating the presence of either metabolically inactive cells or cells in biofilm and inhibited phage propagation. Phages can however adsorb to different classes of bacteria depending on the secondary adsorption mode setting. In the "Uninfected" setting, phages are adsorbing to uninfected bacteria only, which is common in basic mathematical models, where phage A adsorbs only to S, I B , and R B . In the "Susceptible" setting, on the other hand, phages are allowed to adsorb to already-infected bacteria as well, i.e., A adsorbs to S, I A , I B , I AB , R B and R BIA (referred to as secondary adsorption [11]). In addition to this, A can also adsorb to the S r and R rB cells in the refuge if the "Standard" primary adsorption model is applied, the "Planktonic" mode is set and the rate of cells in and out of the refuge are given values. Phage B adsorbs to S r and R rA as well with this setting. Cells in the refuge will however not be infected, only adsorbed by phages.
The expressions I A(t−l A ) , I B(t−l B ) , I AB(t−l B ) and I AB(t−l A ) , part of the delayed differential Equations (6)- (8), are all describing the loss of infected bacteria due to lysis, after the latency time l A or l B . A bacterium simultaneously infected by two phages will lyse at time l A if the latency of phage A is shorter than the latency time for phage B, l B . This results in that I AB(t−l B ) becomes zero for a bacterium when I AB(t−l A ) becomes positive. One of I AB(t−l A ) and I AB(t−l B ) subsequently always becomes zero. A bacterium infected with phage B at time t B and superinfected with phage A at time t A will lyse and produce phages of type A only if t A + l A is shorter than the remaining time to lysis caused by phage B, i.e., t A + l A < t A + l A − t B + l B = t A < t A − t B + l B . This means that in an infection with both phages, A and B will interfere with each other and not produce the number of phages expected from single and separate infections by A or B. Other interference between phages, e.g., by actively impeding the other phage's transcription or replication, is not considered.
Finally, bacteria that are resistant to infections by one phage can become infected with the other phage (Equations (9) and (10)).
Titres of phages A and B can grow through the release of phages from all types of infected bacteria (13 and 14). After the phage specific latency periods mentioned above, each bacterial cell gives rise to the number of phages equal to the phage's burst size, β. Phages will be lost by adsorption to the bacteria mentioned above, and adsorbed phages representing phages bound to bacteria, is denoted P A and P B , respectively (11 and 12). Phages can also decompose at a rate of ϕ, and be washed out at a rate of ω. With the no secondary adsorption "Uninfected" setting: Additionally, with the "Susceptible" setting: The change in phage titres will hence be:

Secondary Adsorption: Poisson
Only uninfected bacteria can be infected by phages in the "Standard" model with the "Secondary adsorption Uninfected" setting (δ A SA in the equations). This is in many cases a good approximation but neglects that several phages may adsorb to a single bacterial cell, assuming that the number of cell receptors is not limited, i.e., multiple adsorption [11]. Phages adsorbed to cells will follow Poisson probabilities. While more phages per bacterium can infect, this is referred to as MOI actual in contrast to MOI input [11,25]. Bound phages will hence be: Here, P is the titre of phages and M is the sum of all bacteria that can be adsorbed by a particular phage. These are denoted M A for phage A and are bacteria S, I B , and R B , in the "Uninfected" adsorption mode and S, I A , I B , I AB , R B and R BIA with the "Susceptible" setting, i.e., the same sets of bacteria as in the "Standard" primary adsorption model. M B is accordingly bacteria S, I A , and R A , and S, I B , I A , I AB , R A and R AIB , respectively. While more phages than one may adsorb to a cell, infected bacteria will equal: Taking Equation (16) into account, the equations describing the change in uninfected bacterial titres (17)(18)(19) will have to change to: The equations for resistant bacteria will change accordingly: If the infection is by the primary adsorption option "Poisson" and bacteria are chosen to be in the planktonic refuge and entered at a certain rate (see Equation (26) below), phages are additionally also adsorbing to the bacteria in the refuge. Phage A will additionally adsorb to S r and R rB cells and phage B to S r and R rA cells. However, this is not the case if the lastin-first-out ("LIFO") type of refuge cells is selected (27). Bound phages, A and B, are again denoted P A and P B , respectively. In the Poisson mode, this results in Equations (21)-(25) for infected bacteria: The expression of phages A and B lost by adsorption to bacteria is the same as in the "Standard" model, described in Equations (13) and (14), but bound phages P A and P B is calculated differently as shown in Equation (15) above.
It should be pointed out that the difference between the "Standard" mode of infection and the "Poisson" mode is obviously small at a MOI around 1. It is only when there are phages in excess, a probability of more than one phage infecting a bacterium, that a difference may be observed as a more rapid loss of adsorbed phages.

Resistance Mutation
Dividing bacteria can mutate at a rate of µ, and the mutant frequencies in the population can be calculated in two different ways. In the "Deterministic" mode, each class of newly divided bacteria contains N × µ mutants, where N is the number of newly divided bacteria. With the "Stochastic" alternative, mutations are introduced by random sampling from a Poisson distribution having a mean of N × µ = λ if λ ≤ 10 or from sampling a normal distribution if λ > 10. The normal distribution, (λ; √ λ), is generated by the Box-Müller algorithm and all random numbers are generated by a Mersenne Twister algorithm. This results in good, but somewhat slow, generation of pseudo random numbers but this does not have a great impact on the overall program performance. When stochastic mutation is active, results will of course vary from run to run. With small numbers of divided bacteria per millilitre, for example, 10 5 bacteria, and a mutation rate of 10 −7 , the resulting frequency of mutants is bound to be very low. There would be only 0.01 mutant bacteria in the population and these would be eliminated if the option of rounding off values below one is activated. In the program, resistance is modelled as affecting the adsorption and regarded as complete. Therefore, resistant bacteria do not adsorb any phages.

Refuge Cells
The refuge population is simulating the existence of metabolically inactive cells, with the "Planktonic" setting, or cells forming biofilm with the last-in-first-out ("LIFO") setting. The "LIFO" setting means that the last cells that entered the refuge are reintroduced to the normal pool of cells followed by the next to last cells and so forth. The rate of cells moving into the refuge can be set to at most 0.01, which means that 1% of the current population will enter the refuge per minute. Another limitation is that there has to be more than 10 cells outside of the refuge. In such a case, only 0.1 cells enter the refuge. If only whole cells should be allowed to enter, the round off <1 option should be chosen. Both boxes, the rate in/min and rate out/min must be given a value in order to activate the refuge cells models. While in the refuge, these cells are not dividing and cannot produce phages or mutate and become resistant which they can become upon reintroduction to the normal pool of cells. Infected bacteria (I A , I B , I AB , R AIB , R BIA ) are not part of either refuge population, as these cells will lyse in any event. In the "Planktonic" mode, cells can be flushed out of the system or decay whereas in "LIFO" mode cells are thought to be metabolically inactive and sessile until reintroduced. Planktonic refuge cells: Cells in the last-in-first-out (LIFO) mode:

Time
Step Size Calculations of differential equations in Cocktail are done using Euler's method, taking the input values as the initial values for calculating the values numerically after the chosen time interval, set either as one minute or as a 30-, 15-or 5-second time step size. At large time intervals, other methods for solving differential equations result in smaller errors, but the differences between methods become smaller and smaller as the step size (time interval) decreases. Hence, running the program with a step size of one minute results in a larger discretisation error than with a five-second step size, but is considerably faster. On the other hand, the program speed depends mainly on the length of the phages' latent periods and the rates of bacteria into and out of refuge populations. These are stored on arrays in dynamic memory that need to be recalculated in each step, which will slow down the program performance if a long running time is set. However, there is virtually no time difference between short and long time step sizes if a short running time and no refuge cells are chosen. If accuracy and a small discretisation error is preferred, step size should be set to five-second intervals.

Results
Examples of Cocktail outputs can be studied by running the example data files provided as Supplementary Materials. The file Bohannan_Lenski_1997_Fig 3B.ctl contains input parameter values and a comparison to a chemostat experiment where the authors found that the titre of Escherichia coli bacteria and an infecting T4 phage can oscillate over time [26]. The phage titre decreases over time when there are very few bacteria to infect which in turn results in a higher titre of bacteria and so forth (Figure 2A). Coexistence can theoretically be shown to occur at higher bacterial titres as well. Running the parameter settings in the file Lenski_1988_Fig_2a.ctl from Lenski [19] results in oscillations leading to stable coexistence of bacteria in a titre of about 10 7 and phage titres being around 10 9 ( Figure 2B). However, a fourfold increase in the concentration of nutrients, from 25 to 100 µg/mL results in increasingly large oscillations, but as in the first case, bacteria never become extinct ( Figure 2C). It is also possible to analyse more complex problems and formulate hypotheses that later can be evaluated experimentally. The last example describes two phages in a cocktail with different latent periods, added in the same titres, and at the same time to the bacteria. Most parameters were entered with their default values (Table 1). Parameters set to different values were the bacteria's starting titre, 1 × 10 8 , and the program was executed with the standard model where phages only adsorb to uninfected cells, mutations are set to be deterministic and no cells were allowed to be resistant to either phage A or B or both, metabolically inactive or form biofilm. The log 10 option was selected for the output. While log 10 (0) = −∞, a titre of 0 is represented as −16 (log 10 of 10 −16 ). The data can be retrieved by running the file Fig_2D.ctl. The result showed that bacteria resistant to phage A will disappear from the system within an hour ( Figure 2D). Phage B has a shorter latent period, and has outcompeted phage A, by infecting most of the susceptible bacteria. The mutation rate of bacteria becoming resistant to both phages was set to 10 −7 × 10 −7 (the product of mutation rate for resistance to A and B, respectively) which resulted in a low titre of double resistant cells, as the bacteria had a good supply of nutrients and were able to divide, but the titre of such cells will grow to about a thousand cells/mL in 48 h. Allowing resistant cells from the beginning, in the start population, results in higher titres of such cells.

Technical Information
Cocktail runs on Windows 64-bit systems. The program interface (Figure 1)  The Cocktail program and source code files are distributed under the license Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. In short, this means that it is free for everyone to use, to modify the source code, build upon the program or code, and free to distribute in any medium. However, you must give appropriate credit and a link to the license. If changes were made to the program or code, these must be specified, and distribution of modifications must be under the same license. It is not allowed for anyone to use any part of the program or code for commercial purposes. A short description of the license can be found at: https://creativecommons.org/licenses/ by-nc-sa/4.0/, accessed on 28 September 2022. The license and program version number can be found by double clicking anywhere in the Cocktail parameter settings window.
The results of the program can be saved as charts, in PNG or SVG graphics file formats, and/or as a .ctl data file. The items in the .ctl file constitute the complete settings for running the program. The file format is a plain .txt file, but note that the format is fixed as in the example .ctl file. Moving items to another position in the file will inevitably result in a file error. A comma (,) is often used as a delimiter when more than one item is to be found on a line. The advantage of this is that the file can contain a short label of each of the items which makes reading and editing a file much easier. The disadvantage is that omitting a comma, or using another delimiter, will result in a file error. Selected output parameters should however be surrounded by at least one blank in the list following the label "Output parameters:", e.g., 1 11 14 (note the blank after the last number). A .ctl file can easily be created by running the program and saving the result by clicking on the "Save" button at the bottom of the result window. Editing such a .ctl file that has been shown to work as a template, and saving it under a new name, is a good idea. Double clicking on a .ctl file will open a new instance of the program provided that a link to the program has been established in the Windows "How do you want to open this file?" dialog by marking the Cocktail program and checking the "Always use this app to open .ctl files" box.