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

 Introduction to 'R'  Overview Basic Commands Practical 1 Practical 2 'R' Resources  

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)

 * RK4 solver:
 * RK4 documentation
 * Interface: rk4(y, times, func, parms, ...)


 * 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:

Questions:
 * 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.