diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index d4a93fa..167d6c5 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-10-01T14:10:55","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-10-01T14:47:34","documenter_version":"1.7.0"}} \ No newline at end of file diff --git a/dev/api/index.html b/dev/api/index.html index 24b9d1a..5e59676 100644 --- a/dev/api/index.html +++ b/dev/api/index.html @@ -4,16 +4,16 @@ gtag('js', new Date()); gtag('config', 'UA-149749027-1', {'page_path': location.pathname + location.search + location.hash});

API references

DataFrames.DataFrameMethod
DataFrame(s::Simulation; 
-  vars=observables(s), parameters_output::Vector{Symbol}=Symbol[], iter::Union{Int,Nothing}=nothing)

Converts simulation results of type SimResult, MCResult, etc to DataFrame.

Example: DataFrame(s)

Arguments:

  • s : simulation results of type SimResult, MCResult or Vector containing them
  • parameters_output : parameters provided as kwarg parameters to sim or mc functions, which should be included in DataFrame. Default is empty
  • iter : Int iteration id, which should be included in DataFrame. Default is nothing
source
HetaSimulator.FitResultType
struct FitResult{L<:Real, I}
+  vars=observables(s), parameters_output::Vector{Symbol}=Symbol[], iter::Union{Int,Nothing}=nothing)

Converts simulation results of type SimResult, MCResult, etc to DataFrame.

Example: DataFrame(s)

Arguments:

  • s : simulation results of type SimResult, MCResult or Vector containing them
  • parameters_output : parameters provided as kwarg parameters to sim or mc functions, which should be included in DataFrame. Default is empty
  • iter : Int iteration id, which should be included in DataFrame. Default is nothing
source
HetaSimulator.FitResultType
struct FitResult{L<:Real, I}
   obj::L
   optim::Vector{Pair{Symbol,Float64}}
   status::Symbol
   numevals::I
-end

Result of fit.

Use optim method to get optimal values.

Use object method to get optimal objective function.

Use status to get status.

The optimal parameters can be saved in heta file, see save_as_heta method.

source
HetaSimulator.MCResultType
struct MCResult{S,C} <: AbstractResult
+end

Result of fit.

Use optim method to get optimal values.

Use object method to get optimal objective function.

Use status to get status.

The optimal parameters can be saved in heta file, see save_as_heta method.

source
HetaSimulator.MCResultType
struct MCResult{S,C} <: AbstractResult
   sim::S
   saveat::Bool
   scenario::C
-end

Structure storing results of [mc]{@ref} method applied for one Scenario.

To convert into tabular format, use DataFrame method.

The base visulaization can be done with plot method.

source
HetaSimulator.ModelType
struct Model{IF,OF,EV,SG,EA, MM} <: AbstractModel
+end

Structure storing results of [mc]{@ref} method applied for one Scenario.

To convert into tabular format, use DataFrame method.

The base visulaization can be done with plot method.

source
HetaSimulator.ModelType
struct Model{IF,OF,EV,SG,EA, MM} <: AbstractModel
   init_func::IF
   ode_func::OF
   events::EV
@@ -22,10 +22,10 @@
   constants::NamedTuple
   events_active::EA
   mass_matrix::MM
-end

Structure storing core properties of ODE model. This represent the content of one namespace from a Heta platform.

To get list of model content use methods: constants(model), records(model), switchers(model).

To get the default model options use methods: events_active(model), events_save(model), observables(model). These values can be rewritten by a [Scenario]{@ref}.

source
HetaSimulator.PlatformType
struct Platform{M,C}
+end

Structure storing core properties of ODE model. This represent the content of one namespace from a Heta platform.

To get list of model content use methods: constants(model), records(model), switchers(model).

To get the default model options use methods: events_active(model), events_save(model), observables(model). These values can be rewritten by a [Scenario]{@ref}.

source
HetaSimulator.PlatformType
struct Platform{M,C}
   models::Dict{Symbol,M}     # dictionary storing Models
   scenarios::Dict{Symbol,C} # dictionary storing Scenarios
-end

The main storage representing a modeling platform. Typically HetaSimulator works with one platform object which can include several models and scenarios.

Usually a Platform is created based on Heta formatted files using [load_platform]{@ref}.

To get the platform content use methods: models(platform), `scenarios(platform).

source
HetaSimulator.ScenarioType

struct Scenario{F,P,M} <: AbstractScenario init_func::F prob::P measurements::M tags::AbstractVector{Symbol} group::Union{Symbol,Nothing} parameters::NamedTuple end

Type representing simulation conditions, i.e. model variant with updated parameters and outputs.

To get the internal properties use methods: tspan(scenario), parameters(scenario), measurements(scenario)

source
HetaSimulator.ScenarioMethod
Scenario(
+end

The main storage representing a modeling platform. Typically HetaSimulator works with one platform object which can include several models and scenarios.

Usually a Platform is created based on Heta formatted files using [load_platform]{@ref}.

To get the platform content use methods: models(platform), `scenarios(platform).

source
HetaSimulator.ScenarioType

struct Scenario{F,P,M} <: AbstractScenario init_func::F prob::P measurements::M tags::AbstractVector{Symbol} group::Union{Symbol,Nothing} parameters::NamedTuple end

Type representing simulation conditions, i.e. model variant with updated parameters and outputs.

To get the internal properties use methods: tspan(scenario), parameters(scenario), measurements(scenario)

source
HetaSimulator.ScenarioMethod
Scenario(
   model::Model,
   tspan;
   measurements::Vector{AbstractMeasurementPoint}=AbstractMeasurementPoint[],
@@ -36,35 +36,35 @@
   saveat::Union{Nothing,AbstractVector} = nothing,
 
   save_scope::Bool = true,
-)

Builds simulation scenario of type Scenario

Example: Scenario(model, (0., 200.))

Arguments:

  • model : model of type Model

  • tspan : time span for the ODE problem

  • measurements : Vector of measurements. Default is empty Vector{AbstractMeasurementPoint}

  • observables : names of output observables. Overwrites default model's values. Default is nothing

  • tags :

  • group :

  • parameters : Vector of Pairs containing parameters' names and values. Overwrites default model's values. Default is empty vector.

  • events_active : Vector of Pairs containing events' names and true/false values. Overwrites default model's values. Default is empty Vector{Pair}

  • events_save : Tuple or Vector{Tuple} marking whether to save solution before and after event. Default is (true,true) for all events

  • saveat : time points, where solution should be saved. Default nothing values stands for saving solution at timepoints reached by the solver

  • save_scope : should scope be saved together with solution. Default is true

source
HetaSimulator.SimResultType
struct SimResult{S, C<:Scenario} <: AbstractResult
+)

Builds simulation scenario of type Scenario

Example: Scenario(model, (0., 200.))

Arguments:

  • model : model of type Model

  • tspan : time span for the ODE problem

  • measurements : Vector of measurements. Default is empty Vector{AbstractMeasurementPoint}

  • observables : names of output observables. Overwrites default model's values. Default is nothing

  • tags :

  • group :

  • parameters : Vector of Pairs containing parameters' names and values. Overwrites default model's values. Default is empty vector.

  • events_active : Vector of Pairs containing events' names and true/false values. Overwrites default model's values. Default is empty Vector{Pair}

  • events_save : Tuple or Vector{Tuple} marking whether to save solution before and after event. Default is (true,true) for all events

  • saveat : time points, where solution should be saved. Default nothing values stands for saving solution at timepoints reached by the solver

  • save_scope : should scope be saved together with solution. Default is true

source
HetaSimulator.SimResultType
struct SimResult{S, C<:Scenario} <: AbstractResult
   sim::S
   scenario::C 
-end

Structure storing results from [sim]{@ref} method applied for one [Scenario]{@ref}.

To get the content use methods: status(results), times(results), vals(results), parameters(results), observables(results).

The results can be transformed using DataFrame method or visualized using plot method.

source
HetaSimulator.add_measurements!Method
add_measurements!(
+end

Structure storing results from [sim]{@ref} method applied for one [Scenario]{@ref}.

To get the content use methods: status(results), times(results), vals(results), parameters(results), observables(results).

The results can be transformed using DataFrame method or visualized using plot method.

source
HetaSimulator.add_measurements!Method
add_measurements!(
   platform::Platform,
   df::DataFrame;
   kwargs...
-)

Adds measurements to Scenario

Arguments:

  • platform : platform of Platform type
  • df : DataFrame with measurements, typically obtained with read_measurements function
  • subset : subset of measurements which will be added to the Scenario. Default Pair{Symbol, Symbol}[] adds all measurements from the df
source
HetaSimulator.add_measurements!Method
add_measurements!(
+)

Adds measurements to Scenario

Arguments:

  • platform : platform of Platform type
  • df : DataFrame with measurements, typically obtained with read_measurements function
  • subset : subset of measurements which will be added to the Scenario. Default Pair{Symbol, Symbol}[] adds all measurements from the df
source
HetaSimulator.add_measurements!Method
add_measurements!(
   scenario::Scenario,
   df::DataFrame;
   kwargs...
-)

Adds measurements to Scenario

Arguments:

  • scenario : simulation scenario of type Scenario
  • df : DataFrame with measurements, typically obtained with read_measurements function
  • subset : subset of measurements which will be added to the Scenario. Default Pair{Symbol, Symbol}[] adds all measurements from the df
source
HetaSimulator.add_scenarios!Method
add_scenarios!(
+)

Adds measurements to Scenario

Arguments:

  • scenario : simulation scenario of type Scenario
  • df : DataFrame with measurements, typically obtained with read_measurements function
  • subset : subset of measurements which will be added to the Scenario. Default Pair{Symbol, Symbol}[] adds all measurements from the df
source
HetaSimulator.add_scenarios!Method
add_scenarios!(
   platform::Platform,
   df::DataFrame;
   subset::AbstractVector{P} = Pair{Symbol, Symbol}[]
-) where P <: Pair{Symbol, Symbol}

Adds a new Scenario to the Platform

Arguments:

  • platform : platform of Platform type
  • df : DataFrame with scenarios setup, typically obtained with read_scenarios function
  • subset : subset of scenarios which will be added to the platform. Default Pair{Symbol, Symbol}[] adds all scenarios from the df
source
HetaSimulator.estimatorMethod
function estimator(
+) where P <: Pair{Symbol, Symbol}

Adds a new Scenario to the Platform

Arguments:

  • platform : platform of Platform type
  • df : DataFrame with scenarios setup, typically obtained with read_scenarios function
  • subset : subset of scenarios which will be added to the platform. Default Pair{Symbol, Symbol}[] adds all scenarios from the df
source
HetaSimulator.estimatorMethod
function estimator(
   platform::Platform,
   parameters_fitted;
   scenarios::Union{AbstractVector{Symbol}, Nothing} = nothing, # all if nothing
   kwargs... 
-)

Generates likelihood estimator function for parameter identification and analysis. It is the interface for Platform. See more detailes in base estimator method.

Arguments:

  • platform : platform of Platform type
  • parameters_fitted : optimization parameters and their initial values
  • scenarios : vector of scenarios identifiers of type Symbol. Default is nothing
  • kwargs... : other arguments supported by estimator, see base method.
source
HetaSimulator.estimatorMethod
function estimator(
+)

Generates likelihood estimator function for parameter identification and analysis. It is the interface for Platform. See more detailes in base estimator method.

Arguments:

  • platform : platform of Platform type
  • parameters_fitted : optimization parameters and their initial values
  • scenarios : vector of scenarios identifiers of type Symbol. Default is nothing
  • kwargs... : other arguments supported by estimator, see base method.
source
HetaSimulator.estimatorMethod
function estimator(
   scenario_pairs::AbstractVector{Pair{Symbol, C}},
   parameters_fitted::DataFrame;
   kwargs...
-) where C<:AbstractScenario

Generates likelihood estimator function for parameter identification and analysis. It is the interface for parameters from DataFrame. See more detailes in base estimator method.

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters_fitted : DataFrame with optimization parameters setup and their initial values, see read_parameters
  • kwargs... : other arguments supported by estimator, see base method.
source
HetaSimulator.estimatorMethod
function estimator(
+) where C<:AbstractScenario

Generates likelihood estimator function for parameter identification and analysis. It is the interface for parameters from DataFrame. See more detailes in base estimator method.

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters_fitted : DataFrame with optimization parameters setup and their initial values, see read_parameters
  • kwargs... : other arguments supported by estimator, see base method.
source
HetaSimulator.estimatorMethod
function estimator(
   scenarios::AbstractVector{C},
   parameters_fitted;
   kwargs...
-) where {C<:AbstractScenario}

Generates likelihood estimator function for parameter identification and analysis. It is the interface for scenarios in vector. See more detailes in base estimator method.

Arguments:

  • scenarios : vector of scenarios of type Scenario
  • parameters_fitted : optimization parameters and their initial values
  • kwargs... : other arguments supported by estimator, see base method.
source
HetaSimulator.estimatorMethod
function estimator(
+) where {C<:AbstractScenario}

Generates likelihood estimator function for parameter identification and analysis. It is the interface for scenarios in vector. See more detailes in base estimator method.

Arguments:

  • scenarios : vector of scenarios of type Scenario
  • parameters_fitted : optimization parameters and their initial values
  • kwargs... : other arguments supported by estimator, see base method.
source
HetaSimulator.estimatorMethod
function estimator(
   scenario_pairs::AbstractVector{Pair{Symbol, C}},
   parameters_fitted::Vector{Pair{Symbol,Float64}};
   parameters::Union{Nothing, Vector{P}}=nothing,
@@ -73,19 +73,19 @@
   abstol=DEFAULT_FITTING_ABSTOL,
   parallel_type=EnsembleSerial(),
   kwargs... # other arguments to sim
-) where {C<:AbstractScenario, P<:Pair}

Generates likelihood estimator function for parameter identification and analysis. It corresponds to -2ln(L) as a function depending on parameter set.

Example: estimator([:x=>scn2, :y=>scn3, :z=>scn4], [:k1=>0.1,:k2=>0.2,:k3=>0.3])

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters_fitted : parameters and their nominal values that will be used as default
  • parameters : paramters, which overwrite both Model and Scenario parameters. Default is nothing
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-6
  • abstol : relative tolerance. Default is 1e-8
  • parallel_type : parallel setup. See SciML docs for details. Default is no parallelism: EnsembleSerial()
  • kwargs... : other ODE solver related arguments supported by SciMLBase.solve. See SciML docs for details

Returns:

function(x:Vector{Float64}=last.(parameters_fitted))

The method returns anonimous function which depends on parameters vector in the same order as in parameters_fitted. This function is ready to be passed to optimizer routine or identifiability analysis.

source
HetaSimulator.fitMethod
fit(platform::Platform,
+) where {C<:AbstractScenario, P<:Pair}

Generates likelihood estimator function for parameter identification and analysis. It corresponds to -2ln(L) as a function depending on parameter set.

Example: estimator([:x=>scn2, :y=>scn3, :z=>scn4], [:k1=>0.1,:k2=>0.2,:k3=>0.3])

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters_fitted : parameters and their nominal values that will be used as default
  • parameters : paramters, which overwrite both Model and Scenario parameters. Default is nothing
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-6
  • abstol : relative tolerance. Default is 1e-8
  • parallel_type : parallel setup. See SciML docs for details. Default is no parallelism: EnsembleSerial()
  • kwargs... : other ODE solver related arguments supported by SciMLBase.solve. See SciML docs for details

Returns:

function(x:Vector{Float64}=last.(parameters_fitted))

The method returns anonimous function which depends on parameters vector in the same order as in parameters_fitted. This function is ready to be passed to optimizer routine or identifiability analysis.

source
HetaSimulator.fitMethod
fit(platform::Platform,
   parameters_fitted;
   scenarios::Union{AbstractVector{Symbol}, Nothing} = nothing,
   kwargs...
-) where C<:AbstractScenario

Fit parameters to experimental measurements. Returns FitResult type.

Example:

fit(platform, [:k1=>0.1,:k2=>0.2,:k3=>0.3];scenarios=[:scn2,:scn3])

Arguments:

  • platform : platform of Platform type
  • parameters_fitted : optimization parameters and their initial values
  • scenarios : vector of scenarios identifiers of type Symbol. Default is nothing
  • kwargs... : other ODE solver and fit related arguments supported by fit(scenario_pairs::Vector{<:Pair}, parameters_fitted::Vector{<:Pair}
source
HetaSimulator.fitMethod
fit(
+) where C<:AbstractScenario

Fit parameters to experimental measurements. Returns FitResult type.

Example:

fit(platform, [:k1=>0.1,:k2=>0.2,:k3=>0.3];scenarios=[:scn2,:scn3])

Arguments:

  • platform : platform of Platform type
  • parameters_fitted : optimization parameters and their initial values
  • scenarios : vector of scenarios identifiers of type Symbol. Default is nothing
  • kwargs... : other ODE solver and fit related arguments supported by fit(scenario_pairs::Vector{<:Pair}, parameters_fitted::Vector{<:Pair}
source
HetaSimulator.fitMethod
fit(
   scenario_pairs::AbstractVector{Pair{Symbol, C}},
   parameters_fitted::DataFrame;
   kwargs...
-) where C<:AbstractScenario

Fit parameters to experimental measurements. Returns FitResult type.

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters_fitted : DataFrame with optimization parameters setup and their initial values, see read_parameters
  • kwargs... : other ODE solver and fit arguments supported by fit(scenario_pairs::Vector{<:Pair}, parameters_fitted::Vector{<:Pair}
source
HetaSimulator.fitMethod
fit(
+) where C<:AbstractScenario

Fit parameters to experimental measurements. Returns FitResult type.

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters_fitted : DataFrame with optimization parameters setup and their initial values, see read_parameters
  • kwargs... : other ODE solver and fit arguments supported by fit(scenario_pairs::Vector{<:Pair}, parameters_fitted::Vector{<:Pair}
source
HetaSimulator.fitMethod
fit(
   scenarios::AbstractVector{C},
   parameters_fitted;
   kwargs...
-) where C<:AbstractScenario

Fit parameters to experimental measurements. Returns FitResult type.

Example:

fit([scn2, scn3, scn4], [:k1=>0.1,:k2=>0.2,:k3=>0.3])

Arguments:

  • scenarios : vector of scenarios of type Scenario
  • parameters_fitted : optimization parameters and their initial values
  • kwargs... : other ODE solver and fit related arguments supported by fit(scenario_pairs::Vector{<:Pair}, parameters_fitted::Vector{<:Pair}
source
HetaSimulator.fitMethod
fit(
+) where C<:AbstractScenario

Fit parameters to experimental measurements. Returns FitResult type.

Example:

fit([scn2, scn3, scn4], [:k1=>0.1,:k2=>0.2,:k3=>0.3])

Arguments:

  • scenarios : vector of scenarios of type Scenario
  • parameters_fitted : optimization parameters and their initial values
  • kwargs... : other ODE solver and fit related arguments supported by fit(scenario_pairs::Vector{<:Pair}, parameters_fitted::Vector{<:Pair}
source
HetaSimulator.fitMethod
fit(
   scenario_pairs::AbstractVector{Pair{Symbol, C}},
   parameters_fitted::Vector{Pair{Symbol,Float64}};
   parameters::Union{Nothing, Vector{P}}=nothing,
@@ -105,7 +105,7 @@
   scale = fill(:lin, length(parameters_fitted)),
   progress::Symbol = :minimal,
   kwargs... 
-) where {C<:AbstractScenario, P<:Pair}

Fit parameters to experimental measurements. Returns FitResult type.

Example: fit([:x=>scn2, :y=>scn3, :z=>scn4], [:k1=>0.1,:k2=>0.2,:k3=>0.3])

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters_fitted : optimization parameters and their initial values
  • parameters : parameters, which overwrite both Model and Scenario parameters. Default is nothing
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-6
  • abstol : relative tolerance. Default is 1e-8
  • parallel_type : parallel setup. See SciML docs for details. Default is no parallelism: EnsembleSerial()
  • ftol_abs : absolute tolerance on function value. See NLopt.jl docs for details. Default is 0.0
  • ftol_rel : relative tolerance on function value. See NLopt.jl docs for details. Default is 1e-4
  • xtol_rel : relative tolerance on optimization parameters. See NLopt.jl docs for details. Default is 0.0
  • xtol_abs : absolute tolerance on optimization parameters. See NLopt.jl docs for details. Default is 0.0
  • fit_alg : fitting algorithm. See NLopt.jl docs for details. Default is :LN_NELDERMEAD
  • maxeval : maximum number of function evaluations. See NLopt.jl docs for details. Default is 1e4
  • maxtime : maximum optimization time (in seconds). See NLopt.jl docs for details. Default is 0
  • lbounds : lower parameters bounds. See NLopt.jl docs for details. Default is fill(0.0, length(parameters_fitted))
  • ubounds : upper parameters bounds. See NLopt.jl docs for details. Default is fill(Inf, length(parameters_fitted))
  • scale : scale of the parameters (supports :lin, :direct, :log, :log10) to be used during fitting. Default is fill(:lin, length(parameters_fitted)). :direct value is a synonym of :lin.
  • progress : progress mode display. One of three values: :silent, :minimal, :full. Default is :minimal
  • kwargs... : other solver related arguments supported by SciMLBase.solve. See SciML docs for details
source
HetaSimulator.hetaMethod
heta(;version::Bool=false, help::Bool=false)

Run heta command in console.

Arguments:

  • version: true if only heta-compiler version is required
  • help: true if CLI help wanted
source
HetaSimulator.heta_buildMethod
heta_build(
+) where {C<:AbstractScenario, P<:Pair}

Fit parameters to experimental measurements. Returns FitResult type.

Example: fit([:x=>scn2, :y=>scn3, :z=>scn4], [:k1=>0.1,:k2=>0.2,:k3=>0.3])

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters_fitted : optimization parameters and their initial values
  • parameters : parameters, which overwrite both Model and Scenario parameters. Default is nothing
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-6
  • abstol : relative tolerance. Default is 1e-8
  • parallel_type : parallel setup. See SciML docs for details. Default is no parallelism: EnsembleSerial()
  • ftol_abs : absolute tolerance on function value. See NLopt.jl docs for details. Default is 0.0
  • ftol_rel : relative tolerance on function value. See NLopt.jl docs for details. Default is 1e-4
  • xtol_rel : relative tolerance on optimization parameters. See NLopt.jl docs for details. Default is 0.0
  • xtol_abs : absolute tolerance on optimization parameters. See NLopt.jl docs for details. Default is 0.0
  • fit_alg : fitting algorithm. See NLopt.jl docs for details. Default is :LN_NELDERMEAD
  • maxeval : maximum number of function evaluations. See NLopt.jl docs for details. Default is 1e4
  • maxtime : maximum optimization time (in seconds). See NLopt.jl docs for details. Default is 0
  • lbounds : lower parameters bounds. See NLopt.jl docs for details. Default is fill(0.0, length(parameters_fitted))
  • ubounds : upper parameters bounds. See NLopt.jl docs for details. Default is fill(Inf, length(parameters_fitted))
  • scale : scale of the parameters (supports :lin, :direct, :log, :log10) to be used during fitting. Default is fill(:lin, length(parameters_fitted)). :direct value is a synonym of :lin.
  • progress : progress mode display. One of three values: :silent, :minimal, :full. Default is :minimal
  • kwargs... : other solver related arguments supported by SciMLBase.solve. See SciML docs for details
source
HetaSimulator.hetaMethod
heta(;version::Bool=false, help::Bool=false)

Run heta command in console.

Arguments:

  • version: true if only heta-compiler version is required
  • help: true if CLI help wanted
source
HetaSimulator.heta_buildMethod
heta_build(
   target_dir::AbstractString;
   declaration::String = "platform",
   units_check::Bool = false,
@@ -116,27 +116,27 @@
   source::String = "index.heta",
   type::String = "heta"
   export::String = nothing
-)

Builds the models from Heta-based platform

See heta comiler docs for details: https://hetalang.github.io/#/heta-compiler/cli-references?id=running-build-with-cli-options

Arguments:

  • target_dir : path to a Heta platform directory
  • declaration : path to declaration file. Default is "platform"
  • 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
  • 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
source
HetaSimulator.heta_initMethod
heta_init(dir::String; force::Bool=false, silent::Bool=false)

Run initialization of the platform

Argument:

  • dir: platform directory
  • force: if true then replace files and directories
  • silent: if true use default options without prompt
source
HetaSimulator.load_jlmodelMethod
load_jlmodel(  
+)

Builds the models from Heta-based platform

See heta comiler docs for details: https://hetalang.github.io/#/heta-compiler/cli-references?id=running-build-with-cli-options

Arguments:

  • target_dir : path to a Heta platform directory
  • declaration : path to declaration file. Default is "platform"
  • 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
  • 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
source
HetaSimulator.heta_initMethod
heta_init(dir::String; force::Bool=false, silent::Bool=false)

Run initialization of the platform

Argument:

  • dir: platform directory
  • force: if true then replace files and directories
  • silent: if true use default options without prompt
source
HetaSimulator.load_jlmodelMethod
load_jlmodel(  
   model_jl::AbstractString; 
   rm_out::Bool = false
-)

Loads prebuild julia model without Platform

Arguments:

  • model_jl : path to Julia model file
  • rm_out : should the file with Julia model be removed after the model is loaded. Default is false
source
HetaSimulator.load_jlplatformMethod
load_jlplatform(  
+)

Loads prebuild julia model without Platform

Arguments:

  • model_jl : path to Julia model file
  • rm_out : should the file with Julia model be removed after the model is loaded. Default is false
source
HetaSimulator.load_jlplatformMethod
load_jlplatform(  
   model_jl::AbstractString; 
   rm_out::Bool = false
-)

Loads prebuild julia model as part of Platform

Arguments:

  • model_jl : path to Julia model file
  • rm_out : should the file with Julia model be removed after the model is loaded. Default is false
source
HetaSimulator.load_platformMethod
load_platform(  
+)

Loads prebuild julia model as part of Platform

Arguments:

  • model_jl : path to Julia model file
  • rm_out : should the file with Julia model be removed after the model is loaded. Default is false
source
HetaSimulator.load_platformMethod
load_platform(  
   target_dir::AbstractString;
   rm_out::Bool = true, 
   dist_dir::String = ".",
   source::String = "index.heta",
   type::String = "heta",
   kwargs...
-)

Converts heta model to Julia and outputs Platform type.

See heta comiler docs for details: https://hetalang.github.io/#/heta-compiler/cli-references?id=running-build-with-cli-options

Arguments:

  • target_dir : path to a Heta platform directory
  • rm_out : should the file with Julia model be removed after the model is loaded. Default is true
  • dist_dir : directory path, where to write distributives to. Default is "."
  • kwargs : other arguments supported by heta_build
source
HetaSimulator.mc!Method
mc!(mcres::M; 
+)

Converts heta model to Julia and outputs Platform type.

See heta comiler docs for details: https://hetalang.github.io/#/heta-compiler/cli-references?id=running-build-with-cli-options

Arguments:

  • target_dir : path to a Heta platform directory
  • rm_out : should the file with Julia model be removed after the model is loaded. Default is true
  • dist_dir : directory path, where to write distributives to. Default is "."
  • kwargs : other arguments supported by heta_build
source
HetaSimulator.mc!Method
mc!(mcres::M; 
   success_status::Vector{Symbol}=[:Success,:Terminated]
   kwargs...
-) where M <: Union{MCResult, Vector{MCResult}, Vector{Pair}}

Re-run failed Monte-Carlo simulations with single Scenario. Updates MCResult type.

Example: mc!(mcres)

Arguments:

  • mcres : Monte-Carlo result of type MCResult
  • success_status : Vector of success statuses. Default is [:Success,:Terminated]
  • kwargs : other solver related arguments supported by mc(scenario::Scenario, parameters_variation::Vector, num_iter::Int64)
source
HetaSimulator.mcMethod
mc(scenario::Scenario,
+) where M <: Union{MCResult, Vector{MCResult}, Vector{Pair}}

Re-run failed Monte-Carlo simulations with single Scenario. Updates MCResult type.

Example: mc!(mcres)

Arguments:

  • mcres : Monte-Carlo result of type MCResult
  • success_status : Vector of success statuses. Default is [:Success,:Terminated]
  • kwargs : other solver related arguments supported by mc(scenario::Scenario, parameters_variation::Vector, num_iter::Int64)
source
HetaSimulator.mcMethod
mc(scenario::Scenario,
   parameters_variation::DataFrame,
   num_iter::Int;
   kwargs...
-)

Run Monte-Carlo simulations with single scenario Scenario. Returns MCResult type.

Example: mc(scn1, DataFrame(k2=rand(3),k3=rand(3)), 1000)

Arguments:

  • scenario : simulation scenario of type Scenario
  • parameters_variation : DataFrame with pre-generated parameters.
  • num_iter : number of Monte-Carlo iterations
  • kwargs : other solver related arguments supported by mc(scenario::Scenario, parameters_variation::Vector, num_iter::Int64)
source
HetaSimulator.mcMethod
mc(scenario_pairs::Vector{<:Pair},
+)

Run Monte-Carlo simulations with single scenario Scenario. Returns MCResult type.

Example: mc(scn1, DataFrame(k2=rand(3),k3=rand(3)), 1000)

Arguments:

  • scenario : simulation scenario of type Scenario
  • parameters_variation : DataFrame with pre-generated parameters.
  • num_iter : number of Monte-Carlo iterations
  • kwargs : other solver related arguments supported by mc(scenario::Scenario, parameters_variation::Vector, num_iter::Int64)
source
HetaSimulator.mcMethod
mc(scenario_pairs::Vector{<:Pair},
   parameters_variation::Vector{<:Pair},
   num_iter::Int64;
   verbose=false,
@@ -145,15 +145,15 @@
   abstol=DEFAULT_SIMULATION_ABSTOL,
   parallel_type=EnsembleSerial(),
   kwargs...
-)

Run Monte-Carlo simulations with single Scenario. Returns Vector{MCResult} type.

Example: mc([:c1=>scn1,:c2=>scn2], [:k2=>Normal(1e-3,1e-4), :k3=>Uniform(1e-4,1e-2)], 1000)

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters_variation : parameters variation setup
  • num_iter : number of Monte-Carlo iterations
  • verbose : print iteration progress. Default is false
  • progress_bar : show progress bar. Default is false
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-3
  • abstol : relative tolerance. Default is 1e-6
  • output_func : the function determines what is saved from the solution to the output array. Defaults to saving the solution itself
  • reduction_func : this function determines how to reduce the data in each batch. Defaults to appending the data from the batches
  • parallel_type : parallel setup. See SciML docs for details. Default is no parallelism: EnsembleSerial()
  • kwargs : other solver related arguments supported by SciMLBase.solve. See SciML docs for details
source
HetaSimulator.mcMethod
mc(scenario_pairs::Vector{<:AbstractScenario},
+)

Run Monte-Carlo simulations with single Scenario. Returns Vector{MCResult} type.

Example: mc([:c1=>scn1,:c2=>scn2], [:k2=>Normal(1e-3,1e-4), :k3=>Uniform(1e-4,1e-2)], 1000)

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters_variation : parameters variation setup
  • num_iter : number of Monte-Carlo iterations
  • verbose : print iteration progress. Default is false
  • progress_bar : show progress bar. Default is false
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-3
  • abstol : relative tolerance. Default is 1e-6
  • output_func : the function determines what is saved from the solution to the output array. Defaults to saving the solution itself
  • reduction_func : this function determines how to reduce the data in each batch. Defaults to appending the data from the batches
  • parallel_type : parallel setup. See SciML docs for details. Default is no parallelism: EnsembleSerial()
  • kwargs : other solver related arguments supported by SciMLBase.solve. See SciML docs for details
source
HetaSimulator.mcMethod
mc(scenario_pairs::Vector{<:AbstractScenario},
   parameters_variation::Vector{<:Pair},
   num_iter::Int64;
   kwargs...
-)

Run Monte-Carlo simulations with single scenario. Returns Vector{MCResult} type.

Example: mc([scn1,scn2], [:k2=>Normal(1e-3,1e-4), :k3=>Uniform(1e-4,1e-2)], 1000)

Arguments:

  • scenario_pairs : vector of scenarios of type Scenario
  • parameters_variation : parameters variation setup
  • num_iter : number of Monte-Carlo iterations
  • kwargs : other solver related arguments supported by mc(scenario_pairs::Vector{<:Pair}, parameters_variation::Vector, num_iter::Int64)
source
HetaSimulator.mcMethod
mc(platform::Platform, 
+)

Run Monte-Carlo simulations with single scenario. Returns Vector{MCResult} type.

Example: mc([scn1,scn2], [:k2=>Normal(1e-3,1e-4), :k3=>Uniform(1e-4,1e-2)], 1000)

Arguments:

  • scenario_pairs : vector of scenarios of type Scenario
  • parameters_variation : parameters variation setup
  • num_iter : number of Monte-Carlo iterations
  • kwargs : other solver related arguments supported by mc(scenario_pairs::Vector{<:Pair}, parameters_variation::Vector, num_iter::Int64)
source
HetaSimulator.mcMethod
mc(platform::Platform, 
   parameters_variation::Vector{<:Pair},
   num_iter::Int64;
   kwargs...
-)

Run Monte-Carlo simulations with single Scenario. Returns Vector{MCResult} type.

Example: mc(platform, [:k2=>Normal(1e-3,1e-4), :k3=>Uniform(1e-4,1e-2)], 1000)

Arguments:

  • platform : platform of Platform type
  • parameters_variation : parameters variation setup
  • num_iter : number of Monte-Carlo iterations
  • kwargs : other solver related arguments supported by mc(scenario_pairs::Vector{<:Pair}, parameters_variation::Vector, num_iter::Int64)
source
HetaSimulator.mcMethod
mc(scenario::Scenario,
+)

Run Monte-Carlo simulations with single Scenario. Returns Vector{MCResult} type.

Example: mc(platform, [:k2=>Normal(1e-3,1e-4), :k3=>Uniform(1e-4,1e-2)], 1000)

Arguments:

  • platform : platform of Platform type
  • parameters_variation : parameters variation setup
  • num_iter : number of Monte-Carlo iterations
  • kwargs : other solver related arguments supported by mc(scenario_pairs::Vector{<:Pair}, parameters_variation::Vector, num_iter::Int64)
source
HetaSimulator.mcMethod
mc(scenario::Scenario,
   parameters_variation::Vector{<:Pair},
   num_iter::Int;
   verbose=false,
@@ -162,17 +162,17 @@
   abstol=DEFAULT_SIMULATION_ABSTOL,
   parallel_type=EnsembleSerial(),
   kwargs...
-)

Run Monte-Carlo simulations with single Scenario. Returns MCResult type.

Example: mc(scenario, [:k2=>Normal(1e-3,1e-4), :k3=>Uniform(1e-4,1e-2)], 1000)

Arguments:

  • scenario : simulation scenario of type Scenario
  • parameters_variation : parameters variation setup
  • num_iter : number of Monte-Carlo iterations
  • verbose : print iteration progress. Default is false
  • progress_bar : show progress bar. Default is false
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-3
  • abstol : relative tolerance. Default is 1e-6
  • output_func : the function determines what is saved from the solution to the output array. Defaults to saving the solution itself
  • reduction_func : this function determines how to reduce the data in each batch. Defaults to appending the data from the batches
  • parallel_type : parallel setup. See SciML docs for details. Default is no parallelism: EnsembleSerial()
  • kwargs : other solver related arguments supported by SciMLBase.solve. See SciML docs for details
source
HetaSimulator.read_mcvecsMethod
read_mcvecs(filepath::String)

Read table with pre-generated parameters for Monte-Carlo simulations. Typically used for virtual patients simulations

Arguments:

  • filepath: path to the file with pre-generated parameters
source
HetaSimulator.read_measurementsFunction
read_measurements(filepath::String, sheet=1; kwargs...)

Reads table file with measurements to DataFrame

Arguments:

  • filepath : path to table file. Supports ".csv" and ".xlsx" files
  • sheet : number of sheet in case of ".xlsx" file. Default is 1
  • kwargs... : other arguments supported by CSV.File or XLSX.readtable
source
HetaSimulator.read_parametersMethod

read_parameters(filepath::String; kwargs...)

Reads parameters csv file and output DataFrame

Arguments:

  • filepath : path to valid parameters csv file
source
HetaSimulator.read_scenariosFunction
read_scenarios(filepath::String, sheet=1; kwargs...)

Reads table file with scenarios to DataFrame

Arguments:

  • filepath : path to table file. Supports ".csv" and ".xlsx" files
  • sheet : number of sheet in case of ".xlsx" file. Default is 1
  • kwargs : other arguments supported by CSV.File or XLSX.readtable
source
HetaSimulator.save_as_hetaMethod

saveasheta(filepath::String, fr::FitResult)

Save fitting results in the Heta-formatted file.

Arguments

  • filepath : file to save. The ".heta" extension is usually used.
  • fr : fitting results.
source
HetaSimulator.save_resultsMethod
save_results(filepath::String, sim::AbstractResult)

Save results as csv file

Arguments:

  • filepath: path and name of the file to write to
  • sim: simulation results of AbstractResult type
source
HetaSimulator.simMethod
sim(platform::Platform; 
+)

Run Monte-Carlo simulations with single Scenario. Returns MCResult type.

Example: mc(scenario, [:k2=>Normal(1e-3,1e-4), :k3=>Uniform(1e-4,1e-2)], 1000)

Arguments:

  • scenario : simulation scenario of type Scenario
  • parameters_variation : parameters variation setup
  • num_iter : number of Monte-Carlo iterations
  • verbose : print iteration progress. Default is false
  • progress_bar : show progress bar. Default is false
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-3
  • abstol : relative tolerance. Default is 1e-6
  • output_func : the function determines what is saved from the solution to the output array. Defaults to saving the solution itself
  • reduction_func : this function determines how to reduce the data in each batch. Defaults to appending the data from the batches
  • parallel_type : parallel setup. See SciML docs for details. Default is no parallelism: EnsembleSerial()
  • kwargs : other solver related arguments supported by SciMLBase.solve. See SciML docs for details
source
HetaSimulator.read_mcvecsMethod
read_mcvecs(filepath::String)

Read table with pre-generated parameters for Monte-Carlo simulations. Typically used for virtual patients simulations

Arguments:

  • filepath: path to the file with pre-generated parameters
source
HetaSimulator.read_measurementsFunction
read_measurements(filepath::String, sheet=1; kwargs...)

Reads table file with measurements to DataFrame

Arguments:

  • filepath : path to table file. Supports ".csv" and ".xlsx" files
  • sheet : number of sheet in case of ".xlsx" file. Default is 1
  • kwargs... : other arguments supported by CSV.File or XLSX.readtable
source
HetaSimulator.read_parametersMethod

read_parameters(filepath::String; kwargs...)

Reads parameters csv file and output DataFrame

Arguments:

  • filepath : path to valid parameters csv file
source
HetaSimulator.read_scenariosFunction
read_scenarios(filepath::String, sheet=1; kwargs...)

Reads table file with scenarios to DataFrame

Arguments:

  • filepath : path to table file. Supports ".csv" and ".xlsx" files
  • sheet : number of sheet in case of ".xlsx" file. Default is 1
  • kwargs : other arguments supported by CSV.File or XLSX.readtable
source
HetaSimulator.save_as_hetaMethod

saveasheta(filepath::String, fr::FitResult)

Save fitting results in the Heta-formatted file.

Arguments

  • filepath : file to save. The ".heta" extension is usually used.
  • fr : fitting results.
source
HetaSimulator.save_resultsMethod
save_results(filepath::String, sim::AbstractResult)

Save results as csv file

Arguments:

  • filepath: path and name of the file to write to
  • sim: simulation results of AbstractResult type
source
HetaSimulator.simMethod
sim(platform::Platform; 
   scenarios::Union{AbstractVector{Symbol}, AbstractVector{InvertedIndex{Symbol}}, Nothing} = nothing,
-  kwargs...) where {C<:AbstractScenario}

Simulate scenarios included in platform. Returns Vector{Pair}.

Example: sim(platform)

Arguments:

  • platform : platform of Platform type
  • scenarios : Vector containing names of scenarios included in platform. Default value nothing stands for all scenarios in the platform
  • kwargs... : other kwargs supported by sim(scenario_pairs::Vector{Pair})
source
HetaSimulator.simMethod
sim(scenarios::AbstractVector{C}; kwargs...) where {C<:AbstractScenario}

Simulate multiple scenarios. Returns Vector{Pair}.

Example: sim([scn1, scn2, scn3])

Arguments:

  • scenarios : Vector containing names and scenarios of type Scenario
  • kwargs : other kwargs supported by sim(scenario_pairs::Vector{Pair})
source
HetaSimulator.simMethod
sim(scenario::Scenario; 
+  kwargs...) where {C<:AbstractScenario}

Simulate scenarios included in platform. Returns Vector{Pair}.

Example: sim(platform)

Arguments:

  • platform : platform of Platform type
  • scenarios : Vector containing names of scenarios included in platform. Default value nothing stands for all scenarios in the platform
  • kwargs... : other kwargs supported by sim(scenario_pairs::Vector{Pair})
source
HetaSimulator.simMethod
sim(scenarios::AbstractVector{C}; kwargs...) where {C<:AbstractScenario}

Simulate multiple scenarios. Returns Vector{Pair}.

Example: sim([scn1, scn2, scn3])

Arguments:

  • scenarios : Vector containing names and scenarios of type Scenario
  • kwargs : other kwargs supported by sim(scenario_pairs::Vector{Pair})
source
HetaSimulator.simMethod
sim(scenario::Scenario; 
   parameters::Vector{P}=Pair{Symbol, Float64}[],
   alg=DEFAULT_ALG, 
   reltol=DEFAULT_SIMULATION_RELTOL,
   abstol=DEFAULT_SIMULATION_ABSTOL,
-  kwargs...)

Simulate single Scenario. Returns SimResult type.

Example: Scenario(model, (0., 200.); saveat = [0.0, 150.]) |> sim

Arguments:

  • scenario : simulation scenario of type Scenario
  • parameters : parameters overwrite both Model and Scenario parameters. Default is empty vector.
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-3
  • abstol : relative tolerance. Default is 1e-6
  • kwargs... : other solver related arguments supported by SciMLBase.solve. See SciML docs for details
source
HetaSimulator.simMethod
sim(scenario_pairs::Vector{P}; 
+  kwargs...)

Simulate single Scenario. Returns SimResult type.

Example: Scenario(model, (0., 200.); saveat = [0.0, 150.]) |> sim

Arguments:

  • scenario : simulation scenario of type Scenario
  • parameters : parameters overwrite both Model and Scenario parameters. Default is empty vector.
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-3
  • abstol : relative tolerance. Default is 1e-6
  • kwargs... : other solver related arguments supported by SciMLBase.solve. See SciML docs for details
source
HetaSimulator.simMethod
sim(scenario_pairs::Vector{P}; 
   parameters::Vector{Pair{Symbol, Float64}}=Pair{Symbol, Float64}[],
   alg=DEFAULT_ALG, 
   reltol=DEFAULT_SIMULATION_RELTOL, 
   abstol=DEFAULT_SIMULATION_ABSTOL,
   parallel_type=EnsembleSerial(),
-  kwargs...) where P<:Pair

Simulate multiple scenarios. Returns Vector{Pair}.

Example: sim([:x => scn1, :y=>scn2, :z=>scn3])

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters : parameters, which overwrite both Model and Scenario parameters. Default is empty vector.
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-3
  • abstol : relative tolerance. Default is 1e-6
  • parallel_type : type of multiple simulations parallelism. Default is no parallelism. See SciML docs for details
  • kwargs... : other solver related arguments supported by SciMLBase.solve. See SciML docs for de #updateinitvalues(scni.prob, scni.initfunc, parametersnt) tails
source
+ kwargs...) where P<:Pair

Simulate multiple scenarios. Returns Vector{Pair}.

Example: sim([:x => scn1, :y=>scn2, :z=>scn3])

Arguments:

source diff --git a/dev/basics/distributed/index.html b/dev/basics/distributed/index.html index 8b94058..24a4d95 100644 --- a/dev/basics/distributed/index.html +++ b/dev/basics/distributed/index.html @@ -13,4 +13,4 @@ @everywhere using HetaSimulator s1 = mc(scn1, df, 150, parallel_type=EnsembleDistributed()) -s2 = mc([scn1, scn2, scn3], [:k2=>Normal(1e-3,1e-4), :k3=>Normal(1e-4,1e-5)], 150, parallel_type=EnsembleDistributed()) +s2 = mc([scn1, scn2, scn3], [:k2=>Normal(1e-3,1e-4), :k3=>Normal(1e-4,1e-5)], 150, parallel_type=EnsembleDistributed()) diff --git a/dev/basics/overview/index.html b/dev/basics/overview/index.html index eb5ca54..0d97798 100644 --- a/dev/basics/overview/index.html +++ b/dev/basics/overview/index.html @@ -204,4 +204,4 @@ :sigma1 => 0.020347955494158528 :sigma2 => 0.31561050699802246 :sigma3 => 0.5716026958426483

You can simulate and plot results with the following code.

res_optim = sim(p, parameters = optim(fit_res))
-plot(res_optim, yscale=:log, ylims=(1e-3,1e2))

sim5

+plot(res_optim, yscale=:log, ylims=(1e-3,1e2))

sim5

diff --git a/dev/basics/solvers/index.html b/dev/basics/solvers/index.html index 0c2f860..3814108 100644 --- a/dev/basics/solvers/index.html +++ b/dev/basics/solvers/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-149749027-1', {'page_path': location.pathname + location.search + location.hash}); -

Solver choice

Page under development. Information will be updated

ODE solver choice

HetaSimulator.jl relies on DifferentialEquations.jl packages, which provide access to 300+ ODE solvers. These solvers can be used in HetaSimulator simulation and parameters estimation functions (sim, fit, etc.), provided via alg keyword argument (for example, see sim). One can also set relative and absolute tolerances (reltol, abstol) and other stepsize related settings via relevant keyword arguments. See DiffEqDocs for details.

If no solver is provided the default one AutoTsit5(Rosenbrock23()) will be used with reltol=1e-3 and abstol=1e-6 for simulation problems and reltol=1e-6 and abstol=1e-8 for parameters estimation.

The following DiffEq Docs page provides general advice on how to choose a solver suitable for your ODE system. For many ODE systems the following simplified guideline is sufficient:

  1. If your system is small (~10 ODEs) go with the default solver
  2. If the system is large and stiff choose FBDF() or QNDF()
  3. If FBDF() fails to solve the system check the model and try it again :)
  4. If FBDF() still fails to solve the system or the integration takes too long try CVODE_BDF()*

*You should be cautious when using CVODE_BDF(). In many cases it is the fastest solver, however the accuracy of the solution is often the tradeoff. You shouldn't use it with tolerances higher than ~ reltol=1e-4 and abstol=1e-7.

+

Solver choice

Page under development. Information will be updated

ODE solver choice

HetaSimulator.jl relies on DifferentialEquations.jl packages, which provide access to 300+ ODE solvers. These solvers can be used in HetaSimulator simulation and parameters estimation functions (sim, fit, etc.), provided via alg keyword argument (for example, see sim). One can also set relative and absolute tolerances (reltol, abstol) and other stepsize related settings via relevant keyword arguments. See DiffEqDocs for details.

If no solver is provided the default one AutoTsit5(Rosenbrock23()) will be used with reltol=1e-3 and abstol=1e-6 for simulation problems and reltol=1e-6 and abstol=1e-8 for parameters estimation.

The following DiffEq Docs page provides general advice on how to choose a solver suitable for your ODE system. For many ODE systems the following simplified guideline is sufficient:

  1. If your system is small (~10 ODEs) go with the default solver
  2. If the system is large and stiff choose FBDF() or QNDF()
  3. If FBDF() fails to solve the system check the model and try it again :)
  4. If FBDF() still fails to solve the system or the integration takes too long try CVODE_BDF()*

*You should be cautious when using CVODE_BDF(). In many cases it is the fastest solver, however the accuracy of the solution is often the tradeoff. You shouldn't use it with tolerances higher than ~ reltol=1e-4 and abstol=1e-7.

diff --git a/dev/index.html b/dev/index.html index 0f3763f..aae1cc2 100644 --- a/dev/index.html +++ b/dev/index.html @@ -31,4 +31,4 @@ │ Float64 Float64 Float64 Symbol ─────┼───────────────────────────────────────────── 1 │ 0.0555525 11.9993 0.000666611 ode_ - 2 │ 0.611077 11.9927 0.00733069 ode_

Architecture

The user of HetaSimulator typically deals with the following three types:

The user can perform the following three operations with both Model, Scenario and Platform

See documentation for detailed overview of HetaSimulator types and functions' arguments.

Getting help

License

This package is distributed under the terms of the MIT License.

Copyright 2020-2024, InSysBio LLC

Authors and history

+ 2 │ 0.611077 11.9927 0.00733069 ode_

Architecture

The user of HetaSimulator typically deals with the following three types:

The user can perform the following three operations with both Model, Scenario and Platform

See documentation for detailed overview of HetaSimulator types and functions' arguments.

Getting help

License

This package is distributed under the terms of the MIT License.

Copyright 2020-2024, InSysBio LLC

Authors and history

diff --git a/dev/objects.inv b/dev/objects.inv index a64b684..f1bcce4 100644 Binary files a/dev/objects.inv and b/dev/objects.inv differ diff --git a/dev/table-formats/measurement/index.html b/dev/table-formats/measurement/index.html index 3909400..11adc59 100644 --- a/dev/table-formats/measurement/index.html +++ b/dev/table-formats/measurement/index.html @@ -20,4 +20,4 @@ push!(dataone.measurements, m1) push!(dataone.measurements, m2) -push!(dataone.measurements, m3) +push!(dataone.measurements, m3) diff --git a/dev/table-formats/parameters/index.html b/dev/table-formats/parameters/index.html index 04f8f5c..d0517d8 100644 --- a/dev/table-formats/parameters/index.html +++ b/dev/table-formats/parameters/index.html @@ -11,4 +11,4 @@ lbounds = [1e-6, 1e-6, 1e-6], ubounds = [1e3, 1e3, 1e3], scale = [:log, :log, :log] -) +) diff --git a/dev/table-formats/scenario/index.html b/dev/table-formats/scenario/index.html index 8230f52..c4ad94c 100644 --- a/dev/table-formats/scenario/index.html +++ b/dev/table-formats/scenario/index.html @@ -43,4 +43,4 @@ events_active = [:sw1=>false] ) push!(platform.scenarios, :scn3=>scn3) - + diff --git a/dev/tutorial/fit/index.html b/dev/tutorial/fit/index.html index 669c7f7..91cf209 100644 --- a/dev/tutorial/fit/index.html +++ b/dev/tutorial/fit/index.html @@ -110,4 +110,4 @@ ftol_rel = 0, maxeval = 10^6 ) -optim(res_optim)

There are several optimization related arguments, which are available for a user. To learn more read about fit method in API documentation.

+optim(res_optim)

There are several optimization related arguments, which are available for a user. To learn more read about fit method in API documentation.

diff --git a/dev/tutorial/gsa/index.html b/dev/tutorial/gsa/index.html index 2d74fd1..8ba05ef 100644 --- a/dev/tutorial/gsa/index.html +++ b/dev/tutorial/gsa/index.html @@ -83,4 +83,4 @@ return out end - sobol_sens = GlobalSensitivity.gsa(Cmax_batch_func, Sobol(), A, B, batch=true) + sobol_sens = GlobalSensitivity.gsa(Cmax_batch_func, Sobol(), A, B, batch=true) diff --git a/dev/tutorial/intro/index.html b/dev/tutorial/intro/index.html index 27c6680..7e341da 100644 --- a/dev/tutorial/intro/index.html +++ b/dev/tutorial/intro/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-149749027-1', {'page_path': location.pathname + location.search + location.hash}); -

Introduction

HetaSimulator was designed as a modeling, simulations and parameters estimation environment for Quantitative Systems Pharmacology (QSP) and Systems Biology (SB) projects. A user is not intended to be experienced Julia programmer but rather a researcher having biological, biophisical and bioinformatical background. We have avoided complicated user interfaces and tried to keep the available computational methods simple for the basic modeling workflow.

The approach implies the "modeling platform" term which means all the components of a model: models structure, variables, parameters, scenarios and experimental dataset. From the practical point of view "modeling platform" is the same as project files. The representation of modeling platform in HetaSimulator package is an object of the Platform type. This object stores Models, Scenarios and Measurements.

Architecture

Model type represents one concrete namespace imported from Heta-compiler. It stores information about ODE system, initial values, events as well as default model-level parameters values. The HetaSimulator approach imply multi-model usage so simulations and parameters estimation can be done for several models simultaneously without specific preparations.

Scenario type stores additional conditions for simulating the model. For example, the same model can be run with or without some events, or differ by some specific parameters values like doses and others, or have some specific output variables (observables). Each Scenario is associated with a specific Model. Each model may be used in different scenarios.

Additionally Scenario instance is a container for the Measurement objects which describe experimental datasets. Measurements can be used for estimation of model parameters or some specific tasks like identifiability analysis and visualization.

platform-scheme

There is no need to create more than one Platform object because it can store any number of Models and Scenarios. The advisable workflow is:

  1. Create one Platform using load_platform method
  2. Update it by Scenarios and Measurements using formatted CSV tables or directly in code
  3. Apply sim, mc, fit and other methods to simulate the model, estimate the parameters, etc.

There are basic methods that can be applied to a Platform object, for example sim, mc and fit. These methods can be applied to a particular Scenario or to the whole Platform (all scenarios in platform). The last approach is preferable.

HetaSimulator vs heta-compiler

Both heta-compiler and HetaSimulator.jl are part of the Heta project initiative. They use the same standards of model notation and can be used in the same projects. Furthermore currently heta-compiler JS code is used internally in HetaSimulator.

When a user installs HetaSimulator in Julia the most appropriate version of heta compiler is installed as well.

+

Introduction

HetaSimulator was designed as a modeling, simulations and parameters estimation environment for Quantitative Systems Pharmacology (QSP) and Systems Biology (SB) projects. A user is not intended to be experienced Julia programmer but rather a researcher having biological, biophisical and bioinformatical background. We have avoided complicated user interfaces and tried to keep the available computational methods simple for the basic modeling workflow.

The approach implies the "modeling platform" term which means all the components of a model: models structure, variables, parameters, scenarios and experimental dataset. From the practical point of view "modeling platform" is the same as project files. The representation of modeling platform in HetaSimulator package is an object of the Platform type. This object stores Models, Scenarios and Measurements.

Architecture

Model type represents one concrete namespace imported from Heta-compiler. It stores information about ODE system, initial values, events as well as default model-level parameters values. The HetaSimulator approach imply multi-model usage so simulations and parameters estimation can be done for several models simultaneously without specific preparations.

Scenario type stores additional conditions for simulating the model. For example, the same model can be run with or without some events, or differ by some specific parameters values like doses and others, or have some specific output variables (observables). Each Scenario is associated with a specific Model. Each model may be used in different scenarios.

Additionally Scenario instance is a container for the Measurement objects which describe experimental datasets. Measurements can be used for estimation of model parameters or some specific tasks like identifiability analysis and visualization.

platform-scheme

There is no need to create more than one Platform object because it can store any number of Models and Scenarios. The advisable workflow is:

  1. Create one Platform using load_platform method
  2. Update it by Scenarios and Measurements using formatted CSV tables or directly in code
  3. Apply sim, mc, fit and other methods to simulate the model, estimate the parameters, etc.

There are basic methods that can be applied to a Platform object, for example sim, mc and fit. These methods can be applied to a particular Scenario or to the whole Platform (all scenarios in platform). The last approach is preferable.

HetaSimulator vs heta-compiler

Both heta-compiler and HetaSimulator.jl are part of the Heta project initiative. They use the same standards of model notation and can be used in the same projects. Furthermore currently heta-compiler JS code is used internally in HetaSimulator.

When a user installs HetaSimulator in Julia the most appropriate version of heta compiler is installed as well.

diff --git a/dev/tutorial/mc/index.html b/dev/tutorial/mc/index.html index c3fcea1..2b99e3c 100644 --- a/dev/tutorial/mc/index.html +++ b/dev/tutorial/mc/index.html @@ -100,4 +100,4 @@ timeseries_steps_meancov(mcv1) # Computes the covariance matrix and means at each time step timeseries_steps_meancor(mcv1) # Computes the correlation matrix and means at each time step

And finally there is an example of statistics summary and visualization.

# Ensemble Summary
 ens = EnsembleSummary(mcsim1; quantiles=[0.05,0.95])
-plot(ens)

mc-fig07

Final remarks

+plot(ens)

mc-fig07

Final remarks

diff --git a/dev/tutorial/sim/index.html b/dev/tutorial/sim/index.html index 227fbb2..660a526 100644 --- a/dev/tutorial/sim/index.html +++ b/dev/tutorial/sim/index.html @@ -125,4 +125,4 @@ Parameters:

To simulate only the selected scenarios from the Platform one can use scenarios argument.

res_selected = sim(p, scenarios = [:dose_1, :dose_10, :dose_100])

The results of multiple simulations can be visualized all together using plot method.

# plot everything
 plot(res_selected, yscale=:log10, ylims=(1e-3,1e2))

fig07

The generated figure includes all scenarios titled with scenario identifier. The additional keyword arguments as vars and plot options can be used in the plot function as well.

sim results for multiple scenarios can be converted into DataFrame.

# convert everything into DataFrame
 res_selected_df = DataFrame(res_selected)
-CSV.write("res_selected_df.csv", res_selected_df)

Final remarks

A typical workflow for simulation of a modeling platforms in HetaSimulator.jl consists of the following steps:

  1. Load heta-based models into the Platform object;

  2. Create scenarios using Scenario constructor or from CSV tables and add them to the Platform;

  3. Run sim method with the whole platform or with the selected scenarios;

  4. Display results with plot or convert them into DataFrame.

  5. Model and Scenario objects are "immutable". This means a user cannot update their parts directly. User can only create new Scenarios and apply add_scenarios! method using the same identifiers. This replaces the previously created scenarios with the same ids.

  6. To update a model structure one should include changes into the heta model code and repeat all the steps.

  7. In many cased Julia chain syntax can be useful. The following code creates the default scenario, runs simulation and plots the result - all in one line.

Scenario(models(p)[:nameless], (0, 100)) |> sim |> plot
  1. plot method for SimResult gives only the default visualization. For more complicated visualization one can transform results into a DataFrame and plot them manually.

  2. For multiple simulations of the Monte-Carlo type one should use mc method instead of sim method. Scenario is not the same as single simulation task in Monte-Carlo.

+CSV.write("res_selected_df.csv", res_selected_df)

Final remarks

A typical workflow for simulation of a modeling platforms in HetaSimulator.jl consists of the following steps:

  1. Load heta-based models into the Platform object;

  2. Create scenarios using Scenario constructor or from CSV tables and add them to the Platform;

  3. Run sim method with the whole platform or with the selected scenarios;

  4. Display results with plot or convert them into DataFrame.

  5. Model and Scenario objects are "immutable". This means a user cannot update their parts directly. User can only create new Scenarios and apply add_scenarios! method using the same identifiers. This replaces the previously created scenarios with the same ids.

  6. To update a model structure one should include changes into the heta model code and repeat all the steps.

  7. In many cased Julia chain syntax can be useful. The following code creates the default scenario, runs simulation and plots the result - all in one line.

Scenario(models(p)[:nameless], (0, 100)) |> sim |> plot
  1. plot method for SimResult gives only the default visualization. For more complicated visualization one can transform results into a DataFrame and plot them manually.

  2. For multiple simulations of the Monte-Carlo type one should use mc method instead of sim method. Scenario is not the same as single simulation task in Monte-Carlo.