0001 function nn = model_embedding_kinetics_combined2flat(network_combined)
0002
0003 kk = network_combined.kinetics;
0004
0005
0006
0007 if ~strcmp(kk.type, 'embedded_kinetic_models'),
0008 error('Wrong kinetics type');
0009 end
0010
0011
0012
0013 for it = 1:length(kk.mapping_metabolites),
0014 map = kk.mapping_metabolites{it};
0015 met_kinetic_model = kk.kinetic_models{it}.metabolites;
0016 met_network_model = network_combined.metabolites(map);
0017 if ~prod(double(strcmp(met_kinetic_model, met_network_model))),
0018 error('Metabolite IDs do not match between network model and embedded kinetic model');
0019 end
0020 end
0021
0022
0023
0024 kk.kinetics_network = kinetics_convert_to_strings(network_combined,kk.kinetics_network);
0025
0026
0027
0028 for it = 1:length(kk.kinetic_models),
0029 kk.kinetic_models{it}.kinetics = kinetics_convert_to_strings(kk.kinetic_models{it}, kk.kinetic_models{it}.kinetics);
0030 if length(kk.kinetic_models{it}.kinetics.parameters),
0031 error('Cannot convert kinetics with global parameters');
0032 end
0033 end
0034
0035
0036
0037
0038 kkk.type = 'kinetic_strings';
0039 kkk.reactions = kk.kinetics_network.reactions;
0040 kkk.parameters = {};
0041 kkk.parameter_values = [];
0042
0043
0044
0045 for it = 1:length(kk.kinetic_models),
0046 ind_reactions = kk.mapping_reactions{it};
0047 my_rate_laws = kk.kinetic_models{it}.kinetics.reactions;
0048 my_enzyme_adjustments = kk.enzyme_adjustment{1};
0049
0050 for itt = 1:length( my_rate_laws),
0051 my_rate_laws{itt}.string = sprintf('EnzymeAdjustment * ( %s )', my_rate_laws{itt}.string);
0052 my_rate_laws{itt}.parameters = [my_rate_laws{itt}.parameters; 'EnzymeAdjustment'];
0053 my_rate_laws{itt}.parameter_values = [my_rate_laws{itt}.parameter_values; my_enzyme_adjustments(itt)];
0054 end
0055 kkk.reactions(ind_reactions) = my_rate_laws;
0056 end
0057
0058 nn = network_combined;
0059 nn.kinetics = kkk;