Skip to content

Commit

Permalink
Fix issue when no RL reactions are defined. Closes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo R. Mier committed Apr 23, 2021
1 parent cd78bf2 commit 54bb9c5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dexomInit.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function dexomInit(cobraToolboxInitMode, verbose)
fprintf('This version was tested with Matlab 2015b (CPLEX v12.8), 2018a (CPLEX v12.9),\n');
fprintf('2018b (CPLEX v12.8) and COBRA Toolbox v3.0.6 on Windows 10.\n');

paperLink = 'https://doi.org/10.1101/2020.07.17.208918';
paperLink = 'https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1008730';
if usejava('desktop')
paperLink = ['<a href=\"', paperLink, '\">', paperLink, '</a>'];
end
Expand Down
14 changes: 12 additions & 2 deletions src/methods/dexom/dexomCreateMILP.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@
lb = model.lb;
ub = model.ub;

if isempty(RHindex)
senseRH = [];
numRH = [];
end
if isempty(RLindex)
senseRL = [];
numRL = [];
end

% Create the A matrix (constraint equations x variables) Ax <=> b
%
% Same A matrix as in the original iMAT code +2 rows, one for the numRL
Expand Down Expand Up @@ -103,8 +112,9 @@
A(lastRow+1,i+size(S,2)) = 1;
end

lastRow = size(A, 1);
for i = 1:length(RLindex)
A(lastRow+2, i+size(S,2)+length(RHindex)) = 1;
A(lastRow+1, i+size(S,2)+length(RHindex)) = 1;
end

% Alternatively, use fitScore to put a min constraint on the RH+RL
Expand Down Expand Up @@ -151,7 +161,7 @@
csenseFitScore = 'G';
csense6(1:size(options.exclude,1)) = 'L'; % All less or eq for options.exclude
csense = [csense1 csense2 csense3 csense4 csense5 senseRH senseRL csenseFitScore csense6];


% Creating lb and ub
lb_y = zeros(2*length(RHindex)+length(RLindex),1);
Expand Down
4 changes: 3 additions & 1 deletion src/methods/dexomSolveCobraMILP.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
global CBT_MILP_SOLVER;
% Add solver-specific configuration
if options.useRandomSeed, options.rseed = randi(intmax('int16')); end
options.solver = struct;
if ~isfield(options,'solver')
options.solver = struct;
end
if strcmp(CBT_MILP_SOLVER, 'ibm_cplex')
options.solver.output.clonelog = -1;
options.solver.workdir = tempdir();
Expand Down

0 comments on commit 54bb9c5

Please sign in to comment.