Commit 0f01c343 authored by St. Elmo's avatar St. Elmo
Browse files

fixed formatting

parent e97a3182
using Documenter, COBREXA using Documenter, COBREXA
# download core model
download("http://bigg.ucsd.edu/static/models/e_coli_core.json", "e_coli_core.json")
makedocs(modules = [COBREXA], makedocs(modules = [COBREXA],
clean = false, clean = false,
sitename = "COBREXA.jl", sitename = "COBREXA.jl",
...@@ -26,5 +23,5 @@ makedocs(modules = [COBREXA], ...@@ -26,5 +23,5 @@ makedocs(modules = [COBREXA],
], ],
) )
# delete core model # delete core model that was downloaded as part of the documentation generation process
rm("e_coli_core.json") rm("e_coli_core.json")
\ No newline at end of file
...@@ -24,7 +24,8 @@ using COBREXA ...@@ -24,7 +24,8 @@ using COBREXA
using JuMP using JuMP
using Tulip using Tulip
model = read_model("e_coli_core.json") model_location = "e_coli_core.json" # hide
model = read_model(model_location)
biomass = findfirst(model.reactions, "BIOMASS_Ecoli_core_w_GAM") biomass = findfirst(model.reactions, "BIOMASS_Ecoli_core_w_GAM")
optimizer = Tulip.Optimizer optimizer = Tulip.Optimizer
...@@ -38,6 +39,7 @@ using JSON ...@@ -38,6 +39,7 @@ using JSON
open("fluxes.json", "w") do io open("fluxes.json", "w") do io
JSON.print(io, sol) JSON.print(io, sol)
end end
rm("fluxes.json") # hide
``` ```
## Solution inspection ## Solution inspection
...@@ -112,7 +114,9 @@ using COBREXA ...@@ -112,7 +114,9 @@ using COBREXA
using JuMP using JuMP
using Tulip using Tulip
model = read_model("e_coli_core.json") model_location = "e_coli_core.json" # hide
model = read_model(model_location)
cbm, v, mb, ubs, lbs = build_cbm(model) cbm, v, mb, ubs, lbs = build_cbm(model)
glucose_index = model[findfirst(model.reactions, "EX_glc__D_e")] glucose_index = model[findfirst(model.reactions, "EX_glc__D_e")]
set_bound(glucose_index, ubs, lbs; ub=-12.0, lb=-12.0) set_bound(glucose_index, ubs, lbs; ub=-12.0, lb=-12.0)
......
...@@ -46,17 +46,18 @@ The optimization solvers are implemented through `JuMP` and thus this package sh ...@@ -46,17 +46,18 @@ The optimization solvers are implemented through `JuMP` and thus this package sh
## Quick Example ## Quick Example
Let's perform flux balance analysis on a constraint based model. Let's perform flux balance analysis on a constraint based model.
```@example intro ```@example
using COBREXA using COBREXA
using JuMP using JuMP
using Tulip using Tulip
# Download a model from the BIGG database
download("http://bigg.ucsd.edu/static/models/e_coli_core.json", "e_coli_core.json")
# Read that model into Julia
model = read_model("e_coli_core.json") model = read_model("e_coli_core.json")
biomass = findfirst(model.reactions, "BIOMASS_Ecoli_core_w_GAM") biomass = findfirst(model.reactions, "BIOMASS_Ecoli_core_w_GAM")
optimizer = Tulip.Optimizer optimizer = Tulip.Optimizer
sol = fba(model, biomass, optimizer) sol = fba(model, biomass, optimizer)
``` ```
...@@ -7,9 +7,13 @@ Currently, JSON and Matlab formatted models can be imported. ...@@ -7,9 +7,13 @@ Currently, JSON and Matlab formatted models can be imported.
read_model(file_location::String) read_model(file_location::String)
``` ```
```@example ioexample ```@example io
using COBREXA using COBREXA
# Download a model from the BIGG database
download("http://bigg.ucsd.edu/static/models/e_coli_core.json", "e_coli_core.json")
# Read that model into Julia
model = read_model("e_coli_core.json") model = read_model("e_coli_core.json")
model # pretty printing model # pretty printing
``` ```
...@@ -21,10 +25,10 @@ Currently, JSON and Matlab models can be exported. ...@@ -21,10 +25,10 @@ Currently, JSON and Matlab models can be exported.
save_model(model::CobraModel, file_location::String) save_model(model::CobraModel, file_location::String)
``` ```
```@example ioexample ```@example io
save_model(model, "e_coli_core2.json") save_model(model, "e_coli_core_saved.json")
rm("e_coli_core2.json") # hide rm("e_coli_core2.json") # hide
``` ```
## IO Problems? ## IO Problems?
Please let me know when you run into model import/export problems by filing an issue. Please let me know when you run into model import/export problems by filing an issue.
\ No newline at end of file
...@@ -12,7 +12,9 @@ using COBREXA ...@@ -12,7 +12,9 @@ using COBREXA
using JuMP using JuMP
using Tulip using Tulip
model = read_model("e_coli_core.json") model_location = "e_coli_core.json" # hide
model = read_model(model_location)
optimizer = Tulip.Optimizer optimizer = Tulip.Optimizer
biomass = findfirst(model.reactions, "BIOMASS_Ecoli_core_w_GAM") biomass = findfirst(model.reactions, "BIOMASS_Ecoli_core_w_GAM")
cons = Dict("EX_glc__D_e" => (-12.0, -12.0)) cons = Dict("EX_glc__D_e" => (-12.0, -12.0))
...@@ -20,4 +22,4 @@ sol = fba(model, biomass, optimizer, constraints=cons) # classic flux balance an ...@@ -20,4 +22,4 @@ sol = fba(model, biomass, optimizer, constraints=cons) # classic flux balance an
cons["BIOMASS_Ecoli_core_w_GAM"] = (sol["BIOMASS_Ecoli_core_w_GAM"], sol["BIOMASS_Ecoli_core_w_GAM"]*0.99) cons["BIOMASS_Ecoli_core_w_GAM"] = (sol["BIOMASS_Ecoli_core_w_GAM"], sol["BIOMASS_Ecoli_core_w_GAM"]*0.99)
samples = hit_and_run(100_000, model, optimizer; keepevery=10, samplesize=5000, constraints=cons) samples = hit_and_run(100_000, model, optimizer; keepevery=10, samplesize=5000, constraints=cons)
``` ```
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment