Commit 348648ce authored by St. Elmo's avatar St. Elmo
Browse files

added reviews


Former-commit-id: 7d61877b
parent a9035eca
......@@ -81,12 +81,12 @@ community = add_model(community, model, exchange_rxn_ids, exchange_met_ids; spec
"""
function add_model(
community::CoreModel,
model::M,
model::MetabolicModel,
exchange_rxn_ids::Vector{String},
exchange_met_ids::Vector{String};
species_name = "",
biomass_id = "",
) where {M<:MetabolicModel}
species_name="unknown_species",
biomass_id=nothing,
)::CoreModel
exchange_met_community_inds = indexin(exchange_met_ids, metabolites(community))
exchange_rxn_community_inds = indexin(exchange_rxn_ids, reactions(community))
......@@ -148,7 +148,7 @@ function add_model(
ubs = [ubs; ubsadd]
rxnsadd = "$(species_name)_" .* reactions(model)
if biomass_id != ""
if !isnothing(biomass_id)
metsadd =
["$(species_name)_" .* metabolites(model); "$(species_name)_" * biomass_id]
else
......@@ -219,7 +219,7 @@ reaction in the community model, if desired. Refer to the tutorial if this is
unclear.
# Example
```jldoctest; output = false
```
m1 = load_model(core_model_path)
m2 = load_model(CoreModel, core_model_path)
......@@ -236,24 +236,6 @@ community = join_with_exchanges(
add_biomass_objective = true,
biomass_ids = biomass_ids,
)
# output
Metabolic model of type CoreModel
⠤⡤⣤⣼⢤⣤⠀⢘⡄⢤⡼⢷⣦⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢸⣘⢀⢛⣠⠘⠀⠀⢡⠀⠻⠒⢛⢿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢚⢛⢙⢹⡨⢌⡀⠀⠰⠹⠚⢈⠒⠔⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⣭⣨⣦⣯⠕⢺⢌⠀⠀⠒⢠⣀⠃⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⡶⠘⠉⠻⠃⡶⠮⡀⠀⢦⡀⠈⠊⠘⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠈⠀⠀⠈⠀⠈⠁⠁⠀⠁⠉⠀⠀⢀⣄⣠⣤⣦⣤⡀⠀⢆⠠⣠⣲⣦⣀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢔⠂⠐⠆⣁⠆⠀⠈⡄⠸⠶⠾⠻⡂⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠛⠜⠗⣏⣬⢂⠀⠀⠲⡼⠗⡡⢥⠄⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢐⣘⣥⣱⡲⠒⡯⡁⠀⠐⠂⣀⢐⠀⠂⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠕⠍⠙⠟⠠⠷⢢⠀⢰⡠⠉⠙⠉⠃⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠲⣄⠀⠀⠀⠀⠀⠀⠂⠀⠀⠃⠈⠙⢮⡀⠈⠙⠃⠀⠀⠲⣄⠀⠀
⠀⠀⠀⢀⠀⠀⠀⠈⠳⠄⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠙⠦⠀⠀⠀⠀⠀⠈⠳⠄
Number of reactions: 211
Number of metabolites: 166
```
"""
function join_with_exchanges(
......
......@@ -4,12 +4,8 @@ ex = quote
using COBREXA, Tulip
include(joinpath(dirname(pathof(COBREXA)), "..", "test", "data_static.jl"))
model = test_LP()
core_model_path =
joinpath(dirname(pathof(COBREXA)), "..", "test", "data", "e_coli_core.json")
Downloads.download(
"http://bigg.ucsd.edu/static/models/e_coli_core.json",
core_model_path,
)
include(joinpath(dirname(pathof(COBREXA)), "..", "test", "test_functions.jl")) # expose functions for downloading
include(joinpath(dirname(pathof(COBREXA)), "..", "test", "doctest_models.jl"))
end
# set module-level metadata
......
core_path = download_data_file(
"http://bigg.ucsd.edu/static/models/e_coli_core.json",
joinpath("data", "e_coli_core.json"),
"7bedec10576cfe935b19218dc881f3fb14f890a1871448fc19a9b4ee15b448d8",
)
function run_test_file(path...)
fn = joinpath(path...)
t = @elapsed include(fn)
@info "$(fn) done in $(round(t; digits = 2))s"
end
function run_test_dir(dir, comment = "Directory $dir/")
@testset "$comment" begin
run_test_file.(joinpath.(dir, filter(fn -> endswith(fn, ".jl"), readdir(dir))))
end
end
function check_data_file_hash(path, expected_checksum)
actual_checksum = bytes2hex(sha256(open(path)))
if actual_checksum != expected_checksum
@error "The downloaded data file `$path' seems to be different from the expected one. Tests will likely fail." actual_checksum expected_checksum
end
end
function download_data_file(url, path, hash)
if isfile(path)
check_data_file_hash(path, hash)
@info "using cached `$path'"
return path
end
Downloads.download(url, path)
check_data_file_hash(path, hash)
return path
end
Markdown is supported
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