Skip to content

Commit

Permalink
fix: find_blocked_reactions solver set bug
Browse files Browse the repository at this point in the history
Solver should be set to the determined `solver_interface`, not the
original argument.
  • Loading branch information
hredestig committed Apr 12, 2017
1 parent bd67728 commit d328042
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,4 @@ manylinux_builder/wheelhouse
venv/
.benchmarks/
glpk-4.*
/.testmondata
2 changes: 1 addition & 1 deletion cobra/flux_analysis/variability.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def find_blocked_reactions(model, reaction_list=None,
reaction_list = [i for i in reaction_list
if abs(solution.x_dict[i.id]) < zero_cutoff]
else:
model.solver = solver
model.solver = solver_interface
model.solver.optimize()
solution = get_solution(model, reactions=reaction_list)
reaction_list = [rxn for rxn in reaction_list if
Expand Down
4 changes: 4 additions & 0 deletions cobra/test/test_flux_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ def test_fva_infeasible(self, model):
with pytest.raises(Infeasible):
flux_variability_analysis(infeasible_model)

def test_find_blocked_reactions_solver_none(self, model):
result = find_blocked_reactions(model, model.reactions[40:46])
assert result == ['FRUpts2']

@pytest.mark.parametrize("solver", all_solvers)
def test_find_blocked_reactions(self, model, solver):
result = find_blocked_reactions(model, model.reactions[40:46],
Expand Down

0 comments on commit d328042

Please sign in to comment.