diff --git a/Artifacts.toml b/Artifacts.toml index c823a4f..24e93f5 100644 --- a/Artifacts.toml +++ b/Artifacts.toml @@ -1,33 +1,33 @@ [[heta_app]] arch = "x86_64" -git-tree-sha1 = "a23558d3a8dafc1280df998cda01be5f3df5322b" +git-tree-sha1 = "3555032f7d9bf3667af7c796e7c5e6ef65ab184d" libc = "glibc" os = "linux" [[heta_app.download]] - sha256 = "c3de7b6935653e4f0e4b0ff7251b639e76d5fecda1a825784f72ee02cb2381c5" - url = "https://github.com/hetalang/heta-compiler/releases/download/v0.8.7/heta-compiler-linux.tar.gz" + sha256 = "93b951ccf358cdd06f525a6022d1fae801d9e135f7196d082bc1b1ff44069058" + url = "https://github.com/hetalang/heta-compiler/releases/download/v0.9.0/heta-compiler-linux.tar.gz" [[heta_app]] arch = "x86_64" -git-tree-sha1 = "b31deea146ed62c2f686888074499a99fb876080" +git-tree-sha1 = "f9a91d0fab917fbd4567bd9c1330670483f77431" os = "windows" [[heta_app.download]] - sha256 = "0b8af8715f6a50240dd475599615c466c4d4bd7979477a512c0b8de20d6cacdf" - url = "https://github.com/hetalang/heta-compiler/releases/download/v0.8.7/heta-compiler-windows.tar.gz" + sha256 = "950b729cf15a60ab83bd3997b9cc0424f0f8885b311d319690052093c9bc2ef6" + url = "https://github.com/hetalang/heta-compiler/releases/download/v0.9.0/heta-compiler-windows.tar.gz" [[heta_app]] arch = "x86_64" -git-tree-sha1 = "a741cebf5cd6872b9da78a1713e5b835f9bc919b" +git-tree-sha1 = "0da38cac8b6fbf9d7d20316a2b1c0e6dc1b4adc3" os = "macos" [[heta_app.download]] - sha256 = "9454cd0b5a47f5692a5a5decdf47a0e03ef18892f4be5c55d28777bf499176a3" - url = "https://github.com/hetalang/heta-compiler/releases/download/v0.8.7/heta-compiler-macos.tar.gz" + sha256 = "8cb8bf7d3fe70926726074debd3692ac641903623669e3d0930552eb2c8ed8be" + url = "https://github.com/hetalang/heta-compiler/releases/download/v0.9.0/heta-compiler-macos.tar.gz" [[heta_app]] arch = "aarch64" -git-tree-sha1 = "a741cebf5cd6872b9da78a1713e5b835f9bc919b" +git-tree-sha1 = "0da38cac8b6fbf9d7d20316a2b1c0e6dc1b4adc3" os = "macos" [[heta_app.download]] - sha256 = "9454cd0b5a47f5692a5a5decdf47a0e03ef18892f4be5c55d28777bf499176a3" - url = "https://github.com/hetalang/heta-compiler/releases/download/v0.8.7/heta-compiler-macos.tar.gz" + sha256 = "8cb8bf7d3fe70926726074debd3692ac641903623669e3d0930552eb2c8ed8be" + url = "https://github.com/hetalang/heta-compiler/releases/download/v0.9.0/heta-compiler-macos.tar.gz" diff --git a/TODO.md b/TODO.md index 6c571cb..1eacdc8 100644 --- a/TODO.md +++ b/TODO.md @@ -4,10 +4,10 @@ _The rest of ideas and issues are posted in https://github.com/hetalang/heta-dis ## bugs -- Big models can result in StackOverFlow because of Savings +- выдает warning при отсутствие параметра в модели - неудобно при фиттниге - `parameters` method in Scenario should get the scenario-level parameters but not the full list of constants -- wrong get parameters from MCResults, Pair{Symbol, MCResults}, Vector{Pair{Symbol, MCResults}} -- +- не выводит параметры уровня `Scenario` в `DataFrame(::SimResult)` +- "NaN dt detected" при `sim` если параметр задается на уровне `Scenario` ## fitting diff --git a/artifacts_scripts/build_artifacts.jl b/artifacts_scripts/build_artifacts.jl index af29e17..8333b08 100644 --- a/artifacts_scripts/build_artifacts.jl +++ b/artifacts_scripts/build_artifacts.jl @@ -1,7 +1,7 @@ using ArtifactUtils using Pkg.Artifacts -const HETA_COMPILER_RELEASE = "v0.8.7" +const HETA_COMPILER_RELEASE = "v0.9.0" const artifacts_toml = joinpath(@__DIR__, "..", "Artifacts.toml") diff --git a/cases/story_3/index.heta b/cases/story_3/index.heta index 544397b..398cb7d 100644 --- a/cases/story_3/index.heta +++ b/cases/story_3/index.heta @@ -48,4 +48,3 @@ Vol1 = 6.000102e+00; kmax = 2.221855e+03; Km = 9.997290e+03; */ -#export {format: Julia, filepath: julia_platform}; diff --git a/docs/src/basics/overview.md b/docs/src/basics/overview.md index 8cb7169..e3a35eb 100644 --- a/docs/src/basics/overview.md +++ b/docs/src/basics/overview.md @@ -16,7 +16,7 @@ Heta is a modeling language for quantitative systems pharmacology (QSP) and syst It is a DSL (domain-specific language) describing dynamic model or multiple models in process-description format. Heta compiler converts it into variety of formats including Julia code, which can be loaded to Julia/HetaSimulator environment. -HetaSimulator supports all features of the [Heta language](https://hetalang.github.io/#/specifications/). One can organize modeling project with re-used modules (files), include any number of models into a single platform with the namespaces mechanism. The platform can use the declaration file __platform.json__ or can be loaded directly from the heta file. +HetaSimulator supports all features of the [Heta language](https://hetalang.github.io/#/specifications/). One can organize modeling project with re-used modules (files), include any number of models into a single platform with the namespaces mechanism. The platform can use the declaration file __platform.yml__ or can be loaded directly from the heta file. All Heta modules: Heta code, tables, SBML and JSON can be loaded as a modeling platform and compiled into ODE-based mathematical representation. To read more about Heta-based modeling platforms and Heta compiler visit the homepage . @@ -141,20 +141,18 @@ The list of additional arguments is approximately the same as [CLI options](http Alternatively you can use files generated with stand-alone [Heta compiler](https://hetalang.github.io/#/heta-compiler/). -To do so the model code should be updated with the `#export` statement. +To do so the model code should be build with `--export Julia` options. ```heta ... sw2 @TimeSwitcher {start: 0, period: 24, active: false}; A0 [sw2]= dose; - -#export {format: Julia, filepath: julia_platform}; ``` -Running the code with the console command `heta build my_project` produces the file __my\_example/dist/julia\_platform/model.jl__ which can be loaded with [`load_jlplatform`](@ref) method. +Running the code with the console command `heta build --export Julia my_project` produces the file __my\_example/dist/julia/model.jl__ which can be loaded with [`load_jlplatform`](@ref) method. ```julia -p = load_jlplatform("./my_example/dist/julia_platform/model.jl") +p = load_jlplatform("./my_example/dist/julia/model.jl") ``` ```julia Loading platform... OK! diff --git a/docs/src/tutorial/fit-files/index.heta b/docs/src/tutorial/fit-files/index.heta index e04713b..3ad596c 100644 --- a/docs/src/tutorial/fit-files/index.heta +++ b/docs/src/tutorial/fit-files/index.heta @@ -33,5 +33,3 @@ A0 [sw2]= dose; sigma1 @Const = 0.1; sigma2 @Const = 0.1; sigma3 @Const = 0.1; - -#export {format: Julia, filepath: julia_platform}; diff --git a/src/HetaSimulator.jl b/src/HetaSimulator.jl index 7b0fc74..060b1e7 100644 --- a/src/HetaSimulator.jl +++ b/src/HetaSimulator.jl @@ -7,7 +7,7 @@ module HetaSimulator import Base: SHA1 # heta-compiler supported version - const HETA_COMPILER_VERSION = "0.8.7" + const HETA_COMPILER_VERSION = "0.9.0" #const SUPPORTED_VERSIONS = ["0.8.4", "0.8.5", "0.8.6"] function heta_compiler_load() diff --git a/src/heta_cli/connect.jl b/src/heta_cli/connect.jl index 4cfa6b8..72bf964 100644 --- a/src/heta_cli/connect.jl +++ b/src/heta_cli/connect.jl @@ -5,8 +5,7 @@ const MODEL_NAME = "model.jl" """ load_platform( target_dir::AbstractString; - rm_out::Bool = true, - julia_only::Bool = true, + rm_out::Bool = true, dist_dir::String = ".", source::String = "index.heta", type::String = "heta", @@ -30,10 +29,12 @@ function load_platform( target_dir::AbstractString; rm_out::Bool = true, dist_dir::String = ".", + spaceFilter::Union{String, Nothing} = nothing, kwargs... ) - # convert heta model to julia - build_res = heta_build(target_dir; julia_only = true, dist_dir = dist_dir, kwargs...) + export_ = isnothing(spaceFilter) ? "{format:Julia,filepath:$MODEL_DIR}" : "{format:Julia,filepath:$MODEL_DIR,spaceFilter:'$spaceFilter'}" + # convert heta model to julia + build_res = heta_build(target_dir; dist_dir = dist_dir, export_ = export_, kwargs...) # check the exitcode (0 - success, 1 - failure) build_res == 1 && throw("Compilation errors. Likely there is an error in the code of the model. See logs") @@ -42,7 +43,7 @@ function load_platform( _target_dir = abspath(target_dir) # load model to Main - return load_jlplatform("$_target_dir/$MODEL_DIR/$MODEL_NAME"; rm_out) + return load_jlplatform("$_target_dir/$dist_dir/$MODEL_DIR/$MODEL_NAME"; rm_out) end """ diff --git a/src/heta_cli/heta.jl b/src/heta_cli/heta.jl index 751a5d9..99bf42d 100644 --- a/src/heta_cli/heta.jl +++ b/src/heta_cli/heta.jl @@ -71,15 +71,14 @@ end heta_build( target_dir::AbstractString; declaration::String = "platform", - skip_export::Bool = false, units_check::Bool = false, log_mode::String = "error", - debug::Bool = false, - julia_only::Bool = false, + debug::Bool = false dist_dir::String = "dist", meta_dir::String = "meta", source::String = "index.heta", type::String = "heta" + export::String = nothing ) Builds the models from Heta-based platform @@ -91,53 +90,44 @@ Arguments: - `target_dir` : path to a Heta platform directory - `declaration` : path to declaration file. Default is `"platform"` -- `skip_export` : if set to `true` no files will be created. Default is `false` - `units_check` : if set to `true` units will be checked for the consistancy - `log_mode` : log mode. Default is `"error"` - `debug` : turn on debug mode. Default is `false` -- `julia_only` : export only julia-based model. Default is `false` - `dist_dir` : directory path, where to write distributives to. Default is `"dist"` - `meta_dir` : meta directory path. Default is `"meta"` - `source` : path to the main heta module. Default is `"index.heta"` - `type` : type of the source file. Default is `"heta"` +- `export` : export the model to the specified format: `Julia,JSON`, `{format:SBML,version:L3V1},JSON` """ function heta_build( target_dir::AbstractString; declaration::String = "platform", - skip_export::Bool = false, units_check::Bool = false, log_mode::String = "error", debug::Bool = false, - julia_only::Bool = false, dist_dir::String = "dist", meta_dir::String = "meta", source::String = "index.heta", - type::String = "heta" + type::String = "heta", + export_::Union{String, Nothing} = nothing, ) # convert to absolute path _target_dir = abspath(target_dir) - # check if the dir contains src, index.heta, platform.json - #isdir("$_target_dir/src") && throw("src directory not found in $_target_dir") - #!isfile("$_target_dir/index.heta") && throw("index.heta file not found in $_target_dir") - #!isfile("$_target_dir/platform.json") && throw("platform.json file not found in $_target_dir") - # cmd options supported by heta-compiler options_array = String[] declaration != "platform" && push!(options_array, "--declaration", declaration) - skip_export && push!(options_array, "--skip-export") units_check && push!(options_array, "--units-check") log_mode != "error" && push!(options_array, "--log-mode", log_mode) debug && push!(options_array, "--debug") - julia_only && push!(options_array, "--julia-only") dist_dir != "dist" && push!(options_array, "--dist-dir", dist_dir) meta_dir != "meta" && push!(options_array, "--meta-dir", meta_dir) source != "index.heta" && push!(options_array, "--source", source) type != "heta" && push!(options_array, "--type", type) push!(options_array, "--skip-updates") - + !isnothing(export_) && push!(options_array, "--export", export_) run_build = run(ignorestatus(`$heta_exe_path build $options_array $_target_dir`)) diff --git a/test/examples/single_comp_events/index.heta b/test/examples/single_comp_events/index.heta index bf62542..1cfb9ae 100644 --- a/test/examples/single_comp_events/index.heta +++ b/test/examples/single_comp_events/index.heta @@ -4,5 +4,3 @@ include ./qsp-units.heta // include model.heta include one-compartment.heta - -// #export { format: DBSolve, filepath: dbsolve_in_vitro }; \ No newline at end of file diff --git a/test/examples/single_comp_events/one-compartment.heta b/test/examples/single_comp_events/one-compartment.heta index 04519ce..0df4288 100644 --- a/test/examples/single_comp_events/one-compartment.heta +++ b/test/examples/single_comp_events/one-compartment.heta @@ -43,5 +43,3 @@ switch [sw]= 1; sw_end @TimeSwitcher { start: time_end, active: false }; switch [sw_end]= 0; - -// #export { format: SBML, filepath: sbml_output }; \ No newline at end of file