IGEM:IMPERIAL/2009/Encapsulation/Modelling/Timer2/code
matlab code
%timer design 2
function dy=ty_timer_AND(t,y)
%variables
global IN PAI dm1 kp1 dp1 dm2 kp2 dp2 k1 k2 n1 n2
%PAI = PAI concentration
%IN = input concentration
%dm1 = rate of degradation of mRNA 1
%kp1 = rate of translation of protein 1
%dp1 = rate of degradation of protein 1
%dm2 = rate of degradation of mRNA 2
%kp2 = rate of translation of protein 2
%dp2 = rate of degradation of protein 2
%k1,k2 are parameters of the activator
%n1, n2 are hill functions of the activator
%equations
dy(1)=IN-dm1*y(1);
dy(2)= kp1*y(1)-dp1*y(2);
%%hill functions
A1=PAI.^n2./(k2.^n2+PAI.^n2);
act=((y(2).^n1).*A1)./(k1.^n1+(y(2).^n1).*A1)
dy(3)=act - dm2*y(3);
dy(4)=kp2*y(3)-dp2*y(4);
dy=[dy(1);dy(2);dy(3);dy(4)];
matlab calling code
%to call dy=ty_timer_AND(t,y)
clear all;
clc;
global IN PAI dm1 kp1 dp1 dm2 kp2 dp2 k1 k2 n1 n2;
%IN=50;
%PAI=0;
dm1=1;
kp1=1;
dp1=1;
dm2=1;
kp2=1;
dp2=1;
k1=1;
%k2=1;
%n1=3;
%n2=3;
i=1; %loop counter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%
PAI=0;
k2=1;
n1=3;
n2=3;
for IN=[0:0.1:0.5];
[T,Y] = ode45(@ty_timer_AND,[0:1:200], [0 0 0 0]);
%loop counter to save all solutions for y2
a2(:,i)=Y(:,2);
a4(:,i)=Y(:,4);
i=i+1;
end
%subplot(2,3,1); plot(T,Y(:,1));
figure(1); subplot(1,2,1); plot(T,a2); TITLE('protein 1'); xlabel('time'); legend('IN=0','IN=0.1','IN=0.2','IN=0.3','IN=0.4','IN=0.5')
%subplot(2,3,3); plot(T,Y(:,3));
figure(1); subplot(1,2,2); plot(T,a4);TITLE('LuxR, variable input'); xlabel('time'); legend('IN=0','IN=0.1','IN=0.2','IN=0.3','IN=0.4','IN=0.5')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%
k2=1
IN=5;
n1=3;
n2=3;
for PAI=[0:1:5];
[T,Y] = ode45(@ty_timer_AND,[0:0.01:2], [0 0 0 0]);
%loop counter to save all solutions for y2
a1(:,i)=Y(:,2);
a3(:,i)=Y(:,4);
i=i+1;
end
figure(2);subplot(1,2,1); plot(T,a1); TITLE('protein 1'); xlabel('time');
legend('PAI=0','PAI=1','PAI=2','PAI=3','PAI=4','PAI=5');
figure(2); subplot(1,2,2); plot(T,a3);TITLE('LuxR - output(n2=3)'); xlabel('time');
legend('PAI=0','PAI=1','PAI=2','PAI=3','PAI=4','PAI=5');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IN=5;
PAI=1;
n1=3;
n2=3;
for k2=[0:1:5]
[T,Y] = ode45(@ty_timer_AND,[0:1:200], [0 0 0 0]);
%loop counter to save all solutions for y2
a5(:,i)=Y(:,2);
a6(:,i)=Y(:,4);
i=i+1;
end
figure(3);subplot(1,2,1); plot(T,a5); TITLE('protein 1'); xlabel('time');
figure(3); subplot(1,2,2); plot(T,a6);TITLE('LuxR - output (variable k2)'); xlabel('time');
legend('k2=0','k2=1','k2=2','k2=3','k2=4','k2=5');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IN=5;
PAI=1;
n1=1;
k2=1;
for n2=[0:1:3]
[T,Y] = ode45(@ty_timer_AND,[0:0.1:10], [0 0 0 0]);
%loop counter to save all solutions for y2
a7(:,i)=Y(:,2);
a8(:,i)=Y(:,4);
i=i+1;
end
figure(4);subplot(1,2,1); plot(T,a7); TITLE('protein 1'); xlabel('time');
legend('n2=0','n2=1','n2=2','n2=3');
figure(4); subplot(1,2,2); plot(T,a8);TITLE('LuxR - output (varable hill exponent)'); xlabel('time');
legend('n2=0','n2=1','n2=2','n2=3');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
k2=1
IN=5;
n1=3;
n2=2;
for PAI=[0:1:5];
[T,Y] = ode45(@ty_timer_AND,[0:0.01:2], [0 0 0 0]);
%loop counter to save all solutions for y2
a9(:,i)=Y(:,2);
a10(:,i)=Y(:,4);
i=i+1;
end
figure(5);subplot(1,2,1); plot(T,a9); TITLE('protein 1'); xlabel('time');
legend('PAI=0','PAI=1','PAI=2','PAI=3','PAI=4','PAI=5');
figure(5); subplot(1,2,2); plot(T,a10);TITLE('LuxR - output (n2=2)'); xlabel('time');
legend('PAI=0','PAI=1','PAI=2','PAI=3','PAI=4','PAI=5');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
k2=2.5;
IN=10;
n1=1;
n2=1;
for PAI=[0:1:5];
[T,Y] = ode45(@ty_timer_AND,[0:0.01:20], [0 0 0 0]);
%loop counter to save all solutions for y2
a11(:,i)=Y(:,2);
a12(:,i)=Y(:,4);
i=i+1;
end
%figure(6);subplot(1,2,1); plot(T,a11); TITLE('protein 1'); xlabel('time');
%legend('PAI=0','PAI=1','PAI=2','PAI=3','PAI=4','PAI=5');
figure(6); subplot(1,2,2); plot(T,a12);TITLE('LuxR - output (k2=2.5)'); xlabel('time');
legend('PAI=0','PAI=1','PAI=2','PAI=3','PAI=4','PAI=5');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
k2=1.5;
IN=10;
n1=1;
n2=1;
for PAI=[0:1:5];
[T,Y] = ode45(@ty_timer_AND,[0:0.01:20], [0 0 0 0]);
%loop counter to save all solutions for y2
a13(:,i)=Y(:,2);
a14(:,i)=Y(:,4);
i=i+1;
end
%figure(7);subplot(1,2,1); plot(T,a13); TITLE('protein 1'); xlabel('time');
%legend('PAI=0','PAI=1','PAI=2','PAI=3','PAI=4','PAI=5');
figure(7); subplot(1,2,2); plot(T,a14);TITLE('LuxR - output (k2=1.5)'); xlabel('time');
legend('PAI=0','PAI=1','PAI=2','PAI=3','PAI=4','PAI=5');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
k2=0.5;
IN=10;
n1=1;
n2=1;
for PAI=[0:1:5];
[T,Y] = ode45(@ty_timer_AND,[0:0.01:20], [0 0 0 0]);
%loop counter to save all solutions for y2
a13(:,i)=Y(:,2);
a14(:,i)=Y(:,4);
i=i+1;
end
%figure(8);subplot(1,2,1); plot(T,a13); TITLE('protein 1'); xlabel('time');
%legend('PAI=0','PAI=1','PAI=2','PAI=3','PAI=4','PAI=5');
figure(8); subplot(1,2,2); plot(T,a14);TITLE('LuxR - output (k2=0.5)'); xlabel('time');
legend('PAI=0','PAI=1','PAI=2','PAI=3','PAI=4','PAI=5');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%