Commit 48e8e4f5 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

make the downloaded file handling robust in docs

parent e957ee8b
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",
...@@ -25,6 +22,3 @@ makedocs(modules = [COBREXA], ...@@ -25,6 +22,3 @@ makedocs(modules = [COBREXA],
"Sampling Tools" => "sampling_tools.md", "Sampling Tools" => "sampling_tools.md",
], ],
) )
# delete core model
rm("e_coli_core.json")
...@@ -24,7 +24,10 @@ using COBREXA ...@@ -24,7 +24,10 @@ using COBREXA
using JuMP using JuMP
using Tulip using Tulip
download("http://bigg.ucsd.edu/static/models/e_coli_core.json", "e_coli_core.json") if !isfile("e_coli_core.json")
download("http://bigg.ucsd.edu/static/models/e_coli_core.json", "e_coli_core.json")
end
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")
...@@ -108,11 +111,8 @@ build_cbm ...@@ -108,11 +111,8 @@ build_cbm
set_bound set_bound
map_fluxes(::Array{Float64,1}, ::CobraModel) map_fluxes(::Array{Float64,1}, ::CobraModel)
``` ```
```@example fba
using COBREXA
using JuMP
using Tulip
```@example fba
model = read_model("e_coli_core.json") model = read_model("e_coli_core.json")
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")]
...@@ -123,5 +123,4 @@ set_optimizer(cbm, Tulip.Optimizer) ...@@ -123,5 +123,4 @@ set_optimizer(cbm, Tulip.Optimizer)
optimize!(cbm) optimize!(cbm)
sol = map_fluxes(v, model) sol = map_fluxes(v, model)
rm("e_coli_core.json") # hide
``` ```
...@@ -51,11 +51,13 @@ using COBREXA ...@@ -51,11 +51,13 @@ using COBREXA
using JuMP using JuMP
using Tulip using Tulip
download("http://bigg.ucsd.edu/static/models/e_coli_core.json", "e_coli_core.json") if !isfile("e_coli_core.json")
download("http://bigg.ucsd.edu/static/models/e_coli_core.json", "e_coli_core.json")
end
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)
rm("e_coli_core.json") # hide
``` ```
...@@ -10,10 +10,12 @@ read_model(file_location::String) ...@@ -10,10 +10,12 @@ read_model(file_location::String)
```@example ioexample ```@example ioexample
using COBREXA using COBREXA
download("http://bigg.ucsd.edu/static/models/e_coli_core.json", "e_coli_core.json") if !isfile("e_coli_core.json")
download("http://bigg.ucsd.edu/static/models/e_coli_core.json", "e_coli_core.json")
end
model = read_model("e_coli_core.json") model = read_model("e_coli_core.json")
rm("e_coli_core.json") # hide model # pretty print the model
model # pretty printing
``` ```
## Writing constraint based models ## Writing constraint based models
...@@ -25,7 +27,6 @@ save_model(model::CobraModel, file_location::String) ...@@ -25,7 +27,6 @@ save_model(model::CobraModel, file_location::String)
```@example ioexample ```@example ioexample
save_model(model, "e_coli_core2.json") save_model(model, "e_coli_core2.json")
rm("e_coli_core2.json") # hide
``` ```
## IO Problems? ## IO Problems?
......
...@@ -12,9 +12,8 @@ using COBREXA ...@@ -12,9 +12,8 @@ using COBREXA
using JuMP using JuMP
using Tulip using Tulip
download("http://bigg.ucsd.edu/static/models/e_coli_core.json", "e_coli_core.json")
model = read_model("e_coli_core.json") model = read_model("e_coli_core.json")
rm("e_coli_core.json") # hide
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))
......
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