Growth curves

Wednesday 23 March 2016

Growth curves

> All scripts mentioned can be found on
> Another post discusses what methodological errors can ruins growth rates

Bacterial growth curves never look like they are in the textbooks as sick bacteria are the worst patients.
Fitness is possibly one of the top three buzzwords in evolutionary biology. It encompasses the more subtle effects that lie between death or growth. However, measuring fitness via growth rates is easier say than done. Especially since auxotrophs and bradytrophs have quirkier behaviours than prototrophs.


One of the most popular multiplate reader brands, Biotek, has a software called Gen5, which gives the steepest slope as the growth rate, which is a terrible idea.
R has a library (grofit) than I haven't found satisfactory as it's an inflexible, cumbersome and a one trick pony —one of those R libraries someone wrote for their specific purposes and as a result the inputted data needs to be in a specific way.
As the maths is simple, but the problems are unique, I prefer writing my own so I can tinker with it.
For curve analysis I use Matlab, because at its core is way better written than R even if there is less biocommunity-written code and it has a rather unique syntax. This post deals with the snippets of code I have written for it in the hope it will help other.


The first problem encountered is specific to the reader I use (BioTek). By default —but changeable— the report gives a table where the rows are timepoints, while the columns are wells listed going across each plate row.  In Matlab when one linearises a matrix (a(:)), the values are listed down each column, therefore the plate needs to be rotated. This is not that simple as the matrix needs to be converted into a 3rd order tensor and then the 3rd and 2nd orders switched and then converted back:
newplate=reshape(permute(reshape(plate,size(plate,1),12,8),[1 3 2]),size(plate,1),96,1);

Outlier elimination

Bubbles are anecdotally blamed for strange outliers, which makes sense. These can be easily removed by smoothing.
for i=1:96


Baseline normalisation is a straightforward process. The first point, which should be the lowest value is the baseline and subtracted from the curve. In many cases, e.g. fancy synthetic biology stuff with GFP, the GFP levels are not noise, but may dip due to the change going from a stationary overnight culture to a fresh media. So the zero is the minimum value seen.
plate = (smoothplate - repmat(min(smoothplate),size(smoothplate,1),1));


So there are papers upon papers that discuss what equation best fits a sigmoidal curve —the key paper to read is this one. The classic one is a logistic curve. A fancier one is the Gompertz equation, which better fits the extreme cases, even if it disobeys the principle of dimensional homogeneity. In my experience with actual data, the differences are so minor and the phenomena seen are so major that such overcomplication is unwarranted. The main thing to do is give good boundary conditions for the fitting to avoid flatlining in border cases.
%As a separate m-file (as an anonymous function is less clear, but would be within the same file)
function y = growthcurve(x, odmax, odlamb, odmu)
y = (1+exp(4*odmu/odmax*(odlamb-x)+2)).\odmax;

function logidata = growthfit(data, interval)
%given a 96 vertically linearised 96-well plate returns a (96,4) sized
%matrix, where the first column is max od, second is slope, third is lag
%and fourth is R^2
%this function assumed the data is zeroed!
spindex = reshape(1:96, 12, 8).';

hold on
for i=1:96
    options = fitoptions('growthcurve(x, odmax, tlambda, odmu)');
    % max set at within 20% error of endpoint. change slp(end) to max(slp) for max 
    options.StartPoint=[slp(end), 0, slp(end)/t(end)];
    options.Lower =[slp(end)*0.90, slp(end)/t(end), 0];
    options.Upper =[slp(end)*1.10, Inf, t(end)]; %say it cannot drop more than to 1/2.
    [fo,gof]=fit( t, slp, fittype('growthcurve(x, odmax,tlambda,odmu)'), options);
    axis off;


There are several problems to this approach (which I will write in detail soon…).

  • Missing lag phase
  • Missing stationary phase
  • Death phase
  • Clumping causing a greater OD than expected with occasional weird peaks
  • Residual supplements causing a step like lag phase
  • Cheats and contaminants causing an increase in the growth rate

Technically, these issues do tell a lot about the strains, but there is so little litterature on the matter that one would have to do a lot of work giving definite proofs that they are best disregarded for papers.

Other functions

In addition to the functions mentioned here, I also wrote two handy functions.
As I want to see my data as a plate I wrote the function platelayout which is just a pretty imagesc. the arguments are a 96 vector and a string for a title.
platelayout(max(rawod),'highest recorded OD in each well')

If a well is dodgy and I want to plot it, I wrote platename. Which if given a string like 'A2', will give a number, e.g. 9. If given a number gives a str. It does not accept vectors yet. so to get a cell array with wells one would need to do something like

No comments:

Post a Comment