Skip to content

Commit

Permalink
Merge pull request #1370 from opencobra/develop
Browse files Browse the repository at this point in the history
Regular merge of develop
  • Loading branch information
artenobot authored Nov 2, 2018
2 parents ad4bb21 + 7b4bdee commit 74dc79a
Show file tree
Hide file tree
Showing 48 changed files with 1,282 additions and 479 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ How to contribute
:+1::tada: First off, thanks for taking the time to contribute to [The COBRA Toolbox](https://github.com/opencobra/cobratoolbox)! :tada::+1:

<p align="center">
<img src="https://cdn.rawgit.com/opencobra/MATLAB.devTools/develop/docs/source/_static/img/logo_devTools.png" height="120px"/>
<img src="https://cdn.jsdelivr.net/gh/opencobra/MATLAB.devTools@e735bd91310e8ef10fab4d3c21833a85bf4b8159/docs/source/_static/img/logo_devTools.png" height="120px"/>
</p>

:bulb: **Check out the [MATLAB.devTools](https://github.com/opencobra/MATLAB.devTools) - and contribute the smart way!**
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Toolbox <https://github.com/opencobra/cobratoolbox>`__! |tada| |thumbsup|
.. raw:: html

<p align="center">
<img src="https://cdn.rawgit.com/opencobra/MATLAB.devTools/develop/docs/source/_static/img/logo_devTools.png" height="120px" alt="devTools"/>
<img src="https://cdn.jsdelivr.net/gh/opencobra/MATLAB.devTools@e735bd91310e8ef10fab4d3c21833a85bf4b8159/docs/source/_static/img/logo_devTools.png" height="120px" alt="devTools"/>
</p>


Expand Down
4 changes: 2 additions & 2 deletions docs/prepareTutorials.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ buildHTMLTutorials(){
createLocalVariables $tutorial
# create PDF file
/usr/local/bin/wkhtmltopdf --page-size A8 --margin-right 2 --margin-bottom 3 --margin-top 3 --margin-left 2 $pdfPath/tutorials/$tutorialFolder/$tutorialName.html $pdfPath/tutorials/$tutorialFolder/$tutorialName.pdf
sed 's#<html><head>#&<script type="text/javascript" src="https://cdn.rawgit.com/opencobra/cobratoolbox/gh-pages/latest/_static/js/iframeResizer.contentWindow.min.js"></script>#g' "$pdfPath/tutorials/$tutorialFolder/$tutorialName.html" > "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
sed 's#<html><head>#&<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/opencobra/cobratoolbox@ffa0229fc0c01c9236bb7e961f65712443277719/latest/_static/js/iframeResizer.contentWindow.min.js"></script>#g' "$pdfPath/tutorials/$tutorialFolder/$tutorialName.html" > "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
sed -i.bak 's/white-space:\ pre-wrap/white-space:\ normal/g' "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
sed -i.bak 's/white-space:\ pre/white-space:\ normal/g' "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
rm "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html.bak"
Expand All @@ -132,7 +132,7 @@ buildHTMLSpecificTutorial(){
createLocalVariables $specificTutorial
# create PDF file
/usr/local/bin/wkhtmltopdf --page-size A8 --margin-right 2 --margin-bottom 3 --margin-top 3 --margin-left 2 $pdfPath/tutorials/$tutorialFolder/$tutorialName.html $pdfPath/tutorials/$tutorialFolder/$tutorialName.pdf
sed 's#<html><head>#&<script type="text/javascript" src="https://cdn.rawgit.com/opencobra/cobratoolbox/gh-pages/latest/_static/js/iframeResizer.contentWindow.min.js"></script>#g' "$pdfPath/tutorials/$tutorialFolder/$tutorialName.html" > "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
sed 's#<html><head>#&<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/opencobra/cobratoolbox@ffa0229fc0c01c9236bb7e961f65712443277719/latest/_static/js/iframeResizer.contentWindow.min.js"></script>#g' "$pdfPath/tutorials/$tutorialFolder/$tutorialName.html" > "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
sed -i.bak 's/white-space:\ pre-wrap/white-space:\ normal/g' "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
sed -i.bak 's/white-space:\ pre/white-space:\ normal/g' "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
rm "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html.bak"
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
'sphinx.ext.linkcode',
'sphinxcontrib.fulltoc']

mathjax_path = 'https://cdn.rawgit.com/mathjax/MathJax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
mathjax_path = 'https://cdn.jsdelivr.net/gh/mathjax/MathJax@2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML'

def linkcode_resolve(domain, info):
return github_linkcode_resolve(
Expand Down
330 changes: 165 additions & 165 deletions docs/source/installation/compatMatrix.rst

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions src/analysis/FVA/fastFVA/fastFVA.m
Original file line number Diff line number Diff line change
Expand Up @@ -234,20 +234,20 @@
valuesCPLEXparams(i) = getfield(cpxControl, namesCPLEXparams{i});
end

% retrieve the b vector of the model file
b = model.b;
% create an LP problem
LPproblem = buildLPproblemFromModel(model);

% define the stoichiometric matrix to be solved
if isfield(model, 'A') && (matrixAS == 'A')
A = model.A;
csense = model.csense(:);
if matrixAS == 'A'
[A,b,csense,lb,ub,c] = deal(LPproblem.A,LPproblem.b,LPproblem.csense,LPproblem.lb,LPproblem.ub,LPproblem.c);
if printLevel > 0
fprintf(' >> Solving Model.A. (coupled) - Generalized\n');
end
else
A = model.S;
csense = char('E' * ones(size(A, 1), 1));
b = b(1:size(A, 1));
if ~isfield(model,'csense')
model.csense = repmat('E',size(model.S,1),1);
end
[A,b,csense,lb,ub,c] = deal(model.S,model.b,model.csense,model.lb,model.ub,model.c);
if printLevel > 0
fprintf(' >> Solving Model.S. (uncoupled) \n');
end
Expand Down Expand Up @@ -352,15 +352,15 @@
fprintf(' \n WARNING: The Sequential Version might take a long time.\n\n');
end
if bExtraOutputs1
[minFlux, maxFlux, optsol, ret, fbasol, fvamin, fvamax, statussolmin, statussolmax] = FVAc(model.c, A, b, csense, model.lb, model.ub, ...
[minFlux, maxFlux, optsol, ret, fbasol, fvamin, fvamax, statussolmin, statussolmax] = FVAc(c, A, b, csense, lb, ub, ...
optPercentage, obj, rxnsKey, ...
1, cpxControl, valuesCPLEXparams, rxnsOptMode, logFileDir, printLevel);
elseif bExtraOutputs
[minFlux, maxFlux, optsol, ret, fbasol, fvamin, fvamax] = FVAc(model.c, A, b, csense, model.lb, model.ub, ...
[minFlux, maxFlux, optsol, ret, fbasol, fvamin, fvamax] = FVAc(c, A, b, csense, lb, ub, ...
optPercentage, obj, rxnsKey, ...
1, cpxControl, valuesCPLEXparams, rxnsOptMode, logFileDir, printLevel);
else
[minFlux, maxFlux, optsol, ret] = FVAc(model.c, A, b, csense, model.lb, model.ub, ...
[minFlux, maxFlux, optsol, ret] = FVAc(c, A, b, csense, lb, ub, ...
optPercentage, obj, rxnsKey, ...
1, cpxControl, valuesCPLEXparams, rxnsOptMode, logFileDir, printLevel);
end
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/thermo/thermoFBA/cycleFreeFlux.m
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
if solution.stat == 1
v1 = solution.full(1:n);
else
v1 = zeros(size(v0));
error('No solution found for a problem that by definition has a solution.\nTry using a different solver');
end

end
Expand Down
23 changes: 15 additions & 8 deletions src/base/install/prepareTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
% - `useSolversIfAvailable`: Names of solvers that should be used if available. If not empty, the resulting solvers struct will contain cell arrays (will not throw an error if not). (default: {})
% - `requireOneSolverOf`: Names of solvers, at least one of which has to be available
% - `excludeSolvers`: Names of solvers which should never be used for the test (because they fail)
% - `useMinimalNumberOfSolvers`: Always use only one solver. This option allows tests which only use FBA to generate input, but where no expicit linear programming code is present, to only validate on one solver (default: false).
% - `needsLP`: Whether a LP solver is required (default: false)
% - `needsMILP`: Whether a MILP solver is required (default: false)
% - `needsQP`: Whether a QP solver is required (default: false)
Expand Down Expand Up @@ -88,7 +89,8 @@
parser.addParamValue('requiredSolvers', {}, @iscell);
parser.addParamValue('useSolversIfAvailable', {}, @iscell);
parser.addParamValue('requireOneSolverOf', {}, @iscell);
parser.addParamValue('excludeSolvers', {}, @iscell);
parser.addParamValue('excludeSolvers', {}, @(x) iscell(x) || ischar(x) );
parser.addParamValue('useMinimalNumberOfSolvers', false, @(x) islogical(x) || x == 1 || x == 0);
parser.addParamValue('needsLP', false, @(x) islogical(x) || x == 1 || x == 0);
parser.addParamValue('needsMILP', false, @(x) islogical(x) || x == 1 || x == 0);
parser.addParamValue('needsNLP', false, @(x) islogical(x) || x == 1 || x == 0);
Expand Down Expand Up @@ -118,11 +120,14 @@
requiredSolvers = parser.Results.requiredSolvers;
possibleSolvers = parser.Results.requireOneSolverOf;
excludedSolvers = parser.Results.excludeSolvers;
if ischar(excludedSolvers)
excludedSolvers = {excludedSolvers};
end
preferredSolvers = parser.Results.useSolversIfAvailable;

needsWebAddress = parser.Results.needsWebAddress;
needsWebRead = parser.Results.needsWebRead;

useMinimalNumberOfSolvers = parser.Results.useMinimalNumberOfSolvers;
runtype = getenv('CI_RUNTYPE');

errorMessage = {};
Expand Down Expand Up @@ -154,8 +159,8 @@
if ~isempty(needsWebAddress)
[status_curl, result_curl] = system(['curl -s -k ' needsWebAddress]);
if status_curl ~= 0 || isempty(result_curl)
errorMessage{end + 1} = sprintf('This function needs to connect to %s and was unable to do so.',needsWebAddress);
end
errorMessage{end + 1} = sprintf('This function needs to connect to %s and was unable to do so.',needsWebAddress);
end
if needsWebRead
if verLessThan('MATLAB','9.3') && isunix && strncmp(needsWebAddress,'https',5)
errorString = sprintf(['This function needs to connect to a ''https'' address using webread.\n', ...
Expand All @@ -169,9 +174,9 @@
'Please note that this test will not be able to run on your system,\n',...
'regardless on whether you fixed the library or not. If you want to run it,',...
'you will have to remove the ''needsWebRead'' flag from the ''prepareTest''',...
'statement in the test and run it again.'],...
matlabroot,matlabroot,matlabroot);
errorMessage{end + 1} = errorString;
'statement in the test and run it again.'],...
matlabroot,matlabroot,matlabroot);
errorMessage{end + 1} = errorString;
end
end
end
Expand Down Expand Up @@ -337,7 +342,9 @@
% collect the Used Solvers.
solversToUse = struct();
problemTypes = OPT_PROB_TYPES;
if strcmpi(runtype,'fullRun')
% if this is the extensive test suite, and the solver use not just about
% testing whether the actual work succeeded.
if strcmpi(runtype, 'extensive') && ~useMinimalNumberOfSolvers
solversToUse = solversForTest;
%exclude pdco if not explicitly requested and available, as it does
%have issues at the moment.
Expand Down
2 changes: 1 addition & 1 deletion src/base/io/utilities/createEmptyFields.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
case 'cell'
model.(fieldNames{field}) =cell(xdim,ydim);
% need to both check, whether the eval is a char AND if it is empty.
if ischar(eval(defaultValue)) && strcmp(eval(defaultValue),'')
if xdim > 0 && ischar(eval(defaultValue)) && strcmp(eval(defaultValue),'')
model.(fieldNames{field})(:) = {''};
else
for i = 1:xdim
Expand Down
32 changes: 26 additions & 6 deletions src/base/io/utilities/writeSBML.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,39 @@
else
tmp_metName=emptyChar;
end
% create annotations and notes
tmp_species.metaid=tmp_species.id; % set the metaid for each species
[tmp_annot,met_notes] = makeSBMLAnnotationString(model,tmp_species.metaid,'met',i);


if isfield(model, 'metFormulas')
tmp_metFormulas = model.metFormulas{i};
% check the chemical formula
tmp_metFormulas = model.metFormulas{i};
if ~isempty(model.metFormulas{i})
coefs = regexp(model.metFormulas{i},'(?<nums>[\.0-9]+)','names');
intVals = cellfun(@(x) mod(str2double(x),1) == 0,{coefs.nums});
if any(~intVals)
warning('Metabolite %s has formula %s. FBC 2.1 only allows integer values for coefficients.\nDiscarding the formula.',model.mets{i},model.metFormulas{i});
met_notes(end+1,1:2) = {'FORMULA',tmp_metFormulas};
tmp_metFormulas = emptyChar;
end
end

else
tmp_metFormulas=emptyChar; %cell(0,1)% {''};%0;%emptyChar;
end

if isfield(model, 'metCharges')
if ~isnan(model.metCharges(i))
tmp_metCharge=model.metCharges(i);
tmp_isSetfbc_charge=1;
if mod(model.metCharges(i),1) ~= 0
warning('Metabolite %s has a charge of %f. FBC 2.1 only allows integer values for charges.\nDiscarding the value.',model.mets{i},model.metCharges(i));
met_notes(end+1,1:2) = {'CHARGE',num2str(model.metCharges(i))};
tmp_metCharge=0;
tmp_isSetfbc_charge=0;
else
tmp_metCharge=model.metCharges(i);
tmp_isSetfbc_charge=1;
end
else
tmp_metCharge=0;
tmp_isSetfbc_charge=0;
Expand Down Expand Up @@ -203,13 +225,11 @@
tmp_species.fbc_chemicalFormula=tmp_metFormulas;
tmp_species.isSetfbc_charge=tmp_isSetfbc_charge;
%% Add annotations for metaoblites to the reconstruction
tmp_species.metaid=tmp_species.id; % set the metaid for each species
[tmp_annot,met_notes] = makeSBMLAnnotationString(model,tmp_species.metaid,'met',i);

tmp_note = emptyChar;
if ~isempty(met_notes)
for noteid = 1:size(met_notes,1)
tmp_note = [ tmp_note ' <p>' regexprep(met_notes{noteid,1},'^rxn','') ':' met_notes{noteid,2} '</p>'];
tmp_note = [ tmp_note ' <p>' regexprep(met_notes{noteid,1},'^met','') ':' met_notes{noteid,2} '</p>'];
end
end
if isfield(model,'metNotes')
Expand Down
9 changes: 7 additions & 2 deletions src/base/io/writeCbModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@
if ischar(varargin{1})
if any(ismember(varargin{1}, newKeyWords))
legacySignature = false;
else
legacySignature = true;
else
if ~isempty(regexp(varargin{1},'\.','ONCE')) % this is a file name.
varargin = {'fileName', varargin{1}, varargin{2:end}};
legacySignature = false;
else
legacySignature = true;
end
end
else
%If its not a char, its not the old signature, as that signature
Expand Down
Loading

0 comments on commit 74dc79a

Please sign in to comment.