Team:Paris/Modeling/More f1 Algo

From 2008.igem.org

(Difference between revisions)
(find_ƒ1)
(find_ƒ1)
 
(7 intermediate revisions not shown)
Line 1: Line 1:
-
{{Paris/Menu}}
+
<html>
 +
<style type="text/css">
 +
pre {font-size: 1.2em}
 +
span.keyword {color: #0000FF}
 +
span.comment {color: #228B22}
 +
span.string {color: #A020F0}
 +
span.untermstring {color: #B20000}
 +
span.syscmd {color: #B28C00}
 +
}
 +
 +
</style>
 +
</html>
 +
 +
<div style="text-align: left">
== find_&#131;1 ==
== find_&#131;1 ==
<html><pre class="codeinput">
<html><pre class="codeinput">
<span class="keyword">function</span> optimal_parameters = find_f1(X_data, Y_data, initial_parameters)
<span class="keyword">function</span> optimal_parameters = find_f1(X_data, Y_data, initial_parameters)
-
 
<span class="comment">% gives the 'best parameters' involved in f1 by least-square optimisation
<span class="comment">% gives the 'best parameters' involved in f1 by least-square optimisation
</span>  
</span>  
Line 14: Line 26:
</span><span class="comment">% initial_parameters = values of the parameters proposed by the literature
</span><span class="comment">% initial_parameters = values of the parameters proposed by the literature
</span><span class="comment">%                      or simply guessed
</span><span class="comment">%                      or simply guessed
-
</span><span class="comment">%                    = [beta1, (K20 -> (gamma.K20)/(coefTet.f0)), n20, K19, n19]
+
</span><span class="comment">%                    = [beta16, (K13 -> (gamma.K13)/(coefTet.f0)), n13, K12, n12]
</span>  
</span>  
<span class="comment">% Warning : in the global parameters, K20 -> K20/coefTet
<span class="comment">% Warning : in the global parameters, K20 -> K20/coefTet
Line 20: Line 32:
     <span class="keyword">function</span> output = expr_pTet(parameters, X_data)
     <span class="keyword">function</span> output = expr_pTet(parameters, X_data)
         <span class="keyword">for</span> k = 1:length(X_data)
         <span class="keyword">for</span> k = 1:length(X_data)
-
                 output(k) = parameters(1) * ( 1 - hill( (1 - hill( X_data(k), parameters(4), parameters(5) )), parameters(2), parameters(3) ) );
+
                 output(k) = parameters(1) * (1 - ...
 +
                    hill((1 - hill(X_data(k),parameters(4),parameters(5))),parameters(2),parameters(3)));
         <span class="keyword">end</span>
         <span class="keyword">end</span>
     <span class="keyword">end</span>
     <span class="keyword">end</span>
   
   
-
options = optimset(<span class="string">'LevenbergMarquardt'</span>,<span class="string">'on'</span>,<span class="string">'TolX'</span>,1e-10,<span class="string">'MaxFunEvals'</span>,1e10,<span class="string">'TolFun'</span>,1e-10,<span class="string">'MaxIter'</span>,1e4);
+
options=optimset(<span class="string">'LevenbergMarquardt'</span>,<span class="string">'on'</span>,<span class="string">'TolX'</span>,1e-10,<span class="string">'MaxFunEvals'</span>,1e10,<span class="string">'TolFun'</span>,1e-10,<span class="string">'MaxIter'</span>,1e4);
<span class="comment">% options for the function lsqcurvefit
<span class="comment">% options for the function lsqcurvefit
</span>  
</span>  
-
optimal_parameters = lsqcurvefit( @(parameters, X_data) expr_pTet(parameters, X_data), initial_parameters, X_data, Y_data,...
+
optimal_parameters = lsqcurvefit( @(parameters, X_data) expr_pTet(parameters, X_data), ...
-
    1/10*initial_parameters, 10*initial_parameters, options );
+
    initial_parameters, X_data, Y_data, 1/10*initial_parameters, 10*initial_parameters, options );
<span class="comment">% search for the fittest parameters, between 1/10 and 10 times the initial
<span class="comment">% search for the fittest parameters, between 1/10 and 10 times the initial
</span><span class="comment">% parameters
</span><span class="comment">% parameters
Line 38: Line 51:
<html><pre class="codeinput">
<html><pre class="codeinput">
-
<span class="keyword">function</span> quant_aTc = Inv_f1(inducer_quantity,aTc_0)
+
<span class="keyword">function</span> quant_aTc = Inv_f1(inducer_quantity)
-
+
<span class="comment">% gives the quantity of [aTc]i needed to get inducer_quantity of a protein
<span class="comment">% gives the quantity of [aTc]i needed to get inducer_quantity of a protein
</span><span class="comment">% throught a gene behind pTet
</span><span class="comment">% throught a gene behind pTet
</span>  
</span>  
<span class="keyword">global</span> gamma, f0;
<span class="keyword">global</span> gamma, f0;
-
+
<span class="comment">% parameters
 +
</span>
     <span class="keyword">function</span> equa = F(x)
     <span class="keyword">function</span> equa = F(x)
         equa = f1( (f0/gamma) , x ) - inducer_quantity;
         equa = f1( (f0/gamma) , x ) - inducer_quantity;
     <span class="keyword">end</span>
     <span class="keyword">end</span>
   
   
-
options = optimset(<span class="string">'LevenbergMarquardt'</span>,<span class="string">'on'</span>,<span class="string">'TolX'</span>,1e-10,<span class="string">'MaxFunEvals'</span>,1e10,<span class="string">'TolFun'</span>,1e-10,<span class="string">'MaxIter'</span>,1e4);
+
options=optimset(<span class="string">'LevenbergMarquardt'</span>,<span class="string">'on'</span>,<span class="string">'TolX'</span>,1e-10,<span class="string">'MaxFunEvals'</span>,1e10,<span class="string">'TolFun'</span>,1e-10,<span class="string">'MaxIter'</span>,1e4);
   
   
-
quant_aTc = fsolve(F,aTc_0,options);
+
quant_aTc = fsolve(F,1,options);
   
   
<span class="keyword">end</span>
<span class="keyword">end</span>
</pre></html>
</pre></html>
 +
 +
</div>

Latest revision as of 03:47, 30 October 2008

find_ƒ1

function optimal_parameters = find_f1(X_data, Y_data, initial_parameters)
% gives the 'best parameters' involved in f1 by least-square optimisation
 
% X_data = vector of given values of a [aTc]i (experimentally
% controled)
% Y_data = vector of experimentally measured values f1 corresponding of
% the X_data
% initial_parameters = values of the parameters proposed by the literature
%                       or simply guessed
%                    = [beta16, (K13 -> (gamma.K13)/(coefTet.f0)), n13, K12, n12]
 
% Warning : in the global parameters, K20 -> K20/coefTet
 
     function output = expr_pTet(parameters, X_data)
         for k = 1:length(X_data)
                 output(k) = parameters(1) * (1 - ...
                     hill((1 - hill(X_data(k),parameters(4),parameters(5))),parameters(2),parameters(3)));
         end
     end
 
options=optimset('LevenbergMarquardt','on','TolX',1e-10,'MaxFunEvals',1e10,'TolFun',1e-10,'MaxIter',1e4);
% options for the function lsqcurvefit
 
optimal_parameters = lsqcurvefit( @(parameters, X_data) expr_pTet(parameters, X_data), ...
     initial_parameters, X_data, Y_data, 1/10*initial_parameters, 10*initial_parameters, options );
% search for the fittest parameters, between 1/10 and 10 times the initial
% parameters
 
end

Inv_ƒ1

function quant_aTc = Inv_f1(inducer_quantity)
% gives the quantity of [aTc]i needed to get inducer_quantity of a protein
% throught a gene behind pTet
 
global gamma, f0;
% parameters
 
     function equa = F(x)
         equa = f1( (f0/gamma) , x ) - inducer_quantity;
     end
 
options=optimset('LevenbergMarquardt','on','TolX',1e-10,'MaxFunEvals',1e10,'TolFun',1e-10,'MaxIter',1e4);
 
quant_aTc = fsolve(F,1,options);
 
end