Team:Grenoble/Projet/Modelling/Stochastic

From 2011.igem.org

(Difference between revisions)
(Created page with "{{:Team:Grenoble/Templates/Current}} <!-- {{:Team:Grenoble/Templates/Team:Grenoble_Rawhide}} --> <html> <div class="body"> <div class="left"> <a href="http://2011.igem.or...")
Line 10: Line 10:
<div class="left">
<div class="left">
 +
    <h1>Modelling - Deterministic</h1>
 +
<div  class="blocbackground" id="Gillespie_algorithm">
 +
    <h2>Gillespie algorithm</h2>
 +
      <p>
 +
During a chemical reaction, the molecules move at random in the medium obeying brownian motion,
 +
and reactions happen randomly in the medium. On a macroscopic scale, the reactions can be seen
 +
as deterministic, and the statistical properties are summarized by constants in classical ODEs.
 +
However, at a cell's scale, the influence of the randomness of the reactions is no longer
 +
negligible, especially for biosensors. For an efficient measurement biosensor systems must provide
 +
the expected precision of the measure.
 +
      </p>
 +
      <p>
 +
IMAGEEUH
 +
      </p>
 +
      <p>
 +
Each reaction has a certain probability to occur in an interval of time, and this probability
 +
depends, for example, on the concentration of reactant species in the medium and on the affinity
 +
constants of the reactions.
 +
      </p>
 +
      <p>
 +
In his algorithm Gillespie uses propensity theory to describe the behaviour of such a medium. Each
 +
reaction occuring in the cell, like construction or destruction of a protein, has a certain
 +
propensity. These propensities depend on the reactants concentrations and on other molecules in the
 +
cell (e.g. : The production of a protein from a gene placed after a pLac promoter depends on the
 +
concentrations of lacI and/or IPTG molecules in the cell).
 +
      </p>
 +
      <ol>
 +
<li>Propensity functions and the Gillespie Algorithm</li>
 +
<p>
 +
  Our stochastic model only describes the stochastic behaviour of the Toggle switch genetical network.
 +
  The toggle switch is the core of our system, it is the most sensitive part of the network and sets
 +
  the precision, the behaviour and the limits of our system.
 +
</p>
 +
<p>
 +
  The propensity functions used in our models are derived from the ODEs we have already written for
 +
  deterministic modelling :
 +
</p>
 +
<table class="nobordure">
 +
<tr>
 +
  <td><big>Chemical reaction</big></td>
 +
  <td><big>Propensity</big></td>
 +
</tr>
 +
<tr>
-
<a href="https://2011.igem.org/Main_Page" title="iGEM 2011"><img height="150px" src="https://static.igem.org/mediawiki/2011/d/de/IGEM_basic_Logo_stylized.png" alt="logo iGEM"/></a>
 
-
<div  class="blocbackground">
+
 
-
+
  <td>
-
<img src="https://static.igem.org/mediawiki/2011/3/38/Jb.png" class="icon"/>
+
    <math >
-
<h2>You are welcome !<span>By JB</span></h2>
+
      <mrow>
-
<div class="noindent">
+
<mi>&Phi;</mi>
 +
<mo>&rarr;</mo>
 +
<mi>TetR</mi>
 +
      </mrow>
 +
    </math>
 +
  </td>
 +
 
 +
 
 +
 
 +
  <td>
 +
  <math >
 +
  <mrow>
 +
  <mfrac>
 +
  <mrow>
 +
    <msub>
 +
    <mi>k</mi>
 +
  <mi>plac</mi>
 +
    </msub>
 +
   
 +
      <mrow>
 +
<msub>
 +
<mi>P</mi>
 +
      <mi>lac total</mi>
 +
</msub>
 +
      </mrow>
 +
   
 +
  </mrow>
 +
  <mrow>
 +
    <mi>1 +</mi>
 +
    <msup>
 +
  <mrow>
 +
    <mfenced open="(" close=")" separators=",">
 +
      <mrow>
 +
<mfrac>
 +
  <mrow>
 +
   
 +
      <mrow>
 +
<mi>lacI</mi>
 +
      </mrow>
 +
   
 +
  </mrow>
 +
  <mrow>
 +
    <mi>1 +</mi>
 +
    <mfrac>
 +
      <mrow>
 +
 +
  <mrow>
 +
    <mi>IPTG</mi>
 +
  </mrow>
 +
 +
      </mrow>
 +
      <mrow>
 +
<msub>
 +
<mi>K</mi>
 +
      <mi>lacI - IPTG</mi>
 +
</msub>
 +
      </mrow>
 +
    </mfrac>
 +
  </mrow>
 +
</mfrac>
 +
      </mrow>
 +
    </mfenced>
 +
  </mrow>
 +
  <msub>
 +
  <mi>n</mi>
 +
<mi>plac</mi>
 +
  </msub>
 +
    </msup>
 +
  </mrow>
 +
</mfrac>
 +
      </mrow>
 +
    </math>
 +
    </td>
 +
 
 +
 
 +
  </tr>
 +
  <tr>
 +
    <td>
 +
      <math >
 +
      <mrow>
 +
<mi>TetR</mi>
 +
<mo>&rarr;</mo>
 +
<mi>&Phi;</mi>
 +
      </mrow>
 +
      </math>
 +
    </td>
 +
   
 +
   
 +
    <td>
 +
      <math >
 +
      <mrow>
 +
<msub>
 +
<mi>&delta;</mi>
 +
      <mi>TetR</mi>
 +
</msub>
 +
<mi>TetR</mi>
 +
      </mrow>
 +
      </math>
 +
    </td>
 +
 
 +
 
 +
    </tr>
 +
    <tr>
 +
      <td>
 +
<math >
 +
  <mrow>
 +
    <mi>&Phi;</mi>
 +
    <mo>&rarr;</mo>
 +
    <mi>lacI</mi>
 +
  </mrow>
 +
</math>
 +
      </td>
 +
 
 +
 
 +
 
 +
      <td>
 +
<math >
 +
  <mrow>
 +
    <mfrac>
 +
      <mrow>
 +
<msub>
 +
<mi>k</mi>
 +
      <mi>pTet</mi>
 +
</msub>
 +
 +
  <mrow>
 +
    <msub>
 +
    <mi>P</mi>
 +
  <mi>Tet total</mi>
 +
    </msub>
 +
  </mrow>
 +
 +
      </mrow>
 +
      <mrow>
 +
<mi>1 +</mi>
 +
<msup>
 +
      <mrow>
 +
<mfenced open="(" close=")" separators=",">
 +
  <mrow>
 +
    <mfrac>
 +
      <mrow>
 +
 +
  <mrow>
 +
    <mi>TetR</mi>
 +
  </mrow>
 +
 +
      </mrow>
 +
      <mrow>
 +
<mi>1 +</mi>
 +
<mfrac>
 +
  <mrow>
 +
   
 +
      <mrow>
 +
<mi>aTc</mi>
 +
      </mrow>
 +
   
 +
  </mrow>
 +
  <mrow>
 +
    <msub>
 +
    <mi>K</mi>
 +
  <mi>TetR - aTc</mi>
 +
    </msub>
 +
  </mrow>
 +
</mfrac>
 +
      </mrow>
 +
    </mfrac>
 +
  </mrow>
 +
</mfenced>
 +
      </mrow>
 +
      <msub>
 +
      <mi>n</mi>
 +
    <mi>pTet</mi>
 +
      </msub>
 +
</msup>
 +
      </mrow>
 +
    </mfrac>
 +
  </mrow>
 +
</math>
 +
      </td>
 +
     
 +
 
 +
 
 +
    </tr>
 +
    <td>
 +
      <math >
 +
      <mrow>
 +
<mi>lacI</mi>
 +
<mo>&rarr;</mo>
 +
<mi>&Phi;</mi>
 +
      </mrow>
 +
      </math>
 +
    </td>
 +
   
 +
   
 +
    <td>
 +
      <math >
 +
      <mrow>
 +
<msub>
 +
<mi>&delta;</mi>
 +
      <mi>lacI</mi>
 +
</msub>
 +
<mi>lacI</mi>
 +
      </mrow>
 +
      </math>
 +
    </td>
 +
 +
   
 +
</table>
<p>
<p>
-
Welcome on version 0.3 of our wiki ! You may still find some blank pages but we are filling it day by day. Follow the state of our work in the <a href="/Team:Grenoble/Notebook/July">Notebook</a> or learn everything you always wanted to know about Grenoble and tartiflette <a href="/Team:Grenoble/Grenoble" >here !</a>
+
  The parameters are the same as those used in ODEs and can be found on the  
 +
  <a href="https://2011.igem.org/Team:Grenoble/Projet/Modelling/Parameters"> parameters page.</a>
 +
  In our Matlab code the propensities are computed at each time step in the file Stochastic_model.m.
</p>
</p>
-
</div>
 
-
</div>
 
-
 
-
<div  class="blocbackground">
 
-
 
-
<img class="icon" src="https://static.igem.org/mediawiki/2011/3/38/Geof.jpg"/>
 
-
<a href="http://syntheticbiology.org/">
 
-
<h2 class="lien"id="Paragraphe2">iGEM and the future of synthetic biology<span>By Geoffrey</span></h2>
 
-
</a>
 
-
<div class="noindent">
 
<p>
<p>
-
Now booming, synthetic biology is a scientific field that divides the world into 2 parts. On the one hand, people who believe it will science and our life. On the over hand, people who believe that synthetic biology is dangerous and it simply means playing God.
+
  Then a pseudo-random number is generated in the interval [0;1] with Matlab function rand(). This
 +
  number will set which one of the reactions will occur during this iteration, or time step. The interval
 +
  of time that separates each iteration is set by the sum of all propensities. If all reactions have very
 +
  high propensities, many iterations will happen in a certain amount of time – And many iterations means  
 +
  many reactions as well. By contrary, if all propensities are low, few reactions will occur during the same
 +
  amount of time. The time interval is then inversely proportionnal to the sum of all propensities.
</p>
</p>
-
</div>
 
<p>
<p>
-
Like all new domains of science, many questions may be raised about synthetic biology. Albert Einstein said: “It is strange that science which before seemed to be inoffensive will be turned into a nightmare that frightens everyone”. The goal of iGEM competition is to promote synthetic biology in the scientific community, but also to inform the public about this new science. Synthetic biology is a very controlled science to prevent side-effects and many countries such as France move to a strong legislative supervision in order to respect the ethical issues related to the modification of life.
+
  This is the core of the algorithm. It can be found in the file Gillespie.m
 +
  The species concentrations are finally changed according to the reaction fixed
 +
  by the random number and the loop keeps running until the ending time of the
 +
  simulation is reached (ending time fixed by the user).
</p>
</p>
-
 
+
<p>Reference : Daniel T. Gillespie (1977). "Exact Stochastic Simulation of Coupled Chemical Reactions".
 +
The Journal of Physical Chemistry 81 (25): 2340–2361</p>
 +
<p>Daniel T. Gillespie (1976). "A General Method for Numerically Simulating the Stochastic Time Evolution
 +
of Coupled Chemical Reactions". Journal of Computational Physics 22 (4): 403–434</p>
 +
<li>Runs and statistical properties</li>
<p>
<p>
-
According to the <a href="http://www.bulletins-electroniques.com/actualites/66814.htm">newsletter of the French Embassy to the United States</a>, the international scientific community recognizes the dangers of synthetic biology and it must identify them precisely. It has especially given to the competition iGEM an important educational role for the scientific community of tomorrow.
+
  In a Gillespie simulation, the information brought by a few instances of the Gillespie simulation is
 +
  enough to get the general behaviour of the genetical system.
 +
  However, it is not sufficient when the information that we want is the mean or the variance of the  
 +
  concentrations in each species.
</p>
</p>
-
 
<p>
<p>
-
However, synthetic biology is a science with an extraordinary potential. Technological advances it could bring are huge. The fields of application are vast, from agriculture to medicine through the environment and energy, synthetic biology offers new possibilities and new alternatives to current technologies. The iGEM competition directly contributes to advance research in all these fields by enabling student teams to contribute in <a href="http://ung.igem.org/Team_Tracks?year=2011">these categories</a>.
+
  In this case a great number of runs is necessary to have a correct estimate of the expected values.  
 +
  This is why we had to write a Matlab code to iterate a great number of runs. This part of the code
 +
  can be found in the file Main_gillespie.m.
</p>
</p>
-
 
<p>
<p>
-
"Open source" policy conveyed by iGEM allows the world to take advantage of advances in this field and thus to improve every year the level of competition and projects. And we can say that the objective is on track, because the number of teams participating in this competition is <a href="http://ung.igem.org/Previous_iGEM_Competitions">constantly increasing</a>.
+
  Once the runs are computed through Gillespie algorithm, we have to extract the information from them.
 +
  In this purpose we wrote the Hist.m, test.m and Dynamicdistros.m files. These files are specific to
 +
  our system, we hope they can give an idea of how to analyse the results obtained via our Gillespie
 +
  code, but they are not as easily understandable as other files.
</p>
</p>
 +
<p>
 +
  Once the datasets are obtained we have to extract its statistical properties. Refer to the next
 +
  section for more information.
 +
</p>
 +
      </ol>
 +
           
 +
      <p>IMPORTANT NOTE:</p>
 +
      <p>
 +
  We tried to write a Matlab code that is as easily adaptable to any other system as possible.
 +
  However, because of the lack of time and the great amount of work it requires, we could not
 +
  build a completely generic MATLAB function handler for Gillespie simulations. We provide the source codes
 +
  <a href="http://igemgrenoble-files.perso.sfr.fr/2011/MATLAB_Archives/">here</a> of the Matlab
 +
  stochastic scripts for our simulations and tried to comment them as much as possible. Note that,
 +
  if you want to adapt our code to a completely different system, only the Stochastic_model.m and
 +
  parameters.mat files need to be changed, but a good understanding of the whole code is necessary.
 +
      </p>
-
</div>
+
</div>
-
 
+
-
 
+
<div class="blocbackground">
-
<div class="blocbackground">
+
    <h2>Mean, standard deviation and statistical properties</h2>
-
+
      <p>
-
<img class="icon" src="https://static.igem.org/mediawiki/2011/6/6e/Felix.png"/>
+
To get the number of bacteria and the minimal step for the IPTG gradient we get, we need to compute
-
<a href="http://syntheticbiology.org/">
+
the mean and the standard deviation of each of the two species of the toggle switch.
-
<h2 class="lien"id="Paragraphe2">A great human adventure<span>By Félix</span></h2>
+
      </p>
-
</a>
+
      <p>
-
<div class="noindent">
+
X1 and X2 are here the matrices which will represent the two toggle switch ways in each bacterium on
 +
the whole plate. On eahc point of the plate are wells containing a great number of bacteria. Each way in each
 +
bacterium is a random variable. The X matrices are then matrices of nb<SUB>cells</SUB>*nb<SUB>cell/well</SUB>
 +
random variables.
 +
      </p>
 +
      <p>
 +
Thanks to stochastic modelling we can obtain the mean and variance in each of the nb<SUB>wells</SUB> wells on
 +
the plate.
 +
     
 +
      <img src="https://static.igem.org/mediawiki/2011/d/df/Mean1.png" class="centerwide"/>
 +
      </p>
 +
      <p>
 +
To design our final device we need to know the width of the interface between the two ways of the toggle switch.
 +
We also need to know the number of bacteria needed in the wells to have a proper measurement.
 +
      </p>
 +
      <p>
 +
The interface which will be the colored part of our plate will turn red when populations in way 1 and populations
 +
in way 2 are in presence on the same point on the plate.
 +
We then need to know the statistical properties of the (X<SUB>1</SUB>X<SUB>2</SUB>)<SUB>well</SUB> random variable.<br/>
 +
      <img src="https://static.igem.org/mediawiki/2011/b/bb/Mean2.png" class="centerwide"/>
 +
      </p>
 +
      <p>
 +
(µ<SUB>X1X2</SUB>(well) is of course not continuous but discrete, we just want to highlight the deviation problem caused
 +
by σ<SUB>X1X2</SUB>(well))
 +
      </p>
 +
      <p>We want to know µ<SUB>X1X2</SUB>(well) and σ<SUB>X1X2</SUB>(well) to obtain respectively :</p>
 +
      <ol>
 +
<li>
 +
  The width of the "gaussian" function of µ<SUB>X1X2</SUB>(well) to set the minimal definition (the ΔIPTG between wells)
 +
  of our final device
 +
</li>
 +
<li>
 +
  The minimum number of bacteria we want in the wells.
 +
</li>
<p>
<p>
-
iGEM competition includes about 160 teams (more or less 2000 students) over the world. There will be a first regional jamboree in different regions such as Europe, Asia, America,… and then a third of us will go to Boston for the last jamboree. This will be the first opportunities for most of students to meet people from so many universities at once ! We ‘ll be hosting at the same places, sharing breakfast and even partying together !... We ‘ll be able to discuss abouts many topics related to our fields, share ideas, and to see how others managed their work by watching their presentations.
+
  We have nb<SUB>cell/well</SUB> independant random variables with the same probability density function. According to
 +
  central limit theorem, the mean of X<SUB>1</SUB>X<SUB>2</SUB> = (X<SUB>1</SUB>X<SUB>2 cell1</SUB> +
 +
  X<SUB>1</SUB>X<SUB>2 cell2</SUB> + ... + X<SUB>1</SUB>X<SUB>2 celln</SUB>) / n is µ<SUB>X1X2</SUB>(well) and its
 +
  standard deviation is σ<SUB>X1X2</SUB>(well)/<math><mrow><msqrt><mi>n</mi></msqrt></mrow></math>.
 +
  The width of the gaussian is therefore easily calculable (µ<SUB>X1X2</SUB>(well) = µ<SUB>X1</SUB>(well) +
 +
  µ<SUB>X2</SUB>(well)), but it's not that easy for the standard deviation σ<SUB>X1X2</SUB>(well)
</p>
</p>
-
</div>
 
<p>
<p>
-
iGEM competition is not just about doing scientific work in order to get a medal, but is also about doing all of what an engineer or researcher needs to do ! Each team needs to set up contacts and collaboration with other groups. Sharing bricks or helping others is a criteria for winning a gold medal! We also need to get funds in order to finance our work…. So we  must make a project that fits some challenge of our society ! As every one knows, new technologies rise up new ethical issues. This aspect has to be considered on every single project !
+
  If we consider Y1 and Y2 two random variables correlated, with known mean and variance (µ<SUB>1</SUB>, µ<SUB>2</SUB>,
 +
  σ<SUB>1</SUB>, σ<SUB>2</SUB>)<br/>
 +
  Var(Y<SUB>1</SUB>Y<SUB>2</SUB>) = E[(Y<SUB>1</SUB>Y<SUB>2</SUB> - E[(Y<SUB>1</SUB>Y<SUB>2</SUB>])<SUP>2</SUP>]<br/>
 +
  = E[(Y<SUB>1</SUB>Y<SUB>2</SUB>)<SUP>2</SUP> -2E[Y<SUB>1</SUB>Y<SUB>2</SUB>]Y<SUB>1</SUB>Y<SUB>2</SUB> +
 +
  E[Y<SUB>1</SUB>Y<SUB>2</SUB>]<SUP>2</SUP>]<br/>
 +
  = E[(Y<SUB>1</SUB>Y<SUB>2</SUB>)] -2(µ<SUB>1</SUB>µ<SUB>2</SUB>)<SUP>2</SUP> + µ<SUB>1</SUB>µ<SUB>2</SUB>
</p>
</p>
-
 
-
<img class="floated" src="greenzap/images/mit.jpg"/>
 
-
 
<p>
<p>
-
Now that we have found an interesting  project  which seems ethic, and can be useful for the society, we are on the way for 4 month of intense work ! Our group is made of 12 people with very different education , that have to understand and synchronise each other. Since we are spread out in multiple places, we already meet once a week in order to coordinate or work. This need of an efficient communication within the team is an exiting part of the project !
+
  and E[(Y<SUB>1</SUB>Y<SUB>2</SUB>)] is not reductible to function of µ<SUB>1</SUB> and µ<SUB>2</SUB>. To obtian this value
 +
  we then needed to create a composite random variable X<SUB>3</SUB> wich will be calculated during for each run of our
 +
  MATLAB stochastic algorithm (see previous section).<br/>
 +
  x<SUB>3</SUB> = x<SUB>1</SUB> * x<SUB>3</SUB><br/>
 +
  We can thus get the variance and mean of X<SUB>1</SUB>X<SUB>2</SUB> (X<SUB>3</SUB>) through simulation.
 +
  If we want to get an error inferior to 10% for example around the µ<SUB>X1X2</SUB>(well) curve, the number of bacteria n
 +
  needed will be n so that :
 +
  <math display="block">
 +
  <mrow>
 +
    <mfrac>
 +
      <mrow>
 +
<msub>
 +
<mi>&sigma;</mi>
 +
      <msub>
 +
      <mi>X</mi>
 +
    <mn>3</mn>
 +
      </msub>
 +
</msub>
 +
<mfenced open="(" close=")" separators=",">
 +
  <mrow>
 +
    <mi>well</mi>
 +
  </mrow>
 +
</mfenced>
 +
      </mrow>
 +
      <mrow>
 +
<msqrt>
 +
  <mi>n</mi>
 +
</msqrt>
 +
      </mrow>
 +
    </mfrac>
 +
    <mo>/</mo>
 +
    <msub>
 +
    <mi>µ</mi>
 +
  <mi>X1X2</mi>
 +
    </msub>
 +
    <mfenced open="(" close=")" separators=",">
 +
      <mrow>
 +
<mi>well</mi>
 +
      </mrow>
 +
    </mfenced>
 +
    <mo>&lt;</mo>
 +
    <mi>10%</mi>
 +
  </mrow>
 +
  </math>
 +
  With such a precision we can then calculate the IPTG definition between the wells.
 +
 
</p>
</p>
 +
-
</div>
+
</div>
</div>
</div>
-
 
</div>
</div>
-
 
</html>
</html>

Revision as of 21:54, 20 September 2011

Grenoble 2011, Mercuro-Coli iGEM


Modelling - Deterministic

Gillespie algorithm

During a chemical reaction, the molecules move at random in the medium obeying brownian motion, and reactions happen randomly in the medium. On a macroscopic scale, the reactions can be seen as deterministic, and the statistical properties are summarized by constants in classical ODEs. However, at a cell's scale, the influence of the randomness of the reactions is no longer negligible, especially for biosensors. For an efficient measurement biosensor systems must provide the expected precision of the measure.

IMAGEEUH

Each reaction has a certain probability to occur in an interval of time, and this probability depends, for example, on the concentration of reactant species in the medium and on the affinity constants of the reactions.

In his algorithm Gillespie uses propensity theory to describe the behaviour of such a medium. Each reaction occuring in the cell, like construction or destruction of a protein, has a certain propensity. These propensities depend on the reactants concentrations and on other molecules in the cell (e.g. : The production of a protein from a gene placed after a pLac promoter depends on the concentrations of lacI and/or IPTG molecules in the cell).

  1. Propensity functions and the Gillespie Algorithm
  2. Our stochastic model only describes the stochastic behaviour of the Toggle switch genetical network. The toggle switch is the core of our system, it is the most sensitive part of the network and sets the precision, the behaviour and the limits of our system.

    The propensity functions used in our models are derived from the ODEs we have already written for deterministic modelling :

    Chemical reaction Propensity
    Φ TetR k plac P lac total 1 + lacI 1 + IPTG K lacI - IPTG n plac
    TetR Φ δ TetR TetR
    Φ lacI k pTet P Tet total 1 + TetR 1 + aTc K TetR - aTc n pTet
    lacI Φ δ lacI lacI

    The parameters are the same as those used in ODEs and can be found on the parameters page. In our Matlab code the propensities are computed at each time step in the file Stochastic_model.m.

    Then a pseudo-random number is generated in the interval [0;1] with Matlab function rand(). This number will set which one of the reactions will occur during this iteration, or time step. The interval of time that separates each iteration is set by the sum of all propensities. If all reactions have very high propensities, many iterations will happen in a certain amount of time – And many iterations means many reactions as well. By contrary, if all propensities are low, few reactions will occur during the same amount of time. The time interval is then inversely proportionnal to the sum of all propensities.

    This is the core of the algorithm. It can be found in the file Gillespie.m The species concentrations are finally changed according to the reaction fixed by the random number and the loop keeps running until the ending time of the simulation is reached (ending time fixed by the user).

    Reference : Daniel T. Gillespie (1977). "Exact Stochastic Simulation of Coupled Chemical Reactions". The Journal of Physical Chemistry 81 (25): 2340–2361

    Daniel T. Gillespie (1976). "A General Method for Numerically Simulating the Stochastic Time Evolution of Coupled Chemical Reactions". Journal of Computational Physics 22 (4): 403–434

  3. Runs and statistical properties
  4. In a Gillespie simulation, the information brought by a few instances of the Gillespie simulation is enough to get the general behaviour of the genetical system. However, it is not sufficient when the information that we want is the mean or the variance of the concentrations in each species.

    In this case a great number of runs is necessary to have a correct estimate of the expected values. This is why we had to write a Matlab code to iterate a great number of runs. This part of the code can be found in the file Main_gillespie.m.

    Once the runs are computed through Gillespie algorithm, we have to extract the information from them. In this purpose we wrote the Hist.m, test.m and Dynamicdistros.m files. These files are specific to our system, we hope they can give an idea of how to analyse the results obtained via our Gillespie code, but they are not as easily understandable as other files.

    Once the datasets are obtained we have to extract its statistical properties. Refer to the next section for more information.

IMPORTANT NOTE:

We tried to write a Matlab code that is as easily adaptable to any other system as possible. However, because of the lack of time and the great amount of work it requires, we could not build a completely generic MATLAB function handler for Gillespie simulations. We provide the source codes here of the Matlab stochastic scripts for our simulations and tried to comment them as much as possible. Note that, if you want to adapt our code to a completely different system, only the Stochastic_model.m and parameters.mat files need to be changed, but a good understanding of the whole code is necessary.

Mean, standard deviation and statistical properties

To get the number of bacteria and the minimal step for the IPTG gradient we get, we need to compute the mean and the standard deviation of each of the two species of the toggle switch.

X1 and X2 are here the matrices which will represent the two toggle switch ways in each bacterium on the whole plate. On eahc point of the plate are wells containing a great number of bacteria. Each way in each bacterium is a random variable. The X matrices are then matrices of nbcells*nbcell/well random variables.

Thanks to stochastic modelling we can obtain the mean and variance in each of the nbwells wells on the plate.

To design our final device we need to know the width of the interface between the two ways of the toggle switch. We also need to know the number of bacteria needed in the wells to have a proper measurement.

The interface which will be the colored part of our plate will turn red when populations in way 1 and populations in way 2 are in presence on the same point on the plate. We then need to know the statistical properties of the (X1X2)well random variable.

X1X2(well) is of course not continuous but discrete, we just want to highlight the deviation problem caused by σX1X2(well))

We want to know µX1X2(well) and σX1X2(well) to obtain respectively :

  1. The width of the "gaussian" function of µX1X2(well) to set the minimal definition (the ΔIPTG between wells) of our final device
  2. The minimum number of bacteria we want in the wells.
  3. We have nbcell/well independant random variables with the same probability density function. According to central limit theorem, the mean of X1X2 = (X1X2 cell1 + X1X2 cell2 + ... + X1X2 celln) / n is µX1X2(well) and its standard deviation is σX1X2(well)/n. The width of the gaussian is therefore easily calculable (µX1X2(well) = µX1(well) + µX2(well)), but it's not that easy for the standard deviation σX1X2(well)

    If we consider Y1 and Y2 two random variables correlated, with known mean and variance (µ1, µ2, σ1, σ2)
    Var(Y1Y2) = E[(Y1Y2 - E[(Y1Y2])2]
    = E[(Y1Y2)2 -2E[Y1Y2]Y1Y2 + E[Y1Y2]2]
    = E[(Y1Y2)] -2(µ1µ2)2 + µ1µ2

    and E[(Y1Y2)] is not reductible to function of µ1 and µ2. To obtian this value we then needed to create a composite random variable X3 wich will be calculated during for each run of our MATLAB stochastic algorithm (see previous section).
    x3 = x1 * x3
    We can thus get the variance and mean of X1X2 (X3) through simulation. If we want to get an error inferior to 10% for example around the µX1X2(well) curve, the number of bacteria n needed will be n so that : σ X 3 well n / µ X1X2 well < 10% With such a precision we can then calculate the IPTG definition between the wells.