Team:Paris/Modeling/Others prog

From 2008.igem.org

(Difference between revisions)
(New page: <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.sysc...)
(Global)
Line 57: Line 57:
== Global ==
== Global ==
 +
 +
<html><pre class="codeinput">
 +
<span class="keyword">function</span> labo=Core_Sytem_Simulation (t, init, prom1, prom2, retro)
 +
<span class="comment">% Simulation of our Core_System
 +
</span>
 +
<span class="comment">% prom1 = 'pTet' or 'pFlhDC'
 +
</span><span class="comment">% prom2 = 'pFlgA' or 'pFlgB'
 +
</span><span class="comment">% retro = 'EnvZ' or 'OmpR' or quantity of aTc
 +
</span>
 +
<span class="comment">% t = discret time scale
 +
</span><span class="comment">% init = vector of the initial state
 +
</span><span class="comment">%  [FlhDC;
 +
</span><span class="comment">%    FliA;
 +
</span><span class="comment">%    FP1;
 +
</span><span class="comment">%    FP2;
 +
</span><span class="comment">%    FP3;
 +
</span><span class="comment">%    TetR / OmpR / EnvZ] regards to the studied version
 +
</span>
 +
<span class="keyword">global</span> gamma beta16 K13 n13 K12 n12 K15 n15 beta17 K6 n6 ...
 +
    beta22 beta18 K1 n1 beta23 K7 n7 beta24 K2 n2 ...
 +
    beta25 K8 n8 gamma37 beta26 K3 n3 beta27 K9 n9 ...
 +
    gamma38 beta28 K4 n4 beta29 K10 n10 beta30 K5 n5 ...
 +
    beta31 K11 n11 gamma39 EnvZ_b OmpR_b K14 n14; 
 +
<span class="comment">% A program must load all parameters !
 +
</span>
 +
if prom2 == <span class="string">'pFlgA'</span>
 +
    F = @f6
 +
elseif prom2 == <span class="string">'pFlgA'</span>
 +
        F = @f7
 +
    <span class="keyword">end</span>
 +
else error(<span class="string">'Wrong promoter <span class="keyword">for</span> FP2<span class="string">')
 +
<span class="keyword">end</span>
 +
 +
if prom1 == <span class="string">'pTet'</span>
 +
    try aTc = eval(retro)
 +
    catch error(<span class="string">'Wrong aTc Value<span class="string">')
 +
    <span class="keyword">end</span>
 +
     
 +
    <span class="keyword">function</span> ydot = deriv(t,y)<span class="comment"> % dy/dt
 +
</span>                              <span class="comment"> % pTet : y(6) = TetR ; retro = aTc
 +
</span>        ydot = [f1(y(6), aTc);
 +
                f4(y(1), y(2));
 +
                f5(y(1), y(2)) - gamma36;
 +
                F(y(1), y(2)) - gamma37;
 +
                f8(y(1), y(2)) - gamma38;
 +
                f8(y(1), y(2));] - gamma*ones(6,1)
 +
    <span class="keyword">end</span>
 +
elseif prom1 == <span class="string">'pFlhDC'</span>
 +
    if retro == <span class="string">'OmpR'</span>
 +
        <span class="keyword">function</span> ydot = deriv(t,y) <span class="comment"> % dy/dt
 +
</span>                                    <span class="comment"> % pFlhDC : y(6) = OmpR
 +
</span>            ydot = [f3(y(2), y(6));
 +
                    f4(y(1), y(2));
 +
                    f5(y(1), y(2)) - gamma36;
 +
                    F(y(1), y(2)) - gamma37;
 +
                    f8(y(1), y(2)) - gamma38;
 +
                    f8(y(1), y(2));] - gamma*ones(6,1)
 +
        <span class="keyword">end</span>
 +
    elseif retro == <span class="string">'EnvZ'</span>
 +
        <span class="keyword">function</span> ydot = deriv(t,y) <span class="comment"> % dy/dt
 +
</span>                                    <span class="comment"> % pFlhDC : y(6) = EnvZ
 +
</span>            ydot = [f3bis(y(6), y(2));
 +
                    f4(y(1), y(2));
 +
                    f5(y(1), y(2)) - gamma36;
 +
                    F(y(1), y(2)) - gamma37;
 +
                    f8(y(1), y(2)) - gamma38;
 +
                    f8(y(1), y(2));] - gamma*ones(6,1)
 +
        <span class="keyword">end</span>
 +
    else
 +
        error(<span class="string">'gene <span class="keyword">for</span> negative feed-back<span class="string">')
 +
    <span class="keyword">end</span>
 +
else
 +
    error(<span class="string">'Wrong promoter <span class="keyword">for</span> flhDC<span class="string">')
 +
    <span class="keyword">end</span>
 +
<span class="keyword">end</span>
 +
 +
[t,labo]=ode45(deriv,t,init);
 +
 +
<span class="comment">% The 'full modularity' of this Approach allow other variations, 
 +
</span><span class="comment">% like  changing the place of the negative feed-back
 +
</span><span class="comment">% (changing f8 by f7, f6, f5)...</span>
 +
</pre></html>
</div>
</div>

Revision as of 04:57, 30 October 2008

complexes

function complexes = complexes(x,y,K,n)
% amount of complexes n*x + y = x_-_y in function of x, y
 
% x, y = initial amounts of binding molecules
% K = dissociation constant
% n = stoechiometric coefficient of x
 
syms z; % to treat z as a symbolic variable
Eqn = ( ( x - n*z )^n )*( y - z ) - K*z; % to define the equation in whose
                                          % the amount of complexes is a root  
 
S = eval(solve( Eqn, 'z' )); % the vector of the roots
 
Index = find ((0 < S) & (n*S < x) & (S < y) & (imag(S) == 0)); % determine  
                                                                % which
                                                                % root is  
                                                                % acceptable
 
complexes = S(Index(1)); % the result
 
end

hill

function compl = hill(x,K,n)
% complexation nx + Y = x_-_Y when x is in large excess :
% gives the ratio (x_-_Y)/(Ytotal) in function of x
 
% x = molecule that binds to Y
% K^n = dissociation constant
% n = stoechiometric coefficient of x ; also known as 'cooperativity'
 
compl = x^n/(K^n + x^n);
 
end

Global

function labo=Core_Sytem_Simulation (t, init, prom1, prom2, retro)
% Simulation of our Core_System
 
% prom1 = 'pTet' or 'pFlhDC'
% prom2 = 'pFlgA' or 'pFlgB'
% retro = 'EnvZ' or 'OmpR' or quantity of aTc
 
% t = discret time scale
% init = vector of the initial state
%   [FlhDC;
%    FliA;
%    FP1;
%    FP2;
%    FP3;
%    TetR / OmpR / EnvZ] regards to the studied version
 
global gamma beta16 K13 n13 K12 n12 K15 n15 beta17 K6 n6 ...
     beta22 beta18 K1 n1 beta23 K7 n7 beta24 K2 n2 ...
     beta25 K8 n8 gamma37 beta26 K3 n3 beta27 K9 n9 ...
     gamma38 beta28 K4 n4 beta29 K10 n10 beta30 K5 n5 ...
     beta31 K11 n11 gamma39 EnvZ_b OmpR_b K14 n14;  
% A program must load all parameters !
 
if prom2 == 'pFlgA'
     F = @f6
elseif prom2 == 'pFlgA'
         F = @f7
     end
else error('Wrong promoter for FP2')
end
 
if prom1 == 'pTet'
     try aTc = eval(retro)
     catch error('Wrong aTc Value')
     end
       
     function ydot = deriv(t,y) % dy/dt
                                % pTet : y(6) = TetR ; retro = aTc
         ydot = [f1(y(6), aTc);
                 f4(y(1), y(2));
                 f5(y(1), y(2)) - gamma36;
                 F(y(1), y(2)) - gamma37;
                 f8(y(1), y(2)) - gamma38;
                 f8(y(1), y(2));] - gamma*ones(6,1)
     end
elseif prom1 == 'pFlhDC'
     if retro == 'OmpR'
         function ydot = deriv(t,y)  % dy/dt
                                     % pFlhDC : y(6) = OmpR
             ydot = [f3(y(2), y(6));
                     f4(y(1), y(2));
                     f5(y(1), y(2)) - gamma36;
                     F(y(1), y(2)) - gamma37;
                     f8(y(1), y(2)) - gamma38;
                     f8(y(1), y(2));] - gamma*ones(6,1)
         end
     elseif retro == 'EnvZ'
         function ydot = deriv(t,y)  % dy/dt
                                     % pFlhDC : y(6) = EnvZ
             ydot = [f3bis(y(6), y(2));
                     f4(y(1), y(2));
                     f5(y(1), y(2)) - gamma36;
                     F(y(1), y(2)) - gamma37;
                     f8(y(1), y(2)) - gamma38;
                     f8(y(1), y(2));] - gamma*ones(6,1)
         end
     else
         error('gene for negative feed-back')
     end
else
     error('Wrong promoter for flhDC')
     end
end
 
[t,labo]=ode45(deriv,t,init);
 
% The 'full modularity' of this Approach allow other variations,  
% like  changing the place of the negative feed-back
% (changing f8 by f7, f6, f5)...