Skip to content

hetalang/HetaSimulator.jl

Repository files navigation

Heta project version GitHub issues Coverage Status Docs GitHub license

HetaSimulator

HetaSimulator is an open-source 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/stable/.

See the ROAD MAP for upcoming updates.

Introduction

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

This package provides the Julia-based simulation engine for Heta-based models and modeling platforms. Users can simulate QSP models in heta format as well as ODE systems in general form using HetaSimulator without additional tools.

Internally HetaSimulator utilizes the features of open-source software 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.10) pkg> add HetaSimulator

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

# update heta compiler for v0.8.1
julia> heta_update("0.8.1") 

Basic usage

Create a model in Heta format or use your Heta-based platform. Here we will use 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 learn more about Heta DSL 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

# convert 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-2024, InSysBio LLC