Skip to content

Commit

Permalink
fixed 2021a version checking issue
Browse files Browse the repository at this point in the history
see issue #165
  • Loading branch information
adrianhauber committed May 4, 2021
1 parent 137ee65 commit 622c970
Show file tree
Hide file tree
Showing 22 changed files with 124 additions and 37 deletions.
2 changes: 1 addition & 1 deletion arFramework3/Advanced/arMyStr2Sym.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

persistent matver % keeping the value from the last call
if isempty(matver)
matver = ver('MATLAB'); % calling this function every time is too time-consuming
matver = arVer; % calling this function every time is too time-consuming
end
% The explicit cast to string is necessary for MATLAB R2017a at least,
% otherwise double will convert the string on a char by char basis.
Expand Down
2 changes: 1 addition & 1 deletion arFramework3/Development/arMiniReport.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function arMiniReport(varargin)
pti = 1 - opts.keepfilenames;

% Fetch MATLAB version
matVer = ver('MATLAB');
matVer = arVer;
ar.config.matlabVersion = str2double(matVer.Version);

savePath = [arSave '/Latex'];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DESCRIPTION
"DallaMan2007_MealModel_GlucoseInsulinSystem"" (DallaMan2007_MealModel_GlucoseInsulinSystem)"
"IMPORTANT: Do not use this file with arLoadModel. Unexpected behavior may occur because of missing observable formulas.""DallaMan2007_MealModel_GlucoseInsulinSystem"" (DallaMan2007_MealModel_GlucoseInsulinSystem)"
"SBML level 2 version 4"
"<notes>
<body xmlns="http://www.w3.org/1999/xhtml">
Expand All @@ -16,15 +16,14 @@ Dalla Man C, Rizza RA, Cobelli C.<em>IEEE Trans Biomed Eng.</em>2007 Oct;54(10):
<br/>
A simulation model of the glucose-insulin system in the postprandial state can be useful in several circumstances, including testing of glucose sensors, insulin infusion algorithms and decision support systems for diabetes. Here, we present a new simulation model in normal humans that describes the physiological events that occur after a meal, by employing the quantitative knowledge that has become available in recent years. Model parameters were set to fit the mean data of a large normal subject database that underwent a triple tracer meal protocol which provided quasi-model-independent estimates of major glucose and insulin fluxes, e.g., meal rate of appearance, endogenous glucose production, utilization of glucose, insulin secretion. By decomposing the system into subsystems, we have developed parametric models of each subsystem by using a forcing function strategy. Model results are shown in describing both a single meal and normal daily life (breakfast, lunch, dinner) in normal. The same strategy is also applied on a smaller database for extending the model to type 2 diabetes
</p>
<p>This model originates from BioModels Database: A Database of Annotated Published Models (http://www.ebi.ac.uk/biomodels/). It is copyright (c) 2005-2011 The BioModels.net Team.<br/>
<p>This model originates from BioModels Database: A Database of Annotated Published Models (http://www.ebi.ac.uk/biomodels/). It is copyright (c) 2005-2011 The BioModels.net Team.<br/>
For more information see the <a href="http://www.ebi.ac.uk/biomodels/legal.html" target="_blank">terms of use</a>.<br/>
To cite BioModels Database, please use: <a href="http://www.ncbi.nlm.nih.gov/pubmed/20587024" target="_blank">Li C, Donizelli M, Rodriguez N, Dharuri H, Endler L, Chelliah V, Li L, He E, Henry A, Stefan MI, Snoep JL, Hucka M, Le Novère N, Laibe C (2010) BioModels Database: An enhanced, curated and annotated resource for published quantitative kinetic models. BMC Syst Biol., 4:92.</a>
</p>
</body>
To cite BioModels Database, please use: <a href="http://www.ncbi.nlm.nih.gov/pubmed/20587024" target="_blank">Li C, Donizelli M, Rodriguez N, Dharuri H, Endler L, Chelliah V, Li L, He E, Henry A, Stefan MI, Snoep JL, Hucka M, Le Novère N, Laibe C (2010) BioModels Database: An enhanced, curated and annotated resource for published quantitative kinetic models. BMC Syst Biol., 4:92.</a></p>
</body>
</notes>"

PREDICTOR
t T "n/a" time 0 100
t T "au" time 0 100

COMPARTMENTS
Compartment1 V "n/a" vol. 1
Expand Down Expand Up @@ -61,21 +60,25 @@ REACTIONS

DERIVED

OBSERVABLES

ERRORS

CONDITIONS
init_G_p "178"
init_G_t "135"
init_I_l "4.5"
init_I_p "1.25"
init_Q_sto1 "78000"
init_Q_gut "0"
init_I_1 "25"
init_I_d "25"
init_X_state "0"
init_I_po "3.6"
init_Y_state "0"
init_Q_sto2 "0"

PARAMETERS
init_G_p 178 1 0 0 1000
init_G_t 135 1 0 0 1000
init_I_l 4.5 1 0 0 1000
init_I_p 1.25 1 0 0 1000
init_Q_sto1 78000 1 0 0 780000
init_Q_gut 0 1 0 0 1000
init_I_1 25 1 0 0 1000
init_I_d 25 1 0 0 1000
init_X_state 0 1 0 0 1000
init_I_po 3.6 1 0 0 1000
init_Y_state 0 1 0 0 1000
init_Q_sto2 0 1 0 0 1000
V_G 1.88 0 0 0 1000
k_1 0.065 0 0 0 1000
k_2 0.079 0 0 0 1000
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
DESCRIPTION
"IMPORTANT: Do not use this file with arLoadModel. Unexpected behavior may occur because of missing observable formulas.""FullModel"
"SBML level 2 version 4"

PREDICTOR
t T "min" time 0 100

COMPARTMENTS
cyt V "pl" vol. 1.4
nuc V "pl" vol. 0.45

STATES
STAT5A C "nM" conc. cyt 1 "STAT5A"
STAT5B C "nM" conc. cyt 1 "STAT5B"
pApB C "nM" conc. cyt 1 "pApB"
pApA C "nM" conc. cyt 1 "pApA"
pBpB C "nM" conc. cyt 1 "pBpB"
nucpApA C "nM" conc. nuc 1 "nucpApA"
nucpApB C "nM" conc. nuc 1 "nucpApB"
nucpBpB C "nM" conc. nuc 1 "nucpBpB"

INPUTS
BaF3_Epo C "n/a" conc. "epo_level*exp(-Epo_degradation_BaF3*t)"

REACTIONS
2 STAT5A -> pApA CUSTOM "BaF3_Epo*STAT5A^2*k_phos" "v1_v_0"
STAT5A + STAT5B -> pApB CUSTOM "BaF3_Epo*STAT5A*STAT5B*k_phos" "v2_v_1"
2 STAT5B -> pBpB CUSTOM "BaF3_Epo*STAT5B^2*k_phos" "v3_v_2"
pApA -> nucpApA CUSTOM "k_imp_homo*pApA" "v4_v_3"
pApB -> nucpApB CUSTOM "k_imp_hetero*pApB" "v5_v_4"
pBpB -> nucpBpB CUSTOM "k_imp_homo*pBpB" "v6_v_5"
nucpApA -> 2 STAT5A CUSTOM "k_exp_homo*nucpApA" "v7_v_6"
nucpApB -> STAT5A + STAT5B CUSTOM "k_exp_hetero*nucpApB" "v8_v_7"
nucpBpB -> 2 STAT5B CUSTOM "k_exp_homo*nucpBpB" "v9_v_8"

DERIVED

OBSERVABLES

ERRORS

CONDITIONS
init_STAT5A "207.6*ratio"
init_STAT5B "207.6 - 207.6*ratio"
init_pApB "0"
init_pApA "0"
init_pBpB "0"
init_nucpApA "0"
init_nucpApB "0"
init_nucpBpB "0"

PARAMETERS
Epo_degradation_BaF3 0.0269765 0 0 0 1000
epo_level 1 0 0 0 1000
k_exp_hetero 1.00097e-05 0 0 0 1000
k_exp_homo 0.00617238 0 0 0 1000
k_imp_hetero 0.0163702 0 0 0 1000
k_imp_homo 96807.7 0 0 0 968077
k_phos 15767.6 0 0 0 157676
ratio 1 0 0 0 1000
BaF3_Epo 0 0 0 0 1000
4 changes: 4 additions & 0 deletions arFramework3/Examples/Boehm_JProteomeRes2014/Setup.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
arInit;
arLoadModel('model_Boehm_JProteomeRes2014');
arLoadData('measurementData_Boehm_JProteomeRes2014.tsv');
arCompileAll;
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion arFramework3/MatlabTools/arSubs.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
end

if(nargin<4)
matVer = ver('MATLAB');
matVer = arVer;
matlab_version = str2double(matVer.Version);
end

Expand Down
2 changes: 1 addition & 1 deletion arFramework3/MatlabTools/arSubsRepeated.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
function out = arSubsRepeated(in, old, new, matlab_version)

if(nargin<4)
matVer = ver('MATLAB');
matVer = arVer;
matlab_version = str2double(matVer.Version);
end

Expand Down
2 changes: 1 addition & 1 deletion arFramework3/MatlabTools/parseArgs.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
persistent matlabver

if isempty(matlabver)
matlabver=ver('MATLAB');
matlabver=arVer;
matlabver=str2double(matlabver.Version);
end

Expand Down
6 changes: 3 additions & 3 deletions arFramework3/Subfunctions/arCcode.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%
% T any kind of symbolic expression
%
% matlab_version Matlab version e.g. 9.5, use ver('MATLAB')
% matlab_version Matlab version e.g. 9.5, use arVer
%
% This function generalizes matlab's ccode function and keeps the
% functionality indpendent of Matlab verions
Expand All @@ -16,7 +16,7 @@
%
% Example:
% T = ar.model(1).condition(1).sym.fv;
% matVer = ver('MATLAB');
% matVer = arVer;
% matlab_version = str2double(matVer.Version);
% cstr = arCcode(T, matlab_version)
% cvar = 'fv'
Expand Down Expand Up @@ -109,7 +109,7 @@
str = strrep( str, total{jm}, fNew );
end
% because of compatibility with MATLAB2020a and later versions
tmp = ver('MATLAB');
tmp = arVer;
if ~verLessThan('matlab', '9.8')
str = strrep(str,';',',');
end
Expand Down
2 changes: 1 addition & 1 deletion arFramework3/Subfunctions/arLink.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

function arLink(silent, tExpAdd, dataAdd, ix, id, im, newData, yStd, add_sec)

matVer = ver('MATLAB');
matVer = arVer;

global ar

Expand Down
2 changes: 1 addition & 1 deletion arFramework3/Subfunctions/arPlot2.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
plotOnlyData = false;
end

matVer = ver('MATLAB');
matVer = arVer;

if(evalfun)
try
Expand Down
2 changes: 1 addition & 1 deletion arFramework3/Subfunctions/arPlotV.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

function arPlotV(saveToFile, fastPlot)

matVer = ver('MATLAB');
matVer = arVer;

global ar

Expand Down
2 changes: 1 addition & 1 deletion arFramework3/Subfunctions/arPlotX.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

function arPlotX(saveToFile, fastPlot)

matVer = ver('MATLAB');
matVer = arVer;

global ar

Expand Down
2 changes: 1 addition & 1 deletion arFramework3/Subfunctions/arPlotY.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

function arPlotY(saveToFile, fastPlot, doLegends, varargin)

matVer = ver('MATLAB');
matVer = arVer;

global ar

Expand Down
19 changes: 19 additions & 0 deletions arFramework3/Subfunctions/arVer.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function matVer = arVer

% matVer = arVer
%
% *** AVOID USING THIS FUNCTION! verLessThan IS RECOMMENDED ***
% *** DO NOT USE ver('matlab') AS THIS WON'T WORK WITH VERSIONS >= 9.10 ***
%
% Return MATLAB version with fix for 2021a (9.10) which leads to unexpected
% behaviour when converting '9.10' to double.

matVer = ver('MATLAB');

versplit = strsplit(matVer.Version,'.');
if strcmp(matVer.Version, '9.10')
matVer.Version = '9.91';
elseif strcmp(matVer.Version, '9.11')
matVer.Version = '9.92';
end
end
2 changes: 1 addition & 1 deletion arFramework3/arCompileAll.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function arCompileAll(forcedCompile, debug_mode, source_dir, simplifyEquations)
end
end

matVer = ver('MATLAB');
matVer = arVer;
matlab_version = str2double(matVer.Version);

% calc model
Expand Down
4 changes: 2 additions & 2 deletions arFramework3/arLoadData.m
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ function arLoadData(name, m, extension, removeEmptyObs, varargin)

% SUBSTITUTIONS (beta)
substitutions = 0;
matVer = ver('MATLAB');
matVer = arVer;
if ( strcmp(C{1},'SUBSTITUTIONS') )
arFprintf( 3, '[ OK ]\nReading substitutions' );
if(str2double(matVer.Version)>=8.4)
Expand Down Expand Up @@ -984,7 +984,7 @@ function checkReserved(m, d)

function [ar,d, fail] = setConditions(fid, ar, m, d, jplot, header, times, data, dataCell, pcond, removeEmptyObs, dpPerShoot, opts)

% matVer = ver('MATLAB');
% matVer = arVer;

% normalization of columns
fail = 0;
Expand Down
2 changes: 1 addition & 1 deletion arFramework3/arLoadModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function arLoadModel(name, m, varargin)
ar.model(m).extra_conditions = {};
end

matVer = ver('MATLAB');
matVer = arVer;

% DESCRIPTION
[str, fid] = arTextScan(fid, '%s', 1, 'CommentStyle', ar.config.comment_string);
Expand Down
2 changes: 1 addition & 1 deletion arFramework3/arPlotMulti.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

function arPlotMulti(ps, ps_weigths, saveToFile, filenameAddition)

matVer = ver('MATLAB');
matVer = arVer;

global ar

Expand Down
2 changes: 1 addition & 1 deletion arFramework3/arReport.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function arReport(project_name,fullODEs)


% Fetch MATLAB version
matVer = ver('MATLAB');
matVer = arVer;
ar.config.matlabVersion = str2double(matVer.Version);

savePath = [arSave '/Latex']; % return argument of arSave is ar.config.savepath
Expand Down

0 comments on commit 622c970

Please sign in to comment.