-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculate_Kset_fitness_small.m
40 lines (26 loc) · 1.72 KB
/
calculate_Kset_fitness_small.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function y = calculate_Kset_fitness_small(Experimental_Data, solutions,...
knockouts, S)
%%%%%%%%%%%%%%%%%%%%%% Define Model Characteristics %%%%%%%%%%%%%%%%%%%%%%%
ref_fluxes = Experimental_Data.ref_fluxes;
flux_rxns = Experimental_Data.flux_rxns;
flux_KOs = Experimental_Data.flux_KOs;
CV = Experimental_Data.CV;
weighted_rxn = Experimental_Data.weighted_rxn;
%%%%%%%%%%%%%%%%%%%% Calculate Parameter Set Fitness %%%%%%%%%%%%%%%%%%%%%%
y_iter = 0;
for m = 1:length(knockouts)
perturbed_fluxes = solutions(:,m);
if max(abs(S*perturbed_fluxes))>= 0.1
y_iter = 10 + y_iter; % Penalize parameter sets unable to predict mass-balanced perturbed steady state
else
predicted_flux = perturbed_fluxes(flux_rxns); % Select flux values specific to reactions included in fitness calculation from overall flux distribution
ref_flux = ref_fluxes(:,find(flux_KOs == knockouts(m))+1); % Select experimentally observed fluxes of perturbed steady state from Experimental Data object
weighted_rxn_flux = ref_flux(flux_rxns == weighted_rxn); % Weighted rxn is net glucose uptake rxn
n_refs = length(ref_flux);
y_iter_next = 1/n_refs*sum(1./CV.*(abs(predicted_flux - ... % Calculate parameter set fitness for perturbed state prediction
ref_flux)./weighted_rxn_flux));
y_iter = y_iter + y_iter_next;
end
y = 1/length(knockouts) * y_iter; % Average fitness values for each perturbed state of the current parameter set
end
end