Team:Colombia/Scripting
From 2014.igem.org
(Difference between revisions)
Line 14: | Line 14: | ||
</font></h1></b></center> | </font></h1></b></center> | ||
<br> | <br> | ||
- | <b><font color="#8A0808" size="3" > | + | <b><font color="#8A0808" size="3" >Deterministic Model</font></b> |
<br> | <br> | ||
- | This code creates the differential equations governing the concentration dinamics of each protein in our model, finds the steady state solutions and then solves them using the numerical aproximation method Runge-Kutta | + | This code creates the differential equations governing the concentration dinamics of each protein in our model, finds the steady state solutions and then solves them using the numerical aproximation method Runge-Kutta<br> |
<textarea> | <textarea> | ||
function y=det() | function y=det() | ||
Line 191: | Line 191: | ||
<b><font color="#8A0808" size="3" >Metropolis-Hastings Algorithm</font></b> | <b><font color="#8A0808" size="3" >Metropolis-Hastings Algorithm</font></b> | ||
<br> | <br> | ||
- | This code determines which set of values for missing parameters yield the most desirable response. | + | This code determines which set of values for missing parameters yield the most desirable response.<br> |
<textarea> | <textarea> | ||
function y=model(patr, pbtr, pho, pkttr, pata, pbta, phtr,pn) | function y=model(patr, pbtr, pho, pkttr, pata, pbta, phtr,pn) | ||
Line 202: | Line 202: | ||
%--------------------------------------------% | %--------------------------------------------% | ||
% | % | ||
- | kcc=1; | + | kcc=1; % CAI1 and CqsS coupling Rate |
- | kcd=1; | + | kcd=1; % CAI1 and CqsS decoupling Rate |
- | kcu=2; | + | kcu=2; % Michaelis Menten Constant for the phoshporylation CqsS-LuxU |
- | kuc=1; | + | kuc=1; % Michaelis Menten Constant of the phosphase process CqSS-LuxU |
- | kuo=2; | + | kuo=2; % Michaelis Menten Constant for the phoshporylation LuxU-LuxO |
- | kou=1; | + | kou=1; % Michaelis Menten Constant of the phosphase process LuxU-LuxO |
- | kttr=pkttr; | + | kttr=pkttr; %Dimerization rate of TetR |
- | gcs=0.5; | + | gcs=0.5; % CqsS protein decay rate |
- | gcsa=1; | + | gcsa=1; % CqsS* protein decay rate |
guf=0.12; % LuxU* protein decay rate | guf=0.12; % LuxU* protein decay rate | ||
gu=0.65; % LuxU protein decay rate | gu=0.65; % LuxU protein decay rate | ||
Line 217: | Line 217: | ||
go=0.12; % LuxO protein decay rate | go=0.12; % LuxO protein decay rate | ||
gtr=0.12; % Ptet Repressor protein decay rate | gtr=0.12; % Ptet Repressor protein decay rate | ||
- | gttr=0.12; | + | gttr=0.12; %Ptet2 dimer Repressor decay rate |
gta=0.12; % Ptet Activator protein decay rate | gta=0.12; % Ptet Activator protein decay rate | ||
- | gr=0.12; | + | gr=0.12; % Response molecule decay rate |
% | % | ||
- | acs=5; | + | acs=5; % CS basal production rate |
- | au=5; | + | au=5; % LuxU basal production rate |
- | ao=5; | + | ao=5; % LuxO basal production rate |
- | ar=0; | + | ar=0; % response molecule basal production rate |
- | atr=patr; | + | atr=patr; % TR basal production rate |
- | ata=pata; | + | ata=pata; % TA basal production rate |
% | % | ||
- | bcu=1; | + | bcu=1; % Phosphorylation rate of CqsS to LuxU |
- | buc=0.1; | + | buc=0.1; % Phosphase rate of CqsS to LuxU |
- | buo=3.2; | + | buo=3.2; % Phosphorylation rate LuxU-LuxO |
bou=1.58; % Phosphase rate LuxU-LuxO | bou=1.58; % Phosphase rate LuxU-LuxO | ||
- | btr=pbtr; | + | btr=pbtr; % Maximum rate of TR expression |
- | bta=pbta; | + | bta=pbta; % Maximum rate of TA expression |
% | % | ||
- | ho=pho; | + | ho=pho; % LuxO*- DNA coupling rate |
- | htr=phtr; | + | htr=phtr; % TRdomain-DNA coupling rate |
% | % | ||
- | n=pn;% Hill coefficient | + | n=pn; % Hill coefficient |
% | % | ||
% | % | ||
Line 248: | Line 248: | ||
%--------------------------------------------% | %--------------------------------------------% | ||
% | % | ||
- | h=210; | + | h=210; % Maximum time |
- | m=1/12; | + | m=1/12; % Step lenght [h] |
- | conInd=[1,0,1,1,1,1,0,1,1,1]; | + | conInd=[1,0,1,1,1,1,0,1,1,1]; % |
- | l=(0:m:h)'; | + | l=(0:m:h)'; % Time vector |
- | x=zeros(length(l),length(conInd)); | + | x=zeros(length(l),length(conInd)); % Variable's Matrix, the variables in each column and time in each row |
- | C=zeros(1,length(l)); | + | C=zeros(1,length(l)); % zero vector to be filled |
- | x(1,:)=conInd; | + | x(1,:)=conInd; % |
% | % | ||
for k=1:length(l)-1 | for k=1:length(l)-1 | ||
- | xk=x(k,:); | + | xk=x(k,:); % Capture of the last value in the matrix, the actual variable values |
- | k1=difeq_Metropolis(l(k),xk); | + | k1=difeq_Metropolis(l(k),xk); % First slope of the RK4 method |
- | k2=difeq_Metropolis(l(k)+m/2,xk+(m/2*k1)'); | + | k2=difeq_Metropolis(l(k)+m/2,xk+(m/2*k1)'); % Second slope of the RK4 method |
- | k3=difeq_Metropolis(l(k)+m/2,xk+(m/2*k2)'); | + | k3=difeq_Metropolis(l(k)+m/2,xk+(m/2*k2)'); % Third slope of the RK4 method |
- | k4=difeq_Metropolis(l(k)+m,xk+(m*k3)'); | + | k4=difeq_Metropolis(l(k)+m,xk+(m*k3)'); % Fourth slope of the RK4 method |
- | xk1=xk+m/6*(k1+2*k2+2*k3+k4)'; | + | xk1=xk+m/6*(k1+2*k2+2*k3+k4)'; % New value calculation for the variables |
- | %xk1=xk+m*difeq_Metropolis(l(k),xk)'; | + | %xk1=xk+m*difeq_Metropolis(l(k),xk)'; % Another aproximation, Newton's method |
- | xk2=zeros(1,length(xk1)); | + | xk2=zeros(1,length(xk1)); % |
% | % | ||
for p=1:length(xk1) | for p=1:length(xk1) | ||
Line 273: | Line 273: | ||
end | end | ||
end | end | ||
- | x(k+1,:)=xk2; | + | x(k+1,:)=xk2; % Actualizacion del nuevo vector de variables en la matriz |
end | end | ||
% | % | ||
Line 286: | Line 286: | ||
% | % | ||
- | CS=x(:,1); | + | CS=x(:,1); % |
- | CSa=x(:,2); | + | CSa=x(:,2); % |
- | Uf=x(:,3); | + | Uf=x(:,3); % |
- | U=x(:,4); | + | U=x(:,4); % |
- | Of=x(:,5); | + | Of=x(:,5); % |
- | O=x(:,6); | + | O=x(:,6); % |
- | TR=x(:,7); | + | TR=x(:,7); % |
- | TTR=x(:,8); | + | TTR=x(:,8); % |
- | TA=x(:,9); | + | TA=x(:,9); % |
- | R=x(:,10); | + | R=x(:,10); % |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
+ | %figure; % | ||
+ | %plot(l,C,l,R,'r'); % | ||
+ | %legend ('CAI','Chromoprotein'); % | ||
+ | %xlabel('Time [h]'); % | ||
+ | %ylabel('Concentration [nanomolar]'); % | ||
+ | %title('Response'); % | ||
+ | % | ||
y=[R(95*12),R(100*12),R(105*12),R(110*12),R(115*12),R(120*12),R(125*12),R(130*12),R(135*12),R(140*12),R(145*12),R(150*12),R(155*12),R(160*12),R(165*12),R(170*12)]; | y=[R(95*12),R(100*12),R(105*12),R(110*12),R(115*12),R(120*12),R(125*12),R(130*12),R(135*12),R(140*12),R(145*12),R(150*12),R(155*12),R(160*12),R(165*12),R(170*12)]; | ||
+ | % | ||
+ | % | ||
% | % | ||
% | % | ||
RFP=[3,3.1,3.15,3.5,4.8,6,11,15,16.5,18,18.5,19,19.5,20,20.25,20.5]; | RFP=[3,3.1,3.15,3.5,4.8,6,11,15,16.5,18,18.5,19,19.5,20,20.25,20.5]; | ||
t=[95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170]; | t=[95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170]; | ||
- | + | % | |
steps=5000; | steps=5000; | ||
- | + | % | |
atr_walk=zeros(1,steps+1); | atr_walk=zeros(1,steps+1); | ||
btr_walk=zeros(1,steps+1); | btr_walk=zeros(1,steps+1); | ||
Line 320: | Line 322: | ||
htr_walk=zeros(1,steps+1); | htr_walk=zeros(1,steps+1); | ||
n_walk=zeros(1,steps+1); | n_walk=zeros(1,steps+1); | ||
- | + | % | |
atr_walk(1)=random('unif',0.5,1.5); | atr_walk(1)=random('unif',0.5,1.5); | ||
btr_walk(1)=random('unif',4,6); | btr_walk(1)=random('unif',4,6); | ||
Line 329: | Line 331: | ||
htr_walk(1)=random('unif',4,7); | htr_walk(1)=random('unif',4,7); | ||
n_walk(1)=random('unif',1,3); | n_walk(1)=random('unif',1,3); | ||
- | + | % | |
for i=1:steps | for i=1:steps | ||
- | + | % | |
atr_prime=random('unif',atr_walk(i)-0.2,atr_walk(i)+0.2); | atr_prime=random('unif',atr_walk(i)-0.2,atr_walk(i)+0.2); | ||
btr_prime=random('unif',btr_walk(i)-0.2,btr_walk(i)+0.2); | btr_prime=random('unif',btr_walk(i)-0.2,btr_walk(i)+0.2); | ||
Line 340: | Line 342: | ||
htr_prime=random('unif',htr_walk(i)-0.2,htr_walk(i)+0.2); | htr_prime=random('unif',htr_walk(i)-0.2,htr_walk(i)+0.2); | ||
n_prime=random('unif',n_walk(i)-0.2,n_walk(i)+0.2); | n_prime=random('unif',n_walk(i)-0.2,n_walk(i)+0.2); | ||
- | + | % | |
model_i=model(atr_walk(i),btr_walk(i),ho_walk(i),kttr_walk(i),ata_walk(i),bta_walk(i),htr_walk(i),n_walk(i)); | model_i=model(atr_walk(i),btr_walk(i),ho_walk(i),kttr_walk(i),ata_walk(i),bta_walk(i),htr_walk(i),n_walk(i)); | ||
model_prime=model(atr_prime,btr_prime,ho_prime,kttr_prime,ata_prime,bta_prime,htr_prime,n_prime); | model_prime=model(atr_prime,btr_prime,ho_prime,kttr_prime,ata_prime,bta_prime,htr_prime,n_prime); | ||
- | + | % | |
alpha=likelihood_lineal(RFP,model_prime)/likelihood_lineal(RFP,model_i); | alpha=likelihood_lineal(RFP,model_prime)/likelihood_lineal(RFP,model_i); | ||
- | + | % | |
if(alpha>=1) | if(alpha>=1) | ||
atr_walk(i+1)=atr_prime; | atr_walk(i+1)=atr_prime; | ||
Line 379: | Line 381: | ||
i | i | ||
end | end | ||
- | + | % | |
figure (1) | figure (1) | ||
plot(t,RFP,'b',t,model(atr_walk(steps+1),btr_walk(steps+1),ho_walk(steps+1),kttr_walk(steps+1),ata_walk(steps+1),bta_walk(steps+1),htr_walk(steps+1),n_walk(steps+1)),'r') | plot(t,RFP,'b',t,model(atr_walk(steps+1),btr_walk(steps+1),ho_walk(steps+1),kttr_walk(steps+1),ata_walk(steps+1),bta_walk(steps+1),htr_walk(steps+1),n_walk(steps+1)),'r') | ||
Line 385: | Line 387: | ||
ylabel('Reportero') | ylabel('Reportero') | ||
title('Respuesta') | title('Respuesta') | ||
- | + | % | |
figure (2) | figure (2) | ||
scatter((1:steps+1),atr_walk) | scatter((1:steps+1),atr_walk) | ||
Line 391: | Line 393: | ||
ylabel('valor') | ylabel('valor') | ||
title('atr') | title('atr') | ||
- | + | % | |
figure (3) | figure (3) | ||
scatter((1:steps+1),btr_walk) | scatter((1:steps+1),btr_walk) | ||
Line 397: | Line 399: | ||
ylabel('valor') | ylabel('valor') | ||
title('btr') | title('btr') | ||
- | + | % | |
figure (4) | figure (4) | ||
scatter((1:steps+1),ho_walk) | scatter((1:steps+1),ho_walk) | ||
Line 403: | Line 405: | ||
ylabel('valor') | ylabel('valor') | ||
title('ho') | title('ho') | ||
- | + | % | |
figure (5) | figure (5) | ||
scatter((1:steps+1),kttr_walk) | scatter((1:steps+1),kttr_walk) | ||
Line 409: | Line 411: | ||
ylabel('valor') | ylabel('valor') | ||
title('kttr') | title('kttr') | ||
- | + | % | |
- | + | ||
figure (6) | figure (6) | ||
scatter((1:steps+1),ata_walk) | scatter((1:steps+1),ata_walk) | ||
Line 416: | Line 417: | ||
ylabel('valor') | ylabel('valor') | ||
title('ata') | title('ata') | ||
- | + | % | |
- | + | ||
figure (7) | figure (7) | ||
scatter((1:steps+1),bta_walk) | scatter((1:steps+1),bta_walk) | ||
Line 423: | Line 423: | ||
ylabel('valor') | ylabel('valor') | ||
title('bta') | title('bta') | ||
- | + | % | |
- | + | ||
figure (8) | figure (8) | ||
scatter((1:steps+1),htr_walk) | scatter((1:steps+1),htr_walk) | ||
Line 430: | Line 429: | ||
ylabel('valor') | ylabel('valor') | ||
title('htr') | title('htr') | ||
- | + | % | |
- | + | ||
figure (9) | figure (9) | ||
scatter((1:steps+1),n_walk) | scatter((1:steps+1),n_walk) |
Revision as of 03:27, 16 October 2014
Scripting
Feel free to expand and scroll through the text boxes in order to further examine the code.
Deterministic Model
This code creates the differential equations governing the concentration dinamics of each protein in our model, finds the steady state solutions and then solves them using the numerical aproximation method Runge-Kutta
Metropolis-Hastings Algorithm
This code determines which set of values for missing parameters yield the most desirable response.