0001
0002
0003 demo_dir = [fileparts(which(mfilename))];
0004
0005 cd(demo_dir)
0006
0007 echo on;
0008 clc
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 pause
0023 clc
0024
0025
0026
0027
0028
0029 load('/data/yeast_ccm_network.mat');
0030
0031
0032
0033 pause
0034 clc
0035
0036
0037
0038
0039
0040
0041
0042 [cba_options, cba_constraints] = cba_default_options(network);
0043
0044
0045
0046 pause
0047 clc
0048
0049
0050
0051 cba_constraints.v_sign = v_sign;
0052
0053
0054
0055
0056 cba_constraints.v_fix(label_names({'R00253'},network.actions)) = 0;
0057 cba_constraints.v_fix(label_names({'R00258'},network.actions)) = 0;
0058 cba_constraints.v_fix(label_names({'R00114'},network.actions)) = 0;
0059 cba_constraints.v_fix(label_names({'R00243'},network.actions)) = 0;
0060 cba_constraints.v_fix(label_names({'R00341'},network.actions)) = 0;
0061 cba_constraints.v_fix(label_names({'R00344'},network.actions)) = 0;
0062 cba_constraints.v_fix(label_names({'R00711'},network.actions)) = 0;
0063
0064
0065
0066 cba_constraints.v_sign(label_names({'R00342'},network.actions)) = 1;
0067
0068
0069
0070 cba_constraints.v_max(label_names({'Oxphos__NADH__irrev__ATP'},network.actions)) = 2;
0071
0072
0073
0074 pause
0075 clc
0076
0077
0078
0079
0080
0081
0082
0083 zx = zeros(nm,1);
0084 zx(label_names({'ATP'},network.metabolites)) = 1;
0085
0086
0087
0088 cba_constraints.z_int = 0 * cba_constraints.z_int;
0089 cba_constraints.z_ext = zx(find(network.external));
0090 cba_constraints.zv = network.N' * zx;
0091
0092
0093
0094 pause
0095 clc
0096
0097
0098
0099
0100
0101
0102 [v_fba,f_benefit] = fba(network,cba_constraints);
0103
0104
0105
0106
0107 f_benefit = cba_constraints.zv'*v_fba;
0108
0109 v = pmf(network,cba_constraints,f_benefit,v_fba);
0110
0111
0112
0113
0114 v(abs(v) < 10^-5 *max(abs(v))) = 0;
0115
0116 v = project_fluxes(network.N,find(network.external), v,[],sign(v),struct('method','euclidean'));
0117
0118
0119
0120
0121 pause
0122 clc
0123
0124
0125
0126
0127 cba_constraints.ind_ignore = label_names({'Biomass_production'},network.actions);
0128
0129 [v,C] = eba_make_feasible(v, network. N, 'loose', nan, cba_constraints.ind_ignore);
0130
0131
0132
0133 pause
0134 clc
0135
0136
0137
0138
0139
0140
0141 cba_constraints.dmu_limit = 10;
0142 cba_constraints.dmu_limit_min = 2;
0143 cba_constraints.mu_min = -20 * ones(size(cba_constraints.mu_min));
0144 cba_constraints.mu_max = 20 * ones(size(cba_constraints.mu_min));
0145 cba_constraints.dmu_min = -20 * ones(size(cba_constraints.dmu_min));
0146 cba_constraints.dmu_max = 20 * ones(size(cba_constraints.dmu_min));
0147 cba_constraints.rho = 100;
0148
0149
0150
0151 pause
0152 clc
0153
0154
0155
0156 [mu, success_flag] = sample_feasible_mu(network.N,find(network.external),v,cba_constraints,cba_options,'sample',1);
0157
0158
0159
0160 pause
0161 clc
0162
0163
0164
0165 [w, delta_w, y, zx] = cba_homogeneous_cost(network, v, cba_constraints);
0166
0167
0168
0169 pause
0170 clc
0171
0172
0173
0174
0175
0176 c = 1+5*rand(size(mu));
0177
0178
0179
0180 cba_options.check_curvatures = 0;
0181 cba_constraints.Q_ext = [];
0182 cba_constraints.hu = ones(size(network.actions));
0183
0184
0185
0186 [network_new, res, cba_constraints_new] = cba_reconstruct_model(network, v, mu, cba_constraints, cba_options, y, w, c);
0187
0188
0189
0190 pause
0191 clc
0192
0193
0194
0195
0196
0197 figure(1); clf;
0198 netgraph_concentrations(network_CoSplit,network.external,[],1,struct('actprintnames',1));
0199
0200
0201 pause
0202
0203
0204
0205 figure(2); clf;
0206 netgraph_concentrations(network_CoSplit,-network.external,v,1,struct('actstyle','none','arrowsize',0.03));
0207
0208
0209 pause
0210
0211
0212
0213 figure(3); clf;
0214 netgraph_concentrations(network_CoHid,[],v_sign,1,struct('actstyle','fixed','arrowsize',0.03,'actprintnames',1));
0215
0216
0217 pause
0218
0219
0220
0221 figure(4); clf;
0222 netgraph_concentrations(network_CoSplit,[],cba_constraints.zv .* v,1,struct('arrowstyle','none'));
0223
0224
0225 pause
0226
0227
0228
0229 figure(5); clf;
0230 netgraph_concentrations(network_CoHid,mu,[-network.N'*mu].*[v~=0],1,struct('actstyle','none','arrowsize',0.01));
0231
0232
0233 pause
0234
0235
0236
0237 figure(5); clf;
0238 netgraph_concentrations(network_CoHid,w,[-network.N'*w].*[v~=0],1,struct('actstyle','none','arrowsize',0.01));
0239
0240
0241 pause
0242 clc
0243
0244
0245
0246
0247
0248
0249
0250 pause
0251 return