Building Deployable Applications for Evaluating PK/PD Drug Efficacy

By Anita Gajjala and Asawari Samant, MathWorks

Pharmacokinetic/pharmacodynamic (PK/PD) and systems pharmacology models are important tools for evaluating drugs in development. Using MATLAB® and SimBiology®, researchers can build and characterize such models either in a graphical environment or using programmatic tools. They can use preclinical data to mathematically describe the dynamic in vivo behavior of new drug candidates, and make predictions and extrapolations in humans based on model simulations. They can then share these models to enable fellow clinicians, biologists, and researchers to better evaluate the efficacy and safety metrics of various dosing strategies and explore what-if scenarios in different patient subpopulations.

In certain cases, it may not be practical to share SimBiology models directly. For example, your colleagues may lack access to, or be unfamiliar with, MATLAB and SimBiology, or you may wish to lock down the model and its characterization so that other users cannot inadvertently change it.

MATLAB Compiler™ lets you deploy a SimBiology model as part of a standalone MATLAB application. You can build a custom graphical interface that other researchers can use to set up and run model simulations. You can then compile the application to enable researchers to use it without installing MATLAB or SimBiology.

Using an oncology model developed by Koch, Walz, Lahu, and Schropp1 as an example, this article describes a workflow for developing and deploying an application for simulating a mechanistic PK/PD model built using SimBiology2.

Oncology Model Overview

The example in this article is based on the Koch et al. oncology model, which is used to characterize tumor growth over time in response to either monotherapy treatment with a single drug, or combination therapy involving simultaneous administration of two drugs.

The SimBiology implementation of the Koch et al. oncology model is shown in Figure 13. The plasma concentration of both drugs is described by independent one-compartment PK models with linear elimination routes. The tumor growth model is represented in the Tumor compartment. The rate of the Decay reaction depends on the plasma concentration of Drug A and Drug B and an interaction parameter. When the plasma concentration of the drugs falls to zero, the tumor dynamics is described by the Tumor Growth process. The tumor weight is defined as the sum of the growing and decaying tumor states, i.e. x1+ x2+ x3+ x4.

Model simulations make it possible to analyze the effect of various combination dosing strategies on tumor suppression (Figure 2).

Figure 2. Plot of tumor weight vs. time for different therapies, simulated in SimBiology. The combination therapy (red line) is more effective at suppressing tumor growth than no therapy or monotherapies (gray lines).

Preparing the Model for Deployment

In order to share the SimBiology model using MATLAB Compiler we first create an exported model4.

We load the SimBiology model into MATLAB using sbioloadproject.

>> sbioloadproject('TumorGrowthModel.sbproj'); % Load the Model

We use export and save to create the exported SimBiology model and save it as a MAT file, which will be loaded into the deployed application.

Note that exported SimBiology models have a limited set of accessible properties. In addition, some model features, including reactions, rules, and events, cannot be changed in the exported version.

Building an Interface to the Model

After creating an exported SimBiology model, we build a custom MATLAB interface. The interface will enable non-modelers and researchers without access to MATLAB to adjust model parameters, apply dosing schedules, and run simulations (Figure 3).

Figure 3. MATLAB interface for interacting with the SimBiology model.

Using MATLAB graphical user interface design environment (GUIDE) tools, we lay out the interface by dragging components from the palette into the layout area (Figure 4).

We need to modify individual properties of each component. For example, we need to update the Tag property for interface elements so that these elements can be easily accessed programmatically. Using a naming convention, such as <Name>_<Type>, improves code readability (Figure 5).

Figure 5. Property Inspector for editing interface control object properties. The Tag property for the cell line’s pop-up menu component is set to CellLine_POPUP.

Programming Functions to Access the Exported SimBiology Model

In a MATLAB desktop-based workflow, applications are coded to access a non-exported SimBiology model. In preparation for deployment, we need to update the code to use the exported SimBiology model.

The first step is to indicate to MATLAB Compiler that the application uses an exported SimBiology model. We do this by adding a directive (via the %#function pragma) in the GUIDE-generated MATLAB file, TumorGrowthInhibition.m, which is linked to the GUIDE FIG-file that we saved.

When the end user interacts with an interface control object, such as a menu or a button, in your application, specific functions, or callbacks, are invoked. Next, we will modify the callback functions to use the exported model.

In the sample app we will modify five callbacks to prepare the model for deployment:TumorGrowthInhibition_OpeningFcn, CellLine_POPUP_Callback, InitialTumorWeight_EDIT_Callback, Dosage1_EDIT_Callback, and SimTumorGrowth_PUSHBUTTON_Callback.

TumorGrowthInhibition_OpeningFcn is the opening function in the example application. It loads the model and initializes doses, model parameters, and other properties in the code. The initial (non-deployed) version uses sbioloadproject to load the model into MATLAB and sbiodose or getdose to create or edit existing dose objects.

For deployed applications, we load the exported model from a MAT file (instead of using sbioloadproject). We use getdose to update the existing dose objects attached to the exported model since new dose objects cannot be added to exported models.

CellLine_POPUP_Callback is invoked when the user selects a cell line from the pop-up menu. This function is responsible for setting the cell line parameters appropriately based on the user’s selection. In the non-exported version of the model, this is done by selecting the appropriate variant with a single call to sbioselect.

InitialTumorWeight_EDIT_Callback is invoked when the user specifies an initial tumor weight (w0). Like CellLine_POPUP_Callback, the non-deployed version of this callback uses sbioselect to set the parameter value in the model.

SimTumorGrowth_PUSHBUTTON_Callback is invoked when the user clicks the Simulate Tumor Growth button. This callback runs the simulation with the appropriate parameter values and dosing schedules to calculate the tumor weight evolution over time. In the non-deployed version of the model, it calls sbiosimulate.

Setting Up Report Generation

Using MATLAB Report Generator™ we generate a document that captures the model’s PK/PD response, model parameters, and dosing schedule. Our application will generate a PDF document called “myreport.pdf”. This callback uses the new Document Object Model (DOM) API available in MATLAB Report Generator 4.0 (R2014b), which lets us to build reports programmatically.

Testing the Application in MATLAB

We execute the TumorGrowthInhibition command to launch the application in MATLAB. When the application launches, we specify the cell line, initial tumor weight, and dosing schedules, then click the Simulate Tumor Growth button to begin the simulation.

The plot displays simulation results for four different treatments (Figure 6).

Once the compilation is complete, an executable (.exe) is generated for distribution with the MATLAB Compiler Runtime (MCR). The MCR is a set of shared libraries that enables users to execute compiled MATLAB applications on computers that do not have MATLAB installed.

Summary: Applying the Workflow

You can use the process outlined in this article to deploy one of your own SimBiology models as a standalone application. Start by loading the model in MATLAB and creating an exported SimBiology model with the export and save commands. Next, build a simple interface with GUIDE, and program callback functions to access your SimBiology model via interface control elements. Finally, after testing your application in MATLAB, compile it with MATLAB Compiler and retest the resulting executable on a computer that does not have MATLAB installed.

2 The first step in this workflow is building and characterizing the model. This step was completed by Koch et al, and while this article provides an overview of the approach, it is not described in detail. See Building a Model in SimBiology to learn more about this step.

3 The underlying rate equations are not shown in Figure 1. Please refer to Koch et. al or the downloadable SimBiology app for model and implementation details.

About the Author

Anita Gajjala is a MathWorks consultant. She specializes in creating custom MATLAB applications for customers in the biotech and pharmaceutical, energy, aerospace and defense, and other industries. Anita holds a B.S. in electrical and computer engineering from Cornell University and an M.S. in electrical and computer engineering from Georgia Institute of Technology.

Asawari Samant is a senior application engineer at MathWorks. She focuses on data analytics and computational biology applications in the biotech and pharmaceutical industry. Asawari holds an M.S. in chemical engineering from the University of Delaware and a B.S. in chemical engineering from the Institute of Chemical Technology, Mumbai, India.

This website uses cookies to improve your user experience, personalize content and ads, and analyze website traffic. By continuing to use this website, you consent to our use of cookies. Please see our Privacy Policy to learn more about cookies and how to change your settings.