# ShinyKGode

Many processes in science and engineering can be described by dynamical systems based on nonlinear ordinary differential equations (ODEs). Often ODE parameters are unknown and not directly measurable. Since nonlinear ODEs typically have no closed form solution, standard iterative inference procedures require a computationally expensive numerical integration of the ODEs every time the parameters are adapted, which in practice restricts statistical inference to very small systems. To overcome this computational bottleneck, approximate methods based on gradient matching have recently gained much attention.

In this package, we develop an easy-to-use application in Shiny to perform parameter inference on ODEs using gradient matching. The application, called `shinyKGode`

, is built upon the KGode package, which implements the kernel ridge regression and the gradient matching algorithm proposed in Niu et al. (2016) and the warping algorithm proposed in Niu et al. (2017) for parameter inference in differential equations. Advanced features such as ODE regularisation and warping can also be easily used for inference in the `shinyKGode`

application.

`shinyKGode`

has built-in support for the following three models described in Niu et al. (2017):

- Lotka-Volterra, which describes the dynamics of ecological systems with predator-prey interactions.
- FitzHughâ€“Nagumo), which is a two-dimensional dynamical system used for modelling spike generation in axons.
- The Biopathway model described in y Vyshemirsky and Girolami (2008), which is a model for the interactions of five protein isoforms.

On top of that, `shinyKGode`

also accepts user-defined models in SBML v2 format. This allows user-defined models specified in the SBML format to be loaded into the application.

## Providing your own models

For loading of SBML, `shinyKGode`

relies on a modified version of SBMLR (with some bugfixes), so a limited range of SBML level v2 model files that can be parsed by SBMLR is supported and can be loaded into the application. Notably, this means only SBML v2 specifications is supported and not v3 yet.

Models exported from Copasi can be loaded into the application after some adjustments. These Copasi-generated SBML files often contain user-defined functions, which are also not supported by the SBMLR parser that `shinyKGode`

uses. In this case, we suggest removing user-defined functions from the SBML file (generated by Copasi) and encoding their kinetic laws directly in the reaction sections of the SBML file.

Below are the links to some example SBML files that you can load into `shinyKGode`

.

The example SBML files above can be used as the starting point to encoding your own models. Note that SBML files are text-based markup languages, which can be edited in either text editors or specialised SBML editors.

## Installation

The latest version of the `shinyKGode`

package can be installed from this github repository using `devtools`

:

```
library(devtools)
install_github('joewandy/shinyKGode')
```

While the stable R package can be installed from CRAN via `install.packages('shinyKGode')`

.

## Running shinyKGode

Once installed, the application can be run by:

```
library(shinyKGode)
startShinyKGode()
```

## Tutorial Videos

### ODE Regularisation

The following video demonstrates the benefits of using ODE regularisation when inferring parameters using gradient matching in the `shinyKGode`

package.