Imperial College/Courses/Fall2008/Synthetic Biology (MRes class)/'R' Tutorial/Practical 2

From OpenWetWare
Jump to navigationJump to search
Fall 2008 - Synthetic Biology (MRes class)


Home        'R' Tutorial        Resources        Literature

<html> <body> <!-- Start of StatCounter Code --> <script type="text/javascript"> var sc_project=3315864; var sc_invisible=0; var sc_partition=36; var sc_security="8bb2efcd"; </script>

<script type="text/javascript" src=""></script><noscript><div class="statcounter"><a class="statcounter" href=""><img class="statcounter" src="" alt="blog stats" /></a></div></noscript> <!-- End of StatCounter Code -->

</body> </html>

Introduction to 'R'

Exercise 1 (Data frames and inputs/ouputs)

In R, files can be used for different purposes such as storing your command script, storing your results, or load data previously generated.

  • Storing your command script:
    • create a .txt file
    • write R commands (1 per line), like creating a random vector of uniform data between [-10,10], and create a sequence of integers between [1,100], and finally plot the resulting scatterplot.
    • save the file
    • in R, use the source("path_to_file") command to execute the commands stored into the file.
  • Storing your results (with a CSV format for example):
    • modify your previous script so that you can now save your two vectors into a different file. You will need to create a data.frame object and use the write.table(...) function.
  • Loading data previously generated:
    • Using the previously save data, try to load again the data by using the read.table(...) function.

Exercise 2 (ODE Solver)

  • Model: Constitutive gene expression
    • ODE System:
      • d[mRNA]/dt = k_1 - d_1*[mRNA]
      • d[protein]/dt = k_2[mRNA] -d_2*[protein]
  • Questions:
    • 1.Considering that the half-life for the mRNA and the protein is respectively 3min and 1h. Workout the values of (k_1, d_1, k_2, d_2) so that, at steady state, [mRNA] = 3 and [protein] = 500.
    • 2.Using the previously found parameter values, plot on the same graph [mRNA](t) and [protein](t) for t=[0, 5h].
    • 3. Parameter scanning: Consider parameter d_2 to vary [-20%, 20%] of its nominal value (10 uniformly spread values). Generate on the same graph the 10 [protein](t) trajectories (t=[0, 5h]).

Exercise 3 (Non linear regression)

Some synthetic data has been generated to mimic the characterisation of a repressed gene construct. The experiment consisted in measuring the reporter concentration at steady-state, expressed by the repressed construct, as a function of different repressor concentration. The measurements are as follow:

Repressor Reporter
471.221542 97489.124
377.841073 95114.595
382.397754 91436.337
251.009797 97063.550
454.568968 97212.833
66.000463 55997.503
8.341641 3055.505
76.925586 66998.853
416.084742 99528.226
94.801759 70843.625


  1. Plot the measurements: Reporter = f(Repressor)
  2. In order to analyse the data, you need to build an hypothetical underlying model of the repressed gene construct. Using ODEs, write down the equations governing the dynamics of the system. In order to model the repressor effect on the transcription, you will use a Hill function.
  3. From the previous ODEs, define the steady-state equilibrium of the system. What are the parameters that characterise the repressed gene construct ? Use the nls(...) function in R.
  4. Using a non linear regression analysis, fit your model to the measurements. Plot on top of the measurements, the resulting fit.
  5. Convert your system of ODEs so that it becomes representative of a PoPS device. Plot its transfer function.