# Endy:F2620/Data Processing/Algorithm

## Background subtraction

We subtracted a media background, [math]\displaystyle{ A_{media} }[/math], from the raw absorbance data, [math]\displaystyle{ A_{raw} }[/math], and assumed that the resulting data, [math]\displaystyle{ A_{corrected} }[/math], was directly proportional to the number of cells in the well.

[math]\displaystyle{ \frac{}{}A_{corrected} = A_{raw}-A_{media} }[/math] | ...Equation 1 |

We subtracted a fluorescent protein-free cell background, [math]\displaystyle{ G_{cells} }[/math], from the the raw fluorescent data, [math]\displaystyle{ G_{raw} }[/math], and assumed that the resulting data [math]\displaystyle{ G_{corrected} }[/math] was proportional to the total number of GFP molecules in the well [*include note here about immature GFP?*].

[math]\displaystyle{ \frac{}{}G_{corrected} = G_{raw}-G_{cells} }[/math] | ...Equation 2 |

## Unit conversion

We then used standard calibration curves (see here for absorbance and here for fluorescence) to convert the background-corrected data into absolute units (CFU/well and GFP molecules per well). The calibration equations used are shown in Equations 3 & 4.

[math]\displaystyle{ \frac{}{}CFU = 3.1e8 * A_{corrected} - 1.6e6 }[/math] | ...Equation 3 | |

[math]\displaystyle{ \frac{}{}GFP = 7.0e8 * G_{corrected} + 6.0e11 }[/math] | ...Equation 4 |

## GFP synthesis rate calculations

To calculate the mean synthesis rate of GFP per cell, [math]\displaystyle{ S_{cell} }[/math], we assume the total GFP synthesis rate is equal to the time differential of [math]\displaystyle{ GFP }[/math]. [math]\displaystyle{ S_{cell} }[/math] can be calculated as the total synthesis rate divided by [math]\displaystyle{ CFU }[/math].

[math]\displaystyle{ \frac{}{}S_{total} = \frac{d[GFP]}{dt} }[/math] | ...Equation 5 | |

[math]\displaystyle{ \frac{}{}S_{cell} = \frac{S_{total}}{CFU} }[/math] | ...Equation 6 |

## Ania's c++ code

- Load the data from the excel file. Read headers of the column to know the colony number and AHL type used. Form a lookup table. Separate the medium column at this point. Count how many repeats there is for each type.
- Find the GFP background by finding the non-induced column
- GFPpre-fit by fitting all the GFP background columns
- Fit medium for OD (find mean)
- For each OD subtract this mean (media)
- For each GFP we subtract the fitted background calculated for non-induced cells of this type (e.g. for cog-AHL we subtract fitted results for non induced cog-AHL from the raw data)
- Calibrate GFP relative units to conc of GFP (from Barry's calibration run): 1.16*10e-6*GFP+9.95*10e-4
- Fit GFP
- Fit OD (don't fit media anymore)
- Plot GFP, GFP/OD, dOD/dt, gamma, (GFP/OD)/dT, total sythesis and output (this is for debugging and outputs a huge .pdf and .tex)
- to params.csv outputs all the fitting parameters and errors (the errors are not really important)
- to surfaces.tsv output points for superimposed transfer functions in 3D (so you can plot the 3D surfaces yourself)
- evaluate the fitting equations for the total synthesis at many timepoints and select the hightest value from cog-AHL and store this time value.
- output to transfer.tsv all values of total function for all series at time calculated above and low/high repeat, st dev (Mathworld definition, I think it is what you call standard error), 95% confidence
- plot using gnuplot 3D superimposed lines "ser*.pdf" files (we don't use them anymore) surfaces (those are the green ones we post on wiki) into files "sersurf*.pdf") and the transfer functions to "tranfer.pdf" with 95% confidence intervals, transferlh.pdf transfer functions with low/high errors, where * is series number

Notes: 1. Evaluation of the total synthesis function is done using arbitrary precision numbers. B/c they exceeded double range