
%iGEM 2008 :MB

close all; 
clear all;
clc;
warning off MATLAB:divideByZero

global K_1 K_2 K_3 K_4 K_5 K_g delta1 delta2;



disp(' ');
disp('__________________________________________________________________________');
disp('iGEM 2008 : Inducible Promoter Model 1');
disp('__________________________________________________________________________');
disp(' ');

tmax = input('t_max of the simulation? (Default is 10) ');
if isempty(tmax)
    tmax = 10;
end

K_1 = input('K_1 ? (Default is 1) ');
if isempty(K_1)
    K_1 = 1;
end
K_2=0;
K_3=0;

K_4 = input('K_4 ? (Default is 1) ');
if isempty(K_4)
    K_4 = 1;
end
K_5 = input('K_5 ? (Default is 1) ');
if isempty(K_5)
    K_5 = 1;
end

K_g = input('K_g ? (Default is 1) ');
if isempty(K_g)
    K_g = 1;
end

delta1 = input('Degradation rate of LacI ? (Default is 1) ');
if isempty(delta1)
    delta1 = 1;
end

delta2 = input('Degradation rate of GFP ? (Default is 1) ');
if isempty(delta2)
    delta2 = 1;
end



disp(' ');
disp('__________________________________________________________________________');
disp(' Initial Conditions');
disp('__________________________________________________________________________');
disp(' ');



alpha = input('Initial Concentrationof LacI? (Default is 0) ');
if isempty(alpha)
    alpha= 0;
end
x0(1)=alpha;
x0(2)=0;
x0(3)=0;

alpha = input('Initial Concentrationof of Promoter? (Default is 1) ');
if isempty(alpha)
    alpha= 1;
end
x0(4)=alpha;

alpha = input('Initial Concentrationof of Bound Promoter? (Default is 0) ');
if isempty(alpha)
    alpha= 0;
end
x0(5)=alpha;

alpha = input('Initial Concentrationof of GFP? (Default is 0) ');
if isempty(alpha)
    alpha= 0;
end
x0(6)=alpha;


% x(1); % LacI
% x(2); % IPTG
% x(3); % LacI-IPTG
% x(4); % P
% x(5); % P-LacI
% x(6); % GFP

%__________________________________________________________________________
%__________________________________________________________________________
% Display Options: User chooses what plots they want to see

disp(' ');
disp('__________________________________________________________________________');
disp(' ');
disp('You can now choose what plots to display');
display_option = input('Do You want to see all the plots or customize the display ? (0=All else=Custom)');
if isempty(display_option)
    display_option = 0;
end

display_option_1=1;
display_option_2=0;
display_option_3=0;
display_option_4=1;
display_option_5=1;
display_option_6=1;

if (display_option>0)
    alpha = input('Do You want to see the Evolution of the concentration of LacI? (0=N else Y)');
    if isempty(alpha)
        alpha = 1;
    end
    if (alpha>0)
        alpha=1;
    end
    display_option_1=alpha;

       
    alpha = input('Do You want to see the Evolution of the concentration of free Promoters else Y)');
    if isempty(alpha)
        alpha = 1;
    end
    if (alpha>0)
        alpha=1;
    end
    display_option_4=alpha;
    
    
    alpha = input('Do You want to see the Evolution of the concentration of the P-LacI Complex? (0=N else Y)');
    if isempty(alpha)
        alpha = 1;
    end
    if (alpha>0)
        alpha=1;
    end
    display_option_5=alpha;
    
    
    alpha = input('Do You want to see the Evolution of the concentration of GFP? (0=N else Y)');
    if isempty(alpha)
        alpha = 1;
    end
    if (alpha>0)
        alpha=1;
    end
    display_option_6=alpha;
end

[t,x] = ode45('InduciblePromoter_SimpleODE',[0 tmax],x0);

%__________________________________________________________________________
%__________________________________________________________________________
% Display of the Interesting Quantities

if (display_option_1>0)
    figure;
    maxi=0;
    plot(t, x(:,1));
    maxi=max(x(:,1));
    if (maxi==0)
        maxi=0.1;
    end
    
    axis([0 tmax 0 maxi]);
    xlabel('time');
    ylabel('Concentration of the concentration of LacI');
    title(' Evolution of the Concentration of the concentration of LacI ');
    hold off;
end


if (display_option_4>0)
    figure;
    maxi=0;
    plot(t, x(:,4));
    maxi=max(x(:,4));
    if (maxi==0)
        maxi=0.1;
    end
    
    axis([0 tmax 0 maxi]);
    xlabel('time');
    ylabel('Concentration of the concentration of free Promoters');
    title(' Evolution of the Concentration of the concentration of free Promoters');
    hold off;
end

if (display_option_5>0)
    figure;
    maxi=0;
    plot(t, x(:,5));
    maxi=max(x(:,5));
    if (maxi==0)
        maxi=0.1;
    end
    
    axis([0 tmax 0 maxi]);
    xlabel('time');
    ylabel('Concentration of the concentration of the P-LacI Complex');
    title(' Evolution of the Concentration of the concentration of the P-LacI Complex');
    hold off;
end

if (display_option_6>0)
    figure;
    maxi=0;
    plot(t, x(:,6));
    maxi=max(x(:,6));
    if (maxi==0)
        maxi=0.1;
    end
    
    axis([0 tmax 0 maxi]);
    xlabel('time');
    ylabel('Concentration of Fluorescent Protein FP');
    title(' Evolution of the Concentration of Fluorescent Protein FP');
    hold off;
end


clear all
%__________________________________________________________________________
%__________________________________________________________________________