Skip to content

Commit

Permalink
Merge pull request #62 from LCSB-BioCore/mk-frog-012
Browse files Browse the repository at this point in the history
update the frog report format to 0.1.2
  • Loading branch information
exaexa committed Mar 24, 2023
2 parents 4d90b43 + 54f25ff commit d39868b
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 27 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name = "FBCModelTests"
uuid = "1060cd45-1c33-4a14-be81-8fa38fdd82bf"
authors = ["The developers of FBCModelTests.jl"]
version = "0.2.0"
version = "0.2.1"

[deps]
COBREXA = "babc4406-5200-4a30-9033-bf5ae714c842"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Expand Down
3 changes: 2 additions & 1 deletion src/frog/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ function load_report(
FROGMetadata(JSON.parse(f))
end

basefilename = metadata["model.filename"]
basefilename = get(metadata, "model_filename", get(metadata, "model.filename", nothing))
isnothing(basefilename) && error("report does not list its filename")

# objectives
objdata = readfrom("01_objective.tsv") do f
Expand Down
36 changes: 27 additions & 9 deletions src/frog/report.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ using ...FBCModelTests: FBCMT_VERSION

using COBREXA
using JuMP
using Dates
using Distributed
using DocStringExtensions
using MD5
Expand Down Expand Up @@ -157,18 +158,35 @@ $(TYPEDSIGNATURES)
"""
generate_metadata(filename::String; optimizer, basefilename::String = basename(filename)) =
FROGMetadata(
"software.name" => "FBCModelTests.jl",
"software.version" => string(FBCMT_VERSION),
"software.url" => "https://github.com/LCSB-BioCore/FBCModelTests.jl/",
"frog_version" => "0.1.2",
"frog_date" => string(Dates.today()),
"model_filename" => basefilename,
"model_md5" => bytes2hex(open(f -> md5(f), filename, "r")),
"model_sha256" => bytes2hex(open(f -> sha256(f), filename, "r")),
"environment" => begin
x = IOBuffer()
InteractiveUtils.versioninfo(x)
replace(String(take!(x)), r"\n *" => " ")
end,
"model.filename" => basefilename,
"model.md5" => bytes2hex(open(f -> md5(f), filename, "r")),
"model.sha256" => bytes2hex(open(f -> sha256(f), filename, "r")),
"solver.name" => "COBREXA.jl $COBREXA_VERSION ($(COBREXA.JuMP.MOI.get(optimizer(), COBREXA.JuMP.MOI.SolverName())))",
"software" => Dict(
"frog" => Dict(
"name" => "FBCModelTests.jl",
"version" => string(FBCMT_VERSION),
"url" => "https://github.com/LCSB-BioCore/FBCModelTests.jl",
),
"toolbox" => Dict(
"name" => "COBREXA.jl",
"version" => string(COBREXA_VERSION),
"url" => "https://github.com/LCSB-BioCore/COBREXA.jl",
),
"solver" => Dict(
"name" => COBREXA.JuMP.MOI.get(optimizer(), COBREXA.JuMP.MOI.SolverName()),
"version" => COBREXA.JuMP.MOI.get(
optimizer(),
COBREXA.JuMP.MOI.SolverVersion(),
),
),
),
)

end
Expand Down Expand Up @@ -238,14 +256,14 @@ end
$(TYPEDSIGNATURES)
"""
function test_metadata_compatibility(a::FROGMetadata, b::FROGMetadata)
for k in ["model.filename", "model.md5"]
for k in ["model_filename", "model_md5"]
@testset "$k is present" begin
@test haskey(a, k)
@test haskey(b, k)
end
end

for k in ["model.filename", "model.md5", "model.sha256"]
for k in ["model_filename", "model_md5", "model_sha256"]
if haskey(a, k) && haskey(b, k)
@testset "$k matches" begin
@test a[k] == b[k]
Expand Down
30 changes: 22 additions & 8 deletions test/data/report-ecoli-damaged/metadata.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
{
"model.sha256": "b4db506aeed0e434c1f5f0fdd35feda0dfe5d82badcfda0e9d1342335ab31116",
"model.md5": "4574760460afe9e1b3388dc16f354706",
"software.name": "FBCModelTests.jl",
"environment": "Julia Version 1.9.0-beta2 Commit 7daffeecb8c (2022-12-29 07:45 UTC) Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 16 × Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-14.0.6 (ORCJIT, skylake) Threads: 1 on 16 virtual cores Environment: JULIA_LOAD_PATH = @:/tmp/jl_acZx63 ",
"software.version": "0.1.0",
"software.url": "https://github.com/LCSB-BioCore/FBCModelTests.jl/",
"model.filename": "e_coli_core.xml",
"solver.name": "COBREXA.jl 1.4.3 (GLPK)"
"software": {
"frog": {
"name": "FBCModelTests.jl",
"version": "0.2.1",
"url": "https://github.com/LCSB-BioCore/FBCModelTests.jl"
},
"toolbox": {
"name": "COBREXA.jl",
"version": "1.4.4",
"url": "https://github.com/LCSB-BioCore/COBREXA.jl"
},
"solver": {
"name": "GLPK",
"version": "5.0"
}
},
"model_filename": "e_coli_core.xml",
"frog_date": "2023-03-24",
"model_sha256": "b4db506aeed0e434c1f5f0fdd35feda0dfe5d82badcfda0e9d1342335ab31116",
"model_md5": "4574760460afe9e1b3388dc16f354706",
"environment": "Julia Version 1.9.0-beta3 Commit 24204a73447 (2023-01-18 07:20 UTC) Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 8 × AMD Ryzen 7 2700U with Radeon Vega Mobile Gfx WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-14.0.6 (ORCJIT, znver1) Threads: 1 on 8 virtual cores Environment: JULIA_LOAD_PATH = @:/tmp/jl_icHaNw ",
"frog_version": "0.1.2"
}
30 changes: 22 additions & 8 deletions test/data/report-ecoli-good/metadata.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
{
"model.sha256": "b4db506aeed0e434c1f5f1fdd35feda0dfe5d82badcfda0e9d1342335ab31116",
"model.md5": "4574760460afe9e1b3388dc15f354706",
"software.name": "FBCModelTests.jl",
"environment": "Julia Version 1.9.0-beta2 Commit 7daffeecb8c (2022-12-29 07:45 UTC) Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 16 × Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-14.0.6 (ORCJIT, skylake) Threads: 1 on 16 virtual cores Environment: JULIA_LOAD_PATH = @:/tmp/jl_acZx63 ",
"software.version": "0.1.0",
"software.url": "https://github.com/LCSB-BioCore/FBCModelTests.jl/",
"model.filename": "e_coli_core.xml",
"solver.name": "COBREXA.jl 1.4.3 (GLPK)"
"software": {
"frog": {
"name": "FBCModelTests.jl",
"version": "0.2.1",
"url": "https://github.com/LCSB-BioCore/FBCModelTests.jl"
},
"toolbox": {
"name": "COBREXA.jl",
"version": "1.4.4",
"url": "https://github.com/LCSB-BioCore/COBREXA.jl"
},
"solver": {
"name": "GLPK",
"version": "5.0"
}
},
"model_filename": "e_coli_core.xml",
"frog_date": "2023-03-24",
"model_sha256": "b4db506aeed0e434c1f5f1fdd35feda0dfe5d82badcfda0e9d1342335ab31116",
"model_md5": "4574760460afe9e1b3388dc15f354706",
"environment": "Julia Version 1.9.0-beta3 Commit 24204a73447 (2023-01-18 07:20 UTC) Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 8 × AMD Ryzen 7 2700U with Radeon Vega Mobile Gfx WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-14.0.6 (ORCJIT, znver1) Threads: 1 on 8 virtual cores Environment: JULIA_LOAD_PATH = @:/tmp/jl_icHaNw ",
"frog_version": "0.1.2"
}

2 comments on commit d39868b

@exaexa
Copy link
Collaborator Author

@exaexa exaexa commented on d39868b Mar 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/80300

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.1 -m "<description of version>" d39868b75433e5d3df7957f7892bc37c81c5ed5f
git push origin v0.2.1

Please sign in to comment.