 %  DOQCS : http://doqcs.ncbs.res.in/ 
 %  Accession Name = simple_AMPAR_traff_model2 
 %  Accession Number = 61 
 %  Transcriber = Upinder S. Bhalla, NCBS 
 %  Developer = Upinder S. Bhalla, NCBS 
 %  Species = General Mammalian 
 %  Tissue = Neuronal 
 %  Cell Compartment = Postsynaptic Density, Synaptic Spine 
 %  Notes =  This is a highly simplified model of the AMPAR trafficking cycle   that exhibits bistability. It is model 2 from Hayer and Bhalla,   PLoS 2005. Its main purpose it to illustrate how the bistability   arises. 
 
   % Note: All the concentrations are in micro Mole (uM)

function moose_convert
%Matlab simulation for chemical kinetics

% Saved on Mon Jul 18 10:03:49 2005
% Automatically generated from kkit model in MOOSE by conv_matlab

global buff;
global t;
global y;

% Define Tables here
tspan=[0, 10000];
% Molecule names
molnames = {
'1 /kinetics/Membrane/PP1-active'
'2 /kinetics/Membrane/PP1-active/PP1/PP1_cplx'
'3 /kinetics/Membrane/PP1-active/PP1[1]/PP1[1]_cplx'
'4 /kinetics/Membrane/MR*'
'5 /kinetics/Membrane/MR'
'6 /kinetics/Membrane/MR**'
'7 /kinetics/Internal/IR**'
'8 /kinetics/Internal/IR'
'9 /kinetics/Internal/IR*'
'10 /kinetics/PKA-active/memb-PKA-act/memb-PKA-act_cplx'
'11 /kinetics/PKA-active/internal-PKA-act/internal-PKA-act_cplx'
'12 /kinetics/PKA-active/memb-PKA-act[1]/memb-PKA-act[1]_cplx'
'13 /kinetics/PKA-active/internal-PKA-act[1]/internal-PKA-act[1]_cplx'
'14 /kinetics/Anchor'
};

bufnames = {
'1 /kinetics/PKA-active'
'2 /kinetics/Bulk_AMPAR'
};

sumtotnames = {
};

% Initial concs of 14 molecules
y0(1) = 0.333333;
y0(2) = 0;
y0(3) = 0;
y0(4) = 0;
y0(5) = 0;
y0(6) = 0;
y0(7) = 0;
y0(8) = 0;
y0(9) = 0;
y0(10) = 0;
y0(11) = 0;
y0(12) = 0;
y0(13) = 0;
y0(14) = 27.3333;
buff(1) = 0.0185185;
buff(2) = 0.003;

% Call the ODE solver and display results
[t, y] = ode23s(@f, tspan, y0);

hold on;
do_plots;

function do_plots()
global t;
global y;
plot(t,y(:,5));
plot(t,y(:,4));
plot(t,y(:,6));
plot(t,y(:,8));
plot(t,y(:,9));
plot(t,y(:,7));
plot(t,y(:,14));
plot(t,y(:,1));

% Evaluation function
function dydt = f(t, y)
global buff;
dydt = [
 - 1.75002 * y(4) * y(1) + 1.4 * y(2) + 0.35 * y(2) - 1.75002 * y(6) * y(1) + 1.4 * y(3) + 0.35 * y(3)
 + 1.75002 * y(4) * y(1) - 1.4 * y(2) - 0.35 * y(2)
 + 1.75002 * y(6) * y(1) - 1.4 * y(3) - 0.35 * y(3)
 + 54 * y(10) - 1.75002 * y(4) * y(1) + 1.4 * y(2) - 8.0001 * y(4) * buff(1) + 216 * y(12) + 0.35 * y(3)
 - 8.0001 * y(5) * buff(1) + 216 * y(10) + 0.35 * y(2) - 0.0008 * y(5)
 + 54 * y(12) + 0.0108 * y(14) * y(7) - 0.008 * y(6) - 1.75002 * y(6) * y(1) + 1.4 * y(3)
 + 6 * y(13) - 0.0012 * y(14) * y(7) + 0.000888889 * y(6) - 2e-05 * y(7)
 - 8.0001 * y(8) * buff(1) + 24 * y(11) + 1 * buff(2) - 1 * y(8) + 8.88889e-05 * y(5)
 + 6 * y(11) - 8.0001 * y(9) * buff(1) + 24 * y(13) - 2e-05 * y(9)
 + 0.8889 * y(5) * buff(1) - 24 * y(10) - 6 * y(10)
 + 8.0001 * y(8) * buff(1) - 24 * y(11) - 6 * y(11)
 + 0.8889 * y(4) * buff(1) - 24 * y(12) - 6 * y(12)
 + 8.0001 * y(9) * buff(1) - 24 * y(13) - 6 * y(13)
 + 0.0008 * y(5) - 0.0108 * y(14) * y(7) + 0.008 * y(6)
];

% end of model
