|
9 | 9 | % |/ |/ \|(_______/(_______/(_______)|/ )_) %
|
10 | 10 | % %
|
11 | 11 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
12 |
| -% Current version: v1.2 % |
13 |
| -% (July 2019) % |
14 |
| -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 12 | +% Current version: v1.3 % |
| 13 | +% (July 2020) % |
| 14 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
15 | 15 | % CONTEXTUALIZATION OF DBN MODELS OF BIOLOGICAL NETWORKS %
|
16 | 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
17 | 17 | % Sébastien De Landtsheer: sebastien.delandtsheer@uni.lu %
|
|
22 | 22 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
23 | 23 | % cite: De Landtsheer et al., 2017, Bioinformatics, 33, 3431–6 %
|
24 | 24 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
| 25 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
25 | 26 |
|
26 | 27 | clc, clear all % clear screen and workspace
|
27 | 28 |
|
28 |
| - |
29 |
| -% =========================== |
30 |
| -% Define optimization options |
31 |
| -% =========================== |
32 |
| -optRound = 4; % Number of optimisation round |
33 |
| -MaxFunEvals = 3000; % Number of maximal function being evaluated (3000 = default) |
34 |
| -MaxIter = 3000; % Number of maximal iteration being evaluated (3000 = default) |
35 |
| -Parallelisation = 1; % Use multiple cores for optimisation? (0=no, 1=yes) |
36 |
| -HLbound = 0.5; % Qualitative threshold between high and low inputs |
37 |
| -InitIC = 2; % Initialise parameters' distribution (1=uniform, 2=normal, 3=zeros) |
38 |
| -ObjFunction = 'weighted'; % Either 'unweighted' or 'weighted' |
39 |
| - |
40 |
| -% Define plotting and saving (0=no, 1=yes) |
41 |
| -PlotFitEvolution = 1; % Graph of optimise fitting cost over iteration |
42 |
| -PlotFitSummary = 1; % Graph of state values at steady-state versus measurements (all in 1) |
43 |
| -PlotFitIndividual = 0; % Graph of state values at steady-state versus measurements (individual) |
44 |
| -PlotHeatmapCost = 1; % Heatmaps of optimal costs for each output for each condition absolute cost |
45 |
| -PlotStateSummary = 1; % Graph of only state values at steady-sate (all in 1) |
46 |
| -PlotStateEvolution = 1; % Graph of state values evolution over the course of the simulation (two graphs) |
47 |
| -PlotBiograph = 0; % Graph of network topology, nodes activities, and optimised parameters |
48 |
| -PlotAllBiographs = 0; % (Only for machines with strong GPUs) Plot all Biographs above |
49 |
| - |
50 |
| -% Additional analyses after the optimisation with the default setting (0=no, 1=yes) |
51 |
| -Resampling_Analysis = 1; % Resampling of experimental data and re-optimise |
52 |
| -NDatasets = 50;% Number of artificial datasets from which to resample. |
53 |
| - |
54 |
| -LPSA_Analysis = 1; % Local parameter sensitivity analysis |
55 |
| -Fast_Option = 0; % Performing faster LPSA by stopping if fitting costs go over a set threshold value |
56 |
| -optRound_LPSA = 5; % Number of optimizations for each perturbed datapoint |
57 |
| -LPSA_Increments = 3; % Number of increments for LPSA. Increase for finer resolution |
58 |
| - |
59 |
| -KO_Analysis = 1; % Parameter knock-out analysis |
60 |
| -KO_Nodes_Analysis = 1; % Node knock-out analysis |
61 |
| -optRound_KO = 5; % Number of optimizations for each KO datapoint. |
62 |
| -KO_Nodes_fast = 1; % |
63 |
| - |
64 |
| -KO_Nodes_Analysis_eff = 1; % test different KO efficencies on each node and analyse the entire network based on this information |
65 |
| -efficiency_range = 0:0.1:1; % indicate the different KO efficencies you want to test (vector from 0 to 1) |
66 |
| - |
67 | 29 | % Model and measurement files
|
68 | 30 | InputFile = 'PDGF_model.xlsx'; %for xls
|
69 |
| -% InputFile='PDGF_model.sif'; %for sif |
70 | 31 | MeasFile = 'PDGF_meas.xlsx'; %for xls
|
71 |
| -% MeasFile={'PDGF_meas_in.csv';'PDGF_meas_out.csv';'PDGF_meas_err.csv'}; %for csv |
72 | 32 |
|
73 |
| - |
74 |
| -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
75 |
| -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
76 |
| - |
77 |
| - |
78 |
| -% Creates a save folder |
79 |
| -SaveFolderName = ['Results_' datestr(now)]; FinalFolderName=strrep(SaveFolderName, ':', '.'); |
80 |
| -mkdir(FinalFolderName) % Automatically generate a folder for saving |
| 33 | +% InputFile='PDGF_model.sif'; %for sif |
| 34 | +% MeasFile={'PDGF_meas_in.csv';'PDGF_meas_out.csv';'PDGF_meas_err.csv'}; %for csv |
81 | 35 |
|
82 | 36 | % Builds a FALCON model for optimisation
|
83 |
| -estim = FalconMakeModel(InputFile, MeasFile, HLbound); %make the model |
| 37 | +estim = FalconMakeModel(InputFile, MeasFile); %make the model |
84 | 38 |
|
85 |
| -% Defines optimisation options |
86 |
| -estim.options = optimoptions('fmincon', 'TolCon', 1e-6, 'TolFun', 1e-6, 'TolX', 1e-10, 'MaxFunEvals', MaxFunEvals, 'MaxIter', MaxIter); % Default setting |
87 |
| -estim.SSthresh = eps*100 ; estim.ObjFunction = ObjFunction; |
88 |
| -if InitIC == 1, IC_Dist = 'uniform'; elseif InitIC == 2, IC_Dist = 'normal'; elseif InitIC == 3, IC_Dist = 'scratch'; else, error('Please choose the initial parameter distribution'), end |
| 39 | +%%%% |
| 40 | +% modify optimization parameters here |
| 41 | +%%%% |
89 | 42 |
|
90 | 43 | % Optimization
|
91 |
| -toc_all = []; x_all = []; fval_all = []; |
92 |
| - |
93 |
| -if Parallelisation |
94 |
| - parfor counter = 1:optRound %'parfor' will run the parallel computing toolbox |
95 |
| - tic, k = FalconIC(estim, IC_Dist); %initial conditions |
96 |
| - [xval, fval] = FalconObjFun(estim, k); %objective function |
97 |
| - toc_all = [toc_all; toc]; x_all = [x_all; xval]; fval_all = [fval_all; fval]; |
98 |
| - end |
99 |
| - |
100 |
| -else |
101 |
| - for counter = 1:optRound %'parfor' will run the parallel computing toolbox |
102 |
| - tic, k = FalconIC(estim, IC_Dist); %initial conditions |
103 |
| - [xval, fval] = FalconObjFun(estim, k); %objective function |
104 |
| - toc_all = [toc_all; toc]; x_all = [x_all; xval]; fval_all = [fval_all; fval]; |
105 |
| - end |
106 |
| - close(h); |
107 |
| -end |
108 |
| - |
109 |
| -fxt_all = [fval_all x_all toc_all]; |
110 |
| -beep; pause(0.5); beep; |
111 |
| -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
112 |
| -%Retrieving the results |
113 |
| - |
114 |
| -[bestx, meanx, stdx, estim] = FalconResults(estim, fxt_all, estim.param_vector, FinalFolderName); |
| 44 | +estim = FalconOptimize(estim); |
115 | 45 |
|
116 | 46 | %%% Re-simulate results based on the best optimised parameter set
|
117 |
| -[MeanStateValueAll, StdStateValueAll, MeanCostAll, StdCostAll, estim] = FalconSimul(estim, bestx, [PlotFitSummary PlotFitIndividual PlotHeatmapCost PlotStateSummary PlotStateEvolution], FinalFolderName); |
| 47 | +[estim, StateValues, MSE] = FalconSimul(estim); |
118 | 48 |
|
119 |
| -save([FinalFolderName filesep 'OptimizedModel']) |
| 49 | +save([estim.FinalFolderName filesep 'OptimizedModel']) |
120 | 50 |
|
121 | 51 | %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
122 | 52 | %%% Analyzing the evolution of fitting cost
|
123 |
| -if PlotFitEvolution |
124 |
| - estim = FalconFitEvol(estim, IC_Dist, FinalFolderName); |
| 53 | +if estim.PlotFitEvolution |
| 54 | + estim = FalconFitEvol(estim); |
125 | 55 | end
|
126 | 56 |
|
127 | 57 | %%% Displayed optimised network with weights
|
128 |
| -if PlotBiograph |
129 |
| - FalconShowNetwork(estim, PlotAllBiographs, FinalFolderName) |
| 58 | +if estim.PlotBiograph |
| 59 | + FalconShowNetwork(estim) |
130 | 60 | end
|
131 | 61 |
|
132 | 62 | %%% Obtaining robust estimates for the parameters by resampling
|
133 |
| -if Resampling_Analysis |
134 |
| - optRound_Sampling = optRound; |
135 |
| - CV_cutoff = 10; % Percent cut-off for large coefficient of variation |
136 |
| - [~,~,estim] = FalconResample(estim, bestx, NDatasets, 3, CV_cutoff, FinalFolderName); |
| 63 | +if estim.Resampling_Analysis |
| 64 | + estim = FalconResample(estim); |
137 | 65 | end
|
138 | 66 |
|
139 | 67 | %%% Sensitivity analysis
|
140 |
| -if LPSA_Analysis |
141 |
| - if Fast_Option, IsFast = 'fast'; else, IsFast = 'slow'; end |
142 |
| - Estimated_Time_LPSA = mean(fxt_all(:, end)) * optRound_LPSA * LPSA_Increments * 3 * length(estim.param_vector); |
143 |
| - disp(['Estimated Time for LPSA analysis (fast): ' num2str(Estimated_Time_LPSA) ' seconds']); beep; pause(3); beep; |
144 |
| - [~, estim] = FalconLPSA(estim, bestx, MeasFile, HLbound, optRound_LPSA, LPSA_Increments, IsFast, Parallelisation, FinalFolderName); |
| 68 | +if estim.LPSA_Analysis |
| 69 | + estim = FalconLPSA(estim); |
145 | 70 | end
|
146 | 71 |
|
147 | 72 | %%% Knock-out analysis
|
148 |
| -if KO_Analysis |
149 |
| - Estimated_Time_KO = mean(fxt_all(:, end)) * optRound_KO * length(estim.param_vector); |
150 |
| - disp(['Estimated Time for KO analysis: ' num2str(Estimated_Time_KO) ' seconds']); beep; pause(3); beep; |
151 |
| - estim = FalconKO(estim, fxt_all, HLbound, optRound_KO, Parallelisation, FinalFolderName); |
| 73 | +if estim.KO_Analysis |
| 74 | + estim = FalconKO(estim); |
152 | 75 | end
|
153 | 76 |
|
154 | 77 | %%% Nodes Knock-out analysis
|
155 |
| -if KO_Nodes_Analysis |
156 |
| - Estimated_Time_KO = mean(fxt_all(:, end)) * optRound_KO * (length(estim.state_names) - length(estim.Input_idx(1,:))); |
157 |
| - disp(['Estimated Time for KO analysis: ' num2str(Estimated_Time_KO) ' seconds']); beep; pause(3); beep; |
158 |
| - estim = FalconKONodes(estim, fxt_all, HLbound, optRound_KO, Parallelisation, FinalFolderName); |
159 |
| -end |
160 |
| - |
161 |
| -%%% Nodes Knock-out efficency analysis |
162 |
| -if KO_Nodes_Analysis_eff |
163 |
| - Estimated_Time_KO = mean(fxt_all(:,end)) * numel(efficiency_range) * optRound_KO * (length(estim.state_names)-length(estim.Input_idx(1,:))); |
164 |
| - disp(['Estimated Time for KO analysis: ' num2str(Estimated_Time_KO) ' seconds']); beep; pause(3); beep; |
165 |
| - estim=FalconKONodes_eff(estim, fxt_all, efficiency_range, HLbound, optRound_KO, FinalFolderName); |
166 |
| - |
| 78 | +if estim.KO_Nodes_Analysis |
| 79 | + estim = FalconKONodes(estim); |
167 | 80 | end
|
168 | 81 |
|
169 | 82 | %%% Fast KO
|
170 |
| -if KO_Nodes_fast |
171 |
| - estim = FalconKONodes_fast(estim, fxt_all, HLbound, optRound_KO, Parallelisation, FinalFolderName); |
| 83 | +if estim.KO_Nodes_fast |
| 84 | + estim = FalconKONodes_fast(estim); |
172 | 85 | end
|
| 86 | +% |
| 87 | +% %%% Nodes Knock-out efficency analysis |
| 88 | +% if estim.KO_Nodes_Analysis_eff |
| 89 | +% estim=FalconKONodes_eff(estim, fxt_all, efficiency_range, HLbound, optRound_KO, FinalFolderName); |
| 90 | +% |
| 91 | +% end |
173 | 92 |
|
174 | 93 | %%% Discriminate fast effects from long-term effects
|
175 | 94 | X = estim.Results.KnockOutNodes.BIC_values;
|
176 | 95 | Y = estim.Results.KnockOutNodesFast.BIC_values;
|
177 |
| -M1 = min(X,Y); M2 = min(X,Y); |
178 | 96 | figure, plot(X,Y,'.k', 'MarkerSize', 15), hold on
|
| 97 | +M1 = min(X,Y); M2 = min(X,Y); |
179 | 98 | plot([M1, M2], [M1, M2], '-k');
|
| 99 | +Nodes = estim.state_names; |
| 100 | +Nodes(estim.Input_idx(1, :)) = []; |
| 101 | +text(X(1), Y(1), 'base') |
| 102 | +for tx = 1:length(X)-1 |
| 103 | + text(X(tx+1), Y(tx+1), Nodes(tx)) |
| 104 | +end |
| 105 | +xlabel('BIC for re-optimized model') |
| 106 | +ylabel('BIC for non-adapted model') |
| 107 | + |
| 108 | + |
180 | 109 |
|
181 | 110 |
|
182 | 111 | % === End of the script === %
|
0 commit comments