from
Systems Biology Tool Box ODE Generator
by Ilya Chorny
Utility to generate ODEs from and xml file generated by sbiodesktop
|
| create_ODEs.m |
modelOBJ = sbmlimport('cAMP_model_rev21.xml');
nreactions = length(modelOBJ.Reactions);
nspecies = length(modelOBJ.Species);
fid = fopen('ode.m', 'w');
for i=1:nspecies
strnum = int2str(i);
str = strcat('yd(',strnum,') = ');
if(modelOBJ.species(i).ConstantAmount == 0)
for j=1:nreactions
nreac = length(modelOBJ.Reactions(j).reactants);
nprod = length(modelOBJ.Reactions(j).products);
for k=1:nreac
if(strcmp(modelOBJ.Species(i).name, modelOBJ.Reactions(j).reactants(k).name) == 1)
str = strcat(str,' -(',modelOBJ.Reactions(j).reactionRate,')');
end
end
for k=1:nprod
if(strcmp(modelOBJ.Species(i).name, modelOBJ.Reactions(j).product(k).name) == 1)
str = strcat(str,' +(', modelOBJ.Reactions(j).reactionRate,')');
end
end
end
else
str = strcat(str,' 0.0');
end
fprintf(fid,'%s;\n',str);
end
fprintf(fid,'\n\n\n');
fprintf(fid,'yd = transpose(yd);\n');
fclose(fid);
|
|
Contact us at files@mathworks.com