Differences between revisions 2 and 12 (spanning 10 versions)
Revision 2 as of 2014-02-26 12:55:12
Size: 773
Editor: david
Comment:
Revision 12 as of 2014-02-28 15:07:45
Size: 5738
Editor: david
Comment:
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:

== Useful tools ==

For the exercises, it will be useful to have the following available:
 * A plotting program, such as
  * Gnuplot, described at [[http://www.gnuplot.info/]]. Versions are available for for Linux (from your repository), [[http://sourceforge.net/projects/gnuplot/files/gnuplot/4.6.3/|Windows]] and [[http://www.flapane.com/nix.php|Mac]].
  * Matlab (or Octave, but Octave uses Gnuplot).
 * A spreadsheet program such as
  * Excel, with the solver add-in activated.
  * !LibreOffice Calc. (There is an nlp-solver add-in, but I can't get it to activate.)

== 1. Functions, parameters and variables ==

 1. The [[attachment:Mathsprecourse.pdf|slides]] are available to download. Only the problem answers are missing!
 1. Download [[attachment:enzymes.zip]] and unzip it in a folder/directory. For the gnuplot examples to work, this directory will have to be gnuplot's working directory. Contents are:
  1. ''MMplot.xls/.ods'' are examples of function plotting with a spreadsheet, as needed for the exercise on slide 6. Much easier and far superior is ''gnuplot''. Open gnuplot and type:
   {{{
gnuplot> mm(s) = s*V/(Km + s)
gnuplot> V = 100
gnuplot> Km = 2
gnuplot> set xlabel '[S]'
gnuplot> set ylabel 'rate'
gnuplot> plot [s=0:5*Km] mm(s)
gnuplot> Km = 4
gnuplot> replot
gnuplot>
}}}
  1. ''twoenz.gnu'' generates the two enzyme steady state graph shown in the slides. To plot the graph, open gnuplot and type
   {{{
gnuplot> load 'twoenz.gnu'
}}}
  1. ''viewlogcont.gnu'' and ''viewcontmap.gnu'' plot the sum of squared residuals against ''K,,m,,'' and ''V'' as in the lecture slide. The mouse will rotate the 3-D plot.
  1. ''enzfitter.gnu'' determines ''K,,m,,'' and ''V'' for the data in ''enz1.dat''. Open ''enzfitter.gnu'' with a text editor to see the commands you will need to modify to fit the data in ''enz2.dat'' as specified on slide 22.
  1. ''!EnzFitter.xls'' is an Excel spreadsheet that fits ''K,,m,,'' and ''V''. It contains the same data as ''enz1.dat''; the initial estimates are in cells B3 and D3. Go to cell G14 and then select the 'solver' menu item to minimise this cell by altering cells B3 and D3. (This sheet does not work in other spreadsheet software as they don't have the solver add-in.)
 1. If you've got time on your hands, follow the gnuplot exercise 2 at [[http://mudshark.brookes.ac.uk/Meetings/Delhi2013/Practicals/Practical_1]].

== 2. Calculating time courses ==

 1. Open the spreadsheet file [[http://mudsharkstatic.brookes.ac.uk/Delhi2013/Models/euler.ods | euler.ods]] or [[http://mudsharkstatic.brookes.ac.uk/Delhi2013/Models/euler.xls | euler.xls]] (with Excel). Check that you understand how the column of substrate concentration values is calculated.

 1. Using the tabs to select the sheets for t=0.01 and t=1.0, look at how the solutions change with increase of the ''K,,m,,'' or decrease of the ''V''.

 1. Can you add a column that computes the product concentration at each time point?

== Matrices and Vectors ==

 1. [[/matrices.pdf|Here]] are the slides.
 1. To solve the matrix formula '''A.x''' = '''y''' for '''x''', follow the appropriate instructions below:
  a. For Calc and Excel:
    {{{
Open a spreadsheet and enter the coefficient array, A, in a square block of cells (3 x 3 for the question on the slides).
Enter the solution vector, y, as a column vector (3 x 1).
Select a block of empty cells of the same size as A for the output.
Select the 'Insert function' menu item and choose MINVERSE from the Array functions.
Select the array A as the argument of the function and press OK.
EXCEL users only: with the outputn array still selected, press F2 and then CTRL+SHIFT+Enter to create an array formula.
In either case you now have the matrix inverse of A.
Now select a set of empty cells as a vector the size of y for the answer vector.
Select the 'Insert function' menu item and choose MMULT from the Array functions.
For the first function argument select the inverse, and for the second the vector y and press OK.
EXCEL users only: with the answer vector still selected, press F2 and then CTRL+SHIFT+Enter to create an array formula.
The answer is the x vector.
Of course, the two steps above could be combined into one function without explicitly creating the inverse on the spreadsheet. Try it.
}}}
  a. For Matlab and Octave:
   {{{
Enter the coefficient array as: A = [a11 a12 a13; a21 a22 a23; a31 a32 a33], replacing a11 with the appropriate numerical value.
Enter the solution vector y as: y = [y1; y2; y3], again with numeric values.
The inverse of A is calculated as A1 = inv(A)
The answer is obtained with x = A1*y
}}}
 1. In fact, solving a linear equation set such as this is generally best done by Gauss-Jordan elimination (with pivoting) to minimise numerical errors. Matlab/Oxtvae users can ask for the solution to be obtained this way by typing:
    {{{
x = A\y
}}}

Mathematical Biochemistry in a Nutshell

David Fell

Innsbruck 2 March 2014

This precourse is designed for those less familiar with the mathematical aspects of modelling and systems biology. The aim is not to improve anyone's competence in mathematics, but to provide a basic introduction to some of the main mathematical concepts and computational techniques used to represent and model biological systems. The selection of topics is designed to underpin the main course and consists of:

  • Functions, parameters and variables
  • Calculating time courses from ordinary differential equations
  • Matrices and vectors
  • Mathematical representation of cellular systems
  • Sensitivity analysis - illustrated with metabolic control analysis

Useful tools

For the exercises, it will be useful to have the following available:

  • A plotting program, such as
    • Gnuplot, described at http://www.gnuplot.info/. Versions are available for for Linux (from your repository), Windows and Mac.

    • Matlab (or Octave, but Octave uses Gnuplot).
  • A spreadsheet program such as
    • Excel, with the solver add-in activated.
    • LibreOffice Calc. (There is an nlp-solver add-in, but I can't get it to activate.)

1. Functions, parameters and variables

  1. The slides are available to download. Only the problem answers are missing!

  2. Download enzymes.zip and unzip it in a folder/directory. For the gnuplot examples to work, this directory will have to be gnuplot's working directory. Contents are:

    1. MMplot.xls/.ods are examples of function plotting with a spreadsheet, as needed for the exercise on slide 6. Much easier and far superior is gnuplot. Open gnuplot and type:

      • gnuplot> mm(s) = s*V/(Km + s)
        gnuplot> V = 100
        gnuplot> Km = 2
        gnuplot> set xlabel '[S]'
        gnuplot> set ylabel 'rate'
        gnuplot> plot [s=0:5*Km] mm(s)
        gnuplot> Km = 4
        gnuplot> replot
        gnuplot> 
    2. twoenz.gnu generates the two enzyme steady state graph shown in the slides. To plot the graph, open gnuplot and type

      • gnuplot> load 'twoenz.gnu' 
    3. viewlogcont.gnu and viewcontmap.gnu plot the sum of squared residuals against Km and V as in the lecture slide. The mouse will rotate the 3-D plot.

    4. enzfitter.gnu determines Km and V for the data in enz1.dat. Open enzfitter.gnu with a text editor to see the commands you will need to modify to fit the data in enz2.dat as specified on slide 22.

    5. EnzFitter.xls is an Excel spreadsheet that fits Km and V. It contains the same data as enz1.dat; the initial estimates are in cells B3 and D3. Go to cell G14 and then select the 'solver' menu item to minimise this cell by altering cells B3 and D3. (This sheet does not work in other spreadsheet software as they don't have the solver add-in.)

  3. If you've got time on your hands, follow the gnuplot exercise 2 at http://mudshark.brookes.ac.uk/Meetings/Delhi2013/Practicals/Practical_1.

2. Calculating time courses

  1. Open the spreadsheet file euler.ods or euler.xls (with Excel). Check that you understand how the column of substrate concentration values is calculated.

  2. Using the tabs to select the sheets for t=0.01 and t=1.0, look at how the solutions change with increase of the Km or decrease of the V.

  3. Can you add a column that computes the product concentration at each time point?

Matrices and Vectors

  1. Here are the slides.

  2. To solve the matrix formula A.x = y for x, follow the appropriate instructions below:

    1. For Calc and Excel:
      • Open a spreadsheet and enter the coefficient array, A, in a square block of cells (3 x 3 for the question on the slides).
        Enter the solution vector, y, as a column vector (3 x 1).
        Select a block of empty cells of the same size as A for the output.
        Select the 'Insert function' menu item and choose MINVERSE from the Array functions.
        Select the array A as the argument of the function and press OK.
        EXCEL users only: with the outputn array still selected, press F2 and then CTRL+SHIFT+Enter to create an array formula.
        In either case you now have the matrix inverse of A.
        Now select a set of empty cells as a vector the size of y for the answer vector.
        Select the 'Insert function' menu item and choose MMULT from the Array functions.
        For the first function argument select the inverse, and for the second the vector y and press OK.
        EXCEL users only: with the answer vector still selected, press F2 and then CTRL+SHIFT+Enter to create an array formula.
        The answer is the x vector.
        Of course, the two steps above could be combined into one function without explicitly creating the inverse on the spreadsheet.  Try it.
    2. For Matlab and Octave:
      • Enter the coefficient array as: A = [a11 a12 a13; a21 a22 a23; a31 a32 a33], replacing a11 with the appropriate numerical value.
        Enter the solution vector y as: y = [y1; y2; y3], again with numeric values.
        The inverse of A is calculated as A1 = inv(A)
        The answer is obtained with x = A1*y
  3. In fact, solving a linear equation set such as this is generally best done by Gauss-Jordan elimination (with pivoting) to minimise numerical errors. Matlab/Oxtvae users can ask for the solution to be obtained this way by typing:
    • x = A\y

None: Meetings/MathBio14 (last edited 2014-03-03 14:28:14 by david)