Difference between revisions of "Team:Dundee/Modeling/Appendix1"
Fmacfarlane (Talk | contribs) |
Fmacfarlane (Talk | contribs) |
||
(141 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<html> | <html> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | <script type="text/javascript" | ||
+ | src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> | ||
+ | </script><!--This script allows mathjax equations to be implemented within the html.--> | ||
+ | |||
<script> | <script> | ||
$('.chevron_toggleable').on('click', function() { | $('.chevron_toggleable').on('click', function() { | ||
$(this).toggleClass('glyphicon-chevron-down glyphicon-chevron-up'); | $(this).toggleClass('glyphicon-chevron-down glyphicon-chevron-up'); | ||
}); | }); | ||
− | </script> | + | </script><!--This script allows buttons to do something on the click.--> |
+ | |||
<script type="text/javascript"> | <script type="text/javascript"> | ||
$(document).ready(function(){ | $(document).ready(function(){ | ||
Line 20: | Line 29: | ||
}); | }); | ||
}); | }); | ||
− | </script> | + | </script><!--Script that allows for easier scrollibility and allows for internal links on the page.--> |
+ | |||
<script type="text/x-mathjax-config"> | <script type="text/x-mathjax-config"> | ||
MathJax.Hub.Config({ | MathJax.Hub.Config({ | ||
TeX: { equationNumbers: { autoNumber: "AMS" } } | TeX: { equationNumbers: { autoNumber: "AMS" } } | ||
}); | }); | ||
− | </script> | + | </script><!--This allows for equations to be numbered in order of appearance.--> |
− | <!-- | + | |
+ | |||
<script type="text/x-mathjax-config"> | <script type="text/x-mathjax-config"> | ||
MathJax.Hub.Config({ | MathJax.Hub.Config({ | ||
TeX: {extensions: ["mhchem.js"]} | TeX: {extensions: ["mhchem.js"]} | ||
}); | }); | ||
− | </script> | + | </script><!--The script tag is to allow for Latex chemical schematics/equations to be shown--> |
− | <!--The | + | |
+ | |||
<script type="text/javascript" | <script type="text/javascript" | ||
− | src="https:// | + | src="https://2015.igem.org/common/MathJax-2.5-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> |
− | </script> | + | </script><!--The script tag allows for MathJax to be used, a language that allows for Latex code to be displayed in html--> |
+ | <!--The script tag allows for MathJax to be used, a language that allows for Latex code to be displayed in html--> | ||
<style> | <style> | ||
+ | .MathJax_Display { | ||
+ | color: #FFFFFF !important; | ||
+ | } | ||
+ | .codeinput{ color:#000000; font-size:10pt } | ||
+ | span.keyword { color:#0000FF; font-size:10pt } | ||
+ | span.comment { color:#228B22; font-size:10pt } | ||
+ | span.string { color:#A020F0; font-size:10pt } | ||
+ | span.untermstring { color:#B20000; font-size:10pt } | ||
+ | span.syscmd { color:#B28C00; font-size:10t } | ||
+ | </style><!--This formats classes to match font colour with that from MATLAB editor and ensures latex equatinos are white.--> | ||
+ | <meta name="viewport" content="width=device-width, initial-scale=1.0"><!--This ensures page is compatible with mobile device.--> | ||
− | + | <header id="header-modelling-appendix"> | |
− | + | <a class="anchor" id="top"></a><!--Sets anchor so that this section can be returned to by using the #top command.--> | |
− | + | ||
− | + | ||
− | + | ||
− | < | + | |
− | + | ||
− | + | ||
− | <a class="anchor" id="top"></a> | + | |
<center> | <center> | ||
<h1><highlight class="highlight">Appendix 1</highlight></h1> | <h1><highlight class="highlight">Appendix 1</highlight></h1> | ||
− | <h3><highlight class="highlight"> | + | <br> |
+ | <h3><highlight class="highlight">FluID Code</highlight></h3> | ||
</center> | </center> | ||
− | </header> | + | |
+ | </header><!--Inserts centered header (h1) and sub-header(h3)--> | ||
<body> | <body> | ||
+ | <font colour="white"><!--Sets font size to 5 and colour to white to allow for easier readability--> | ||
+ | <a class="anchor" id="end"></a><!--Sets anchor so that this section can be returned to by using the #end command.--> | ||
+ | <section id="end"> | ||
+ | <div class="row3"> | ||
+ | <div class="row"> | ||
+ | |||
+ | <div class="col-lg-12 feature" style=""> | ||
+ | <div class="row"> | ||
+ | <br><!--Adds a line break--> | ||
+ | <p>To see the MATLAB code for the Fingerprint Ageing section of the project or the Chromate Biosensor section of the project use the following buttons.</p> | ||
+ | <br><!--Adds a line break--> | ||
+ | <a href="https://2015.igem.org/Team:Dundee/Modeling/Appendix3" class="btn btn-primary btn-lg pull-right" role="button">Appendix 3: Chromate Biosensor</a> | ||
− | <a class="anchor" id="Blood_code"></a> | + | <a href="https://2015.igem.org/Team:Dundee/Modeling/Appendix2" class="btn btn-primary btn-lg pull-right" role="button">Appendix 2: Fingerprint Ageing</a> |
+ | </div> | ||
+ | |||
+ | </div> | ||
+ | </div> | ||
+ | |||
+ | |||
+ | </div> | ||
+ | </section> | ||
+ | |||
+ | |||
+ | |||
+ | <a class="anchor" id="selection"></a><!--Sets anchor so that this section can be returned to by using the #selection command.--> | ||
+ | <section id="about" class="row1"> | ||
+ | <div class="row"> | ||
+ | <div class="col-md-3"> | ||
+ | <a href="#Blood_code" class="scroll"> <span class="glyphicon glyphicon-tint" type="button"></span></a> <!--Button that navigates to specific section within the page--> | ||
+ | <h3>MATLAB for Blood</h3> | ||
+ | |||
+ | </div> | ||
+ | <div class="col-md-3"> | ||
+ | <a href="#Semen_code" class="scroll"><span class="glyphicon glyphicon-tint" type="button"></span></a><!--Button that navigates to specific section within the page--> | ||
+ | <h3>MATLAB for Semen</h3> | ||
+ | |||
+ | </div> | ||
+ | <div class="col-md-3"> | ||
+ | <a href="#Saliva_code" class="scroll"><span class="glyphicon glyphicon-tint" type="button"></span></a> <!--Button that navigates to specific section within the page--> | ||
+ | <h3>MATLAB for Saliva</h3> | ||
+ | |||
+ | </div> | ||
+ | <div class="col-md-3"> | ||
+ | <a href="#Nasal_code" class="scroll"><span class="glyphicon glyphicon-tint" type="button"></span></a> <!--Button that navigates to specific section within the page--> | ||
+ | <h3>MATLAB for Nasal Mucus</h3> | ||
+ | |||
+ | </div> | ||
+ | </div> | ||
+ | </section> | ||
+ | |||
+ | <div class="container"><!--All content within this division will be of the container class, therfore will have a margin--> | ||
+ | |||
+ | <a class="anchor" id="Blood_code"></a><!--Sets anchor so that this section can be returned to by using the #Blood_code command.--> | ||
<section id="Blood_code"> | <section id="Blood_code"> | ||
<div class="row3"> | <div class="row3"> | ||
<div class="row"> | <div class="row"> | ||
− | + | ||
− | + | ||
− | + | ||
<div class="col-lg-12 feature" style=""> | <div class="col-lg-12 feature" style=""> | ||
<div class="row"> | <div class="row"> | ||
+ | |||
+ | |||
+ | |||
− | < | + | <h2><b>Blood: MATLAB Code</b></h2> |
− | $$ | + | <br><!--Adds a line break--> |
+ | <p>The figure shown in the <u><a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#blood"><!--Links to figure on another page.-->haptoglobin and haemoglobin binding model</a></u> were created using MATLAB. Before using MATLAB the original system of equations was non-dimensionalised to the system:</p> | ||
+ | |||
+ | $$ | ||
+ | |||
\begin{eqnarray*} | \begin{eqnarray*} | ||
− | \frac{dHp}{d\tau}&=&[Hp\cdot \alpha_{H}]-\lambda Hp \alpha_{H}, | + | \frac{dHp}{d\tau}&=&[Hp\cdot \alpha_{H}]-\lambda Hp \alpha_{H},\\ |
− | \frac{d\alpha_{H}}{d\tau}&=&[Hp\cdot \alpha_{H}]-\lambda Hp \alpha_{H}, | + | \frac{d\alpha_{H}}{d\tau}&=&[Hp\cdot \alpha_{H}]-\lambda Hp \alpha_{H},\\ |
− | \frac{d[Hp \cdot \alpha_{H}]}{d\tau}&=&\lambda Hp \alpha_{H}-[Hp \cdot \alpha_{H}]-\gamma [Hp \cdot \alpha_{H}], | + | \frac{d[Hp \cdot \alpha_{H}]}{d\tau}&=&\lambda Hp \alpha_{H}-[Hp \cdot \alpha_{H}]-\gamma [Hp \cdot \alpha_{H}],\\ |
\frac{d[Hp \cdot \alpha_{H} \cdot \beta_{H}]}{d\tau}&=&\gamma [Hp \cdot \alpha_{H}]. | \frac{d[Hp \cdot \alpha_{H} \cdot \beta_{H}]}{d\tau}&=&\gamma [Hp \cdot \alpha_{H}]. | ||
− | \end | + | \end{eqnarray*} |
+ | $$ | ||
+ | <!--Mathjax equations are surronded by $$ $$--> | ||
+ | <p>The initial conditions were also non-dimensionalised to become:</p> | ||
$$ | $$ | ||
− | <p> | + | \begin{eqnarray*} |
+ | Hp(0)&=&4.17,\\ | ||
+ | \alpha_{H}(0)&=&1,\\ | ||
+ | [Hp \cdot \alpha_{H}](0)&=&0,\\ | ||
+ | [Hp \cdot \alpha_{H} \cdot \beta_{H}](0)&=&0. | ||
+ | \end{eqnarray*} | ||
+ | $$ | ||
+ | <p>Two files were written to perform sensitivity analysis; one to set the function (haptosen.m) and one to solve the function and plot the results in <u><a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#fig1">Figure 1</a></u> (run_haptosen.m). Both files are shown below, where the green is comments to aid in understanding of the scripts.</p> | ||
+ | <br><!--Adds a line break--> | ||
</div> | </div> | ||
− | + | </div> | |
− | + | ||
</div> | </div> | ||
− | + | </div> | |
+ | </section> | ||
− | |||
− | |||
+ | <div class="content"><pre class="codeinput"><!--This marks the beginning of the input copied from matlab published html.--> | ||
+ | <span class="comment"><b><font size='6' color='green'>MATLAB code from haptosen.m file</b></font></span> | ||
− | + | <span class="comment"><b>% Function to define the non-dimensionalised system of ODEs describing the binding between Haptoglobin and Haemoglobin.</b></span> | |
− | + | <span class="comment">% u is a 4 dimensional vector where;</span> | |
− | <span class="comment">% | + | <span class="comment">% u(1)=Hp (haptoglobin concentration),</span> |
− | + | <span class="comment">% u(2)=\alpha (free haemoglobin concentration),</span> | |
− | <span class="comment">% u(1)=Hp ( | + | <span class="comment">% u(3)= [\alpha \cdot Hp] (haptoglobin and haemoglobin initial complex concentration),</span> |
− | <span class="comment">% u(2)= | + | <span class="comment">% u(4)= [\alpha \cdot Hp \cdot \beta] (final haemoglobin/haptoglobin complex concentration).</span> |
− | <span class="comment">% u(3)= | + | <span class="comment">% Parameter t is the time that the simulation is run over.</span> |
− | <span class="comment">% u(4)= | + | <span class="comment">% Parameter lambda represents the parameter in the system determined by binding rates and initial concentration of haemoglobin.</span> |
− | <span class="comment">% t is the time that the simulation is run over.</span> | + | <span class="comment">% Parameter gamma represents the parameter in the system determined by binding rates.</span> |
− | <span class="comment">% lambda represents the parameter in the system determined by binding rates | + | |
− | <span class="comment">% gamma represents the parameter in the system determined by binding rates.</span> | + | |
<span class="keyword">function</span> f = haptosen(t,u,lambda,gamma); | <span class="keyword">function</span> f = haptosen(t,u,lambda,gamma); | ||
− | <span class="comment">% | + | <span class="comment">% Define the system of ODEs by setting the vector f = right hand side of the system.</span> |
f = [u(3)-lambda.*u(1)*u(2); | f = [u(3)-lambda.*u(1)*u(2); | ||
u(3)-lambda.*u(1)*u(2); | u(3)-lambda.*u(1)*u(2); | ||
Line 111: | Line 196: | ||
<span class="keyword">end</span> | <span class="keyword">end</span> | ||
− | <span class="comment">% This function can then be called in the run_haptosen.m file by using</span> | + | <span class="comment">% This function can then be called in the run_haptosen.m file by using the @haptosen command.</span> |
− | <span class="comment">% | + | <span class="comment">% END OF FILE</span> |
+ | <span class="comment"> <b><font size='6' color='green'>MATLAB code from run_haptosen.m file</b></font></span> | ||
− | + | <span class="comment"><b>% File to perform sensitivity analysis for haptoglobin and haemoglobin binding model.</b></span> | |
− | + | ||
− | <span class="comment">% a is the number of values chosen for each of the ranges of parameters | + | <span class="comment">% Variable a is the number of values chosen for each of the ranges of parameters, 100 different values were chosen..</span> |
− | + | ||
a=100; | a=100; | ||
− | <span class="comment">% | + | <span class="comment">% Define lambda1 as the range of values for the parameter lambda, chosen with the maximum value as twice the expected value.</span> |
− | + | ||
lambda1=linspace(0,((100/317)*0.3878494524)*2,a); | lambda1=linspace(0,((100/317)*0.3878494524)*2,a); | ||
− | <span class="comment">% | + | <span class="comment">% Define gamma1 as the range of values for the parameter gamma, chosen with the maximum value as twice the expected value.</span> |
− | + | ||
gamma1=linspace(0,(83/317)*2,a); | gamma1=linspace(0,(83/317)*2,a); | ||
− | <span class="comment">%T is the final time of the simulation.</span> | + | <span class="comment">% T is the final time of the simulation, in seconds.</span> |
T=30; | T=30; | ||
− | <span class="comment">% Store | + | <span class="comment">% Define Store as an empty matrix for the final concentrations of the complex with the varied parameter values.</span> |
− | + | ||
Store = zeros(a,a); | Store = zeros(a,a); | ||
− | <span class="comment">%figure(1) calls up a new figure.</span> | + | <span class="comment">% Command figure(1) calls up a new figure.</span> |
figure(1) | figure(1) | ||
− | <span class="comment">% The for loop solves the ode system defined in haptosen function using ode23 for the range of values for both | + | <span class="comment">% The for loop solves the ode system defined in haptosen function using ode23 for the range of values for both parameters.</span> |
− | + | ||
<span class="keyword">for</span> i=1:a | <span class="keyword">for</span> i=1:a | ||
<span class="keyword">for</span> j=1:a | <span class="keyword">for</span> j=1:a | ||
[t,u]=ode23(@haptosen,[0 T],[4.17 1 0 0],[],lambda1(a+1-i),gamma1(j)); | [t,u]=ode23(@haptosen,[0 T],[4.17 1 0 0],[],lambda1(a+1-i),gamma1(j)); | ||
Store(i,j) = u(end,4); | Store(i,j) = u(end,4); | ||
− | + | ||
<span class="keyword">end</span> | <span class="keyword">end</span> | ||
<span class="keyword">end</span> | <span class="keyword">end</span> | ||
− | <span class="comment">%imagesc plots the surf plot of the parameters and the complex | + | <span class="comment">% Command imagesc plots the surf plot of the parameters and the complex concentration.</span> |
− | + | ||
imagesc(Store) | imagesc(Store) | ||
<span class="comment">% xlabel and ylabel add labels to the plot.</span> | <span class="comment">% xlabel and ylabel add labels to the plot.</span> | ||
xlabel(<span class="string">'Increasing \lambda'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | xlabel(<span class="string">'Increasing \lambda'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
ylabel(<span class="string">'Increasing \gamma'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ylabel(<span class="string">'Increasing \gamma'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
− | <span class="comment">%set removes the x and y axis</span> | + | <span class="comment">% Command set removes the x and y axis values.</span> |
set(gca,<span class="string">'YTick'</span>,[],<span class="string">'XTick'</span>,[]); | set(gca,<span class="string">'YTick'</span>,[],<span class="string">'XTick'</span>,[]); | ||
− | <span class="comment">% The following lines add a colour bar with defined | + | <span class="comment">% The following lines add a colour bar with defined label and text.</span> |
c=colorbar(<span class="string">'Ticks'</span>,[0,0.99],<span class="string">'TickLabels'</span>,{<span class="string">'None'</span>,<span class="string">'High'</span>},<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | c=colorbar(<span class="string">'Ticks'</span>,[0,0.99],<span class="string">'TickLabels'</span>,{<span class="string">'None'</span>,<span class="string">'High'</span>},<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
c.Label.String = <span class="string">'Complex Concentration'</span>; | c.Label.String = <span class="string">'Complex Concentration'</span>; | ||
− | <span class="comment">% | + | <span class="comment">% The following lines add a text arrow to allow for annotation of the graph with defined colours positions and width.</span> |
ta1 = annotation(<span class="string">'textarrow'</span>, [0.13 0.79], [0.13 0.92]); | ta1 = annotation(<span class="string">'textarrow'</span>, [0.13 0.79], [0.13 0.92]); | ||
h = text(0.5,0.5,<span class="string">'Complex Formation'</span>); | h = text(0.5,0.5,<span class="string">'Complex Formation'</span>); | ||
Line 169: | Line 249: | ||
ta1.Color = <span class="string">'red'</span>; | ta1.Color = <span class="string">'red'</span>; | ||
ta1.LineWidth= 4; | ta1.LineWidth= 4; | ||
− | </pre>< | + | <span class="comment">% END OF FILE</span> |
− | + | </pre> | |
− | + | <a href="#selection" class="btn btn-info btn-lg pull-right" role="button">↑</a><!--Button that takes user to top of page.--> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | end | + | <a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#blood" class="btn btn-primary btn-lg pull-right" role="button">View description of model</a> <!--Button navigates to relevant section in FluID page--> |
− | % This function can then be called in the | + | |
− | + | ||
− | + | ||
− | + | ||
− | % File to perform sensitivity analysis for | + | <a class="anchor" id="Semen_code"></a><!--Sets anchor so that this section can be returned to by using the #Semen_code command.--> |
− | % binding model. | + | <section id="Semen_code"> |
− | % a | + | <div class="row3"> |
− | + | <div class="row"> | |
− | a= | + | |
− | % | + | <div class="col-lg-12 feature" style=""> |
− | + | <div class="row"> | |
− | + | ||
− | % | + | <h2><b>Semen: MATLAB Code</b></h2> |
− | + | <br><!--Adds a line break--> | |
− | + | <p>The figures shown in the <u><a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#semen"><!--Links to relevant model in FluID page-->spermidine and potD binding model</a></u> were created using MATLAB. Before using MATLAB the original system of equations was non-dimensionalised to the system:</p> | |
− | %T is the final time of the simulation. | + | $$ |
− | T= | + | |
− | % Store | + | \begin{eqnarray*} |
− | + | \frac{dP}{d\tau}&=&C-\kappa P S,\\ | |
+ | \frac{dS}{d\tau}&=&C-\kappa P S,\\ | ||
+ | \frac{dC}{d\tau}&=&\kappa P S -C. | ||
+ | \end{eqnarray*} | ||
+ | $$<!--Mathjax equations are surrounded by $$ $$ --> | ||
+ | <p>The initial conditions were also non-dimensionalised to become:</p> | ||
+ | $$ | ||
+ | |||
+ | \begin{eqnarray*} | ||
+ | P(0)&=&R_{0},\\ | ||
+ | S(0)&=&1,\\ | ||
+ | C(0)&=&0. | ||
+ | \end{eqnarray*} | ||
+ | |||
+ | $$ | ||
+ | <p>Two files were written to perform sensitivity analysis; one to set the function (spermsen.m) and one to solve the function and plot the results in <u><a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#fig2">Figure 2</a></u>, <u><a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#fig3">Figure 3</a></u> and <u><a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#fig4">Figure 4</a></u> (run_spermsen.m). Both files are shown below, where the green is comments to aid in understanding of the scripts.</p> | ||
+ | <br><!--Adds a line break--> | ||
+ | |||
+ | </div> | ||
+ | |||
+ | </div> | ||
+ | </div> | ||
+ | |||
+ | |||
+ | </div> | ||
+ | </section> | ||
+ | <div class="content"><pre class="codeinput"><!--This marks the beginning of the input copied from matlab published html.--><span class="comment"><b><font size='6' color='green'>MATLAB code from spermsen.m file.</b></font></span> | ||
+ | <span class="comment"><b>%% Function to define the non-dimensionalised system of ODEs describing the binding between spermidine and potD.</b></span> | ||
+ | <span class="comment">% Parameter u is a 3 dimensional vector where;</span> | ||
+ | <span class="comment">% u(1)= P (potD concentration),</span> | ||
+ | <span class="comment">% u(2)= S (spermidine concentration),</span> | ||
+ | <span class="comment">% u(3)= C (potD and spermidine complex concentration).</span> | ||
+ | <span class="comment">% Parameter t is the time that the simulation is run over.</span> | ||
+ | <span class="comment">% Parameter kappa is the binding parameter determined by the binding rates and initial concentration of spermidine.</span> | ||
+ | <span class="keyword">function</span> f = spermsen(t,u,kappa) | ||
+ | <span class="comment">% Define the system of ODEs by setting the vector f = right hand side of the system.</span> | ||
+ | f = [u(3)-kappa.*u(1)*u(2); | ||
+ | u(3)-kappa.*u(1)*u(2); | ||
+ | kappa.*u(1)*u(2)-u(3)]; | ||
+ | <span class="comment">% The function is then ended.</span> | ||
+ | <span class="keyword">end</span> | ||
+ | <span class="comment">% This function can then be called in the run_spermsen.m file by using the @spermsen command.</span> | ||
+ | <span class="comment">% END OF FILE</span> | ||
+ | |||
+ | |||
+ | <span class="comment"><b><font size='6' color='green'>MATLAB code for run_spermsen.m file.</b></font></span> | ||
+ | <font color="green"> | ||
+ | <span class="comment"><b>%% Section 1: File to perform sensitivity analysis for potD and spermidine binding model.</b></span> | ||
+ | |||
+ | <span class="comment">% This section runs the analysis on both the binding parameter kappa and the ratio between potD and spermidine, u0 (R0 in the described model).</span></font> | ||
+ | <span class="comment">% Define a as the number of datapoints in the range for both kappa and u0, chosen to be 50.</span> | ||
+ | a=50; | ||
+ | <span class="comment">% Define kappa1 as the range of values for kappa that the system will be solved over, where the maximum value is twice the expected value.</span> | ||
+ | kappa1=linspace(0,(129.0875)*2,a); | ||
+ | <span class="comment">% Define u0 as the range of values for u0 that the system will be solved over, where the maximum value is four times the expected value.</span> | ||
+ | u0=linspace(0,2,a); | ||
+ | <span class="comment">% T is the final time of the simulation, in seconds.</span> | ||
+ | T=0.10; | ||
+ | <span class="comment">% Store is set as an empty matrix that will be filled by the values for the complex concentration for each of the values of kappa and u0.</span> | ||
Store = zeros(a,a); | Store = zeros(a,a); | ||
− | + | <span class="comment">% The for loop solves the function spermsen.m using ode23 for the range of values of kappa and u0, and stores the complex concentration values in the Store matrix.</span> | |
− | + | <span class="keyword">for</span> i=1:a | |
− | % The for loop solves the | + | <span class="keyword">for</span> j=1:a |
− | + | [t,u]=ode23(@spermsen,[0 T],[u0(a-i+1) 1 0],[],kappa1(j)); | |
− | for i=1:a | + | Store(i,j) = u(end,3); |
− | for j=1:a | + | <span class="keyword">end</span> |
− | [t,u]=ode23(@ | + | <span class="keyword">end</span> |
− | Store(i,j) = u(end, | + | <span class="comment">% Command imagesc plots the complex concentration against u0 and kappa.</span> |
− | + | ||
− | end | + | |
− | end | + | |
− | %imagesc plots | + | |
− | + | ||
imagesc(Store) | imagesc(Store) | ||
− | % | + | <span class="comment">% Command label adds x labels to both the x and y axis.</span> |
− | xlabel('Increasing | + | xlabel(<span class="string">'Increasing R_{0}'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); |
− | ylabel('Increasing \ | + | ylabel(<span class="string">'Increasing \kappa'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); |
− | %set removes the x and y axis | + | <span class="comment">% The set function removes the values from the x and y axis.</span> |
− | set(gca,'YTick',[],'XTick',[]); | + | set(gca,<span class="string">'YTick'</span>,[],<span class="string">'XTick'</span>,[]); |
− | % The | + | <span class="comment">% The color bar function adds a user defined colourbar with the label, 'Complex Concentration'.</span> |
− | c=colorbar('Ticks',[0,0.99],'TickLabels',{'None','High'},'FontSize',15,'FontWeight','bold'); | + | c=colorbar(<span class="string">'Ticks'</span>,[0,0.99],<span class="string">'TickLabels'</span>,{<span class="string">'None'</span>,<span class="string">'High'</span>},<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); |
− | c.Label.String = 'Complex Concentration'; | + | c.Label.String = <span class="string">'Complex Concentration'</span>; |
− | % | + | <span class="comment">% The resulting plot is Figure 2.</span> |
− | + | <span class="comment">%</span> | |
− | + | <span class="comment">%</span> | |
− | + | <span class="comment"><b>%% Section 2: This section is used to plot only u0 against complex concentration over time.</b></span> | |
− | + | <span class="comment">% Define a as the number of datapoints in the range for u0, chosen to be 50.</span> | |
− | + | a=50; | |
− | + | <span class="comment">% Define u0 as the range of values for u0 that the system will be solved over, where the maximum value is four times the expected value.</span> | |
− | + | u0=linspace(0,2,a); | |
− | + | <span class="comment">% Define store as an empty matrix that will be filled by the values for the time values, potD concentration, spermidine concentration and complex concentration for each value of u0.</span> | |
− | + | store = zeros(a,4,a); <span class="comment">% 1st is time, 2:4 are u.</span> | |
− | + | <span class="comment">% The for loop solves spermsen.m for the range of values of u0 and stores the values in the store matrix.</span> | |
− | + | <span class="keyword">for</span> i=1:a | |
− | + | ||
+ | [t,u]=ode23(@spermsen,[0 0.1],[u0(i) 1 0],[],129.0875); | ||
+ | store(end-size(t,1)+1:end,1,i) = t; | ||
+ | store(end-size(t,1)+1:end,2:4,i) = u; | ||
+ | |||
+ | <span class="keyword">end</span> | ||
+ | <span class="comment">% Command figure calls up an empty figure so that figure 2 is not overwritten.</span> | ||
+ | figure | ||
+ | <span class="comment">% Then u0 can be plotted against complex concentration, u(3).</span> | ||
+ | plot(u0,squeeze(store(end,4,:)),<span class="string">'LineWidth'</span>,2); | ||
+ | <span class="comment">% Command label adds x labels to both the x and y axis.</span> | ||
+ | xlabel(<span class="string">'Increasing R_{0}'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | ylabel(<span class="string">'Concentration of Complex Formed'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | <span class="comment">% This plot is Figure 3.</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment"><b>%% Section 3: This section is used to plot only kappa against complex concentration over time.</b></span> | ||
+ | <span class="comment">% Define a as the number of datapoints in the range for kappa, chosen to be 50.</span> | ||
+ | a=50; | ||
+ | <span class="comment">% Define kappa1 as the range of values for kappa that the system will be solved over, where the maximum value is twice the expected value.</span> | ||
+ | kappa1=linspace(0,(129.0875)*2,a); | ||
+ | <span class="comment">% Define store as an empty matrix that will be filled by the values for the time values, potD concentration, spermidine concentration and complex concentration for each value of kappa.</span> | ||
+ | store = zeros(a,4,a); <span class="comment">% 1st is time, 2:4 are u</span> | ||
+ | <span class="comment">% The for loop solves spermsen.m for the range of values of kappa and stores the values in the store matrix.</span> | ||
+ | <span class="keyword">for</span> i=1:a | ||
+ | |||
+ | [t,u]=ode23(@spermsen,[0 0.1],[1.4 1 0],[],kappa1(i)); | ||
+ | store(end-size(t,1)+1:end,1,i) = t; | ||
+ | store(end-size(t,1)+1:end,2:4,i) = u; | ||
+ | |||
+ | <span class="keyword">end</span> | ||
+ | <span class="comment">% Command figure calls up an empty figure so that figure 3 is not overwritten.</span> | ||
+ | figure | ||
+ | <span class="comment">% Then kappa can be plotted against complex concentration, u(3).</span> | ||
+ | plot(kappa1,squeeze(store(end,4,:)),<span class="string">'LineWidth'</span>,2); | ||
+ | <span class="comment">% Command axis tight ensures the axis are not too large for the datapoints.</span> | ||
+ | axis <span class="string">tight</span> | ||
+ | <span class="comment">% Command label adds x labels to both the x and y axis.</span> | ||
+ | xlabel(<span class="string">'Increasing \kappa'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | ylabel(<span class="string">'Concentration of Complex Formed'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | <span class="comment">% This plot is Figure 4.</span> | ||
+ | <span class="comment">% END OF FILE</span> | ||
+ | </pre> | ||
+ | <a href="#selection" class="btn btn-info btn-lg pull-right" role="button">↑</a><!--Button that takes user to top of page.--> | ||
+ | <a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#semen" class="btn btn-primary btn-lg pull-right" role="button">View description of model</a> | ||
− | ##### | + | |
− | --></body></html> | + | <a class="anchor" id="Saliva_code"></a><!--Sets anchor so that this section can be returned to by using the #Saliva_code command.--> |
− | {{:Team:Dundee/navbar}} | + | <section id="Saliva_code"> |
− | {{:Team:Dundee/footer}} | + | <div class="row3"> |
+ | <div class="row"> | ||
+ | |||
+ | <div class="col-lg-12 feature" style=""> | ||
+ | <div class="row"> | ||
+ | |||
+ | <h2><b>Saliva: MATLAB Code</b></h2> | ||
+ | <br><!--Adds a line break--> | ||
+ | <p>The figures shown in the <u><a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#saliva">lactoferrin and LBP binding model</a></u> were created using MATLAB. Before using MATLAB the original system of equations was non-dimensionalised to the system:</p> | ||
+ | $$ | ||
+ | |||
+ | \begin{eqnarray*} | ||
+ | \frac{dLf}{d\tau}&=&[Lf \cdot LBP]-\theta Lf LBP,\\ | ||
+ | \frac{dLBP}{d\tau}&=&[Lf \cdot LBP]-\theta Lf LBP,\\ | ||
+ | \frac{d[Lf \cdot LBP]}{d\tau}&=&\theta Lf LBP -[Lf \cdot LBP]. | ||
+ | \end{eqnarray*} | ||
+ | $$ | ||
+ | <p>The initial conditions were also non-dimensionalised to become:</p> | ||
+ | $$ | ||
+ | |||
+ | \begin{eqnarray*} | ||
+ | Lf(0)&=&1,\\ | ||
+ | LBP(0)&=&v_{0},\\ | ||
+ | [Lf \cdot LBP](0)&=&0. | ||
+ | \end{eqnarray*} | ||
+ | |||
+ | $$ | ||
+ | <p>Two files were written to perform sensitivity analysis; one to set the function (lactofun.m) and one to solve the function and plot the results in <u><a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#fig5">Figure 5</a></u>, <u><a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#fig6">Figure 6</a></u> and <u><a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#fig7">Figure 7</a></u> (run_lactofun.m). Both files are shown below, where the green is comments to aid in understanding of the scripts.</p> | ||
+ | <br><!--Adds a line break--> | ||
+ | |||
+ | </div> | ||
+ | |||
+ | </div> | ||
+ | </div> | ||
+ | |||
+ | |||
+ | </div> | ||
+ | </section> | ||
+ | |||
+ | <div class="content"><pre class="codeinput"><!--This marks the beginning of the input copied from matlab published html.--><span class="comment"><b><font size='6' color='green'>MATLAB code for lactofun.m file.</b></font></span> | ||
+ | <span class="comment"><b>% Function to define the non-dimensionalised system of ODEs describing the binding between lactoferrin and LBP.</b></span> | ||
+ | <span class="comment">% Parameter u is a 3 dimensional vector where;</span> | ||
+ | <span class="comment">% u(1) represents lactoferrin,</span> | ||
+ | <span class="comment">% u(2) represents the lactoferrin binding protein,</span> | ||
+ | <span class="comment">% u(3) represents the final complex.</span> | ||
+ | <span class="comment">% Parameter t is the time that the simulation is run over.</span> | ||
+ | <span class="comment">% Parameter theta is the binding parameter determined by the binding rates and the initial concentration of lactoferrin.</span> | ||
+ | <span class="keyword">function</span> f = lactofun(t,u,theta) | ||
+ | <span class="comment">% Define the system of ODEs by setting the vector f = right hand side of the system.</span> | ||
+ | f=[u(3)-theta.*u(1)*u(2); | ||
+ | u(3)-theta.*u(1)*u(2); | ||
+ | -u(3)+theta.*u(1)*u(2)]; | ||
+ | <span class="comment">% The function is then ended.</span> | ||
+ | <span class="keyword">end</span> | ||
+ | <span class="comment">% This function can then be called in the run_lactofun.m file by using</span> | ||
+ | <span class="comment">% @lactofun command.</span> | ||
+ | <span class="comment">%END OF FILE.</span> | ||
+ | |||
+ | |||
+ | |||
+ | <span class="comment"><b><font size='6' color='green'>MATLAB code for run_lactofun.m file.</b></font></span> | ||
+ | <span class="comment"><b>%% Section 1: File to perform sensitivity analysis for lactoferrin and lactoferrin binding protein binding model.</b></span></p> | ||
+ | <span class="comment">%This section runs the analysis on both the binding parameter theta and the ratio between lactoferrin binding protein and lactoferrin, v0.</span> | ||
+ | <span class="comment">% Variable a is the number of datapoints in the range for both theta and v0, chosen to be 50.</span> | ||
+ | a=50; | ||
+ | <span class="comment">% Define theta1 as the range of values for theta that the system will be solved over, where the maximum value is twice the expected value.</span> | ||
+ | theta1=linspace(0,623.417*2,a); | ||
+ | <span class="comment">% Define v0 as the range of values for v0 that the system will be solved over where the maximum value is four times the expected value.</span> | ||
+ | v0=linspace(0,4,a); | ||
+ | <span class="comment">% T is the final time of the simulation in seconds.</span> | ||
+ | T=10; | ||
+ | <span class="comment">% Set Store as an empty matrix that will be filled by the values for the complex concentration for each of the values of theta and v0.</span> | ||
+ | Store = zeros(a,a); | ||
+ | <span class="comment">% The for loop solves the function lactofun.m using ode23 for the range of values of theta and v0, and stores the complex concentration values in the Store matrix.</span> | ||
+ | <span class="keyword">for</span> i=1:a | ||
+ | <span class="keyword">for</span> j=1:a | ||
+ | [t,u]=ode23(@lacto,[0 T],[1 v0(a-i+1) 0],[],theta1(j)); | ||
+ | Store(i,j) = u(end,3); | ||
+ | <span class="keyword">end</span> | ||
+ | <span class="keyword">end</span> | ||
+ | <span class="comment">% Call up a new figure.</span> | ||
+ | figure(1) | ||
+ | <span class="comment">% Command imagesc plots the complex concentration against v0 and theta.</span> | ||
+ | imagesc(Store) | ||
+ | <span class="comment">% The label function adds x labels to both the x and y axis.</span> | ||
+ | xlabel(<span class="string">'Increasing v_{0}'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | ylabel(<span class="string">'Increasing \theta'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | <span class="comment">% The set function removes the values from the x and y axis.</span> | ||
+ | set(gca,<span class="string">'YTick'</span>,[],<span class="string">'XTick'</span>,[]); | ||
+ | <span class="comment">% The color bar function adds a user defined colourbar with the label, 'Complex Concentration'.</span> | ||
+ | c=colorbar(<span class="string">'Ticks'</span>,[0,0.99],<span class="string">'TickLabels'</span>,{<span class="string">'None'</span>,<span class="string">'High'</span>},<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | c.Label.String = <span class="string">'Complex Concentration'</span>; | ||
+ | <span class="comment">% The resulting plot is Figure 5.</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment"><b>%% Section 2: This section is used to plot only v0 against complex concentration over time.</b></span> | ||
+ | <span class="comment">% Define store1 as an empty matrix that will be filled by the values for the time values, lactoferrin concentration, lactoferrin binding protein concentration and complex concentration for each value of v0.</span> | ||
+ | store1 = zeros(5000,4,a); <span class="comment">% 1st is time, 2:4 are u.</span> | ||
+ | <span class="comment">% The for loop solves lactofun.m for the range of values of v0 and stores the values in the store1 matrix</span> | ||
+ | |||
+ | <span class="keyword">for</span> i=1:a | ||
+ | |||
+ | [t,u]=ode23(@lactofun,[0 T],[1 v0(i) 0],[],5); | ||
+ | store1(end-size(t,1)+1:end,1,i) = t; | ||
+ | store1(end-size(t,1)+1:end,2:4,i) = u; | ||
+ | |||
+ | <span class="keyword">end</span> | ||
+ | <span class="comment">% Command figure calls up an empty figure so that Figure 5 is not overwritten.</span> | ||
+ | figure (2) | ||
+ | <span class="comment">% Then v0 can be plotted against complex concentration, u(3).</span> | ||
+ | plot(v0,squeeze(store1(end,4,:)),<span class="string">'LineWidth'</span>,2); | ||
+ | <span class="comment">% The label function adds x labels to both the x and y axis.</span> | ||
+ | xlabel(<span class="string">'Increasing v_{0}'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | ylabel(<span class="string">'Concentration of Complex Formed'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | <span class="comment">% This plot is Figure 6.</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment"><b>%% Section 3: This section is used to plot only theta against complex concentration over time.</b></span> | ||
+ | <span class="comment">% Define store2 as an empty matrix that will be filled by the values for the time values, lactoferrin concentration, lactoferrin binding protein concentration and complex concentration for each value of theta.</span> | ||
+ | store2 = zeros(5000,4,a); <span class="comment">% 1st is time, 2:4 are u</span> | ||
+ | <span class="comment">% The for loop solves lactofun.m for the range of values of theta and stores the values in the store2 matrix.</span> | ||
+ | <span class="keyword">for</span> i=1:a | ||
+ | |||
+ | [t,u]=ode23(@lactofun,[0 T],[1 1 0],[],theta1(i)); | ||
+ | store2(end-size(t,1)+1:end,1,i) = t; | ||
+ | store2(end-size(t,1)+1:end,2:4,i) = u; | ||
+ | |||
+ | <span class="keyword">end</span> | ||
+ | <span class="comment">% Command figure calls up an empty figure so that Figure 6 is not overwritten.</span> | ||
+ | figure(3) | ||
+ | <span class="comment">% Then theta can be plotted against complex concentration, u(3).</span> | ||
+ | plot(theta1,squeeze(store2(end,4,:)),<span class="string">'LineWidth'</span>,2); | ||
+ | <span class="comment">% Command axis defines the axis we wish to consider.</span> | ||
+ | axis([0,1200,0,1]) | ||
+ | <span class="comment">% The label function adds x labels to both the x and y axis.</span> | ||
+ | xlabel(<span class="string">'Increasing \theta'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | ylabel(<span class="string">'Concentration of Complex Formed'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | <span class="comment">% This plot is Figure 7.</span> | ||
+ | <span class="comment">% END OF FILE.</span> | ||
+ | </pre> | ||
+ | |||
+ | <a href="#selection" class="btn btn-info btn-lg pull-right" role="button">↑</a><!--Button that takes user to top of page.--> | ||
+ | <a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#saliva" class="btn btn-primary btn-lg pull-right" role="button">View description of model</a> | ||
+ | |||
+ | <a class="anchor" id="Nasal_code"></a><!--Sets anchor so that this section can be returned to by using the #Nasal_code command.--> | ||
+ | <section id="Nasal_code"> | ||
+ | <div class="row3"> | ||
+ | <div class="row"> | ||
+ | |||
+ | <div class="col-lg-12 feature" style=""> | ||
+ | <div class="row"> | ||
+ | |||
+ | <h2><b>Nasal Mucus: MATLAB Code.</b></h2> | ||
+ | <br><!--Adds a line break--> | ||
+ | <p>The figures shown in the <u><a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#nasal">odorant binding protein folding model</a></u> were created using MATLAB. Before using MATLAB the original system of equations was non-dimensionalised to the system:</p> | ||
+ | $$ | ||
+ | |||
+ | \begin{eqnarray*} | ||
+ | \frac{d\alpha}{d\tau}&=&OBP-\psi \alpha \beta,\\ | ||
+ | \frac{d\beta}{d\tau}&=&OBP-\psi \alpha \beta,\\ | ||
+ | \frac{dOBP}{d\tau}&=&\psi \alpha \beta -OBP. | ||
+ | \end{eqnarray*} | ||
+ | $$ | ||
+ | <p>The initial conditions were also non-dimensionalised to become:</p> | ||
+ | $$ | ||
+ | |||
+ | \begin{eqnarray*} | ||
+ | \alpha(0)&=&1,\\ | ||
+ | \beta(0)&=&D_{0},\\ | ||
+ | OBP(0)&=&0. | ||
+ | \end{eqnarray*} | ||
+ | $$ | ||
+ | <p>Two files were written to perform sensitivity analysis; one to set the function (obp.m) and one to solve the function and plot the results in <u><a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#fig8">Figure 8</a></u>, <u><a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#fig9">Figure 9</a></u> and <u><a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#fig10">Figure 10</a></u> (run_obp.m). Both files are shown below, where the green is comments to aid in understanding of the scripts.</p> | ||
+ | <br><!--Adds a line break--> | ||
+ | |||
+ | </div> | ||
+ | |||
+ | </div> | ||
+ | </div> | ||
+ | |||
+ | |||
+ | </div> | ||
+ | </section> | ||
+ | |||
+ | <div class="content"><pre class="codeinput"><!--This marks the beginning of the input copied from matlab published html.--><span class="comment"><b><font size='6' color='green'>MATLAB code from obp.m file</b></font></span> | ||
+ | <span class="comment"><b>% Function to define the non-dimensionalised system of ODEs describing the folding of the odorant binding protein (OBP).</b></span> | ||
+ | <span class="comment">% u is a 3 dimensional vector where;</span> | ||
+ | <span class="comment">% u(1)= alpha (alpha helix concentration),</span> | ||
+ | <span class="comment">% u(2)= beta (beta-barrel concentration),</span> | ||
+ | <span class="comment">% u(3)= OBP (folded OBP concentration).</span> | ||
+ | <span class="comment">% Parameter t is the time that the simulation is run over.</span> | ||
+ | <span class="comment">% Parameter K represents psi, the binding parameter determined by the binding rates and initial concentration of alpha helices.</span> | ||
+ | <span class="keyword">function</span> f = obp(t,u,K) | ||
+ | <span class="comment">% Define the system of ODEs by setting the vector f = right hand side of the system.</span> | ||
+ | f = [u(3)-K*u(1)*u(2); | ||
+ | u(3)-K*u(1)*u(2); | ||
+ | -u(3)+K*u(1)*u(2)]; | ||
+ | <span class="comment">% The function is then ended.</span> | ||
+ | <span class="keyword">end</span> | ||
+ | <span class="comment">% This function can then be called in the run_obp.m file by using the @obp command.</span> | ||
+ | <span class="comment">% END OF FILE</span> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | <span class="comment"><b><font size='6' color='green'>MATLAB code for run_obp.m file.</b></font></span> | ||
+ | <span class="comment"><b>% File to perform sensitivity analysis for OBP folding model.</span> | ||
+ | <span class="comment">%% Section 1: This section runs sensitivity analysis for both the parameter psi (K) and the ratio between beta barrels and alpha helices, v0 (D0 in the described model).</b></span> | ||
+ | <span class="comment">% Define a as the number of datapoints in the range for both K and v0, chosen to be 50.</span> | ||
+ | a=50; | ||
+ | <span class="comment">% Define K as the range of values for K that the system will be solved over, where the maximum value is twice the expected value.</span> | ||
+ | K=linspace(0,(5291.005292)*2,a); | ||
+ | <span class="comment">% Define u0 as the range of values for v0 that the system will be solved over, where the maximum value is four times the expected value.</span> | ||
+ | v0=linspace(0,4,a); | ||
+ | <span class="comment">% T is the final time of the simulation in seconds.</span> | ||
+ | T=0.001; | ||
+ | <span class="comment">% Define Store as an empty matrix that will be filled by the values for the folded OBP concentration for each of the values of K and v0.</span> | ||
+ | Store = zeros(a,a); | ||
+ | <span class="comment">% Call up first empty figure to plot in.</span> | ||
+ | figure(1) | ||
+ | <span class="comment">% The for loop solves the function obp.m using ode23 for the range of values of K and v0, and stores the complex concentration values in the Store matrix.</span> | ||
+ | <span class="keyword">for</span> i=1:a | ||
+ | <span class="keyword">for</span> j=1:a | ||
+ | [t,u]=ode23(@obp,[0 T],[1 v0(a-i+1) 0],[],K(j)); | ||
+ | Store(i,j) = u(end,3); | ||
+ | |||
+ | <span class="keyword">end</span> | ||
+ | <span class="keyword">end</span> | ||
+ | <span class="comment">% The command imagesc plots the complex concentration against v0 and K.</span> | ||
+ | imagesc(Store) | ||
+ | <span class="comment">% The label function adds x labels to both the x and y axis.</span> | ||
+ | xlabel(<span class="string">'Increasing D_{0}'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | ylabel(<span class="string">'Increasing \psi'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | <span class="comment">% The set function removes the values from the x and y axis.</span> | ||
+ | set(gca,<span class="string">'YTick'</span>,[],<span class="string">'XTick'</span>,[]); | ||
+ | <span class="comment">% The color bar function adds a user defined colourbar with the label,</span> | ||
+ | <span class="comment">% 'Complex Concentration'.</span> | ||
+ | c=colorbar(<span class="string">'Ticks'</span>,[0,0.99],<span class="string">'TickLabels'</span>,{<span class="string">'None'</span>,<span class="string">'High'</span>},<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | c.Label.String = <span class="string">'Complex Concentration'</span>; | ||
+ | <span class="comment">% The resulting plot is Figure 8.</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment"><b>%% Section 2: This section is used to plot only v0 against complex concentration over time.</b></span> | ||
+ | <span class="comment">a is the number of datapoints in the range for v0, chosen to be 50.</span> | ||
+ | a=50; | ||
+ | <span class="comment">% Define v0 as the range of values for v0 that the system will be solved over, where the maximum value is four times the expected value</span> | ||
+ | v0=linspace(0,4,a); | ||
+ | <span class="comment">% define store as an empty matrix that will be filled by the values for the time values, alpha helix concentration, beta-barrel concentration and folded OBP concentration for each value of v0.</span> | ||
+ | store = zeros(a,4,a); <span class="comment">% 1st is time, 2:4 are u.</span> | ||
+ | <span class="comment">% The for loop solves obp.m for the range of values of v0 and stores the values in the store matrix.</span> | ||
+ | <span class="keyword">for</span> i=1:a | ||
+ | |||
+ | [t,u]=ode23(@spermsen,[0 0.001],[1 v0(i) 0],[],5291.005292); | ||
+ | store(end-size(t,1)+1:end,1,i) = t; | ||
+ | store(end-size(t,1)+1:end,2:4,i) = u; | ||
+ | |||
+ | <span class="keyword">end</span> | ||
+ | |||
+ | <span class="comment">% The command figure calls up an empty figure so that Figure 8 is not overwritten.</span> | ||
+ | figure(2) | ||
+ | <span class="comment">% Then v0 can be plotted against complex concentration, u(3).</span> | ||
+ | plot(v0,squeeze(store(end,4,:)),<span class="string">'LineWidth'</span>,2); | ||
+ | <span class="comment">% The label function adds x labels to both the x and y axis.</span> | ||
+ | xlabel(<span class="string">'Ratio of \beta to \alpha, D_{0}'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | ylabel(<span class="string">'Concentration of Complex Formed'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | <span class="comment">% The annotation command allows us to add lines with specified style, width and colour for annotation of the graph, these can then be manually manipulated by using the edit plot tool.</span> | ||
+ | t2 = annotation(<span class="string">'line'</span>, [0.42 0.42], [0.15 0.91]); | ||
+ | b = t2.Color; | ||
+ | d=t2.LineWidth; | ||
+ | g=t2.LineStyle; | ||
+ | t2.Color = <span class="string">'red'</span>; | ||
+ | t2.LineWidth= 2; | ||
+ | t2.LineStyle= <span class="string">':'</span>; | ||
+ | <span class="comment">% This plot is Figure 9.</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment"><b>%% Section 3: This section is used to plot only K against folded OBP over time.</b></span> | ||
+ | <span class="comment">% Define a as the number of datapoints in the range for K, chosen to be 50.</span> | ||
+ | a=50; | ||
+ | <span class="comment">% Define K as the range of values for K that the system will be solved over, where the maximum value is twice the expected value.</span> | ||
+ | K=linspace(0,(5291.005292)*2,a); | ||
+ | <span class="comment">% Define as an empty matrix that will be filled by the values for the time values, alpha helix concentration, beta-barrel concentration and folded OBP concentration for each value of K.</span> | ||
+ | store = zeros(a,4,a); <span class="comment">% 1st is time, 2:4 are u</span> | ||
+ | <span class="keyword">for</span> i=1:a | ||
+ | |||
+ | [t,u]=ode23(@spermsen,[0 0.001],[1.5 1 0],[],K(i)); | ||
+ | store(end-size(t,1)+1:end,1,i) = t; | ||
+ | store(end-size(t,1)+1:end,2:4,i) = u; | ||
+ | |||
+ | <span class="keyword">end</span> | ||
+ | <span class="comment">% The for loop solves obp.m for the range of values of K and stores the values in the store matrix.</span> | ||
+ | <span class="comment">% The command figure calls up an empty figure so that Figure 9 is not overwritten.</span> | ||
+ | figure(3) | ||
+ | <span class="comment">% Then K can be plotted against complex concentration, u(3).</span> | ||
+ | plot(K,squeeze(store(end,4,:)),<span class="string">'LineWidth'</span>,2); | ||
+ | <span class="comment">% The command axis tight ensures the axis are not too large for the datapoints.</span> | ||
+ | axis <span class="string">tight</span> | ||
+ | <span class="comment">% The label function adds x labels to both the x and y axis.</span> | ||
+ | xlabel(<span class="string">'Increasing K'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | ylabel(<span class="string">'Concentration of Complex Formed'</span>,<span class="string">'FontSize'</span>,15,<span class="string">'FontWeight'</span>,<span class="string">'bold'</span>); | ||
+ | <span class="comment">% This plot is Figure 10.</span> | ||
+ | <span class="comment">% END OF FILE</span> | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | <a href="#selection" class="btn btn-info btn-lg pull-right" role="button">↑</a><!--Button that takes user to top of page.--> | ||
+ | <a href="https://2015.igem.org/Team:Dundee/Modeling/FluID#nasal" class="btn btn-primary btn-lg pull-right" role="button">View description of model</a> | ||
+ | |||
+ | </div> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | </body> | ||
+ | |||
+ | |||
+ | </div> | ||
+ | </font> | ||
+ | </html> | ||
+ | {{:Team:Dundee/navbar}}<!--Inputs standard navbar--> | ||
+ | {{:Team:Dundee/footer}}<!--Inputs standard footer--> |
Latest revision as of 22:25, 18 September 2015
To see the MATLAB code for the Fingerprint Ageing section of the project or the Chromate Biosensor section of the project use the following buttons.
Appendix 3: Chromate Biosensor Appendix 2: Fingerprint Ageing
Blood: MATLAB Code
The figure shown in the haptoglobin and haemoglobin binding model were created using MATLAB. Before using MATLAB the original system of equations was non-dimensionalised to the system:
$$ \begin{eqnarray*} \frac{dHp}{d\tau}&=&[Hp\cdot \alpha_{H}]-\lambda Hp \alpha_{H},\\ \frac{d\alpha_{H}}{d\tau}&=&[Hp\cdot \alpha_{H}]-\lambda Hp \alpha_{H},\\ \frac{d[Hp \cdot \alpha_{H}]}{d\tau}&=&\lambda Hp \alpha_{H}-[Hp \cdot \alpha_{H}]-\gamma [Hp \cdot \alpha_{H}],\\ \frac{d[Hp \cdot \alpha_{H} \cdot \beta_{H}]}{d\tau}&=&\gamma [Hp \cdot \alpha_{H}]. \end{eqnarray*} $$The initial conditions were also non-dimensionalised to become:
$$ \begin{eqnarray*} Hp(0)&=&4.17,\\ \alpha_{H}(0)&=&1,\\ [Hp \cdot \alpha_{H}](0)&=&0,\\ [Hp \cdot \alpha_{H} \cdot \beta_{H}](0)&=&0. \end{eqnarray*} $$Two files were written to perform sensitivity analysis; one to set the function (haptosen.m) and one to solve the function and plot the results in Figure 1 (run_haptosen.m). Both files are shown below, where the green is comments to aid in understanding of the scripts.
MATLAB code from haptosen.m file % Function to define the non-dimensionalised system of ODEs describing the binding between Haptoglobin and Haemoglobin. % u is a 4 dimensional vector where; % u(1)=Hp (haptoglobin concentration), % u(2)=\alpha (free haemoglobin concentration), % u(3)= [\alpha \cdot Hp] (haptoglobin and haemoglobin initial complex concentration), % u(4)= [\alpha \cdot Hp \cdot \beta] (final haemoglobin/haptoglobin complex concentration). % Parameter t is the time that the simulation is run over. % Parameter lambda represents the parameter in the system determined by binding rates and initial concentration of haemoglobin. % Parameter gamma represents the parameter in the system determined by binding rates. function f = haptosen(t,u,lambda,gamma); % Define the system of ODEs by setting the vector f = right hand side of the system. f = [u(3)-lambda.*u(1)*u(2); u(3)-lambda.*u(1)*u(2); -u(3)+lambda.*u(1)*u(2)-gamma.*u(3); gamma.*u(3)]; % The function is then ended. end % This function can then be called in the run_haptosen.m file by using the @haptosen command. % END OF FILE MATLAB code from run_haptosen.m file % File to perform sensitivity analysis for haptoglobin and haemoglobin binding model. % Variable a is the number of values chosen for each of the ranges of parameters, 100 different values were chosen.. a=100; % Define lambda1 as the range of values for the parameter lambda, chosen with the maximum value as twice the expected value. lambda1=linspace(0,((100/317)*0.3878494524)*2,a); % Define gamma1 as the range of values for the parameter gamma, chosen with the maximum value as twice the expected value. gamma1=linspace(0,(83/317)*2,a); % T is the final time of the simulation, in seconds. T=30; % Define Store as an empty matrix for the final concentrations of the complex with the varied parameter values. Store = zeros(a,a); % Command figure(1) calls up a new figure. figure(1) % The for loop solves the ode system defined in haptosen function using ode23 for the range of values for both parameters. for i=1:a for j=1:a [t,u]=ode23(@haptosen,[0 T],[4.17 1 0 0],[],lambda1(a+1-i),gamma1(j)); Store(i,j) = u(end,4); end end % Command imagesc plots the surf plot of the parameters and the complex concentration. imagesc(Store) % xlabel and ylabel add labels to the plot. xlabel('Increasing \lambda','FontSize',15,'FontWeight','bold'); ylabel('Increasing \gamma','FontSize',15,'FontWeight','bold'); % Command set removes the x and y axis values. set(gca,'YTick',[],'XTick',[]); % The following lines add a colour bar with defined label and text. c=colorbar('Ticks',[0,0.99],'TickLabels',{'None','High'},'FontSize',15,'FontWeight','bold'); c.Label.String = 'Complex Concentration'; % The following lines add a text arrow to allow for annotation of the graph with defined colours positions and width. ta1 = annotation('textarrow', [0.13 0.79], [0.13 0.92]); h = text(0.5,0.5,'Complex Formation'); s = h.FontSize; h.FontSize = 12; j = h.Rotation; h.Rotation=45; k = h.Position; h.Position = [0.5 0.5 0]; b = ta1.Color; d=ta1.LineWidth; ta1.Color = 'red'; ta1.LineWidth= 4; % END OF FILE↑ View description of model
Semen: MATLAB Code
The figures shown in the spermidine and potD binding model were created using MATLAB. Before using MATLAB the original system of equations was non-dimensionalised to the system:
$$ \begin{eqnarray*} \frac{dP}{d\tau}&=&C-\kappa P S,\\ \frac{dS}{d\tau}&=&C-\kappa P S,\\ \frac{dC}{d\tau}&=&\kappa P S -C. \end{eqnarray*} $$The initial conditions were also non-dimensionalised to become:
$$ \begin{eqnarray*} P(0)&=&R_{0},\\ S(0)&=&1,\\ C(0)&=&0. \end{eqnarray*} $$Two files were written to perform sensitivity analysis; one to set the function (spermsen.m) and one to solve the function and plot the results in Figure 2, Figure 3 and Figure 4 (run_spermsen.m). Both files are shown below, where the green is comments to aid in understanding of the scripts.
MATLAB code from spermsen.m file. %% Function to define the non-dimensionalised system of ODEs describing the binding between spermidine and potD. % Parameter u is a 3 dimensional vector where; % u(1)= P (potD concentration), % u(2)= S (spermidine concentration), % u(3)= C (potD and spermidine complex concentration). % Parameter t is the time that the simulation is run over. % Parameter kappa is the binding parameter determined by the binding rates and initial concentration of spermidine. function f = spermsen(t,u,kappa) % Define the system of ODEs by setting the vector f = right hand side of the system. f = [u(3)-kappa.*u(1)*u(2); u(3)-kappa.*u(1)*u(2); kappa.*u(1)*u(2)-u(3)]; % The function is then ended. end % This function can then be called in the run_spermsen.m file by using the @spermsen command. % END OF FILE MATLAB code for run_spermsen.m file. %% Section 1: File to perform sensitivity analysis for potD and spermidine binding model. % This section runs the analysis on both the binding parameter kappa and the ratio between potD and spermidine, u0 (R0 in the described model). % Define a as the number of datapoints in the range for both kappa and u0, chosen to be 50. a=50; % Define kappa1 as the range of values for kappa that the system will be solved over, where the maximum value is twice the expected value. kappa1=linspace(0,(129.0875)*2,a); % Define u0 as the range of values for u0 that the system will be solved over, where the maximum value is four times the expected value. u0=linspace(0,2,a); % T is the final time of the simulation, in seconds. T=0.10; % Store is set as an empty matrix that will be filled by the values for the complex concentration for each of the values of kappa and u0. Store = zeros(a,a); % The for loop solves the function spermsen.m using ode23 for the range of values of kappa and u0, and stores the complex concentration values in the Store matrix. for i=1:a for j=1:a [t,u]=ode23(@spermsen,[0 T],[u0(a-i+1) 1 0],[],kappa1(j)); Store(i,j) = u(end,3); end end % Command imagesc plots the complex concentration against u0 and kappa. imagesc(Store) % Command label adds x labels to both the x and y axis. xlabel('Increasing R_{0}','FontSize',15,'FontWeight','bold'); ylabel('Increasing \kappa','FontSize',15,'FontWeight','bold'); % The set function removes the values from the x and y axis. set(gca,'YTick',[],'XTick',[]); % The color bar function adds a user defined colourbar with the label, 'Complex Concentration'. c=colorbar('Ticks',[0,0.99],'TickLabels',{'None','High'},'FontSize',15,'FontWeight','bold'); c.Label.String = 'Complex Concentration'; % The resulting plot is Figure 2. % % %% Section 2: This section is used to plot only u0 against complex concentration over time. % Define a as the number of datapoints in the range for u0, chosen to be 50. a=50; % Define u0 as the range of values for u0 that the system will be solved over, where the maximum value is four times the expected value. u0=linspace(0,2,a); % Define store as an empty matrix that will be filled by the values for the time values, potD concentration, spermidine concentration and complex concentration for each value of u0. store = zeros(a,4,a); % 1st is time, 2:4 are u. % The for loop solves spermsen.m for the range of values of u0 and stores the values in the store matrix. for i=1:a [t,u]=ode23(@spermsen,[0 0.1],[u0(i) 1 0],[],129.0875); store(end-size(t,1)+1:end,1,i) = t; store(end-size(t,1)+1:end,2:4,i) = u; end % Command figure calls up an empty figure so that figure 2 is not overwritten. figure % Then u0 can be plotted against complex concentration, u(3). plot(u0,squeeze(store(end,4,:)),'LineWidth',2); % Command label adds x labels to both the x and y axis. xlabel('Increasing R_{0}','FontSize',15,'FontWeight','bold'); ylabel('Concentration of Complex Formed','FontSize',15,'FontWeight','bold'); % This plot is Figure 3. % % %% Section 3: This section is used to plot only kappa against complex concentration over time. % Define a as the number of datapoints in the range for kappa, chosen to be 50. a=50; % Define kappa1 as the range of values for kappa that the system will be solved over, where the maximum value is twice the expected value. kappa1=linspace(0,(129.0875)*2,a); % Define store as an empty matrix that will be filled by the values for the time values, potD concentration, spermidine concentration and complex concentration for each value of kappa. store = zeros(a,4,a); % 1st is time, 2:4 are u % The for loop solves spermsen.m for the range of values of kappa and stores the values in the store matrix. for i=1:a [t,u]=ode23(@spermsen,[0 0.1],[1.4 1 0],[],kappa1(i)); store(end-size(t,1)+1:end,1,i) = t; store(end-size(t,1)+1:end,2:4,i) = u; end % Command figure calls up an empty figure so that figure 3 is not overwritten. figure % Then kappa can be plotted against complex concentration, u(3). plot(kappa1,squeeze(store(end,4,:)),'LineWidth',2); % Command axis tight ensures the axis are not too large for the datapoints. axis tight % Command label adds x labels to both the x and y axis. xlabel('Increasing \kappa','FontSize',15,'FontWeight','bold'); ylabel('Concentration of Complex Formed','FontSize',15,'FontWeight','bold'); % This plot is Figure 4. % END OF FILE↑ View description of model
Saliva: MATLAB Code
The figures shown in the lactoferrin and LBP binding model were created using MATLAB. Before using MATLAB the original system of equations was non-dimensionalised to the system:
$$ \begin{eqnarray*} \frac{dLf}{d\tau}&=&[Lf \cdot LBP]-\theta Lf LBP,\\ \frac{dLBP}{d\tau}&=&[Lf \cdot LBP]-\theta Lf LBP,\\ \frac{d[Lf \cdot LBP]}{d\tau}&=&\theta Lf LBP -[Lf \cdot LBP]. \end{eqnarray*} $$The initial conditions were also non-dimensionalised to become:
$$ \begin{eqnarray*} Lf(0)&=&1,\\ LBP(0)&=&v_{0},\\ [Lf \cdot LBP](0)&=&0. \end{eqnarray*} $$Two files were written to perform sensitivity analysis; one to set the function (lactofun.m) and one to solve the function and plot the results in Figure 5, Figure 6 and Figure 7 (run_lactofun.m). Both files are shown below, where the green is comments to aid in understanding of the scripts.
MATLAB code for lactofun.m file. % Function to define the non-dimensionalised system of ODEs describing the binding between lactoferrin and LBP. % Parameter u is a 3 dimensional vector where; % u(1) represents lactoferrin, % u(2) represents the lactoferrin binding protein, % u(3) represents the final complex. % Parameter t is the time that the simulation is run over. % Parameter theta is the binding parameter determined by the binding rates and the initial concentration of lactoferrin. function f = lactofun(t,u,theta) % Define the system of ODEs by setting the vector f = right hand side of the system. f=[u(3)-theta.*u(1)*u(2); u(3)-theta.*u(1)*u(2); -u(3)+theta.*u(1)*u(2)]; % The function is then ended. end % This function can then be called in the run_lactofun.m file by using % @lactofun command. %END OF FILE. MATLAB code for run_lactofun.m file. %% Section 1: File to perform sensitivity analysis for lactoferrin and lactoferrin binding protein binding model. %This section runs the analysis on both the binding parameter theta and the ratio between lactoferrin binding protein and lactoferrin, v0. % Variable a is the number of datapoints in the range for both theta and v0, chosen to be 50. a=50; % Define theta1 as the range of values for theta that the system will be solved over, where the maximum value is twice the expected value. theta1=linspace(0,623.417*2,a); % Define v0 as the range of values for v0 that the system will be solved over where the maximum value is four times the expected value. v0=linspace(0,4,a); % T is the final time of the simulation in seconds. T=10; % Set Store as an empty matrix that will be filled by the values for the complex concentration for each of the values of theta and v0. Store = zeros(a,a); % The for loop solves the function lactofun.m using ode23 for the range of values of theta and v0, and stores the complex concentration values in the Store matrix. for i=1:a for j=1:a [t,u]=ode23(@lacto,[0 T],[1 v0(a-i+1) 0],[],theta1(j)); Store(i,j) = u(end,3); end end % Call up a new figure. figure(1) % Command imagesc plots the complex concentration against v0 and theta. imagesc(Store) % The label function adds x labels to both the x and y axis. xlabel('Increasing v_{0}','FontSize',15,'FontWeight','bold'); ylabel('Increasing \theta','FontSize',15,'FontWeight','bold'); % The set function removes the values from the x and y axis. set(gca,'YTick',[],'XTick',[]); % The color bar function adds a user defined colourbar with the label, 'Complex Concentration'. c=colorbar('Ticks',[0,0.99],'TickLabels',{'None','High'},'FontSize',15,'FontWeight','bold'); c.Label.String = 'Complex Concentration'; % The resulting plot is Figure 5. % % %% Section 2: This section is used to plot only v0 against complex concentration over time. % Define store1 as an empty matrix that will be filled by the values for the time values, lactoferrin concentration, lactoferrin binding protein concentration and complex concentration for each value of v0. store1 = zeros(5000,4,a); % 1st is time, 2:4 are u. % The for loop solves lactofun.m for the range of values of v0 and stores the values in the store1 matrix for i=1:a [t,u]=ode23(@lactofun,[0 T],[1 v0(i) 0],[],5); store1(end-size(t,1)+1:end,1,i) = t; store1(end-size(t,1)+1:end,2:4,i) = u; end % Command figure calls up an empty figure so that Figure 5 is not overwritten. figure (2) % Then v0 can be plotted against complex concentration, u(3). plot(v0,squeeze(store1(end,4,:)),'LineWidth',2); % The label function adds x labels to both the x and y axis. xlabel('Increasing v_{0}','FontSize',15,'FontWeight','bold'); ylabel('Concentration of Complex Formed','FontSize',15,'FontWeight','bold'); % This plot is Figure 6. % % %% Section 3: This section is used to plot only theta against complex concentration over time. % Define store2 as an empty matrix that will be filled by the values for the time values, lactoferrin concentration, lactoferrin binding protein concentration and complex concentration for each value of theta. store2 = zeros(5000,4,a); % 1st is time, 2:4 are u % The for loop solves lactofun.m for the range of values of theta and stores the values in the store2 matrix. for i=1:a [t,u]=ode23(@lactofun,[0 T],[1 1 0],[],theta1(i)); store2(end-size(t,1)+1:end,1,i) = t; store2(end-size(t,1)+1:end,2:4,i) = u; end % Command figure calls up an empty figure so that Figure 6 is not overwritten. figure(3) % Then theta can be plotted against complex concentration, u(3). plot(theta1,squeeze(store2(end,4,:)),'LineWidth',2); % Command axis defines the axis we wish to consider. axis([0,1200,0,1]) % The label function adds x labels to both the x and y axis. xlabel('Increasing \theta','FontSize',15,'FontWeight','bold'); ylabel('Concentration of Complex Formed','FontSize',15,'FontWeight','bold'); % This plot is Figure 7. % END OF FILE.↑ View description of model
Nasal Mucus: MATLAB Code.
The figures shown in the odorant binding protein folding model were created using MATLAB. Before using MATLAB the original system of equations was non-dimensionalised to the system:
$$ \begin{eqnarray*} \frac{d\alpha}{d\tau}&=&OBP-\psi \alpha \beta,\\ \frac{d\beta}{d\tau}&=&OBP-\psi \alpha \beta,\\ \frac{dOBP}{d\tau}&=&\psi \alpha \beta -OBP. \end{eqnarray*} $$The initial conditions were also non-dimensionalised to become:
$$ \begin{eqnarray*} \alpha(0)&=&1,\\ \beta(0)&=&D_{0},\\ OBP(0)&=&0. \end{eqnarray*} $$Two files were written to perform sensitivity analysis; one to set the function (obp.m) and one to solve the function and plot the results in Figure 8, Figure 9 and Figure 10 (run_obp.m). Both files are shown below, where the green is comments to aid in understanding of the scripts.
MATLAB code from obp.m file % Function to define the non-dimensionalised system of ODEs describing the folding of the odorant binding protein (OBP). % u is a 3 dimensional vector where; % u(1)= alpha (alpha helix concentration), % u(2)= beta (beta-barrel concentration), % u(3)= OBP (folded OBP concentration). % Parameter t is the time that the simulation is run over. % Parameter K represents psi, the binding parameter determined by the binding rates and initial concentration of alpha helices. function f = obp(t,u,K) % Define the system of ODEs by setting the vector f = right hand side of the system. f = [u(3)-K*u(1)*u(2); u(3)-K*u(1)*u(2); -u(3)+K*u(1)*u(2)]; % The function is then ended. end % This function can then be called in the run_obp.m file by using the @obp command. % END OF FILE MATLAB code for run_obp.m file. % File to perform sensitivity analysis for OBP folding model. %% Section 1: This section runs sensitivity analysis for both the parameter psi (K) and the ratio between beta barrels and alpha helices, v0 (D0 in the described model). % Define a as the number of datapoints in the range for both K and v0, chosen to be 50. a=50; % Define K as the range of values for K that the system will be solved over, where the maximum value is twice the expected value. K=linspace(0,(5291.005292)*2,a); % Define u0 as the range of values for v0 that the system will be solved over, where the maximum value is four times the expected value. v0=linspace(0,4,a); % T is the final time of the simulation in seconds. T=0.001; % Define Store as an empty matrix that will be filled by the values for the folded OBP concentration for each of the values of K and v0. Store = zeros(a,a); % Call up first empty figure to plot in. figure(1) % The for loop solves the function obp.m using ode23 for the range of values of K and v0, and stores the complex concentration values in the Store matrix. for i=1:a for j=1:a [t,u]=ode23(@obp,[0 T],[1 v0(a-i+1) 0],[],K(j)); Store(i,j) = u(end,3); end end % The command imagesc plots the complex concentration against v0 and K. imagesc(Store) % The label function adds x labels to both the x and y axis. xlabel('Increasing D_{0}','FontSize',15,'FontWeight','bold'); ylabel('Increasing \psi','FontSize',15,'FontWeight','bold'); % The set function removes the values from the x and y axis. set(gca,'YTick',[],'XTick',[]); % The color bar function adds a user defined colourbar with the label, % 'Complex Concentration'. c=colorbar('Ticks',[0,0.99],'TickLabels',{'None','High'},'FontSize',15,'FontWeight','bold'); c.Label.String = 'Complex Concentration'; % The resulting plot is Figure 8. % % %% Section 2: This section is used to plot only v0 against complex concentration over time. a is the number of datapoints in the range for v0, chosen to be 50. a=50; % Define v0 as the range of values for v0 that the system will be solved over, where the maximum value is four times the expected value v0=linspace(0,4,a); % define store as an empty matrix that will be filled by the values for the time values, alpha helix concentration, beta-barrel concentration and folded OBP concentration for each value of v0. store = zeros(a,4,a); % 1st is time, 2:4 are u. % The for loop solves obp.m for the range of values of v0 and stores the values in the store matrix. for i=1:a [t,u]=ode23(@spermsen,[0 0.001],[1 v0(i) 0],[],5291.005292); store(end-size(t,1)+1:end,1,i) = t; store(end-size(t,1)+1:end,2:4,i) = u; end % The command figure calls up an empty figure so that Figure 8 is not overwritten. figure(2) % Then v0 can be plotted against complex concentration, u(3). plot(v0,squeeze(store(end,4,:)),'LineWidth',2); % The label function adds x labels to both the x and y axis. xlabel('Ratio of \beta to \alpha, D_{0}','FontSize',15,'FontWeight','bold'); ylabel('Concentration of Complex Formed','FontSize',15,'FontWeight','bold'); % The annotation command allows us to add lines with specified style, width and colour for annotation of the graph, these can then be manually manipulated by using the edit plot tool. t2 = annotation('line', [0.42 0.42], [0.15 0.91]); b = t2.Color; d=t2.LineWidth; g=t2.LineStyle; t2.Color = 'red'; t2.LineWidth= 2; t2.LineStyle= ':'; % This plot is Figure 9. % % %% Section 3: This section is used to plot only K against folded OBP over time. % Define a as the number of datapoints in the range for K, chosen to be 50. a=50; % Define K as the range of values for K that the system will be solved over, where the maximum value is twice the expected value. K=linspace(0,(5291.005292)*2,a); % Define as an empty matrix that will be filled by the values for the time values, alpha helix concentration, beta-barrel concentration and folded OBP concentration for each value of K. store = zeros(a,4,a); % 1st is time, 2:4 are u for i=1:a [t,u]=ode23(@spermsen,[0 0.001],[1.5 1 0],[],K(i)); store(end-size(t,1)+1:end,1,i) = t; store(end-size(t,1)+1:end,2:4,i) = u; end % The for loop solves obp.m for the range of values of K and stores the values in the store matrix. % The command figure calls up an empty figure so that Figure 9 is not overwritten. figure(3) % Then K can be plotted against complex concentration, u(3). plot(K,squeeze(store(end,4,:)),'LineWidth',2); % The command axis tight ensures the axis are not too large for the datapoints. axis tight % The label function adds x labels to both the x and y axis. xlabel('Increasing K','FontSize',15,'FontWeight','bold'); ylabel('Concentration of Complex Formed','FontSize',15,'FontWeight','bold'); % This plot is Figure 10. % END OF FILE↑ View description of model