Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Data2Dynamics/d2d
Browse files Browse the repository at this point in the history
  • Loading branch information
timo-rachel committed Sep 4, 2023
2 parents e288d1c + 93cd15a commit 0b7e762
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 43 deletions.
4 changes: 0 additions & 4 deletions arFramework3/Advanced/arCompileAllSetups.log

This file was deleted.

4 changes: 2 additions & 2 deletions arFramework3/Advanced/arCompileAllSetups.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
if ~testmode
eval(sprintf('arSave(''arCompileAllSetups_%s'');',mode));
end
case 'core' % only the most improtant setup commands
case 'core' % only the most important setup commands
did_compile = false;
fid = fopen([name,ext], 'r');
while (~feof(fid))
% [str, fid] = arTextScan(fid, '%s', 'Delimiter', '', 'CommentStyle', '%');
Expand All @@ -96,7 +97,6 @@

if ~isempty(str) && ischar(str)
str = strtrim(str);
did_compile = false;
if ~isempty(str) && ischar(str)
if ~isempty(regexp(str,'^arInit'))
fprintf(fidlog,'%s\n',str);
Expand Down
121 changes: 84 additions & 37 deletions arFramework3/Advanced/arCopyBenchmarkModels.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,29 @@
%
% 'fast10'
% the 10 models with least computation times
%
% 'new'
% Three models that have been added to benchmark collection after
% publication of Hass et al, 2018
%
% 'all' or '23'
% The 20 original benchmark models plus the three new models
%
% The (starting characters of) model names can also be
% specified, e.g.:
% arCopyBenchmarkModels('Becker')
% arCopyBenchmarkModels('Swa')
%
% subset can also be a cell array of keywords and modelnames
% e.g.: {'fast10', 'new', 'Bachmann'}.
%
% target_path Default: pwd
% target_path Default: current working directory (pwd)
%
% Examples
% arCopyBenchmarkModels % 20 default benchmark models
% arCopyBenchmarkModels('Bachmann') % only the Bachmann model
% arCopyBenchmarkModels('Ra') % only the Raia model (abbreviation Ra only fits for Raia)
% arCopyBenchmarkModels({'fast10', "Chen"}) % 10 fastest models plus Chen_MSB2009
%
%
% Reference:
Expand All @@ -36,17 +47,26 @@
% New Concepts for Evaluating the Performance of Computational Methods.
% IFAC-PapersOnLine (2016) 49(26): 63-70.

function arCopyBenchmarkModels(subset,target_path)
function arCopyBenchmarkModels(subset, target_path)

if ~exist('target_path','var') || isempty(target_path)
target_path = pwd;
end

if ~exist('subset','var') || isempty(subset)
% set default
subset = '20';

elseif iscell(subset)
% recursive call
cellfun(@(x) arCopyBenchmarkModels(x, target_path), subset);
return

elseif isnumeric(subset)
% convert to string
subset = num2str(subset);
end

if ~exist('target_path','var') || isempty(target_path)
target_path = pwd;
end

models20 = {
'Bachmann_MSB2011',...
'Becker_Science2010',...
Expand All @@ -70,6 +90,14 @@ function arCopyBenchmarkModels(subset,target_path)
'Zheng_PNAS2012'};


% models from benchmarking collection not yet included in Hass et al, 2019
new_models = {
'Borghans_BiophysChem_1997', ...
'Elowitz_Nature2000', ...
'Sneyd_PNAS2002'};
all_models = sort([models20, new_models]);


switch lower(subset)
case {'20',''} % default
models = models20;
Expand Down Expand Up @@ -112,52 +140,71 @@ function arCopyBenchmarkModels(subset,target_path)
'Swameye_PNAS2003',...
'Weber_BMC2015',...
'Zheng_PNAS2012'};
case 'new'
models = new_models;
case {'all', '23'}
models = all_models;
otherwise
ind = strmatch(lower(subset),lower(models20));
if ~isempty(ind)
models = models20(ind);
else
% find models that start with the string subset
ind = startsWith(all_models, subset, IgnoreCase=true);
models = all_models(ind);
if isempty(models)
error('Subset unknown');
end
end

DoCopy(models, target_path, subset);
DoCopy(models, target_path);





function DoCopy(models, target_path, subset)
function DoCopy(models, target_path)

source_path = [fileparts(which('arInit')),filesep,'Examples'];
source_path = fullfile(fileparts(which('arInit')), 'Examples');

for i=1:length(models)

fprintf('Copying %s ...\n',models{i});
copyfile([source_path,filesep,models{i}],[target_path,filesep,models{i}]);

switch lower(subset) % model-specific operatios which has to be done:
case {'20','','lhsok'}
if strcmp(models{i},'Merkle_JAK2STAT5_PCB2016')==1 % just keep SetupFinal.m
delete([target_path,filesep,models{i},filesep,'SetupCFUE.m']);
delete([target_path,filesep,models{i},filesep,'SetupComprehensive.m']);
delete([target_path,filesep,models{i},filesep,'SetupH838.m']);
delete([target_path,filesep,models{i},filesep,'SetupSens.m']);
end
if strcmp(models{i},'Lucarelli_TGFb_2017')==1 % just keep reduced model with genes
rmdir([target_path,filesep,models{i},filesep,'TGFb_ComplexModel_ModelSelection_L1'],'s');
rmdir([target_path,filesep,models{i},filesep,'TGFb_ComplexModel_withGenes'],'s');
movefile([target_path,filesep,models{i},filesep,'TGFb_ComplexModel_WithGenes_Reduced',filesep,'*'],...
[target_path,filesep,models{i},filesep,'.']);
rmdir([target_path,filesep,models{i},filesep,'TGFb_ComplexModel_WithGenes_Reduced'],'s');
end
if strcmp(models{i},'Sobotta_Frontiers2017')==1 % just keep Setup_Core.m
delete([target_path,filesep,models{i},filesep,'Setup_IL6_ExpDesign.m']);
delete([target_path,filesep,models{i},filesep,'Setup_IL6_Full.m']);
end
if strcmp(models{i},'Swameye_PNAS2003')==1 % just keep Setup.m
delete([target_path,filesep,models{i},filesep,'Setup2003.m']);
end
copyfile(fullfile(source_path, models{i}), ...
fullfile(target_path, models{i}));

% model-specific operations which have to be done:
switch models{i}
case 'Becker_Science2010'
% use only original model, not Setup_Regularization.m
delete(fullfile(target_path, models{i}, 'Setup_Regularization.m'));

case 'Boehm_JProteomeRes2014'
% only keep Setup.m
delete(fullfile(target_path, models{i}, 'Setup_FullModel_Boehm2014.m'));

case 'Merkle_JAK2STAT5_PCB2016'
% only keep SetupFinal.m
delete(fullfile(target_path, models{i}, 'SetupCFUE.m'));
delete(fullfile(target_path, models{i}, 'SetupComprehensive.m'));
delete(fullfile(target_path, models{i}, 'SetupH838.m'));
delete(fullfile(target_path, models{i}, 'SetupSens.m'));

case 'Lucarelli_TGFb_2017'
% just keep reduced model with genes
rmdir(fullfile(target_path, models{i}, 'TGFb_ComplexModel_ModelSelection_L1'),'s');
rmdir(fullfile(target_path, models{i}, 'TGFb_ComplexModel_withGenes'),'s');
movefile(fullfile(target_path, models{i}, 'TGFb_ComplexModel_WithGenes_Reduced', '*'), ...
fullfile(target_path, models{i}));
rmdir(fullfile(target_path, models{i}, 'TGFb_ComplexModel_WithGenes_Reduced'),'s');

case 'Sobotta_Frontiers2017'
% just keep Setup_Core.m
delete(fullfile(target_path, models{i}, 'Setup_IL6_ExpDesign.m'));
delete(fullfile(target_path, models{i}, 'Setup_IL6_Full.m'));

case 'Swameye_PNAS2003'
% just keep Setup.m
delete(fullfile(target_path, models{i}, 'Setup2003.m'));
end


end


0 comments on commit 0b7e762

Please sign in to comment.