Team:Paris/Modeling/More f2 Algo

From 2008.igem.org

(Difference between revisions)
(Inv_ƒ2)
(find_ƒ2)
 
(2 intermediate revisions not shown)
Line 16: Line 16:
== find_ƒ2 ==
== find_ƒ2 ==
-
 
+
<html><pre class="codeinput">
 +
<span class="keyword">function</span> optimal_parameters = find_f2(X_data, Y_data, initial_parameters)
 +
<span class="comment">% gives the 'best parameters' involved in f2 by least-square optimisation
 +
</span>
 +
<span class="comment">% X_data = vector of given values of a [arab]i (experimentally
 +
</span><span class="comment">% controled)
 +
</span><span class="comment">% Y_data = vector of experimentally measured values f2 corresponding of
 +
</span><span class="comment">% the X_data
 +
</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">%                    = [betabad, (Kbad -> (gamma.Kbad)/(const.expr(pBad))), nbad, Kara, nara]
 +
</span>
 +
    <span class="keyword">function</span> output = expr_pBad(parameters, X_data)
 +
        <span class="keyword">for</span> k = 1:length(X_data)
 +
                output(k) = parameters(1) * ( hill( ...
 +
                    (hill(X_data(k), parameters(4), parameters(5))), parameters(2), parameters(3)) );
 +
        <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);
 +
<span class="comment">% options for the function lsqcurvefit
 +
</span>
 +
optimal_parameters = lsqcurvefit( @(parameters, X_data) expr_pBad(parameters, X_data), ...
 +
    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><span class="comment">% parameters
 +
</span><span class="keyword">end</span>
 +
</pre></html>
== Inv_&#131;2 ==
== Inv_&#131;2 ==
-
 
+
<html><pre class="codeinput">
 +
<span class="keyword">function</span> quant_ara = Inv_f2(inducer_quantity)
 +
<span class="comment">% gives the quantity of [ara]i needed to get inducer_quantity of a protein
 +
</span><span class="comment">% throught a gene behind pBad
 +
</span>
 +
    <span class="keyword">function</span> equa = F(x)
 +
        equa = f2( x ) - inducer_quantity;
 +
    <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);
 +
 +
quant_ara = fsolve(F,1,options);
 +
 +
<span class="keyword">end</span>
 +
</pre></html>
</div>
</div>

Latest revision as of 03:48, 30 October 2008

find_ƒ2

function optimal_parameters = find_f2(X_data, Y_data, initial_parameters)
% gives the 'best parameters' involved in f2 by least-square optimisation
 
% X_data = vector of given values of a [arab]i (experimentally
% controled)
% Y_data = vector of experimentally measured values f2 corresponding of
% the X_data
% initial_parameters = values of the parameters proposed by the literature
%                       or simply guessed
%                    = [betabad, (Kbad -> (gamma.Kbad)/(const.expr(pBad))), nbad, Kara, nara]
 
     function output = expr_pBad(parameters, X_data)
         for k = 1:length(X_data)
                 output(k) = parameters(1) * ( hill( ...
                     (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_pBad(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_ƒ2

function quant_ara = Inv_f2(inducer_quantity)
% gives the quantity of [ara]i needed to get inducer_quantity of a protein
% throught a gene behind pBad
 
     function equa = F(x)
         equa = f2( x ) - inducer_quantity;
     end
 
options=optimset('LevenbergMarquardt','on','TolX',1e-10,'MaxFunEvals',1e10,'TolFun',1e-10,'MaxIter',1e4);
 
quant_ara = fsolve(F,1,options);
 
end