Skip to content

Commit

Permalink
Fixed test_auxotrophies #121
Browse files Browse the repository at this point in the history
Changed infeasible status of optimisation to be handled as 0
  • Loading branch information
GwennyGit committed Sep 1, 2024
1 parent 4e76f63 commit bb564e7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/refinegems/analysis/growth.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,8 @@ def test_auxotrophies(model:cobraModel, media_list:list[Medium], supplement_list
if len(entry) == 0:
warn_str = f'Amino acid {a} has no identifier for your chosen namespace {namespace}. Please contact support if you want to add one.'
warnings.warn(warn_str)
auxotrophies[a] = m.optimize().objective_value
growth_res = m.optimize()
auxotrophies[a] = growth_res.objective_value if growth_res.status == 'optimal' else 0.0
else:

# create and check IDs for the chosen namespace
Expand Down Expand Up @@ -834,7 +835,8 @@ def test_auxotrophies(model:cobraModel, media_list:list[Medium], supplement_list
m.reactions.get_by_id(exchange_reac).lower_bound = 0.0
m.reactions.get_by_id(exchange_reac).upper_bound = 0.0
# and calculate the new objective
auxotrophies[a] = m.optimize().objective_value
growth_res = m.optimize()
auxotrophies[a] = growth_res.objective_value if growth_res.status == 'optimal' else 0.0

# add the current test results to the list of all results
results[med.name] = auxotrophies
Expand Down

0 comments on commit bb564e7

Please sign in to comment.