Commit e6d8f33f authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

load and test models from multiple sources

(Uses a few new models from EBI repository.)
parent 6a5bf4db
...@@ -15,6 +15,7 @@ end ...@@ -15,6 +15,7 @@ end
@test typeof(mdl) == Model @test typeof(mdl) == Model
@info "The next warning is an expected side-effect of testing an error condition"
@test_throws AssertionError readSBML(sbmlfile * ".does.not.really.exist") @test_throws AssertionError readSBML(sbmlfile * ".does.not.really.exist")
@test length(mdl.compartments) == 2 @test length(mdl.compartments) == 2
......
sbmlfile = "e_coli_core.xml"
if !isfile(sbmlfile)
download("http://bigg.ucsd.edu/static/models/e_coli_core.xml", sbmlfile)
end
cksum = bytes2hex(sha256(open(sbmlfile)))
if cksum != "b4db506aeed0e434c1f5f1fdd35feda0dfe5d82badcfda0e9d1342335ab31116"
@warn "The downloaded E Coli core model seems to be different from the expected one. Tests will likely fail." cksum
end
@testset "SBML model-only file loading" begin
mdl = readSBML(sbmlfile)
@test typeof(mdl) == Model
mets, rxns, _ = getS(mdl)
@test length(mets) == 72
@test length(rxns) == 95
end
sbmlfiles = [
# a test model from BIGG
("e_coli_core.xml",
"http://bigg.ucsd.edu/static/models/e_coli_core.xml",
"b4db506aeed0e434c1f5f1fdd35feda0dfe5d82badcfda0e9d1342335ab31116",
72,
95),
# a relatively new non-curated model from biomodels
("T1M1133.xml",
"https://www.ebi.ac.uk/biomodels/model/download/MODEL1909260004.4?filename=T1M1133.xml",
"2b1e615558b6190c649d71052ac9e0dc1635e3ad281e541bc7d4fdf2892a5967",
2517,
3956),
# a curated model from biomodels
("Dasgupta2020.xml",
"https://www.ebi.ac.uk/biomodels/model/download/BIOMD0000000973.3?filename=Dasgupta2020.xml",
"958b131d4df2f215dae68255433542f228601db0326d26a54efd08ddcf823489",
2, 6),
]
@testset "Loading of models from various sources" begin
for (sbmlfile, url, hash, expected_mets, expected_rxns) in sbmlfiles
if !isfile(sbmlfile)
download(url, sbmlfile)
end
cksum = bytes2hex(sha256(open(sbmlfile)))
if cksum != hash
@warn "The downloaded model `$sbmlfile' seems to be different from the expected one. Tests will likely fail." cksum
end
@testset "Loading of $sbmlfile" begin
mdl = readSBML(sbmlfile)
@test typeof(mdl) == Model
mets, rxns, _ = getS(mdl)
@test length(mets) == expected_mets
@test length(rxns) == expected_rxns
end
end
end
...@@ -6,5 +6,5 @@ import Pkg ...@@ -6,5 +6,5 @@ import Pkg
@testset "SBML test suite" begin @testset "SBML test suite" begin
include("version.jl") include("version.jl")
include("ecoli_flux.jl") include("ecoli_flux.jl")
include("ecoli_modelonly.jl") include("loadmodels.jl")
end 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