# Team:Carnegie Mellon/Mod-Matlab

### From 2012.igem.org

Line 312: | Line 312: | ||

similarly to Degradation.m, takes the data and fits a curve to the data. | similarly to Degradation.m, takes the data and fits a curve to the data. | ||

</p> | </p> | ||

+ | <head> | ||

+ | <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | ||

+ | <title>~/Desktop/MATLAB/DegradationP.m.html</title> | ||

+ | <meta name="Generator" content="Vim/7.3"> | ||

+ | <meta name="plugin-version" content="vim7.3_v6"> | ||

+ | <meta name="syntax" content="matlab"> | ||

+ | <meta name="settings" content="use_css,number_lines"> | ||

+ | <style type="text/css"> | ||

+ | <!-- | ||

+ | pre { font-family: monospace; color: #000000; background-color: #ffffff; } | ||

+ | body { font-family: monospace; color: #000000; background-color: #ffffff; } | ||

+ | .lnr { color: #888888; background-color: #e6e6e6; } | ||

+ | .Statement { color: #b03060; font-weight: bold; } | ||

+ | .Special { color: #8a2be2; } | ||

+ | .Constant { color: #ff8c00; } | ||

+ | .Comment { color: #0000ee; font-style: italic; } | ||

+ | .Identifier { color: #458b74; } | ||

+ | --> | ||

+ | </style> | ||

+ | </head> | ||

+ | |||

+ | <pre> | ||

+ | <span class="lnr"> 1 </span><span class="Identifier">function</span> <span class="Identifier">[</span> beta2 <span class="Identifier">]</span> = DegradationP ( modeldata ) | ||

+ | <span class="lnr"> 2 </span><span class="Comment">%DegradationP</span> | ||

+ | <span class="lnr"> 3 </span> | ||

+ | <span class="lnr"> 4 </span>dPi = modeldata(:,<span class="Constant">6</span>)<span class="Special">;</span> | ||

+ | <span class="lnr"> 5 </span>timeP = modeldata(:,<span class="Constant">1</span>)<span class="Special">;</span> | ||

+ | <span class="lnr"> 6 </span><span class="Comment">%dRi ./ dt = alpha * Ri, solution: R = Ce^(alpha t) ./ alpha</span> | ||

+ | <span class="lnr"> 7 </span>C1 = <span class="Statement">max</span>(dPi)<span class="Special">;</span> | ||

+ | <span class="lnr"> 8 </span><span class="Comment">%ln(Ri ./ C) ./ t = alpha</span> | ||

+ | <span class="lnr"> 9 </span><span class="Statement">for</span> i = <span class="Constant">1</span>:length(dPi) | ||

+ | <span class="lnr">10 </span> <span class="Statement">if</span> dPi(i) <span class="Statement">~</span>= <span class="Constant">0</span> <span class="Statement">&&</span> timeP(i) <span class="Statement">~</span>= <span class="Constant">0</span> | ||

+ | <span class="lnr">11 </span> beta(i) = <span class="Statement">log</span>(dPi(i) <span class="Statement">./</span> C1) <span class="Statement">./</span> timeP(i)<span class="Special">;</span> | ||

+ | <span class="lnr">12 </span> <span class="Statement">else</span> | ||

+ | <span class="lnr">13 </span> beta(i) = <span class="Statement">log</span>(dPi(<span class="Constant">2</span>) <span class="Statement">./</span> C1) <span class="Statement">./</span> timeP(<span class="Constant">2</span>)<span class="Special">;</span> | ||

+ | <span class="lnr">14 </span> <span class="Statement">end</span> | ||

+ | <span class="lnr">15 </span><span class="Statement">end</span> | ||

+ | <span class="lnr">16 </span> | ||

+ | <span class="lnr">17 </span>beta2 = <span class="Statement">-</span><span class="Statement">mean</span>(beta)<span class="Special">;</span> | ||

+ | <span class="lnr">18 </span><span class="Comment">%Pdegra = beta2 * Pt;</span> | ||

+ | <span class="lnr">19 </span><span class="Statement">end</span> | ||

+ | </pre> | ||

+ | |||

+ | |||

<p> | <p> | ||

The degradation functions return alpha2 and beta2 to Fluoro2.m. Fluoro2.m then calls ProteinFunctions.m to convert the protein titration data to | The degradation functions return alpha2 and beta2 to Fluoro2.m. Fluoro2.m then calls ProteinFunctions.m to convert the protein titration data to |

## Revision as of 16:02, 29 September 2012

# Matlab Documentation

**Inputs**

**Inputs**

The inputs to the model are the measurement tables of concentration of dye vs. time. Optional inputs to the model include an in vitro measurement of saturation of the dye, and measurements of the fluorescence of the dye with mRNA and protein synthesis turned off. The first optional measurement can be used to compare the in vitro fluorescence saturation levels with the in vivo fluorescence saturation levels in order to give a scaling factor for the all the measurements in the input. Estimations can be used in place of these to simplify the number of inputs. The second optional measurement can be used to determine the degradation rates of mRNA and protein.

**Walkthrough**

**Walkthrough**

**Fluoro2.m**

This function is the function that is called to run the entire program. In addition, it takes the mRNA titration tables (modeldata) and converts it into fluorescent mRNA concentrations. It then passes the degradation data to the degradation functions, Degradation.m and DegradationP.m to return alpha2 and beta2, the degradation coefficients.

1 function [ PoPSans ] = Fluoro2( matrix, modeldata ) 2 %Fluoro 2: This function takes in a matrix of titrations and determines 3 %both the possible percentage for bound mRNA as well as the actual 4 %fluorescent mRNA concentration from fluorescent input values. 5 6 DNA = 1 * 10^(-9); 7 8 controlc = matrix(end,:); %concentration and fluorescence of the control 9 controlconc = controlc(1); %concentration of dye for the control 10 controldat = controlc(1:end); %fluorescence of the control 11 maxc = max(controldat); 12 concs = matrix(:,1); %concentrations of the dye in the wells 13 concs1 = concs(1:(end - 2)); 14 controlmax = maxc; 15 16 Rf = []; 17 18 for i = 2:size(matrix, 2); 19 fluordat = matrix(:,i); %fluoroscence data at some time point 20 fluordat1 = fluordat(1:(end - 2)); 21 s = fitoptions('Method', 'NonlinearLeastSquares', 'Startpoint', [fluordat1(end), 1/(controlconc)]); 22 g = fittype('a * (1 - exp(b * (-x)))', 'coefficients', {'a', 'b'}, 'options', s); 23 h = fit(concs1, fluordat1, g); 24 %figure(i); 25 %plot(h, concs1, fluordat1) 26 factorScale = h(1) / controlmax; %scaling factor from in vitro to in vivo 27 for j = 1:size(concs1); 28 if abs(h(concs1(j)) - h(1)) <= (.2 * h(1)); 29 Rf(i - 1) = concs1(j) * factorScale; 30 break 31 end 32 end 33 34 end 35 time = matrix(1,:); 36 fluortime = time(2:size(matrix, 2)); 37 38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 39 %Section for Transcriptional Efficiency % 40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 41 42 Rt = FluoroLR(Rf, fluortime); 43 44 45 alpha2 = Degradation(modeldata); 46 47 ETF = mRNAexpress(fluortime, DNA, Rt, alpha2); 48 %ETF = mean(ETF); 49 50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 51 %Section for Translational Efficiency % 52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 53 54 Pt = ProteinFunctions(matrix); 55 56 beta2 = DegradationP(modeldata); 57 58 Tl = proteinexpress(DNA, Pt, ETF, alpha2, beta2); 59 60 %Tl = proteinexpress(DNA, 1.6, ETF, alpha2, beta2) 61 62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 63 %Section for Polymerase per Second % 64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 65 66 PoPSans = PoPS(alpha2, beta2, Pt, Tl); 67 68 end

**Degradation.m**

This function takes in mRNA fluorescence data with mRNA synthesis turned off. This makes determining degradation rates easier, as all the change (as we will define degradation) in the mRNA concentration will be due to degradation. The function takes the data and fits a curve to the data, in the process calculating the degradation rate.

1 function [ alpha2 ] = Degradation ( modeldata ) 2 dRi = modeldata(:,3); 3 time = modeldata(:,1); 4 %dRi(length(dRi),:) = []; 5 C = max(dRi); 6 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7 %Differential Equation: dRi./dt = alpha * Rt% 8 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 9 10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 11 %dRi is the fluorescence measurements of RNA during degradation only% 12 %alpha is the desired result, so we solve the diff eq % 13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 14 15 for i = 1:(length(dRi)); 16 if dRi(i) ~= 0 && time(i) ~= 0 17 alpha(i) = log(dRi(i) ./ C) ./ time(i); 18 else 19 alpha(i) = log(dRi(2) ./ C) ./ time(2); 20 end 21 end 22 alpha; 23 alpha2 = -mean(alpha); 24 %Rdegra = Rt * alpha2; 25 26 end

**DegradationP.m**

This function has a similar role to Degradation.m. This function takes in protein fluorescence data with protein synthesis turned off. This function, similarly to Degradation.m, takes the data and fits a curve to the data.

1 function [ beta2 ] = DegradationP ( modeldata ) 2 %DegradationP 3 4 dPi = modeldata(:,6); 5 timeP = modeldata(:,1); 6 %dRi ./ dt = alpha * Ri, solution: R = Ce^(alpha t) ./ alpha 7 C1 = max(dPi); 8 %ln(Ri ./ C) ./ t = alpha 9 for i = 1:length(dPi) 10 if dPi(i) ~= 0 && timeP(i) ~= 0 11 beta(i) = log(dPi(i) ./ C1) ./ timeP(i); 12 else 13 beta(i) = log(dPi(2) ./ C1) ./ timeP(2); 14 end 15 end 16 17 beta2 = -mean(beta); 18 %Pdegra = beta2 * Pt; 19 end

The degradation functions return alpha2 and beta2 to Fluoro2.m. Fluoro2.m then calls ProteinFunctions.m to convert the protein titration data to fluorescent protein concentrations.

**ProteinFunctions.m**

This function does the same thing as Fluoro2.m with the mRNA titration data. It returns fluorescent protein concentrations over time.

Fluoro2.m takes the fluorescent protein and fluorescent mRNA concentrations and passes them to FluoroLR.m and FluoroLP.m to convert to total protein and total mRNA concentrations.

**FluoroLR.m**

This function takes in fluorescent mRNA concentrations and converts it to mRNA concentrations using first-order chemical reactions. One dye molecule will bond to one mRNA molecule, creating an mRNA-dye complex. This leads to a rather simple conversion using the known dye concentration.

\begin{equation}K_{D_R} = \frac{[R_f]}{([R]_0 - [R_f])([D_R]_0 - [R_f])}\end{equation}Where KDR is the dissociation constant, $[Rf]$ is the fluorescent mRNA concentration, $[R]$ is the mRNA concentration, and $[D_R]$ is the dye concentration.

**FluoroLP.m**

This function has a similar role to FluoroLR.m, except using fluorescent protein concentrations and converting it to protein concentration.

**mRNAexpress.m**

Fluoro2.m then takes the total mRNA concentrations passed by FluoroLR.m and passes it to mRNAexpress.m, which calculates the transcriptional efficiency. This is done via the differential equation

\begin{equation}\frac{d[R]}{dt} = Ts \cdot [D] - \alpha \cdot [R]\end{equation}to which the solution is

\begin{equation} Ts = \frac{[R] \cdot \alpha}{[D] \cdot (1 - e^{-\alpha \cdot t})}\end{equation}

where $[R]$ is mRNA concentration, $Ts$ is transcriptional efficiency, $[D]$ is DNA concentration, and $\alpha$ is the mRNA degradation coefficient.

**proteinexpress.m**

Fluoro2.m takes the transcriptional efficiency from mRNAexpress.m, total protein concentrations from FluoroLP.m, and alpha2 and beta2 from Degradation.m and DegradationP.m, and passes them to proteinexpress.m. proteinexpress.m computes the translational efficiency using the differential equation

\begin{equation}\frac{d[P]}{dt} = [R] \cdot Tl - \beta \cdot [P]\end{equation}

to which the solution is

\begin{equation}Tl = \frac{[P]}{\frac{Ts \cdot [D]}{(\alpha \cdot \beta)} \cdot (1 - e^{-\beta \cdot t}) - \frac{Ts \cdot [D]}{\alpha \cdot (-\alpha + \beta)} \cdot (e^{-\alpha \cdot t} - e^{-\beta \cdot t})} \label{eq:Tl}\end{equation}

where Tl is translational efficiency, beta is the protein degradation coefficient, and [P] is the protein concentration.

**PoPS.m**

Fluoro2.m passes to the final function alpha2 and beta2 from Degradation.m and DegradationP.m, total protein concentration from FluoroLP.m, and translational efficiency from proteinexpress.m. PoPS.m calculates the approximate polymerase per second using the equation

\begin{equation}PoPS = \frac{\alpha \cdot \beta \cdot [P]}{n \cdot Tl} \label{eq:PoPS}\end{equation}

where n is the approximate number of the promoters of interest in a cell (i.e. plasmid copy).

** **

**Outputs**

**Outputs**

The model outputs polymerase per second, although transcriptional efficiency and translational efficiency are also important factors in the model. Derivations of these equations can be found on the derivations page.