/HetaSimulator.jl

Simulation engines for Heta-based modeling platforms

Primary LanguageJuliaMIT LicenseMIT

Heta project version GitHub issues Coverage Status api-docs GitHub license

HetaSimulator

HetaSimulator is an OpenSource simulation and parameters estimation (fitting) platform for the Heta modeling language. The main purpose of the package is to establish the linkage between emerging QSP frameworks and fast computational methods (parallel simulations, automatic differentiation, etc.).

The latest documentation can be found here: https://hetalang.github.io/HetaSimulator.jl/dev/.

See the ROAD MAP for future implementations.

Introduction

Heta language is a domain-specific modeling language (DSL) for dynamic models used in quantitative systems pharmacology (QSP) and systems biology (SB). The Heta code and the tables can be translated into variety of formats like Simbiology, Matlab, mrgsolve, DBSolve and many others.

This package provides the simulation engines for the Heta-based models and modeling platforms to be run in Julia. A QSP model can be directly run using the HetaSimulator without additional tools. The ODE system in general form can also be run with HetaSimulator.

Internally HetaSimulator utilizes the facilities of OpenSource projects like Julia and SciML ecosystem.

Installation

It is assumed that you have Julia installed. The latest Julia release can be downloaded from julialang.org

To install or update HetaSimulator and Heta compiler run the code below in Julia environment:

julia> ]
(@v1.6) pkg> add HetaSimulator

Internally HetaSimulator uses Heta compiler. Sometimes it is required to update the compiler's version.

# update heta compiler for v0.6.10
julia> heta_update("0.6.10") 

Basic usage

Create a model in Heta format or use your Heta-based platform. Here we will use the example with a simple model with two species and one reaction.

// index.heta file in directory "my_project"
comp1 @Compartment .= 1.5;

s1 @Species {compartment: comp1, output: true} .= 12;
s2 @Species {compartment: comp1, output: true} .= 0;

r1 @Reaction {actors: s1 => s2, output: true} := k1 * s1 * comp1;

k1 @Const = 1e-3;

To read more about Heta code read Heta specifications

using HetaSimulator, Plots

# set the absolute or relative path to the project directory
platform = load_platform("./my_project")
# wait for the platform compilation...

# get the base Heta model
model = platform.models[:nameless]

# single simulation and plot
results = Scenario(model, (0., 1200.)) |> sim
plot(results)

Plot

# transform results to data frame
df = DataFrame(results)
...
9×4 DataFrame
 Row │ t             s1        s2           scope  
     │ Float64       Float64   Float64      Symbol 
─────┼─────────────────────────────────────────────
   10.0555525  11.9993   0.000666611  ode_
   20.611077   11.9927   0.00733069   ode_

To read more about available functions, see the documentation

Getting help

Contributing

License

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

Copyright 2020-2022, InSysBio LLC