-------------------------------------------------------------------------- Script for running model embedding (This script is also called by scripts in directory 'models') ---------------------------------------------------------------------------
0001 % -------------------------------------------------------------------------- 0002 % Script for running model embedding 0003 % (This script is also called by scripts in directory 'models') 0004 % --------------------------------------------------------------------------- 0005 0006 % Model variables to be loaded (from files in 'model' subdiretory): 0007 % 0008 % kinetic_models - list of kinetic models to be embedded 0009 % steady state concentrations for kinetic models 0010 % must be given in fields 's_init' 0011 % network - network model into which they are embedded 0012 % network_CoHid - version with cofactors omitted (only for graphics) 0013 % me_options - directives for model embedding, for details see 'model_embedding' 0014 % c_init - initial state (augmented model), only used for dynamic simulations 0015 % T_max - duration of dynamic simulations 0016 0017 0018 % --------------------------------------------------------------------------- 0019 % Load model 0020 0021 if ~exist('model_name','var'), error('No model name has been specified'); end 0022 0023 %filenames = filenames_embedding(model_name); 0024 %load(filenames.network_file); 0025 0026 eval(default('me_options','struct')); 0027 0028 me_options = join_struct(model_embedding_default_options,me_options); 0029 %me_options.verbose = 1; 0030 0031 0032 % ------------------------------------------------------------ 0033 % Run model embedding 0034 0035 [network_combined, res, network_aug, network_aug_CoHid, network_aug_CoSplit] = model_embedding(kinetic_models, network, network_CoHid, me_options ); 0036 0037 % netgraph_edit_positions(network_aug_CoSplit, me_options.position_file,0); 0038 0039 0040 % ------------------------------------------------------------ 0041 % Check whether fluxes are stationary 0042 0043 flux_stationary = flux_check_stationarity(network_combined,res.v_combined); 0044 if me_options.verbose 0045 flux_stationary 0046 end 0047 0048 % ------------------------------------------------------------ 0049 % Run simulations 0050 0051 c_init = me_options.c_init; 0052 Tmax = me_options.Tmax ; 0053 0054 if isempty(c_init), 0055 c_init = res.c_combined; c_init(1) = 5 * c_init(1); 0056 end 0057 0058 v_init = network_velocities(c_init,network_combined); 0059 0060 % First embedded model, simulated in isolation 0061 [simulation_local.t, simulation_local.C] = network_integrate(network_combined.kinetics.kinetic_models{1}, c_init(res.mapping_metabolites{1}), Tmax); 0062 0063 % First embedded model 0064 [simulation.t, simulation.C] = network_integrate(network_combined, c_init, Tmax); 0065 0066 0067 % ------------------------------------------------------------ 0068 % Make "flat" kinetics field and run simulation (only as check) 0069 0070 % TO DO: metbolitnamen relativ frueh in 'network' anpassen; 0071 % das geht aber nur, wenn verschiedene lokale pathways nicht ueberlappen! 0072 0073 try 0074 network_flat = model_embedding_kinetics_combined2flat(network_combined); 0075 [simulation_flat.t, simulation_flat.C] = network_integrate(network_flat, c_init, Tmax); 0076 catch 0077 %if me_options.verbose, 0078 display('No "flat" model can be generated from these input models'); 0079 %end 0080 network_flat = []; 0081 simulation_flat.t = []; 0082 end 0083 0084 0085 % ------------------------------------------------------------ 0086 % Save model 0087 0088 if length(network_flat), 0089 eval(default('sbml_dir','[]')); 0090 if length(sbml_dir), 0091 network_sbml_export(network_flat,0,'Combined model',[sbml_dir '/' model_name '_flat.xml']); 0092 end 0093 end 0094 0095 %save(filenames.result_file,'network_combined', 'res', 'network_aug', 'network_aug_CoHid', 'network_aug_CoSplit', 'c_init','v_init','simulation','simulation_local','network_flat','simulation_flat'); 0096 0097 0098 % ------------------------------------------------------------ 0099 % Graphics 0100 0101 if 0, 0102 filenames = filenames_embedding(model_name); 0103 load(filenames.network_file); 0104 %load(filenames.result_file); 0105 end 0106 0107 flag_save_graphics = 1; 0108 flag_movies = 0; 0109 eval(default('psfile_dir','[]')); 0110 0111 ca; model_embedding_graphics