Skip to content

Commit

Permalink
add altering medium example GeomScale#95
Browse files Browse the repository at this point in the history
  • Loading branch information
hariszaf committed Apr 25, 2024
1 parent d138a58 commit dd468ef
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,29 @@ sampler = polytope_sampler(model)
steady_states = sampler.generate_steady_states()
```

### Change the medium on your model

To do that, you need to first describe the new medium and then assign it on your `model`.
For example:

```python
initial_medium = model.medium
model.medium
# {'EX_co2_e': 1000.0, 'EX_glc__D_e': 10.0, 'EX_h_e': 1000.0, 'EX_h2o_e': 1000.0, 'EX_nh4_e': 1000.0, 'EX_o2_e': 1000.0, 'EX_pi_e': 1000.0}
model.fba()[-1]
# 0.8739215069684305
new_medium = initial_medium.copy()

# Set anoxygenic conditions
new_medium['EX_o2_e'] = 0
model.medium = new_medium
model.fba()[-1]

# Check the difference in the optimal value
# 0.21166294973531055
```




### Plot flux marginals
Expand Down

0 comments on commit dd468ef

Please sign in to comment.